#![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 application_gateway_private_endpoint_connections_client(&self) -> application_gateway_private_endpoint_connections::Client {
application_gateway_private_endpoint_connections::Client(self.clone())
}
pub fn application_gateway_private_link_resources_client(&self) -> application_gateway_private_link_resources::Client {
application_gateway_private_link_resources::Client(self.clone())
}
pub fn application_gateways_client(&self) -> application_gateways::Client {
application_gateways::Client(self.clone())
}
pub fn application_security_groups_client(&self) -> application_security_groups::Client {
application_security_groups::Client(self.clone())
}
pub fn available_delegations_client(&self) -> available_delegations::Client {
available_delegations::Client(self.clone())
}
pub fn available_endpoint_services_client(&self) -> available_endpoint_services::Client {
available_endpoint_services::Client(self.clone())
}
pub fn available_private_endpoint_types_client(&self) -> available_private_endpoint_types::Client {
available_private_endpoint_types::Client(self.clone())
}
pub fn available_resource_group_delegations_client(&self) -> available_resource_group_delegations::Client {
available_resource_group_delegations::Client(self.clone())
}
pub fn available_service_aliases_client(&self) -> available_service_aliases::Client {
available_service_aliases::Client(self.clone())
}
pub fn azure_firewall_fqdn_tags_client(&self) -> azure_firewall_fqdn_tags::Client {
azure_firewall_fqdn_tags::Client(self.clone())
}
pub fn azure_firewalls_client(&self) -> azure_firewalls::Client {
azure_firewalls::Client(self.clone())
}
pub fn bastion_hosts_client(&self) -> bastion_hosts::Client {
bastion_hosts::Client(self.clone())
}
pub fn bgp_service_communities_client(&self) -> bgp_service_communities::Client {
bgp_service_communities::Client(self.clone())
}
pub fn connection_monitors_client(&self) -> connection_monitors::Client {
connection_monitors::Client(self.clone())
}
pub fn custom_ip_prefixes_client(&self) -> custom_ip_prefixes::Client {
custom_ip_prefixes::Client(self.clone())
}
pub fn ddos_custom_policies_client(&self) -> ddos_custom_policies::Client {
ddos_custom_policies::Client(self.clone())
}
pub fn ddos_protection_plans_client(&self) -> ddos_protection_plans::Client {
ddos_protection_plans::Client(self.clone())
}
pub fn default_security_rules_client(&self) -> default_security_rules::Client {
default_security_rules::Client(self.clone())
}
pub fn dscp_configuration_client(&self) -> dscp_configuration::Client {
dscp_configuration::Client(self.clone())
}
pub fn express_route_circuit_authorizations_client(&self) -> express_route_circuit_authorizations::Client {
express_route_circuit_authorizations::Client(self.clone())
}
pub fn express_route_circuit_connections_client(&self) -> express_route_circuit_connections::Client {
express_route_circuit_connections::Client(self.clone())
}
pub fn express_route_circuit_peerings_client(&self) -> express_route_circuit_peerings::Client {
express_route_circuit_peerings::Client(self.clone())
}
pub fn express_route_circuits_client(&self) -> express_route_circuits::Client {
express_route_circuits::Client(self.clone())
}
pub fn express_route_connections_client(&self) -> express_route_connections::Client {
express_route_connections::Client(self.clone())
}
pub fn express_route_cross_connection_peerings_client(&self) -> express_route_cross_connection_peerings::Client {
express_route_cross_connection_peerings::Client(self.clone())
}
pub fn express_route_cross_connections_client(&self) -> express_route_cross_connections::Client {
express_route_cross_connections::Client(self.clone())
}
pub fn express_route_gateways_client(&self) -> express_route_gateways::Client {
express_route_gateways::Client(self.clone())
}
pub fn express_route_links_client(&self) -> express_route_links::Client {
express_route_links::Client(self.clone())
}
pub fn express_route_ports_client(&self) -> express_route_ports::Client {
express_route_ports::Client(self.clone())
}
pub fn express_route_ports_locations_client(&self) -> express_route_ports_locations::Client {
express_route_ports_locations::Client(self.clone())
}
pub fn express_route_service_providers_client(&self) -> express_route_service_providers::Client {
express_route_service_providers::Client(self.clone())
}
pub fn firewall_policies_client(&self) -> firewall_policies::Client {
firewall_policies::Client(self.clone())
}
pub fn firewall_policy_idps_signatures_client(&self) -> firewall_policy_idps_signatures::Client {
firewall_policy_idps_signatures::Client(self.clone())
}
pub fn firewall_policy_idps_signatures_filter_values_client(&self) -> firewall_policy_idps_signatures_filter_values::Client {
firewall_policy_idps_signatures_filter_values::Client(self.clone())
}
pub fn firewall_policy_idps_signatures_overrides_client(&self) -> firewall_policy_idps_signatures_overrides::Client {
firewall_policy_idps_signatures_overrides::Client(self.clone())
}
pub fn firewall_policy_rule_collection_groups_client(&self) -> firewall_policy_rule_collection_groups::Client {
firewall_policy_rule_collection_groups::Client(self.clone())
}
pub fn flow_logs_client(&self) -> flow_logs::Client {
flow_logs::Client(self.clone())
}
pub fn hub_route_tables_client(&self) -> hub_route_tables::Client {
hub_route_tables::Client(self.clone())
}
pub fn hub_virtual_network_connections_client(&self) -> hub_virtual_network_connections::Client {
hub_virtual_network_connections::Client(self.clone())
}
pub fn inbound_nat_rules_client(&self) -> inbound_nat_rules::Client {
inbound_nat_rules::Client(self.clone())
}
pub fn inbound_security_rule_client(&self) -> inbound_security_rule::Client {
inbound_security_rule::Client(self.clone())
}
pub fn ip_allocations_client(&self) -> ip_allocations::Client {
ip_allocations::Client(self.clone())
}
pub fn ip_groups_client(&self) -> ip_groups::Client {
ip_groups::Client(self.clone())
}
pub fn load_balancer_backend_address_pools_client(&self) -> load_balancer_backend_address_pools::Client {
load_balancer_backend_address_pools::Client(self.clone())
}
pub fn load_balancer_frontend_ip_configurations_client(&self) -> load_balancer_frontend_ip_configurations::Client {
load_balancer_frontend_ip_configurations::Client(self.clone())
}
pub fn load_balancer_load_balancing_rules_client(&self) -> load_balancer_load_balancing_rules::Client {
load_balancer_load_balancing_rules::Client(self.clone())
}
pub fn load_balancer_network_interfaces_client(&self) -> load_balancer_network_interfaces::Client {
load_balancer_network_interfaces::Client(self.clone())
}
pub fn load_balancer_outbound_rules_client(&self) -> load_balancer_outbound_rules::Client {
load_balancer_outbound_rules::Client(self.clone())
}
pub fn load_balancer_probes_client(&self) -> load_balancer_probes::Client {
load_balancer_probes::Client(self.clone())
}
pub fn load_balancers_client(&self) -> load_balancers::Client {
load_balancers::Client(self.clone())
}
pub fn local_network_gateways_client(&self) -> local_network_gateways::Client {
local_network_gateways::Client(self.clone())
}
pub fn nat_gateways_client(&self) -> nat_gateways::Client {
nat_gateways::Client(self.clone())
}
pub fn nat_rules_client(&self) -> nat_rules::Client {
nat_rules::Client(self.clone())
}
pub fn network_interface_ip_configurations_client(&self) -> network_interface_ip_configurations::Client {
network_interface_ip_configurations::Client(self.clone())
}
pub fn network_interface_load_balancers_client(&self) -> network_interface_load_balancers::Client {
network_interface_load_balancers::Client(self.clone())
}
pub fn network_interface_tap_configurations_client(&self) -> network_interface_tap_configurations::Client {
network_interface_tap_configurations::Client(self.clone())
}
pub fn network_interfaces_client(&self) -> network_interfaces::Client {
network_interfaces::Client(self.clone())
}
pub fn network_profiles_client(&self) -> network_profiles::Client {
network_profiles::Client(self.clone())
}
pub fn network_security_groups_client(&self) -> network_security_groups::Client {
network_security_groups::Client(self.clone())
}
pub fn network_virtual_appliances_client(&self) -> network_virtual_appliances::Client {
network_virtual_appliances::Client(self.clone())
}
pub fn network_watchers_client(&self) -> network_watchers::Client {
network_watchers::Client(self.clone())
}
pub fn operations_client(&self) -> operations::Client {
operations::Client(self.clone())
}
pub fn p2s_vpn_gateways_client(&self) -> p2s_vpn_gateways::Client {
p2s_vpn_gateways::Client(self.clone())
}
pub fn packet_captures_client(&self) -> packet_captures::Client {
packet_captures::Client(self.clone())
}
pub fn peer_express_route_circuit_connections_client(&self) -> peer_express_route_circuit_connections::Client {
peer_express_route_circuit_connections::Client(self.clone())
}
pub fn private_dns_zone_groups_client(&self) -> private_dns_zone_groups::Client {
private_dns_zone_groups::Client(self.clone())
}
pub fn private_endpoints_client(&self) -> private_endpoints::Client {
private_endpoints::Client(self.clone())
}
pub fn private_link_services_client(&self) -> private_link_services::Client {
private_link_services::Client(self.clone())
}
pub fn public_ip_addresses_client(&self) -> public_ip_addresses::Client {
public_ip_addresses::Client(self.clone())
}
pub fn public_ip_prefixes_client(&self) -> public_ip_prefixes::Client {
public_ip_prefixes::Client(self.clone())
}
pub fn resource_navigation_links_client(&self) -> resource_navigation_links::Client {
resource_navigation_links::Client(self.clone())
}
pub fn route_filter_rules_client(&self) -> route_filter_rules::Client {
route_filter_rules::Client(self.clone())
}
pub fn route_filters_client(&self) -> route_filters::Client {
route_filters::Client(self.clone())
}
pub fn route_tables_client(&self) -> route_tables::Client {
route_tables::Client(self.clone())
}
pub fn routes_client(&self) -> routes::Client {
routes::Client(self.clone())
}
pub fn routing_intent_client(&self) -> routing_intent::Client {
routing_intent::Client(self.clone())
}
pub fn security_partner_providers_client(&self) -> security_partner_providers::Client {
security_partner_providers::Client(self.clone())
}
pub fn security_rules_client(&self) -> security_rules::Client {
security_rules::Client(self.clone())
}
pub fn service_association_links_client(&self) -> service_association_links::Client {
service_association_links::Client(self.clone())
}
pub fn service_endpoint_policies_client(&self) -> service_endpoint_policies::Client {
service_endpoint_policies::Client(self.clone())
}
pub fn service_endpoint_policy_definitions_client(&self) -> service_endpoint_policy_definitions::Client {
service_endpoint_policy_definitions::Client(self.clone())
}
pub fn service_tag_information_client(&self) -> service_tag_information::Client {
service_tag_information::Client(self.clone())
}
pub fn service_tags_client(&self) -> service_tags::Client {
service_tags::Client(self.clone())
}
pub fn subnets_client(&self) -> subnets::Client {
subnets::Client(self.clone())
}
pub fn usages_client(&self) -> usages::Client {
usages::Client(self.clone())
}
pub fn virtual_appliance_sites_client(&self) -> virtual_appliance_sites::Client {
virtual_appliance_sites::Client(self.clone())
}
pub fn virtual_appliance_skus_client(&self) -> virtual_appliance_skus::Client {
virtual_appliance_skus::Client(self.clone())
}
pub fn virtual_hub_bgp_connection_client(&self) -> virtual_hub_bgp_connection::Client {
virtual_hub_bgp_connection::Client(self.clone())
}
pub fn virtual_hub_bgp_connections_client(&self) -> virtual_hub_bgp_connections::Client {
virtual_hub_bgp_connections::Client(self.clone())
}
pub fn virtual_hub_ip_configuration_client(&self) -> virtual_hub_ip_configuration::Client {
virtual_hub_ip_configuration::Client(self.clone())
}
pub fn virtual_hub_route_table_v2s_client(&self) -> virtual_hub_route_table_v2s::Client {
virtual_hub_route_table_v2s::Client(self.clone())
}
pub fn virtual_hubs_client(&self) -> virtual_hubs::Client {
virtual_hubs::Client(self.clone())
}
pub fn virtual_network_gateway_connections_client(&self) -> virtual_network_gateway_connections::Client {
virtual_network_gateway_connections::Client(self.clone())
}
pub fn virtual_network_gateway_nat_rules_client(&self) -> virtual_network_gateway_nat_rules::Client {
virtual_network_gateway_nat_rules::Client(self.clone())
}
pub fn virtual_network_gateways_client(&self) -> virtual_network_gateways::Client {
virtual_network_gateways::Client(self.clone())
}
pub fn virtual_network_peerings_client(&self) -> virtual_network_peerings::Client {
virtual_network_peerings::Client(self.clone())
}
pub fn virtual_network_taps_client(&self) -> virtual_network_taps::Client {
virtual_network_taps::Client(self.clone())
}
pub fn virtual_networks_client(&self) -> virtual_networks::Client {
virtual_networks::Client(self.clone())
}
pub fn virtual_router_peerings_client(&self) -> virtual_router_peerings::Client {
virtual_router_peerings::Client(self.clone())
}
pub fn virtual_routers_client(&self) -> virtual_routers::Client {
virtual_routers::Client(self.clone())
}
pub fn virtual_wans_client(&self) -> virtual_wans::Client {
virtual_wans::Client(self.clone())
}
pub fn vpn_connections_client(&self) -> vpn_connections::Client {
vpn_connections::Client(self.clone())
}
pub fn vpn_gateways_client(&self) -> vpn_gateways::Client {
vpn_gateways::Client(self.clone())
}
pub fn vpn_link_connections_client(&self) -> vpn_link_connections::Client {
vpn_link_connections::Client(self.clone())
}
pub fn vpn_server_configurations_client(&self) -> vpn_server_configurations::Client {
vpn_server_configurations::Client(self.clone())
}
pub fn vpn_server_configurations_associated_with_virtual_wan_client(
&self,
) -> vpn_server_configurations_associated_with_virtual_wan::Client {
vpn_server_configurations_associated_with_virtual_wan::Client(self.clone())
}
pub fn vpn_site_link_connections_client(&self) -> vpn_site_link_connections::Client {
vpn_site_link_connections::Client(self.clone())
}
pub fn vpn_site_links_client(&self) -> vpn_site_links::Client {
vpn_site_links::Client(self.clone())
}
pub fn vpn_sites_client(&self) -> vpn_sites::Client {
vpn_sites::Client(self.clone())
}
pub fn vpn_sites_configuration_client(&self) -> vpn_sites_configuration::Client {
vpn_sites_configuration::Client(self.clone())
}
pub fn web_application_firewall_policies_client(&self) -> web_application_firewall_policies::Client {
web_application_firewall_policies::Client(self.clone())
}
pub fn web_categories_client(&self) -> web_categories::Client {
web_categories::Client(self.clone())
}
}
pub mod application_gateways {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified application gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the specified application gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `parameters`: Parameters supplied to the create or update application gateway operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
parameters: impl Into<models::ApplicationGateway>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates the specified application gateway tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `parameters`: Parameters supplied to update application gateway tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified application gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all application gateways in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the application gateways in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Starts the specified application gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn start(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> start::Builder {
start::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Stops the specified application gateway in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn stop(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> stop::Builder {
stop::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the backend health of the specified application gateway in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn backend_health(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> backend_health::Builder {
backend_health::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets the backend health for given combination of backend pool and http setting of the specified application gateway in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `probe_request`: Request body for on-demand test probe operation."]
pub fn backend_health_on_demand(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
probe_request: impl Into<models::ApplicationGatewayOnDemandProbe>,
) -> backend_health_on_demand::Builder {
backend_health_on_demand::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
subscription_id: subscription_id.into(),
probe_request: probe_request.into(),
expand: None,
}
}
#[doc = "Lists all available server variables."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_available_server_variables(&self, subscription_id: impl Into<String>) -> list_available_server_variables::Builder {
list_available_server_variables::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all available request headers."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_available_request_headers(&self, subscription_id: impl Into<String>) -> list_available_request_headers::Builder {
list_available_request_headers::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all available response headers."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_available_response_headers(&self, subscription_id: impl Into<String>) -> list_available_response_headers::Builder {
list_available_response_headers::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all available web application firewall rule sets."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_available_waf_rule_sets(&self, subscription_id: impl Into<String>) -> list_available_waf_rule_sets::Builder {
list_available_waf_rule_sets::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists available Ssl options for configuring Ssl policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_available_ssl_options(&self, subscription_id: impl Into<String>) -> list_available_ssl_options::Builder {
list_available_ssl_options::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all SSL predefined policies for configuring Ssl policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_available_ssl_predefined_policies(
&self,
subscription_id: impl Into<String>,
) -> list_available_ssl_predefined_policies::Builder {
list_available_ssl_predefined_policies::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets Ssl predefined policy with the specified policy name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `predefined_policy_name`: Name of Ssl predefined policy."]
pub fn get_ssl_predefined_policy(
&self,
subscription_id: impl Into<String>,
predefined_policy_name: impl Into<String>,
) -> get_ssl_predefined_policy::Builder {
get_ssl_predefined_policy::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
predefined_policy_name: predefined_policy_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ApplicationGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::ApplicationGateway),
Ok200(models::ApplicationGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) parameters: models::ApplicationGateway,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::ApplicationGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ApplicationGatewayListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/applicationGateways",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_all {
use super::models;
type Response = models::ApplicationGatewayListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/applicationGateways",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod start {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationGateways/{}/start",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod stop {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationGateways/{}/stop",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod backend_health {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ApplicationGatewayBackendHealth),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands BackendAddressPool and BackendHttpSettings referenced in backend health."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationGateways/{}/backendhealth",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayBackendHealth = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod backend_health_on_demand {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ApplicationGatewayBackendHealthOnDemand),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) subscription_id: String,
pub(crate) probe_request: models::ApplicationGatewayOnDemandProbe,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands BackendAddressPool and BackendHttpSettings referenced in backend health."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationGateways/{}/getBackendHealthOnDemand" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . application_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.probe_request)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayBackendHealthOnDemand = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_available_server_variables {
use super::models;
type Response = models::ApplicationGatewayAvailableServerVariablesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationGatewayAvailableServerVariables",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayAvailableServerVariablesResult =
serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_available_request_headers {
use super::models;
type Response = models::ApplicationGatewayAvailableRequestHeadersResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationGatewayAvailableRequestHeaders",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayAvailableRequestHeadersResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_available_response_headers {
use super::models;
type Response = models::ApplicationGatewayAvailableResponseHeadersResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationGatewayAvailableResponseHeaders",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayAvailableResponseHeadersResult =
serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_available_waf_rule_sets {
use super::models;
type Response = models::ApplicationGatewayAvailableWafRuleSetsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationGatewayAvailableWafRuleSets",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayAvailableWafRuleSetsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_available_ssl_options {
use super::models;
type Response = models::ApplicationGatewayAvailableSslOptions;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationGatewayAvailableSslOptions/default",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayAvailableSslOptions = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_available_ssl_predefined_policies {
use super::models;
type Response = models::ApplicationGatewayAvailableSslPredefinedPolicies;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies" , this . client . endpoint () , & this . subscription_id)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayAvailableSslPredefinedPolicies =
serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_ssl_predefined_policy {
use super::models;
type Response = models::ApplicationGatewaySslPredefinedPolicy;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) predefined_policy_name: String,
}
impl Builder {
pub fn into_future(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.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . predefined_policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewaySslPredefinedPolicy = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod application_gateway_private_link_resources {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all private link resources on an application gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::ApplicationGatewayPrivateLinkResourceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/applicationGateways/{}/privateLinkResources",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_gateway_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayPrivateLinkResourceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod application_gateway_private_endpoint_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified private endpoint connection on application gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `connection_name`: The name of the application gateway private endpoint connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
connection_name: connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates the specified private endpoint connection on application gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `connection_name`: The name of the application gateway private endpoint connection."]
#[doc = "* `parameters`: Parameters supplied to update application gateway private endpoint connection operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
connection_name: impl Into<String>,
parameters: impl Into<models::ApplicationGatewayPrivateEndpointConnection>,
subscription_id: impl Into<String>,
) -> update::Builder {
update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
connection_name: connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified private endpoint connection on application gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `connection_name`: The name of the application gateway private endpoint connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
connection_name: connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all private endpoint connections on an application gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_gateway_name`: The name of the application gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
application_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_gateway_name: application_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ApplicationGatewayPrivateEndpointConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationGateways/{}/privateEndpointConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . application_gateway_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayPrivateEndpointConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ApplicationGatewayPrivateEndpointConnection),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) connection_name: String,
pub(crate) parameters: models::ApplicationGatewayPrivateEndpointConnection,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationGateways/{}/privateEndpointConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . application_gateway_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayPrivateEndpointConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationGateways/{}/privateEndpointConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . application_gateway_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ApplicationGatewayPrivateEndpointConnectionListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/applicationGateways/{}/privateEndpointConnections" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . application_gateway_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationGatewayPrivateEndpointConnectionListResult =
serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod network_interfaces {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets information about the specified network interface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a network interface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `parameters`: Parameters supplied to the create or update network interface operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
parameters: impl Into<models::NetworkInterface>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a network interface tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `parameters`: Parameters supplied to update network interface tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified network interface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network interfaces in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network interfaces in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all route tables applied to a network interface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_effective_route_table(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_effective_route_table::Builder {
get_effective_route_table::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network security groups applied to a network interface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_effective_network_security_groups(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_effective_network_security_groups::Builder {
list_effective_network_security_groups::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets information about all network interfaces in a role instance in a cloud service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cloud_service_name`: The name of the cloud service."]
#[doc = "* `role_instance_name`: The name of role instance."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_cloud_service_role_instance_network_interfaces(
&self,
resource_group_name: impl Into<String>,
cloud_service_name: impl Into<String>,
role_instance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_cloud_service_role_instance_network_interfaces::Builder {
list_cloud_service_role_instance_network_interfaces::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cloud_service_name: cloud_service_name.into(),
role_instance_name: role_instance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network interfaces in a cloud service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cloud_service_name`: The name of the cloud service."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_cloud_service_network_interfaces(
&self,
resource_group_name: impl Into<String>,
cloud_service_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_cloud_service_network_interfaces::Builder {
list_cloud_service_network_interfaces::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cloud_service_name: cloud_service_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get the specified network interface in a cloud service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cloud_service_name`: The name of the cloud service."]
#[doc = "* `role_instance_name`: The name of role instance."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_cloud_service_network_interface(
&self,
resource_group_name: impl Into<String>,
cloud_service_name: impl Into<String>,
role_instance_name: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_cloud_service_network_interface::Builder {
get_cloud_service_network_interface::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cloud_service_name: cloud_service_name.into(),
role_instance_name: role_instance_name.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets information about all network interfaces in a virtual machine in a virtual machine scale set."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_machine_scale_set_name`: The name of the virtual machine scale set."]
#[doc = "* `virtualmachine_index`: The virtual machine index."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_virtual_machine_scale_set_vm_network_interfaces(
&self,
resource_group_name: impl Into<String>,
virtual_machine_scale_set_name: impl Into<String>,
virtualmachine_index: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_virtual_machine_scale_set_vm_network_interfaces::Builder {
list_virtual_machine_scale_set_vm_network_interfaces::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(),
virtualmachine_index: virtualmachine_index.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network interfaces in a virtual machine scale set."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_machine_scale_set_name`: The name of the virtual machine scale set."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_virtual_machine_scale_set_network_interfaces(
&self,
resource_group_name: impl Into<String>,
virtual_machine_scale_set_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_virtual_machine_scale_set_network_interfaces::Builder {
list_virtual_machine_scale_set_network_interfaces::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get the specified network interface in a virtual machine scale set."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_machine_scale_set_name`: The name of the virtual machine scale set."]
#[doc = "* `virtualmachine_index`: The virtual machine index."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_virtual_machine_scale_set_network_interface(
&self,
resource_group_name: impl Into<String>,
virtual_machine_scale_set_name: impl Into<String>,
virtualmachine_index: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_virtual_machine_scale_set_network_interface::Builder {
get_virtual_machine_scale_set_network_interface::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(),
virtualmachine_index: virtualmachine_index.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Get the specified network interface ip configuration in a virtual machine scale set."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_machine_scale_set_name`: The name of the virtual machine scale set."]
#[doc = "* `virtualmachine_index`: The virtual machine index."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_virtual_machine_scale_set_ip_configurations(
&self,
resource_group_name: impl Into<String>,
virtual_machine_scale_set_name: impl Into<String>,
virtualmachine_index: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_virtual_machine_scale_set_ip_configurations::Builder {
list_virtual_machine_scale_set_ip_configurations::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(),
virtualmachine_index: virtualmachine_index.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Get the specified network interface ip configuration in a virtual machine scale set."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_machine_scale_set_name`: The name of the virtual machine scale set."]
#[doc = "* `virtualmachine_index`: The virtual machine index."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `ip_configuration_name`: The name of the ip configuration."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_virtual_machine_scale_set_ip_configuration(
&self,
resource_group_name: impl Into<String>,
virtual_machine_scale_set_name: impl Into<String>,
virtualmachine_index: impl Into<String>,
network_interface_name: impl Into<String>,
ip_configuration_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_virtual_machine_scale_set_ip_configuration::Builder {
get_virtual_machine_scale_set_ip_configuration::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(),
virtualmachine_index: virtualmachine_index.into(),
network_interface_name: network_interface_name.into(),
ip_configuration_name: ip_configuration_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
}
pub mod get {
use super::models;
type Response = models::NetworkInterface;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/networkInterfaces/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterface = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::NetworkInterface),
Ok200(models::NetworkInterface),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) parameters: models::NetworkInterface,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkInterfaces/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterface = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterface = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::NetworkInterface;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkInterfaces/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterface = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkInterfaces/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::NetworkInterfaceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkInterfaces",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkInterfaceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkInterfaces",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_effective_route_table {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::EffectiveRouteListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkInterfaces/{}/effectiveRouteTable",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::EffectiveRouteListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_effective_network_security_groups {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::EffectiveNetworkSecurityGroupListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkInterfaces/{}/effectiveNetworkSecurityGroups" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_interface_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::EffectiveNetworkSecurityGroupListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_cloud_service_role_instance_network_interfaces {
use super::models;
type Response = models::NetworkInterfaceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cloud_service_name: String,
pub(crate) role_instance_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Compute/cloudServices/{}/roleInstances/{}/networkInterfaces" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . cloud_service_name , & this . role_instance_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_cloud_service_network_interfaces {
use super::models;
type Response = models::NetworkInterfaceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cloud_service_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Compute/cloudServices/{}/networkInterfaces",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.cloud_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, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_cloud_service_network_interface {
use super::models;
type Response = models::NetworkInterface;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cloud_service_name: String,
pub(crate) role_instance_name: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Compute/cloudServices/{}/roleInstances/{}/networkInterfaces/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . cloud_service_name , & this . role_instance_name , & this . network_interface_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterface = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_virtual_machine_scale_set_vm_network_interfaces {
use super::models;
type Response = models::NetworkInterfaceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_machine_scale_set_name: String,
pub(crate) virtualmachine_index: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_machine_scale_set_name , & this . virtualmachine_index)) ? ;
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, "2018-10-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, "2018-10-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_virtual_machine_scale_set_network_interfaces {
use super::models;
type Response = models::NetworkInterfaceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_machine_scale_set_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Compute/virtualMachineScaleSets/{}/networkInterfaces" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_machine_scale_set_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, "2018-10-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, "2018-10-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_virtual_machine_scale_set_network_interface {
use super::models;
type Response = models::NetworkInterface;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_machine_scale_set_name: String,
pub(crate) virtualmachine_index: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_machine_scale_set_name , & this . virtualmachine_index , & this . network_interface_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, "2018-10-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterface = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_virtual_machine_scale_set_ip_configurations {
use super::models;
type Response = models::NetworkInterfaceIpConfigurationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_machine_scale_set_name: String,
pub(crate) virtualmachine_index: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}/ipConfigurations" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_machine_scale_set_name , & this . virtualmachine_index , & this . network_interface_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, "2018-10-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, "2018-10-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_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceIpConfigurationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_virtual_machine_scale_set_ip_configuration {
use super::models;
type Response = models::NetworkInterfaceIpConfiguration;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_machine_scale_set_name: String,
pub(crate) virtualmachine_index: String,
pub(crate) network_interface_name: String,
pub(crate) ip_configuration_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}/ipConfigurations/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_machine_scale_set_name , & this . virtualmachine_index , & this . network_interface_name , & this . ip_configuration_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, "2018-10-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceIpConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod network_interface_ip_configurations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get all ip configurations in a network interface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the specified network interface ip configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `ip_configuration_name`: The name of the ip configuration name."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
ip_configuration_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
ip_configuration_name: ip_configuration_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkInterfaceIpConfigurationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkInterfaces/{}/ipConfigurations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceIpConfigurationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::NetworkInterfaceIpConfiguration;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) ip_configuration_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkInterfaces/{}/ipConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name,
&this.ip_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceIpConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod network_interface_load_balancers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List all load balancers in a network interface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkInterfaceLoadBalancerListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkInterfaces/{}/loadBalancers",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceLoadBalancerListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod network_interface_tap_configurations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the specified tap configuration on a network interface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `tap_configuration_name`: The name of the tap configuration."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
tap_configuration_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
tap_configuration_name: tap_configuration_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a Tap configuration in the specified NetworkInterface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `tap_configuration_name`: The name of the tap configuration."]
#[doc = "* `tap_configuration_parameters`: Parameters supplied to the create or update tap configuration operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
tap_configuration_name: impl Into<String>,
tap_configuration_parameters: impl Into<models::NetworkInterfaceTapConfiguration>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
tap_configuration_name: tap_configuration_name.into(),
tap_configuration_parameters: tap_configuration_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified tap configuration from the NetworkInterface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `tap_configuration_name`: The name of the tap configuration."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
tap_configuration_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
tap_configuration_name: tap_configuration_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get all Tap configurations in a network interface."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
network_interface_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_interface_name: network_interface_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::NetworkInterfaceTapConfiguration;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) tap_configuration_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkInterfaces/{}/tapConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name,
&this.tap_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceTapConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::NetworkInterfaceTapConfiguration),
Created201(models::NetworkInterfaceTapConfiguration),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) tap_configuration_name: String,
pub(crate) tap_configuration_parameters: models::NetworkInterfaceTapConfiguration,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkInterfaces/{}/tapConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name,
&this.tap_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.tap_configuration_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceTapConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceTapConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) tap_configuration_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkInterfaces/{}/tapConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name,
&this.tap_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkInterfaceTapConfigurationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_interface_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkInterfaces/{}/tapConfigurations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_interface_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceTapConfigurationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_network_taps {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets information about the specified virtual network tap."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `tap_name`: The name of virtual network tap."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
tap_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
tap_name: tap_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a Virtual Network Tap."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `tap_name`: The name of the virtual network tap."]
#[doc = "* `parameters`: Parameters supplied to the create or update virtual network tap operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
tap_name: impl Into<String>,
parameters: impl Into<models::VirtualNetworkTap>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
tap_name: tap_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an VirtualNetworkTap tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `tap_name`: The name of the tap."]
#[doc = "* `tap_parameters`: Parameters supplied to update VirtualNetworkTap tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
tap_name: impl Into<String>,
tap_parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
tap_name: tap_name.into(),
tap_parameters: tap_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified virtual network tap."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `tap_name`: The name of the virtual network tap."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
tap_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
tap_name: tap_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the VirtualNetworkTaps in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the VirtualNetworkTaps in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualNetworkTap;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) tap_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworkTaps/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.tap_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkTap = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualNetworkTap),
Created201(models::VirtualNetworkTap),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) tap_name: String,
pub(crate) parameters: models::VirtualNetworkTap,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkTaps/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.tap_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkTap = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkTap = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::VirtualNetworkTap;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) tap_name: String,
pub(crate) tap_parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworkTaps/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.tap_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.tap_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkTap = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) tap_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkTaps/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.tap_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::VirtualNetworkTapListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworkTaps",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkTapListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::VirtualNetworkTapListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworkTaps",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkTapListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod load_balancers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified load balancer."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a load balancer."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `parameters`: Parameters supplied to the create or update load balancer operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
parameters: impl Into<models::LoadBalancer>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a load balancer tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `parameters`: Parameters supplied to update load balancer tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified load balancer."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the load balancers in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the load balancers in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Swaps VIPs between two load balancers."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The region where load balancers are located at."]
#[doc = "* `parameters`: Parameters that define which VIPs should be swapped."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn swap_public_ip_addresses(
&self,
location: impl Into<String>,
parameters: impl Into<models::LoadBalancerVipSwapRequest>,
subscription_id: impl Into<String>,
) -> swap_public_ip_addresses::Builder {
swap_public_ip_addresses::Builder {
client: self.0.clone(),
location: location.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "List of inbound NAT rule port mappings."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `backend_pool_name`: The name of the load balancer backend address pool."]
#[doc = "* `parameters`: Query inbound NAT rule port mapping request."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_inbound_nat_rule_port_mappings(
&self,
group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
backend_pool_name: impl Into<String>,
parameters: impl Into<models::QueryInboundNatRulePortMappingRequest>,
subscription_id: impl Into<String>,
) -> list_inbound_nat_rule_port_mappings::Builder {
list_inbound_nat_rule_port_mappings::Builder {
client: self.0.clone(),
group_name: group_name.into(),
load_balancer_name: load_balancer_name.into(),
backend_pool_name: backend_pool_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::LoadBalancer;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/loadBalancers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancer = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::LoadBalancer),
Ok200(models::LoadBalancer),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) parameters: models::LoadBalancer,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/loadBalancers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancer = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancer = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::LoadBalancer;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/loadBalancers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancer = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/loadBalancers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::LoadBalancerListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/loadBalancers",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancerListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::LoadBalancerListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/loadBalancers",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancerListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod swap_public_ip_addresses {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) parameters: models::LoadBalancerVipSwapRequest,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/locations/{}/setLoadBalancerFrontendPublicIpAddresses",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_inbound_nat_rule_port_mappings {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::BackendAddressInboundNatRulePortMappings),
Accepted202(models::BackendAddressInboundNatRulePortMappings),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) backend_pool_name: String,
pub(crate) parameters: models::QueryInboundNatRulePortMappingRequest,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/loadBalancers/{}/backendAddressPools/{}/queryInboundNatRulePortMapping" , this . client . endpoint () , & this . subscription_id , & this . group_name , & this . load_balancer_name , & this . backend_pool_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BackendAddressInboundNatRulePortMappings = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BackendAddressInboundNatRulePortMappings = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod load_balancer_backend_address_pools {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all the load balancer backed address pools."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets load balancer backend address pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `backend_address_pool_name`: The name of the backend address pool."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
backend_address_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
backend_address_pool_name: backend_address_pool_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a load balancer backend address pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `backend_address_pool_name`: The name of the backend address pool."]
#[doc = "* `parameters`: Parameters supplied to the create or update load balancer backend address pool operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
backend_address_pool_name: impl Into<String>,
parameters: impl Into<models::BackendAddressPool>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
backend_address_pool_name: backend_address_pool_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified load balancer backend address pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `backend_address_pool_name`: The name of the backend address pool."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
backend_address_pool_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
backend_address_pool_name: backend_address_pool_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::LoadBalancerBackendAddressPoolListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/loadBalancers/{}/backendAddressPools",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancerBackendAddressPoolListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::BackendAddressPool;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) backend_address_pool_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/loadBalancers/{}/backendAddressPools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name,
&this.backend_address_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BackendAddressPool = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::BackendAddressPool),
Ok200(models::BackendAddressPool),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) backend_address_pool_name: String,
pub(crate) parameters: models::BackendAddressPool,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/loadBalancers/{}/backendAddressPools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name,
&this.backend_address_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BackendAddressPool = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BackendAddressPool = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) backend_address_pool_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/loadBalancers/{}/backendAddressPools/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name,
&this.backend_address_pool_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod load_balancer_frontend_ip_configurations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all the load balancer frontend IP configurations."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets load balancer frontend IP configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `frontend_ip_configuration_name`: The name of the frontend IP configuration."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
frontend_ip_configuration_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
frontend_ip_configuration_name: frontend_ip_configuration_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::LoadBalancerFrontendIpConfigurationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/loadBalancers/{}/frontendIPConfigurations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancerFrontendIpConfigurationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::FrontendIpConfiguration;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) frontend_ip_configuration_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/loadBalancers/{}/frontendIPConfigurations/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . load_balancer_name , & this . frontend_ip_configuration_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FrontendIpConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod inbound_nat_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all the inbound NAT rules in a load balancer."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the specified load balancer inbound NAT rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `inbound_nat_rule_name`: The name of the inbound NAT rule."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
inbound_nat_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
inbound_nat_rule_name: inbound_nat_rule_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a load balancer inbound NAT rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `inbound_nat_rule_name`: The name of the inbound NAT rule."]
#[doc = "* `inbound_nat_rule_parameters`: Parameters supplied to the create or update inbound NAT rule operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
inbound_nat_rule_name: impl Into<String>,
inbound_nat_rule_parameters: impl Into<models::InboundNatRule>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
inbound_nat_rule_name: inbound_nat_rule_name.into(),
inbound_nat_rule_parameters: inbound_nat_rule_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified load balancer inbound NAT rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `inbound_nat_rule_name`: The name of the inbound NAT rule."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
inbound_nat_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
inbound_nat_rule_name: inbound_nat_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::InboundNatRuleListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/loadBalancers/{}/inboundNatRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::InboundNatRuleListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::InboundNatRule;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) inbound_nat_rule_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/loadBalancers/{}/inboundNatRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name,
&this.inbound_nat_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::InboundNatRule = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::InboundNatRule),
Ok200(models::InboundNatRule),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) inbound_nat_rule_name: String,
pub(crate) inbound_nat_rule_parameters: models::InboundNatRule,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/loadBalancers/{}/inboundNatRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name,
&this.inbound_nat_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.inbound_nat_rule_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::InboundNatRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::InboundNatRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) inbound_nat_rule_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/loadBalancers/{}/inboundNatRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name,
&this.inbound_nat_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod load_balancer_load_balancing_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all the load balancing rules in a load balancer."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the specified load balancer load balancing rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `load_balancing_rule_name`: The name of the load balancing rule."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
load_balancing_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
load_balancing_rule_name: load_balancing_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::LoadBalancerLoadBalancingRuleListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/loadBalancers/{}/loadBalancingRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancerLoadBalancingRuleListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::LoadBalancingRule;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) load_balancing_rule_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/loadBalancers/{}/loadBalancingRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name,
&this.load_balancing_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancingRule = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod load_balancer_outbound_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all the outbound rules in a load balancer."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the specified load balancer outbound rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `outbound_rule_name`: The name of the outbound rule."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
outbound_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
outbound_rule_name: outbound_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::LoadBalancerOutboundRuleListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/loadBalancers/{}/outboundRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancerOutboundRuleListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::OutboundRule;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) outbound_rule_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/loadBalancers/{}/outboundRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name,
&this.outbound_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::OutboundRule = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod load_balancer_network_interfaces {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets associated load balancer network interfaces."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkInterfaceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/loadBalancers/{}/networkInterfaces",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkInterfaceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod load_balancer_probes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all the load balancer probes."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets load balancer probe."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `load_balancer_name`: The name of the load balancer."]
#[doc = "* `probe_name`: The name of the probe."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
load_balancer_name: impl Into<String>,
probe_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
load_balancer_name: load_balancer_name.into(),
probe_name: probe_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::LoadBalancerProbeListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/loadBalancers/{}/probes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LoadBalancerProbeListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::Probe;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) load_balancer_name: String,
pub(crate) probe_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/loadBalancers/{}/probes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.load_balancer_name,
&this.probe_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::Probe = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod virtual_networks {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified virtual network by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a virtual network in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `parameters`: Parameters supplied to the create or update virtual network operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
parameters: impl Into<models::VirtualNetwork>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a virtual network tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `parameters`: Parameters supplied to update virtual network tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified virtual network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all virtual networks in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all virtual networks in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Checks whether a private IP address is available for use."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `ip_address`: The private IP address to be verified."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn check_ip_address_availability(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
ip_address: impl Into<String>,
subscription_id: impl Into<String>,
) -> check_ip_address_availability::Builder {
check_ip_address_availability::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
ip_address: ip_address.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists usage stats."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_usage(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_usage::Builder {
list_usage::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualNetwork;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/virtualNetworks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetwork = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualNetwork),
Created201(models::VirtualNetwork),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) parameters: models::VirtualNetwork,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetwork = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetwork = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::VirtualNetwork;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetwork = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::VirtualNetworkListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworks",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::VirtualNetworkListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod check_ip_address_availability {
use super::models;
type Response = models::IpAddressAvailabilityResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) ip_address: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworks/{}/CheckIPAddressAvailability" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let ip_address = &this.ip_address;
req.url_mut().query_pairs_mut().append_pair("ipAddress", ip_address);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpAddressAvailabilityResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_usage {
use super::models;
type Response = models::VirtualNetworkListUsageResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworks/{}/usages",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkListUsageResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod subnets {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified subnet by virtual network and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subnet_name`: The name of the subnet."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subnet_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subnet_name: subnet_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a subnet in the specified virtual network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subnet_name`: The name of the subnet."]
#[doc = "* `subnet_parameters`: Parameters supplied to the create or update subnet operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subnet_name: impl Into<String>,
subnet_parameters: impl Into<models::Subnet>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subnet_name: subnet_name.into(),
subnet_parameters: subnet_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified subnet."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subnet_name`: The name of the subnet."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subnet_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subnet_name: subnet_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Prepares a subnet by applying network intent policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subnet_name`: The name of the subnet."]
#[doc = "* `prepare_network_policies_request_parameters`: Parameters supplied to prepare subnet by applying network intent policies."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn prepare_network_policies(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subnet_name: impl Into<String>,
prepare_network_policies_request_parameters: impl Into<models::PrepareNetworkPoliciesRequest>,
subscription_id: impl Into<String>,
) -> prepare_network_policies::Builder {
prepare_network_policies::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subnet_name: subnet_name.into(),
prepare_network_policies_request_parameters: prepare_network_policies_request_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Unprepares a subnet by removing network intent policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subnet_name`: The name of the subnet."]
#[doc = "* `unprepare_network_policies_request_parameters`: Parameters supplied to unprepare subnet to remove network intent policies."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn unprepare_network_policies(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subnet_name: impl Into<String>,
unprepare_network_policies_request_parameters: impl Into<models::UnprepareNetworkPoliciesRequest>,
subscription_id: impl Into<String>,
) -> unprepare_network_policies::Builder {
unprepare_network_policies::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subnet_name: subnet_name.into(),
unprepare_network_policies_request_parameters: unprepare_network_policies_request_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all subnets in a virtual network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::Subnet;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subnet_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/virtualNetworks/{}/subnets/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name,
&this.subnet_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::Subnet = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::Subnet),
Created201(models::Subnet),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subnet_name: String,
pub(crate) subnet_parameters: models::Subnet,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworks/{}/subnets/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name,
&this.subnet_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.subnet_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::Subnet = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::Subnet = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
NoContent204,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subnet_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworks/{}/subnets/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name,
&this.subnet_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod prepare_network_policies {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subnet_name: String,
pub(crate) prepare_network_policies_request_parameters: models::PrepareNetworkPoliciesRequest,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworks/{}/subnets/{}/PrepareNetworkPolicies" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_name , & this . subnet_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.prepare_network_policies_request_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod unprepare_network_policies {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subnet_name: String,
pub(crate) unprepare_network_policies_request_parameters: models::UnprepareNetworkPoliciesRequest,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworks/{}/subnets/{}/UnprepareNetworkPolicies" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_name , & this . subnet_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.unprepare_network_policies_request_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::SubnetListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworks/{}/subnets",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SubnetListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod resource_navigation_links {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of resource navigation links for a subnet."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subnet_name`: The name of the subnet."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subnet_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subnet_name: subnet_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::ResourceNavigationLinksListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subnet_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworks/{}/subnets/{}/ResourceNavigationLinks" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_name , & this . subnet_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ResourceNavigationLinksListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod service_association_links {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of service association links for a subnet."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subnet_name`: The name of the subnet."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subnet_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subnet_name: subnet_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::ServiceAssociationLinksListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subnet_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworks/{}/subnets/{}/ServiceAssociationLinks" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_name , & this . subnet_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceAssociationLinksListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod virtual_network_peerings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified virtual network peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `virtual_network_peering_name`: The name of the virtual network peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
virtual_network_peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
virtual_network_peering_name: virtual_network_peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a peering in the specified virtual network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `virtual_network_peering_name`: The name of the peering."]
#[doc = "* `virtual_network_peering_parameters`: Parameters supplied to the create or update virtual network peering operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
virtual_network_peering_name: impl Into<String>,
virtual_network_peering_parameters: impl Into<models::VirtualNetworkPeering>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
virtual_network_peering_name: virtual_network_peering_name.into(),
virtual_network_peering_parameters: virtual_network_peering_parameters.into(),
subscription_id: subscription_id.into(),
sync_remote_address_space: None,
}
}
#[doc = "Deletes the specified virtual network peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `virtual_network_peering_name`: The name of the virtual network peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
virtual_network_peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
virtual_network_peering_name: virtual_network_peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all virtual network peerings in a virtual network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_name`: The name of the virtual network."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
virtual_network_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_name: virtual_network_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualNetworkPeering;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) virtual_network_peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworks/{}/virtualNetworkPeerings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_name , & this . virtual_network_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkPeering = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualNetworkPeering),
Created201(models::VirtualNetworkPeering),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) virtual_network_peering_name: String,
pub(crate) virtual_network_peering_parameters: models::VirtualNetworkPeering,
pub(crate) subscription_id: String,
pub(crate) sync_remote_address_space: Option<String>,
}
impl Builder {
#[doc = "Parameter indicates the intention to sync the peering with the current address space on the remote vNet after it's updated."]
pub fn sync_remote_address_space(mut self, sync_remote_address_space: impl Into<String>) -> Self {
self.sync_remote_address_space = Some(sync_remote_address_space.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworks/{}/virtualNetworkPeerings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_name , & this . virtual_network_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, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.virtual_network_peering_parameters)?;
if let Some(sync_remote_address_space) = &this.sync_remote_address_space {
req.url_mut()
.query_pairs_mut()
.append_pair("syncRemoteAddressSpace", sync_remote_address_space);
}
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkPeering = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkPeering = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
NoContent204,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) virtual_network_peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworks/{}/virtualNetworkPeerings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_name , & this . virtual_network_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::VirtualNetworkPeeringListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworks/{}/virtualNetworkPeerings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkPeeringListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod network_security_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified network security group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a network security group in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `parameters`: Parameters supplied to the create or update network security group operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
parameters: impl Into<models::NetworkSecurityGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a network security group tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `parameters`: Parameters supplied to update network security group tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified network security group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network security groups in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network security groups in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::NetworkSecurityGroup;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/networkSecurityGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_security_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkSecurityGroup = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::NetworkSecurityGroup),
Ok200(models::NetworkSecurityGroup),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) parameters: models::NetworkSecurityGroup,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkSecurityGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_security_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkSecurityGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkSecurityGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::NetworkSecurityGroup;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkSecurityGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_security_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkSecurityGroup = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkSecurityGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_security_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::NetworkSecurityGroupListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkSecurityGroups",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkSecurityGroupListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkSecurityGroupListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkSecurityGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkSecurityGroupListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod security_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the specified network security rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `security_rule_name`: The name of the security rule."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
security_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
security_rule_name: security_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a security rule in the specified network security group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `security_rule_name`: The name of the security rule."]
#[doc = "* `security_rule_parameters`: Parameters supplied to the create or update network security rule operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
security_rule_name: impl Into<String>,
security_rule_parameters: impl Into<models::SecurityRule>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
security_rule_name: security_rule_name.into(),
security_rule_parameters: security_rule_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified network security rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `security_rule_name`: The name of the security rule."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
security_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
security_rule_name: security_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all security rules in a network security group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::SecurityRule;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) security_rule_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkSecurityGroups/{}/securityRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_security_group_name,
&this.security_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityRule = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::SecurityRule),
Created201(models::SecurityRule),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) security_rule_name: String,
pub(crate) security_rule_parameters: models::SecurityRule,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkSecurityGroups/{}/securityRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_security_group_name,
&this.security_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.security_rule_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) security_rule_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkSecurityGroups/{}/securityRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_security_group_name,
&this.security_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::SecurityRuleListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkSecurityGroups/{}/securityRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_security_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityRuleListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod default_security_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all default security rules in a network security group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get the specified default network security rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_security_group_name`: The name of the network security group."]
#[doc = "* `default_security_rule_name`: The name of the default security rule."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_security_group_name: impl Into<String>,
default_security_rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_security_group_name: network_security_group_name.into(),
default_security_rule_name: default_security_rule_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::SecurityRuleListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkSecurityGroups/{}/defaultSecurityRules" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_security_group_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityRuleListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::SecurityRule;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_security_group_name: String,
pub(crate) default_security_rule_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkSecurityGroups/{}/defaultSecurityRules/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_security_group_name , & this . default_security_rule_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityRule = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod application_security_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets information about the specified application security group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_security_group_name`: The name of the application security group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
application_security_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_security_group_name: application_security_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an application security group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_security_group_name`: The name of the application security group."]
#[doc = "* `parameters`: Parameters supplied to the create or update ApplicationSecurityGroup operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
application_security_group_name: impl Into<String>,
parameters: impl Into<models::ApplicationSecurityGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_security_group_name: application_security_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an application security group's tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_security_group_name`: The name of the application security group."]
#[doc = "* `parameters`: Parameters supplied to update application security group tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
application_security_group_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_security_group_name: application_security_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified application security group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `application_security_group_name`: The name of the application security group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
application_security_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
application_security_group_name: application_security_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all application security groups in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the application security groups in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ApplicationSecurityGroup;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_security_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationSecurityGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_security_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationSecurityGroup = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::ApplicationSecurityGroup),
Ok200(models::ApplicationSecurityGroup),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_security_group_name: String,
pub(crate) parameters: models::ApplicationSecurityGroup,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationSecurityGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_security_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationSecurityGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationSecurityGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::ApplicationSecurityGroup;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_security_group_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/applicationSecurityGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_security_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationSecurityGroup = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) application_security_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/applicationSecurityGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.application_security_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::ApplicationSecurityGroupListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/applicationSecurityGroups",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationSecurityGroupListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::ApplicationSecurityGroupListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/applicationSecurityGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ApplicationSecurityGroupListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod network_watchers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified network watcher by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a network watcher in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `parameters`: Parameters that define the network watcher resource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::NetworkWatcher>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a network watcher tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `parameters`: Parameters supplied to update network watcher tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified network watcher resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network watchers by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network watchers by subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the current network topology by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `parameters`: Parameters that define the representation of topology."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_topology(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::TopologyParameters>,
subscription_id: impl Into<String>,
) -> get_topology::Builder {
get_topology::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Verify IP flow from the specified VM to a location given the currently configured NSG rules."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `parameters`: Parameters that define the IP flow to be verified."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn verify_ip_flow(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::VerificationIpFlowParameters>,
subscription_id: impl Into<String>,
) -> verify_ip_flow::Builder {
verify_ip_flow::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the next hop from the specified VM."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `parameters`: Parameters that define the source and destination endpoint."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_next_hop(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::NextHopParameters>,
subscription_id: impl Into<String>,
) -> get_next_hop::Builder {
get_next_hop::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the configured and effective security group rules on the specified VM."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `parameters`: Parameters that define the VM to check security groups for."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_vm_security_rules(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::SecurityGroupViewParameters>,
subscription_id: impl Into<String>,
) -> get_vm_security_rules::Builder {
get_vm_security_rules::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Initiate troubleshooting on a specified resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher resource."]
#[doc = "* `parameters`: Parameters that define the resource to troubleshoot."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_troubleshooting(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::TroubleshootingParameters>,
subscription_id: impl Into<String>,
) -> get_troubleshooting::Builder {
get_troubleshooting::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get the last completed troubleshooting result on a specified resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher resource."]
#[doc = "* `parameters`: Parameters that define the resource to query the troubleshooting result."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_troubleshooting_result(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::QueryTroubleshootingParameters>,
subscription_id: impl Into<String>,
) -> get_troubleshooting_result::Builder {
get_troubleshooting_result::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Configures flow log and traffic analytics (optional) on a specified resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the network watcher resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher resource."]
#[doc = "* `parameters`: Parameters that define the configuration of flow log."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn set_flow_log_configuration(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::FlowLogInformation>,
subscription_id: impl Into<String>,
) -> set_flow_log_configuration::Builder {
set_flow_log_configuration::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Queries status of flow log and traffic analytics (optional) on a specified resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the network watcher resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher resource."]
#[doc = "* `parameters`: Parameters that define a resource to query flow log and traffic analytics (optional) status."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_flow_log_status(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::FlowLogStatusParameters>,
subscription_id: impl Into<String>,
) -> get_flow_log_status::Builder {
get_flow_log_status::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the network watcher resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher resource."]
#[doc = "* `parameters`: Parameters that determine how the connectivity check will be performed."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn check_connectivity(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::ConnectivityParameters>,
subscription_id: impl Into<String>,
) -> check_connectivity::Builder {
check_connectivity::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "NOTE: This feature is currently in preview and still being tested for stability. Gets the relative latency score for internet service providers from a specified location to Azure regions."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the network watcher resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher resource."]
#[doc = "* `parameters`: Parameters that determine Azure reachability report configuration."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_azure_reachability_report(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::AzureReachabilityReportParameters>,
subscription_id: impl Into<String>,
) -> get_azure_reachability_report::Builder {
get_azure_reachability_report::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "NOTE: This feature is currently in preview and still being tested for stability. Lists all available internet service providers for a specified Azure region."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the network watcher resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher resource."]
#[doc = "* `parameters`: Parameters that scope the list of available providers."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_available_providers(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::AvailableProvidersListParameters>,
subscription_id: impl Into<String>,
) -> list_available_providers::Builder {
list_available_providers::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets Network Configuration Diagnostic data to help customers understand and debug network behavior. It provides detailed information on what security rules were applied to a specified traffic flow and the result of evaluating these rules. Customers must provide details of a flow like source, destination, protocol, etc. The API returns whether traffic was allowed or denied, the rules evaluated for the specified flow and the evaluation results."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `parameters`: Parameters to get network configuration diagnostic."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_network_configuration_diagnostic(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
parameters: impl Into<models::NetworkConfigurationDiagnosticParameters>,
subscription_id: impl Into<String>,
) -> get_network_configuration_diagnostic::Builder {
get_network_configuration_diagnostic::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::NetworkWatcher;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkWatchers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkWatcher = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::NetworkWatcher),
Created201(models::NetworkWatcher),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::NetworkWatcher,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkWatchers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkWatcher = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkWatcher = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::NetworkWatcher;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkWatchers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkWatcher = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkWatcherListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as the continuation token is not part of the response schema"]
pub fn into_future(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.Network/networkWatchers",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkWatcherListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::NetworkWatcherListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as the continuation token is not part of the response schema"]
pub fn into_future(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.Network/networkWatchers",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkWatcherListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_topology {
use super::models;
type Response = models::Topology;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::TopologyParameters,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkWatchers/{}/topology",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::Topology = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod verify_ip_flow {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VerificationIpFlowResult),
Accepted202(models::VerificationIpFlowResult),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::VerificationIpFlowParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/ipFlowVerify",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VerificationIpFlowResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VerificationIpFlowResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_next_hop {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::NextHopResult),
Accepted202(models::NextHopResult),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::NextHopParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/nextHop",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NextHopResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NextHopResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_vm_security_rules {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::SecurityGroupViewResult),
Accepted202(models::SecurityGroupViewResult),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::SecurityGroupViewParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/securityGroupView",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityGroupViewResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityGroupViewResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_troubleshooting {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::TroubleshootingResult),
Accepted202(models::TroubleshootingResult),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::TroubleshootingParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/troubleshoot",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::TroubleshootingResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::TroubleshootingResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_troubleshooting_result {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::TroubleshootingResult),
Accepted202(models::TroubleshootingResult),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::QueryTroubleshootingParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/queryTroubleshootResult",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::TroubleshootingResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::TroubleshootingResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod set_flow_log_configuration {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::FlowLogInformation),
Accepted202(models::FlowLogInformation),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::FlowLogInformation,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/configureFlowLog",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FlowLogInformation = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FlowLogInformation = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_flow_log_status {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::FlowLogInformation),
Accepted202(models::FlowLogInformation),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::FlowLogStatusParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/queryFlowLogStatus",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FlowLogInformation = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FlowLogInformation = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod check_connectivity {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ConnectivityInformation),
Accepted202(models::ConnectivityInformation),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::ConnectivityParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/connectivityCheck",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectivityInformation = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectivityInformation = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_azure_reachability_report {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::AzureReachabilityReport),
Accepted202(models::AzureReachabilityReport),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::AzureReachabilityReportParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/azureReachabilityReport",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureReachabilityReport = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureReachabilityReport = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_available_providers {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::AvailableProvidersList),
Accepted202(models::AvailableProvidersList),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::AvailableProvidersListParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/availableProvidersList",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AvailableProvidersList = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AvailableProvidersList = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_network_configuration_diagnostic {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::NetworkConfigurationDiagnosticResponse),
Accepted202(models::NetworkConfigurationDiagnosticResponse),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) parameters: models::NetworkConfigurationDiagnosticParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/networkConfigurationDiagnostic" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_watcher_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkConfigurationDiagnosticResponse = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkConfigurationDiagnosticResponse = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod packet_captures {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a packet capture session by name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `packet_capture_name`: The name of the packet capture session."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
packet_capture_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
packet_capture_name: packet_capture_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Create and start a packet capture on the specified VM."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `packet_capture_name`: The name of the packet capture session."]
#[doc = "* `parameters`: Parameters that define the create packet capture operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
packet_capture_name: impl Into<String>,
parameters: impl Into<models::PacketCapture>,
subscription_id: impl Into<String>,
) -> create::Builder {
create::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
packet_capture_name: packet_capture_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified packet capture session."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `packet_capture_name`: The name of the packet capture session."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
packet_capture_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
packet_capture_name: packet_capture_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Stops a specified packet capture session."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `packet_capture_name`: The name of the packet capture session."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn stop(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
packet_capture_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> stop::Builder {
stop::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
packet_capture_name: packet_capture_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Query the status of a running packet capture session."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `packet_capture_name`: The name given to the packet capture session."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_status(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
packet_capture_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_status::Builder {
get_status::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
packet_capture_name: packet_capture_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all packet capture sessions within the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::PacketCaptureResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) packet_capture_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkWatchers/{}/packetCaptures/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.packet_capture_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PacketCaptureResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create {
use super::models;
type Response = models::PacketCaptureResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) packet_capture_name: String,
pub(crate) parameters: models::PacketCapture,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/packetCaptures/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.packet_capture_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PacketCaptureResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) packet_capture_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/packetCaptures/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.packet_capture_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod stop {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) packet_capture_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/packetCaptures/{}/stop",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.packet_capture_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_status {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::PacketCaptureQueryStatusResult),
Accepted202(models::PacketCaptureQueryStatusResult),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) packet_capture_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/packetCaptures/{}/queryStatus" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_watcher_name , & this . packet_capture_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PacketCaptureQueryStatusResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PacketCaptureQueryStatusResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::PacketCaptureListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as the continuation token is not part of the response schema"]
pub fn into_future(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.Network/networkWatchers/{}/packetCaptures",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PacketCaptureListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod connection_monitors {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a connection monitor by name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing Network Watcher."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `connection_monitor_name`: The name of the connection monitor."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
connection_monitor_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
connection_monitor_name: connection_monitor_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Create or update a connection monitor."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing Network Watcher."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `connection_monitor_name`: The name of the connection monitor."]
#[doc = "* `parameters`: Parameters that define the operation to create a connection monitor."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
connection_monitor_name: impl Into<String>,
parameters: impl Into<models::ConnectionMonitor>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
connection_monitor_name: connection_monitor_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
migrate: None,
}
}
#[doc = "Update tags of the specified connection monitor."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `connection_monitor_name`: The name of the connection monitor."]
#[doc = "* `parameters`: Parameters supplied to update connection monitor tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
connection_monitor_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
connection_monitor_name: connection_monitor_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified connection monitor."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing Network Watcher."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `connection_monitor_name`: The name of the connection monitor."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
connection_monitor_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
connection_monitor_name: connection_monitor_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Stops the specified connection monitor."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing Network Watcher."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `connection_monitor_name`: The name of the connection monitor."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn stop(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
connection_monitor_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> stop::Builder {
stop::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
connection_monitor_name: connection_monitor_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Starts the specified connection monitor."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing Network Watcher."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `connection_monitor_name`: The name of the connection monitor."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn start(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
connection_monitor_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> start::Builder {
start::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
connection_monitor_name: connection_monitor_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Query a snapshot of the most recent connection states."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing Network Watcher."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `connection_monitor_name`: The name given to the connection monitor."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn query(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
connection_monitor_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> query::Builder {
query::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
connection_monitor_name: connection_monitor_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all connection monitors for the specified Network Watcher."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing Network Watcher."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ConnectionMonitorResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) connection_monitor_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkWatchers/{}/connectionMonitors/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.connection_monitor_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionMonitorResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ConnectionMonitorResult),
Created201(models::ConnectionMonitorResult),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) connection_monitor_name: String,
pub(crate) parameters: models::ConnectionMonitor,
pub(crate) subscription_id: String,
pub(crate) migrate: Option<String>,
}
impl Builder {
#[doc = "Value indicating whether connection monitor V1 should be migrated to V2 format."]
pub fn migrate(mut self, migrate: impl Into<String>) -> Self {
self.migrate = Some(migrate.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/connectionMonitors/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.connection_monitor_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
if let Some(migrate) = &this.migrate {
req.url_mut().query_pairs_mut().append_pair("migrate", migrate);
}
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionMonitorResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionMonitorResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::ConnectionMonitorResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) connection_monitor_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkWatchers/{}/connectionMonitors/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.connection_monitor_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionMonitorResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) connection_monitor_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/connectionMonitors/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.connection_monitor_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod stop {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) connection_monitor_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/connectionMonitors/{}/stop" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_watcher_name , & this . connection_monitor_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod start {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) connection_monitor_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/connectionMonitors/{}/start" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_watcher_name , & this . connection_monitor_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod query {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ConnectionMonitorQueryResult),
Accepted202(models::ConnectionMonitorQueryResult),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) connection_monitor_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/connectionMonitors/{}/query" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_watcher_name , & this . connection_monitor_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionMonitorQueryResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionMonitorQueryResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Accepted202(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ConnectionMonitorListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as the continuation token is not part of the response schema"]
pub fn into_future(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.Network/networkWatchers/{}/connectionMonitors",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionMonitorListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod flow_logs {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a flow log resource by name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `flow_log_name`: The name of the flow log resource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
flow_log_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
flow_log_name: flow_log_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Create or update a flow log for the specified network security group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `flow_log_name`: The name of the flow log."]
#[doc = "* `parameters`: Parameters that define the create or update flow log resource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
flow_log_name: impl Into<String>,
parameters: impl Into<models::FlowLog>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
flow_log_name: flow_log_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Update tags of the specified flow log."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `flow_log_name`: The name of the flow log."]
#[doc = "* `parameters`: Parameters supplied to update flow log tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
flow_log_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
flow_log_name: flow_log_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified flow log resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_watcher_name`: The name of the network watcher."]
#[doc = "* `flow_log_name`: The name of the flow log resource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
flow_log_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
flow_log_name: flow_log_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all flow log resources for the specified Network Watcher."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing Network Watcher."]
#[doc = "* `network_watcher_name`: The name of the Network Watcher resource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
network_watcher_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_watcher_name: network_watcher_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::FlowLog;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) flow_log_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkWatchers/{}/flowLogs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.flow_log_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FlowLog = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::FlowLog),
Ok200(models::FlowLog),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) flow_log_name: String,
pub(crate) parameters: models::FlowLog,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/flowLogs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.flow_log_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FlowLog = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FlowLog = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::FlowLog;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) flow_log_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkWatchers/{}/flowLogs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.flow_log_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FlowLog = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) flow_log_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkWatchers/{}/flowLogs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name,
&this.flow_log_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::FlowLogListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_watcher_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkWatchers/{}/flowLogs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_watcher_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FlowLogListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod route_tables {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified route table."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_table_name`: The name of the route table."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
route_table_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_table_name: route_table_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Create or updates a route table in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_table_name`: The name of the route table."]
#[doc = "* `parameters`: Parameters supplied to the create or update route table operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
route_table_name: impl Into<String>,
parameters: impl Into<models::RouteTable>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_table_name: route_table_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a route table tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_table_name`: The name of the route table."]
#[doc = "* `parameters`: Parameters supplied to update route table tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
route_table_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_table_name: route_table_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified route table."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_table_name`: The name of the route table."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
route_table_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_table_name: route_table_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all route tables in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all route tables in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::RouteTable;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_table_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/routeTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteTable = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::RouteTable),
Created201(models::RouteTable),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_table_name: String,
pub(crate) parameters: models::RouteTable,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/routeTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteTable = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteTable = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::RouteTable;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_table_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/routeTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteTable = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_table_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/routeTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::RouteTableListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/routeTables",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteTableListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_all {
use super::models;
type Response = models::RouteTableListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/routeTables",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteTableListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod routes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified route from a route table."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_table_name`: The name of the route table."]
#[doc = "* `route_name`: The name of the route."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
route_table_name: impl Into<String>,
route_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_table_name: route_table_name.into(),
route_name: route_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a route in the specified route table."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_table_name`: The name of the route table."]
#[doc = "* `route_name`: The name of the route."]
#[doc = "* `route_parameters`: Parameters supplied to the create or update route operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
route_table_name: impl Into<String>,
route_name: impl Into<String>,
route_parameters: impl Into<models::Route>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_table_name: route_table_name.into(),
route_name: route_name.into(),
route_parameters: route_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified route from a route table."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_table_name`: The name of the route table."]
#[doc = "* `route_name`: The name of the route."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
route_table_name: impl Into<String>,
route_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_table_name: route_table_name.into(),
route_name: route_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all routes in a route table."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_table_name`: The name of the route table."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
route_table_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_table_name: route_table_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::Route;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_table_name: String,
pub(crate) route_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/routeTables/{}/routes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_table_name,
&this.route_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::Route = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::Route),
Created201(models::Route),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_table_name: String,
pub(crate) route_name: String,
pub(crate) route_parameters: models::Route,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/routeTables/{}/routes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_table_name,
&this.route_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.route_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::Route = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::Route = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_table_name: String,
pub(crate) route_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/routeTables/{}/routes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_table_name,
&this.route_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::RouteListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_table_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/routeTables/{}/routes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_table_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod service_endpoint_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified service Endpoint Policies in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_endpoint_policy_name`: The name of the service endpoint policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
service_endpoint_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_endpoint_policy_name: service_endpoint_policy_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a service Endpoint Policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_endpoint_policy_name`: The name of the service endpoint policy."]
#[doc = "* `parameters`: Parameters supplied to the create or update service endpoint policy operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
service_endpoint_policy_name: impl Into<String>,
parameters: impl Into<models::ServiceEndpointPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_endpoint_policy_name: service_endpoint_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates tags of a service endpoint policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_endpoint_policy_name`: The name of the service endpoint policy."]
#[doc = "* `parameters`: Parameters supplied to update service endpoint policy tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
service_endpoint_policy_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_endpoint_policy_name: service_endpoint_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified service endpoint policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_endpoint_policy_name`: The name of the service endpoint policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
service_endpoint_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_endpoint_policy_name: service_endpoint_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the service endpoint policies in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all service endpoint Policies in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ServiceEndpointPolicy;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_endpoint_policy_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/serviceEndpointPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.service_endpoint_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicy = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::ServiceEndpointPolicy),
Ok200(models::ServiceEndpointPolicy),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_endpoint_policy_name: String,
pub(crate) parameters: models::ServiceEndpointPolicy,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/serviceEndpointPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.service_endpoint_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicy = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicy = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::ServiceEndpointPolicy;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_endpoint_policy_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/serviceEndpointPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.service_endpoint_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicy = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_endpoint_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/serviceEndpointPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.service_endpoint_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ServiceEndpointPolicyListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ServiceEndpointPolicies",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicyListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ServiceEndpointPolicyListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/serviceEndpointPolicies",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicyListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod service_endpoint_policy_definitions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the specified service endpoint policy definitions from service endpoint policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_endpoint_policy_name`: The name of the service endpoint policy name."]
#[doc = "* `service_endpoint_policy_definition_name`: The name of the service endpoint policy definition name."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
service_endpoint_policy_name: impl Into<String>,
service_endpoint_policy_definition_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_endpoint_policy_name: service_endpoint_policy_name.into(),
service_endpoint_policy_definition_name: service_endpoint_policy_definition_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a service endpoint policy definition in the specified service endpoint policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_endpoint_policy_name`: The name of the service endpoint policy."]
#[doc = "* `service_endpoint_policy_definition_name`: The name of the service endpoint policy definition name."]
#[doc = "* `service_endpoint_policy_definitions`: Parameters supplied to the create or update service endpoint policy operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
service_endpoint_policy_name: impl Into<String>,
service_endpoint_policy_definition_name: impl Into<String>,
service_endpoint_policy_definitions: impl Into<models::ServiceEndpointPolicyDefinition>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_endpoint_policy_name: service_endpoint_policy_name.into(),
service_endpoint_policy_definition_name: service_endpoint_policy_definition_name.into(),
service_endpoint_policy_definitions: service_endpoint_policy_definitions.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified ServiceEndpoint policy definitions."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_endpoint_policy_name`: The name of the Service Endpoint Policy."]
#[doc = "* `service_endpoint_policy_definition_name`: The name of the service endpoint policy definition."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
service_endpoint_policy_name: impl Into<String>,
service_endpoint_policy_definition_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_endpoint_policy_name: service_endpoint_policy_name.into(),
service_endpoint_policy_definition_name: service_endpoint_policy_definition_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all service endpoint policy definitions in a service end point policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_endpoint_policy_name`: The name of the service endpoint policy name."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
service_endpoint_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_endpoint_policy_name: service_endpoint_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ServiceEndpointPolicyDefinition;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_endpoint_policy_name: String,
pub(crate) service_endpoint_policy_definition_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . service_endpoint_policy_name , & this . service_endpoint_policy_definition_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicyDefinition = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ServiceEndpointPolicyDefinition),
Created201(models::ServiceEndpointPolicyDefinition),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_endpoint_policy_name: String,
pub(crate) service_endpoint_policy_definition_name: String,
pub(crate) service_endpoint_policy_definitions: models::ServiceEndpointPolicyDefinition,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . service_endpoint_policy_name , & this . service_endpoint_policy_definition_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.service_endpoint_policy_definitions)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicyDefinition = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicyDefinition = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_endpoint_policy_name: String,
pub(crate) service_endpoint_policy_definition_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . service_endpoint_policy_name , & this . service_endpoint_policy_definition_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ServiceEndpointPolicyDefinitionListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_endpoint_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . service_endpoint_policy_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceEndpointPolicyDefinitionListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod private_endpoints {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified private endpoint by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `private_endpoint_name`: The name of the private endpoint."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
private_endpoint_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
private_endpoint_name: private_endpoint_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates an private endpoint in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `private_endpoint_name`: The name of the private endpoint."]
#[doc = "* `parameters`: Parameters supplied to the create or update private endpoint operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
private_endpoint_name: impl Into<String>,
parameters: impl Into<models::PrivateEndpoint>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
private_endpoint_name: private_endpoint_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified private endpoint."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `private_endpoint_name`: The name of the private endpoint."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
private_endpoint_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
private_endpoint_name: private_endpoint_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all private endpoints in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all private endpoints in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_subscription(&self, subscription_id: impl Into<String>) -> list_by_subscription::Builder {
list_by_subscription::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::PrivateEndpoint;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) private_endpoint_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/privateEndpoints/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_endpoint_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateEndpoint = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::PrivateEndpoint),
Created201(models::PrivateEndpoint),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) private_endpoint_name: String,
pub(crate) parameters: models::PrivateEndpoint,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/privateEndpoints/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_endpoint_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateEndpoint = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateEndpoint = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) private_endpoint_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/privateEndpoints/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_endpoint_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::PrivateEndpointListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/privateEndpoints",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateEndpointListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_subscription {
use super::models;
type Response = models::PrivateEndpointListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/privateEndpoints",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateEndpointListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod available_private_endpoint_types {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location of the domain name."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, location: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
location: location.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location of the domain name."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
location: impl Into<String>,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
location: location.into(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::AvailablePrivateEndpointTypesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/availablePrivateEndpointTypes",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AvailablePrivateEndpointTypesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::AvailablePrivateEndpointTypesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/availablePrivateEndpointTypes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AvailablePrivateEndpointTypesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod private_dns_zone_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the private dns zone group resource by specified private dns zone group name."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `private_endpoint_name`: The name of the private endpoint."]
#[doc = "* `private_dns_zone_group_name`: The name of the private dns zone group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
private_endpoint_name: impl Into<String>,
private_dns_zone_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
private_endpoint_name: private_endpoint_name.into(),
private_dns_zone_group_name: private_dns_zone_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a private dns zone group in the specified private endpoint."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `private_endpoint_name`: The name of the private endpoint."]
#[doc = "* `private_dns_zone_group_name`: The name of the private dns zone group."]
#[doc = "* `parameters`: Parameters supplied to the create or update private dns zone group operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
private_endpoint_name: impl Into<String>,
private_dns_zone_group_name: impl Into<String>,
parameters: impl Into<models::PrivateDnsZoneGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
private_endpoint_name: private_endpoint_name.into(),
private_dns_zone_group_name: private_dns_zone_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified private dns zone group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `private_endpoint_name`: The name of the private endpoint."]
#[doc = "* `private_dns_zone_group_name`: The name of the private dns zone group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
private_endpoint_name: impl Into<String>,
private_dns_zone_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
private_endpoint_name: private_endpoint_name.into(),
private_dns_zone_group_name: private_dns_zone_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all private dns zone groups in a private endpoint."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `private_endpoint_name`: The name of the private endpoint."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
private_endpoint_name: impl Into<String>,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
private_endpoint_name: private_endpoint_name.into(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::PrivateDnsZoneGroup;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) private_endpoint_name: String,
pub(crate) private_dns_zone_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/privateEndpoints/{}/privateDnsZoneGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_endpoint_name,
&this.private_dns_zone_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateDnsZoneGroup = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::PrivateDnsZoneGroup),
Created201(models::PrivateDnsZoneGroup),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) private_endpoint_name: String,
pub(crate) private_dns_zone_group_name: String,
pub(crate) parameters: models::PrivateDnsZoneGroup,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/privateEndpoints/{}/privateDnsZoneGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_endpoint_name,
&this.private_dns_zone_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateDnsZoneGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateDnsZoneGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) private_endpoint_name: String,
pub(crate) private_dns_zone_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/privateEndpoints/{}/privateDnsZoneGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_endpoint_name,
&this.private_dns_zone_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::PrivateDnsZoneGroupListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) private_endpoint_name: String,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/privateEndpoints/{}/privateDnsZoneGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_endpoint_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateDnsZoneGroupListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod private_link_services {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified private link service by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_name`: The name of the private link service."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
service_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_name: service_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates an private link service in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_name`: The name of the private link service."]
#[doc = "* `parameters`: Parameters supplied to the create or update private link service operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
service_name: impl Into<String>,
parameters: impl Into<models::PrivateLinkService>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_name: service_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified private link service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_name`: The name of the private link service."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
service_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_name: service_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all private link services in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all private link service in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_subscription(&self, subscription_id: impl Into<String>) -> list_by_subscription::Builder {
list_by_subscription::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get the specific private end point connection by specific private link service in the resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_name`: The name of the private link service."]
#[doc = "* `pe_connection_name`: The name of the private end point connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_private_endpoint_connection(
&self,
resource_group_name: impl Into<String>,
service_name: impl Into<String>,
pe_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_private_endpoint_connection::Builder {
get_private_endpoint_connection::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_name: service_name.into(),
pe_connection_name: pe_connection_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Approve or reject private end point connection for a private link service in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_name`: The name of the private link service."]
#[doc = "* `pe_connection_name`: The name of the private end point connection."]
#[doc = "* `parameters`: Parameters supplied to approve or reject the private end point connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_private_endpoint_connection(
&self,
resource_group_name: impl Into<String>,
service_name: impl Into<String>,
pe_connection_name: impl Into<String>,
parameters: impl Into<models::PrivateEndpointConnection>,
subscription_id: impl Into<String>,
) -> update_private_endpoint_connection::Builder {
update_private_endpoint_connection::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_name: service_name.into(),
pe_connection_name: pe_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Delete private end point connection for a private link service in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_name`: The name of the private link service."]
#[doc = "* `pe_connection_name`: The name of the private end point connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete_private_endpoint_connection(
&self,
resource_group_name: impl Into<String>,
service_name: impl Into<String>,
pe_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete_private_endpoint_connection::Builder {
delete_private_endpoint_connection::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_name: service_name.into(),
pe_connection_name: pe_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all private end point connections for a specific private link service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `service_name`: The name of the private link service."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_private_endpoint_connections(
&self,
resource_group_name: impl Into<String>,
service_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_private_endpoint_connections::Builder {
list_private_endpoint_connections::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
service_name: service_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Checks whether the subscription is visible to private link service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location of the domain name."]
#[doc = "* `parameters`: The request body of CheckPrivateLinkService API call."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn check_private_link_service_visibility(
&self,
location: impl Into<String>,
parameters: impl Into<models::CheckPrivateLinkServiceVisibilityRequest>,
subscription_id: impl Into<String>,
) -> check_private_link_service_visibility::Builder {
check_private_link_service_visibility::Builder {
client: self.0.clone(),
location: location.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Checks whether the subscription is visible to private link service in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location of the domain name."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `parameters`: The request body of CheckPrivateLinkService API call."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn check_private_link_service_visibility_by_resource_group(
&self,
location: impl Into<String>,
resource_group_name: impl Into<String>,
parameters: impl Into<models::CheckPrivateLinkServiceVisibilityRequest>,
subscription_id: impl Into<String>,
) -> check_private_link_service_visibility_by_resource_group::Builder {
check_private_link_service_visibility_by_resource_group::Builder {
client: self.0.clone(),
location: location.into(),
resource_group_name: resource_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location of the domain name."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_auto_approved_private_link_services(
&self,
location: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_auto_approved_private_link_services::Builder {
list_auto_approved_private_link_services::Builder {
client: self.0.clone(),
location: location.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location of the domain name."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_auto_approved_private_link_services_by_resource_group(
&self,
location: impl Into<String>,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_auto_approved_private_link_services_by_resource_group::Builder {
list_auto_approved_private_link_services_by_resource_group::Builder {
client: self.0.clone(),
location: location.into(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::PrivateLinkService;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/privateLinkServices/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.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, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateLinkService = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::PrivateLinkService),
Created201(models::PrivateLinkService),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_name: String,
pub(crate) parameters: models::PrivateLinkService,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/privateLinkServices/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.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, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateLinkService = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateLinkService = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/privateLinkServices/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::PrivateLinkServiceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/privateLinkServices",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateLinkServiceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_subscription {
use super::models;
type Response = models::PrivateLinkServiceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/privateLinkServices",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateLinkServiceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_private_endpoint_connection {
use super::models;
type Response = models::PrivateEndpointConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_name: String,
pub(crate) pe_connection_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/privateLinkServices/{}/privateEndpointConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . service_name , & this . pe_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateEndpointConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_private_endpoint_connection {
use super::models;
type Response = models::PrivateEndpointConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_name: String,
pub(crate) pe_connection_name: String,
pub(crate) parameters: models::PrivateEndpointConnection,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/privateLinkServices/{}/privateEndpointConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . service_name , & this . pe_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateEndpointConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete_private_endpoint_connection {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_name: String,
pub(crate) pe_connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/privateLinkServices/{}/privateEndpointConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . service_name , & this . pe_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_private_endpoint_connections {
use super::models;
type Response = models::PrivateEndpointConnectionListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) service_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/privateLinkServices/{}/privateEndpointConnections" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . 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, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateEndpointConnectionListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod check_private_link_service_visibility {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::PrivateLinkServiceVisibility),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) parameters: models::CheckPrivateLinkServiceVisibilityRequest,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/locations/{}/checkPrivateLinkServiceVisibility",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateLinkServiceVisibility = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod check_private_link_service_visibility_by_resource_group {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::PrivateLinkServiceVisibility),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) resource_group_name: String,
pub(crate) parameters: models::CheckPrivateLinkServiceVisibilityRequest,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/locations/{}/checkPrivateLinkServiceVisibility" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PrivateLinkServiceVisibility = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_auto_approved_private_link_services {
use super::models;
type Response = models::AutoApprovedPrivateLinkServicesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/autoApprovedPrivateLinkServices",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AutoApprovedPrivateLinkServicesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_auto_approved_private_link_services_by_resource_group {
use super::models;
type Response = models::AutoApprovedPrivateLinkServicesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/autoApprovedPrivateLinkServices" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . location)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AutoApprovedPrivateLinkServicesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod network_profiles {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified network profile in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_profile_name`: The name of the public IP prefix."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_profile_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_profile_name: network_profile_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a network profile."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_profile_name`: The name of the network profile."]
#[doc = "* `parameters`: Parameters supplied to the create or update network profile operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_profile_name: impl Into<String>,
parameters: impl Into<models::NetworkProfile>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_profile_name: network_profile_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates network profile tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_profile_name`: The name of the network profile."]
#[doc = "* `parameters`: Parameters supplied to update network profile tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
network_profile_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_profile_name: network_profile_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified network profile."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_profile_name`: The name of the NetworkProfile."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_profile_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_profile_name: network_profile_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the network profiles in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all network profiles in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::NetworkProfile;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_profile_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/networkProfiles/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_profile_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkProfile = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::NetworkProfile),
Ok200(models::NetworkProfile),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_profile_name: String,
pub(crate) parameters: models::NetworkProfile,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkProfiles/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_profile_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkProfile = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkProfile = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::NetworkProfile;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_profile_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkProfiles/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_profile_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkProfile = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_profile_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkProfiles/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_profile_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::NetworkProfileListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkProfiles",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkProfileListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkProfileListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkProfiles",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkProfileListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod public_ip_addresses {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified public IP address in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `public_ip_address_name`: The name of the public IP address."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
public_ip_address_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
public_ip_address_name: public_ip_address_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a static or dynamic public IP address."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `public_ip_address_name`: The name of the public IP address."]
#[doc = "* `parameters`: Parameters supplied to the create or update public IP address operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
public_ip_address_name: impl Into<String>,
parameters: impl Into<models::PublicIpAddress>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
public_ip_address_name: public_ip_address_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates public IP address tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `public_ip_address_name`: The name of the public IP address."]
#[doc = "* `parameters`: Parameters supplied to update public IP address tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
public_ip_address_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
public_ip_address_name: public_ip_address_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified public IP address."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `public_ip_address_name`: The name of the public IP address."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
public_ip_address_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
public_ip_address_name: public_ip_address_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the public IP addresses in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all public IP addresses in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets information about all public IP addresses on a cloud service level."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cloud_service_name`: The name of the cloud service."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_cloud_service_public_ip_addresses(
&self,
resource_group_name: impl Into<String>,
cloud_service_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_cloud_service_public_ip_addresses::Builder {
list_cloud_service_public_ip_addresses::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cloud_service_name: cloud_service_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets information about all public IP addresses in a role instance IP configuration in a cloud service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cloud_service_name`: The name of the cloud service."]
#[doc = "* `role_instance_name`: The name of role instance."]
#[doc = "* `network_interface_name`: The network interface name."]
#[doc = "* `ip_configuration_name`: The IP configuration name."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_cloud_service_role_instance_public_ip_addresses(
&self,
resource_group_name: impl Into<String>,
cloud_service_name: impl Into<String>,
role_instance_name: impl Into<String>,
network_interface_name: impl Into<String>,
ip_configuration_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_cloud_service_role_instance_public_ip_addresses::Builder {
list_cloud_service_role_instance_public_ip_addresses::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cloud_service_name: cloud_service_name.into(),
role_instance_name: role_instance_name.into(),
network_interface_name: network_interface_name.into(),
ip_configuration_name: ip_configuration_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get the specified public IP address in a cloud service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cloud_service_name`: The name of the cloud service."]
#[doc = "* `role_instance_name`: The role instance name."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `ip_configuration_name`: The name of the IP configuration."]
#[doc = "* `public_ip_address_name`: The name of the public IP Address."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_cloud_service_public_ip_address(
&self,
resource_group_name: impl Into<String>,
cloud_service_name: impl Into<String>,
role_instance_name: impl Into<String>,
network_interface_name: impl Into<String>,
ip_configuration_name: impl Into<String>,
public_ip_address_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_cloud_service_public_ip_address::Builder {
get_cloud_service_public_ip_address::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cloud_service_name: cloud_service_name.into(),
role_instance_name: role_instance_name.into(),
network_interface_name: network_interface_name.into(),
ip_configuration_name: ip_configuration_name.into(),
public_ip_address_name: public_ip_address_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets information about all public IP addresses on a virtual machine scale set level."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_machine_scale_set_name`: The name of the virtual machine scale set."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_virtual_machine_scale_set_public_ip_addresses(
&self,
resource_group_name: impl Into<String>,
virtual_machine_scale_set_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_virtual_machine_scale_set_public_ip_addresses::Builder {
list_virtual_machine_scale_set_public_ip_addresses::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets information about all public IP addresses in a virtual machine IP configuration in a virtual machine scale set."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_machine_scale_set_name`: The name of the virtual machine scale set."]
#[doc = "* `virtualmachine_index`: The virtual machine index."]
#[doc = "* `network_interface_name`: The network interface name."]
#[doc = "* `ip_configuration_name`: The IP configuration name."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_virtual_machine_scale_set_vm_public_ip_addresses(
&self,
resource_group_name: impl Into<String>,
virtual_machine_scale_set_name: impl Into<String>,
virtualmachine_index: impl Into<String>,
network_interface_name: impl Into<String>,
ip_configuration_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_virtual_machine_scale_set_vm_public_ip_addresses::Builder {
list_virtual_machine_scale_set_vm_public_ip_addresses::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(),
virtualmachine_index: virtualmachine_index.into(),
network_interface_name: network_interface_name.into(),
ip_configuration_name: ip_configuration_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get the specified public IP address in a virtual machine scale set."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_machine_scale_set_name`: The name of the virtual machine scale set."]
#[doc = "* `virtualmachine_index`: The virtual machine index."]
#[doc = "* `network_interface_name`: The name of the network interface."]
#[doc = "* `ip_configuration_name`: The name of the IP configuration."]
#[doc = "* `public_ip_address_name`: The name of the public IP Address."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_virtual_machine_scale_set_public_ip_address(
&self,
resource_group_name: impl Into<String>,
virtual_machine_scale_set_name: impl Into<String>,
virtualmachine_index: impl Into<String>,
network_interface_name: impl Into<String>,
ip_configuration_name: impl Into<String>,
public_ip_address_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_virtual_machine_scale_set_public_ip_address::Builder {
get_virtual_machine_scale_set_public_ip_address::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_machine_scale_set_name: virtual_machine_scale_set_name.into(),
virtualmachine_index: virtualmachine_index.into(),
network_interface_name: network_interface_name.into(),
ip_configuration_name: ip_configuration_name.into(),
public_ip_address_name: public_ip_address_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
}
pub mod get {
use super::models;
type Response = models::PublicIpAddress;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) public_ip_address_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/publicIPAddresses/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.public_ip_address_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddress = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::PublicIpAddress),
Ok200(models::PublicIpAddress),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) public_ip_address_name: String,
pub(crate) parameters: models::PublicIpAddress,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/publicIPAddresses/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.public_ip_address_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddress = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddress = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::PublicIpAddress;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) public_ip_address_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/publicIPAddresses/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.public_ip_address_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddress = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) public_ip_address_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/publicIPAddresses/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.public_ip_address_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::PublicIpAddressListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/publicIPAddresses",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddressListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::PublicIpAddressListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/publicIPAddresses",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddressListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_cloud_service_public_ip_addresses {
use super::models;
type Response = models::PublicIpAddressListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cloud_service_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Compute/cloudServices/{}/publicipaddresses",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.cloud_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, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddressListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_cloud_service_role_instance_public_ip_addresses {
use super::models;
type Response = models::PublicIpAddressListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cloud_service_name: String,
pub(crate) role_instance_name: String,
pub(crate) network_interface_name: String,
pub(crate) ip_configuration_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Compute/cloudServices/{}/roleInstances/{}/networkInterfaces/{}/ipconfigurations/{}/publicipaddresses" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . cloud_service_name , & this . role_instance_name , & this . network_interface_name , & this . ip_configuration_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddressListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_cloud_service_public_ip_address {
use super::models;
type Response = models::PublicIpAddress;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cloud_service_name: String,
pub(crate) role_instance_name: String,
pub(crate) network_interface_name: String,
pub(crate) ip_configuration_name: String,
pub(crate) public_ip_address_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Compute/cloudServices/{}/roleInstances/{}/networkInterfaces/{}/ipconfigurations/{}/publicipaddresses/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . cloud_service_name , & this . role_instance_name , & this . network_interface_name , & this . ip_configuration_name , & this . public_ip_address_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddress = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_virtual_machine_scale_set_public_ip_addresses {
use super::models;
type Response = models::PublicIpAddressListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_machine_scale_set_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Compute/virtualMachineScaleSets/{}/publicipaddresses" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_machine_scale_set_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, "2018-10-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, "2018-10-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddressListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_virtual_machine_scale_set_vm_public_ip_addresses {
use super::models;
type Response = models::PublicIpAddressListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_machine_scale_set_name: String,
pub(crate) virtualmachine_index: String,
pub(crate) network_interface_name: String,
pub(crate) ip_configuration_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}/ipconfigurations/{}/publicipaddresses" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_machine_scale_set_name , & this . virtualmachine_index , & this . network_interface_name , & this . ip_configuration_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, "2018-10-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, "2018-10-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddressListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_virtual_machine_scale_set_public_ip_address {
use super::models;
type Response = models::PublicIpAddress;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_machine_scale_set_name: String,
pub(crate) virtualmachine_index: String,
pub(crate) network_interface_name: String,
pub(crate) ip_configuration_name: String,
pub(crate) public_ip_address_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Compute/virtualMachineScaleSets/{}/virtualMachines/{}/networkInterfaces/{}/ipconfigurations/{}/publicipaddresses/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_machine_scale_set_name , & this . virtualmachine_index , & this . network_interface_name , & this . ip_configuration_name , & this . public_ip_address_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, "2018-10-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpAddress = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod nat_gateways {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified nat gateway in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `nat_gateway_name`: The name of the nat gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
nat_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
nat_gateway_name: nat_gateway_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a nat gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `nat_gateway_name`: The name of the nat gateway."]
#[doc = "* `parameters`: Parameters supplied to the create or update nat gateway operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
nat_gateway_name: impl Into<String>,
parameters: impl Into<models::NatGateway>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
nat_gateway_name: nat_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates nat gateway tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `nat_gateway_name`: The name of the nat gateway."]
#[doc = "* `parameters`: Parameters supplied to update nat gateway tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
nat_gateway_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
nat_gateway_name: nat_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified nat gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `nat_gateway_name`: The name of the nat gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
nat_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
nat_gateway_name: nat_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the Nat Gateways in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all nat gateways in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::NatGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) nat_gateway_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/natGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.nat_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NatGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::NatGateway),
Ok200(models::NatGateway),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) nat_gateway_name: String,
pub(crate) parameters: models::NatGateway,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/natGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.nat_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NatGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NatGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::NatGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) nat_gateway_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/natGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.nat_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NatGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) nat_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/natGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.nat_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::NatGatewayListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/natGateways",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NatGatewayListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::NatGatewayListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/natGateways",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NatGatewayListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod available_delegations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all of the available subnet delegations for this subscription in this region."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location of the subnet."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, location: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
location: location.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::AvailableDelegationsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/availableDelegations",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AvailableDelegationsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod available_resource_group_delegations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all of the available subnet delegations for this resource group in this region."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location of the domain name."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
location: impl Into<String>,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
location: location.into(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::AvailableDelegationsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/availableDelegations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AvailableDelegationsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod available_service_aliases {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all available service aliases for this subscription in this region."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, location: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
location: location.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all available service aliases for this resource group in this region."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `location`: The location."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
location: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
location: location.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::AvailableServiceAliasesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/availableServiceAliases",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AvailableServiceAliasesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::AvailableServiceAliasesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) location: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/availableServiceAliases",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AvailableServiceAliasesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod azure_firewalls {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Azure Firewall."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `azure_firewall_name`: The name of the Azure Firewall."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
azure_firewall_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
azure_firewall_name: azure_firewall_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the specified Azure Firewall."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `azure_firewall_name`: The name of the Azure Firewall."]
#[doc = "* `parameters`: Parameters supplied to the create or update Azure Firewall operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
azure_firewall_name: impl Into<String>,
parameters: impl Into<models::AzureFirewall>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
azure_firewall_name: azure_firewall_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates tags of an Azure Firewall resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `azure_firewall_name`: The name of the Azure Firewall."]
#[doc = "* `parameters`: Parameters supplied to update azure firewall tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
azure_firewall_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
azure_firewall_name: azure_firewall_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified Azure Firewall."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `azure_firewall_name`: The name of the Azure Firewall."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
azure_firewall_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
azure_firewall_name: azure_firewall_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all Azure Firewalls in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the Azure Firewalls in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::AzureFirewall;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) azure_firewall_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/azureFirewalls/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.azure_firewall_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureFirewall = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::AzureFirewall),
Ok200(models::AzureFirewall),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) azure_firewall_name: String,
pub(crate) parameters: models::AzureFirewall,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/azureFirewalls/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.azure_firewall_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureFirewall = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureFirewall = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(models::AzureFirewall),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) azure_firewall_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/azureFirewalls/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.azure_firewall_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureFirewall = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) azure_firewall_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/azureFirewalls/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.azure_firewall_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::AzureFirewallListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/azureFirewalls",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureFirewallListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_all {
use super::models;
type Response = models::AzureFirewallListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/azureFirewalls",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureFirewallListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod azure_firewall_fqdn_tags {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all the Azure Firewall FQDN Tags in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_all {
use super::models;
type Response = models::AzureFirewallFqdnTagListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/azureFirewallFqdnTags",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureFirewallFqdnTagListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod web_categories {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Azure Web Category."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `name`: The name of the azureWebCategory."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(&self, name: impl Into<String>, subscription_id: impl Into<String>) -> get::Builder {
get::Builder {
client: self.0.clone(),
name: name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets all the Azure Web Categories in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_subscription(&self, subscription_id: impl Into<String>) -> list_by_subscription::Builder {
list_by_subscription::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::AzureWebCategory;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands resourceIds back referenced by the azureWebCategory resource."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/azureWebCategories/{}",
this.client.endpoint(),
&this.subscription_id,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureWebCategory = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_subscription {
use super::models;
type Response = models::AzureWebCategoryListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/azureWebCategories",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AzureWebCategoryListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod bastion_hosts {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Bastion Host."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `bastion_host_name`: The name of the Bastion Host."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
bastion_host_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
bastion_host_name: bastion_host_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the specified Bastion Host."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `bastion_host_name`: The name of the Bastion Host."]
#[doc = "* `parameters`: Parameters supplied to the create or update Bastion Host operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
bastion_host_name: impl Into<String>,
parameters: impl Into<models::BastionHost>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
bastion_host_name: bastion_host_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates Tags for BastionHost resource"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `bastion_host_name`: The name of the Bastion Host."]
#[doc = "* `parameters`: Parameters supplied to update BastionHost tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
bastion_host_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
bastion_host_name: bastion_host_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes the specified Bastion Host."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `bastion_host_name`: The name of the Bastion Host."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
bastion_host_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
bastion_host_name: bastion_host_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all Bastion Hosts in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all Bastion Hosts in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::BastionHost;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) bastion_host_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/bastionHosts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.bastion_host_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionHost = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::BastionHost),
Ok200(models::BastionHost),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) bastion_host_name: String,
pub(crate) parameters: models::BastionHost,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/bastionHosts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.bastion_host_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionHost = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionHost = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::BastionHost),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) bastion_host_name: String,
pub(crate) parameters: models::TagsObject,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/bastionHosts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.bastion_host_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionHost = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) bastion_host_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/bastionHosts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.bastion_host_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::BastionHostListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/bastionHosts",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionHostListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::BastionHostListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/bastionHosts",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionHostListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
impl Client {
#[doc = "Creates a Bastion Shareable Links for all the VMs specified in the request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `bastion_host_name`: The name of the Bastion Host."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `bsl_request`: Post request for all the Bastion Shareable Link endpoints."]
pub fn put_bastion_shareable_link(
&self,
resource_group_name: impl Into<String>,
bastion_host_name: impl Into<String>,
subscription_id: impl Into<String>,
bsl_request: impl Into<models::BastionShareableLinkListRequest>,
) -> put_bastion_shareable_link::Builder {
put_bastion_shareable_link::Builder {
client: self.clone(),
resource_group_name: resource_group_name.into(),
bastion_host_name: bastion_host_name.into(),
subscription_id: subscription_id.into(),
bsl_request: bsl_request.into(),
}
}
#[doc = "Deletes the Bastion Shareable Links for all the VMs specified in the request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `bastion_host_name`: The name of the Bastion Host."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `bsl_request`: Post request for all the Bastion Shareable Link endpoints."]
pub fn delete_bastion_shareable_link(
&self,
resource_group_name: impl Into<String>,
bastion_host_name: impl Into<String>,
subscription_id: impl Into<String>,
bsl_request: impl Into<models::BastionShareableLinkListRequest>,
) -> delete_bastion_shareable_link::Builder {
delete_bastion_shareable_link::Builder {
client: self.clone(),
resource_group_name: resource_group_name.into(),
bastion_host_name: bastion_host_name.into(),
subscription_id: subscription_id.into(),
bsl_request: bsl_request.into(),
}
}
#[doc = "Return the Bastion Shareable Links for all the VMs specified in the request."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `bastion_host_name`: The name of the Bastion Host."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `bsl_request`: Post request for all the Bastion Shareable Link endpoints."]
pub fn get_bastion_shareable_link(
&self,
resource_group_name: impl Into<String>,
bastion_host_name: impl Into<String>,
subscription_id: impl Into<String>,
bsl_request: impl Into<models::BastionShareableLinkListRequest>,
) -> get_bastion_shareable_link::Builder {
get_bastion_shareable_link::Builder {
client: self.clone(),
resource_group_name: resource_group_name.into(),
bastion_host_name: bastion_host_name.into(),
subscription_id: subscription_id.into(),
bsl_request: bsl_request.into(),
}
}
#[doc = "Returns the list of currently active sessions on the Bastion."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `bastion_host_name`: The name of the Bastion Host."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_active_sessions(
&self,
resource_group_name: impl Into<String>,
bastion_host_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_active_sessions::Builder {
get_active_sessions::Builder {
client: self.clone(),
resource_group_name: resource_group_name.into(),
bastion_host_name: bastion_host_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Returns the list of currently active sessions on the Bastion."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `bastion_host_name`: The name of the Bastion Host."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `session_ids`: The list of sessionids to disconnect."]
pub fn disconnect_active_sessions(
&self,
resource_group_name: impl Into<String>,
bastion_host_name: impl Into<String>,
subscription_id: impl Into<String>,
session_ids: impl Into<models::SessionIds>,
) -> disconnect_active_sessions::Builder {
disconnect_active_sessions::Builder {
client: self.clone(),
resource_group_name: resource_group_name.into(),
bastion_host_name: bastion_host_name.into(),
subscription_id: subscription_id.into(),
session_ids: session_ids.into(),
}
}
#[doc = "Checks whether a domain name in the cloudapp.azure.com zone is available for use."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location of the domain name."]
#[doc = "* `domain_name_label`: The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn check_dns_name_availability(
&self,
location: impl Into<String>,
domain_name_label: impl Into<String>,
subscription_id: impl Into<String>,
) -> check_dns_name_availability::Builder {
check_dns_name_availability::Builder {
client: self.clone(),
location: location.into(),
domain_name_label: domain_name_label.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gives the supported security providers for the virtual wan."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name."]
#[doc = "* `virtual_wan_name`: The name of the VirtualWAN for which supported security providers are needed."]
pub fn supported_security_providers(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_wan_name: impl Into<String>,
) -> supported_security_providers::Builder {
supported_security_providers::Builder {
client: self.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_wan_name: virtual_wan_name.into(),
}
}
#[doc = "Generates a unique VPN profile for P2S clients for VirtualWan and associated VpnServerConfiguration combination in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name."]
#[doc = "* `virtual_wan_name`: The name of the VirtualWAN whose associated VpnServerConfigurations is needed."]
#[doc = "* `vpn_client_params`: Parameters supplied to the generate VirtualWan VPN profile generation operation."]
pub fn generatevirtualwanvpnserverconfigurationvpnprofile(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_wan_name: impl Into<String>,
vpn_client_params: impl Into<models::VirtualWanVpnProfileParameters>,
) -> generatevirtualwanvpnserverconfigurationvpnprofile::Builder {
generatevirtualwanvpnserverconfigurationvpnprofile::Builder {
client: self.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_wan_name: virtual_wan_name.into(),
vpn_client_params: vpn_client_params.into(),
}
}
}
pub mod put_bastion_shareable_link {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::BastionShareableLinkListResult),
Accepted202,
}
impl azure_core::Continuable for Response {
type Continuation = String;
fn continuation(&self) -> Option<Self::Continuation> {
match self {
Self::Ok200(x) => x.continuation(),
Self::Accepted202 => None,
}
}
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::Client,
pub(crate) resource_group_name: String,
pub(crate) bastion_host_name: String,
pub(crate) subscription_id: String,
pub(crate) bsl_request: models::BastionShareableLinkListRequest,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/bastionHosts/{}/createShareableLinks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.bastion_host_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::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()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.bsl_request)?;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionShareableLinkListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod delete_bastion_shareable_link {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::Client,
pub(crate) resource_group_name: String,
pub(crate) bastion_host_name: String,
pub(crate) subscription_id: String,
pub(crate) bsl_request: models::BastionShareableLinkListRequest,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/bastionHosts/{}/deleteShareableLinks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.bastion_host_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.bsl_request)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_bastion_shareable_link {
use super::models;
type Response = models::BastionShareableLinkListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::Client,
pub(crate) resource_group_name: String,
pub(crate) bastion_host_name: String,
pub(crate) subscription_id: String,
pub(crate) bsl_request: models::BastionShareableLinkListRequest,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/bastionHosts/{}/getShareableLinks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.bastion_host_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::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()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.bsl_request)?;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionShareableLinkListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_active_sessions {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::BastionActiveSessionListResult),
Accepted202,
}
impl azure_core::Continuable for Response {
type Continuation = String;
fn continuation(&self) -> Option<Self::Continuation> {
match self {
Self::Ok200(x) => x.continuation(),
Self::Accepted202 => None,
}
}
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::Client,
pub(crate) resource_group_name: String,
pub(crate) bastion_host_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/bastionHosts/{}/getActiveSessions",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.bastion_host_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::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()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionActiveSessionListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod disconnect_active_sessions {
use super::models;
type Response = models::BastionSessionDeleteResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::Client,
pub(crate) resource_group_name: String,
pub(crate) bastion_host_name: String,
pub(crate) subscription_id: String,
pub(crate) session_ids: models::SessionIds,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/bastionHosts/{}/disconnectActiveSessions",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.bastion_host_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::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()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.session_ids)?;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BastionSessionDeleteResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod check_dns_name_availability {
use super::models;
type Response = models::DnsNameAvailabilityResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::Client,
pub(crate) location: String,
pub(crate) domain_name_label: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/locations/{}/CheckDnsNameAvailability",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let domain_name_label = &this.domain_name_label;
req.url_mut().query_pairs_mut().append_pair("domainNameLabel", domain_name_label);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DnsNameAvailabilityResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod supported_security_providers {
use super::models;
type Response = models::VirtualWanSecurityProviders;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_wan_name: String,
}
impl Builder {
pub fn into_future(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.Network/virtualWans/{}/supportedSecurityProviders",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_wan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualWanSecurityProviders = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod generatevirtualwanvpnserverconfigurationvpnprofile {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnProfileResponse),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_wan_name: String,
pub(crate) vpn_client_params: models::VirtualWanVpnProfileParameters,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualWans/{}/GenerateVpnProfile",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_wan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.vpn_client_params)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnProfileResponse = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod custom_ip_prefixes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified custom IP prefix in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `custom_ip_prefix_name`: The name of the custom IP prefix."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
custom_ip_prefix_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
custom_ip_prefix_name: custom_ip_prefix_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a custom IP prefix."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `custom_ip_prefix_name`: The name of the custom IP prefix."]
#[doc = "* `parameters`: Parameters supplied to the create or update custom IP prefix operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
custom_ip_prefix_name: impl Into<String>,
parameters: impl Into<models::CustomIpPrefix>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
custom_ip_prefix_name: custom_ip_prefix_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates custom IP prefix tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `custom_ip_prefix_name`: The name of the custom IP prefix."]
#[doc = "* `parameters`: Parameters supplied to update custom IP prefix tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
custom_ip_prefix_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
custom_ip_prefix_name: custom_ip_prefix_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified custom IP prefix."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `custom_ip_prefix_name`: The name of the CustomIpPrefix."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
custom_ip_prefix_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
custom_ip_prefix_name: custom_ip_prefix_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the custom IP prefixes in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all custom IP prefixes in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::CustomIpPrefix;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) custom_ip_prefix_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/customIpPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.custom_ip_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, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::CustomIpPrefix = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::CustomIpPrefix),
Ok200(models::CustomIpPrefix),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) custom_ip_prefix_name: String,
pub(crate) parameters: models::CustomIpPrefix,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/customIpPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.custom_ip_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, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::CustomIpPrefix = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::CustomIpPrefix = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::CustomIpPrefix;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) custom_ip_prefix_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/customIpPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.custom_ip_prefix_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::CustomIpPrefix = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) custom_ip_prefix_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/customIpPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.custom_ip_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::CustomIpPrefixListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/customIpPrefixes",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::CustomIpPrefixListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::CustomIpPrefixListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/customIpPrefixes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::CustomIpPrefixListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod ddos_custom_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets information about the specified DDoS custom policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ddos_custom_policy_name`: The name of the DDoS custom policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
ddos_custom_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ddos_custom_policy_name: ddos_custom_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a DDoS custom policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ddos_custom_policy_name`: The name of the DDoS custom policy."]
#[doc = "* `parameters`: Parameters supplied to the create or update operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
ddos_custom_policy_name: impl Into<String>,
parameters: impl Into<models::DdosCustomPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ddos_custom_policy_name: ddos_custom_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Update a DDoS custom policy tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ddos_custom_policy_name`: The name of the DDoS custom policy."]
#[doc = "* `parameters`: Parameters supplied to update DDoS custom policy resource tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
ddos_custom_policy_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ddos_custom_policy_name: ddos_custom_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified DDoS custom policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ddos_custom_policy_name`: The name of the DDoS custom policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
ddos_custom_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ddos_custom_policy_name: ddos_custom_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::DdosCustomPolicy;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ddos_custom_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/ddosCustomPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ddos_custom_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosCustomPolicy = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::DdosCustomPolicy),
Ok200(models::DdosCustomPolicy),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ddos_custom_policy_name: String,
pub(crate) parameters: models::DdosCustomPolicy,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/ddosCustomPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ddos_custom_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosCustomPolicy = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosCustomPolicy = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::DdosCustomPolicy;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ddos_custom_policy_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/ddosCustomPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ddos_custom_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosCustomPolicy = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ddos_custom_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/ddosCustomPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ddos_custom_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod ddos_protection_plans {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets information about the specified DDoS protection plan."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ddos_protection_plan_name`: The name of the DDoS protection plan."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
ddos_protection_plan_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ddos_protection_plan_name: ddos_protection_plan_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a DDoS protection plan."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ddos_protection_plan_name`: The name of the DDoS protection plan."]
#[doc = "* `parameters`: Parameters supplied to the create or update operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
ddos_protection_plan_name: impl Into<String>,
parameters: impl Into<models::DdosProtectionPlan>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ddos_protection_plan_name: ddos_protection_plan_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Update a DDoS protection plan tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ddos_protection_plan_name`: The name of the DDoS protection plan."]
#[doc = "* `parameters`: Parameters supplied to the update DDoS protection plan resource tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
ddos_protection_plan_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ddos_protection_plan_name: ddos_protection_plan_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified DDoS protection plan."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ddos_protection_plan_name`: The name of the DDoS protection plan."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
ddos_protection_plan_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ddos_protection_plan_name: ddos_protection_plan_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all DDoS protection plans in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the DDoS protection plans in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::DdosProtectionPlan;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ddos_protection_plan_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/ddosProtectionPlans/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ddos_protection_plan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosProtectionPlan = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::DdosProtectionPlan),
Ok200(models::DdosProtectionPlan),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ddos_protection_plan_name: String,
pub(crate) parameters: models::DdosProtectionPlan,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/ddosProtectionPlans/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ddos_protection_plan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosProtectionPlan = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosProtectionPlan = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::DdosProtectionPlan;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ddos_protection_plan_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/ddosProtectionPlans/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ddos_protection_plan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosProtectionPlan = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ddos_protection_plan_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/ddosProtectionPlans/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ddos_protection_plan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::DdosProtectionPlanListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ddosProtectionPlans",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosProtectionPlanListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::DdosProtectionPlanListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ddosProtectionPlans",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DdosProtectionPlanListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod dscp_configuration {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a DSCP Configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `dscp_configuration_name`: The name of the resource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
dscp_configuration_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
dscp_configuration_name: dscp_configuration_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a DSCP Configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `dscp_configuration_name`: The name of the resource."]
#[doc = "* `parameters`: Parameters supplied to the create or update dscp configuration operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
dscp_configuration_name: impl Into<String>,
parameters: impl Into<models::DscpConfiguration>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
dscp_configuration_name: dscp_configuration_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a DSCP Configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `dscp_configuration_name`: The name of the resource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
dscp_configuration_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
dscp_configuration_name: dscp_configuration_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a DSCP Configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all dscp configurations in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::DscpConfiguration;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) dscp_configuration_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/dscpConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.dscp_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DscpConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::DscpConfiguration),
Ok200(models::DscpConfiguration),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) dscp_configuration_name: String,
pub(crate) parameters: models::DscpConfiguration,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/dscpConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.dscp_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DscpConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DscpConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) dscp_configuration_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/dscpConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.dscp_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::DscpConfigurationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/dscpConfigurations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DscpConfigurationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_all {
use super::models;
type Response = models::DscpConfigurationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/dscpConfigurations",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::DscpConfigurationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod available_endpoint_services {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List what values of endpoint services are available for use."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location to check available endpoint services."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, location: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
location: location.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::EndpointServicesListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/virtualNetworkAvailableEndpointServices",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::EndpointServicesListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod express_route_circuit_authorizations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified authorization from the specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `authorization_name`: The name of the authorization."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
authorization_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
authorization_name: authorization_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an authorization in the specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `authorization_name`: The name of the authorization."]
#[doc = "* `authorization_parameters`: Parameters supplied to the create or update express route circuit authorization operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
authorization_name: impl Into<String>,
authorization_parameters: impl Into<models::ExpressRouteCircuitAuthorization>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
authorization_name: authorization_name.into(),
authorization_parameters: authorization_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified authorization from the specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `authorization_name`: The name of the authorization."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
authorization_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
authorization_name: authorization_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all authorizations in an express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the circuit."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRouteCircuitAuthorization;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) authorization_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCircuits/{}/authorizations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name,
&this.authorization_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitAuthorization = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::ExpressRouteCircuitAuthorization),
Ok200(models::ExpressRouteCircuitAuthorization),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) authorization_name: String,
pub(crate) authorization_parameters: models::ExpressRouteCircuitAuthorization,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}/authorizations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name,
&this.authorization_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.authorization_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitAuthorization = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitAuthorization = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) authorization_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}/authorizations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name,
&this.authorization_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::AuthorizationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteCircuits/{}/authorizations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::AuthorizationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod express_route_circuit_peerings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified peering for the express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a peering in the specified express route circuits."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `peering_parameters`: Parameters supplied to the create or update express route circuit peering operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
peering_parameters: impl Into<models::ExpressRouteCircuitPeering>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
peering_parameters: peering_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified peering from the specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all peerings in a specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRouteCircuitPeering;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitPeering = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteCircuitPeering),
Created201(models::ExpressRouteCircuitPeering),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) peering_parameters: models::ExpressRouteCircuitPeering,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_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, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.peering_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitPeering = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitPeering = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRouteCircuitPeeringListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteCircuits/{}/peerings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitPeeringListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod express_route_circuit_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Express Route Circuit Connection from the specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `connection_name`: The name of the express route circuit connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
connection_name: connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a Express Route Circuit Connection in the specified express route circuits."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `connection_name`: The name of the express route circuit connection."]
#[doc = "* `express_route_circuit_connection_parameters`: Parameters supplied to the create or update express route circuit connection operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
connection_name: impl Into<String>,
express_route_circuit_connection_parameters: impl Into<models::ExpressRouteCircuitConnection>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
connection_name: connection_name.into(),
express_route_circuit_connection_parameters: express_route_circuit_connection_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified Express Route Circuit Connection from the specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `connection_name`: The name of the express route circuit connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
connection_name: connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all global reach connections associated with a private peering in an express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRouteCircuitConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}/connections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . circuit_name , & this . peering_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteCircuitConnection),
Created201(models::ExpressRouteCircuitConnection),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) connection_name: String,
pub(crate) express_route_circuit_connection_parameters: models::ExpressRouteCircuitConnection,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}/connections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . circuit_name , & this . peering_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.express_route_circuit_connection_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}/connections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . circuit_name , & this . peering_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRouteCircuitConnectionListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteCircuits/{}/peerings/{}/connections" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . circuit_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, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitConnectionListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod peer_express_route_circuit_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Peer Express Route Circuit Connection from the specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `connection_name`: The name of the peer express route circuit connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
connection_name: connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all global reach peer connections associated with a private peering in an express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::PeerExpressRouteCircuitConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}/peerConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . circuit_name , & this . peering_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PeerExpressRouteCircuitConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::PeerExpressRouteCircuitConnectionListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteCircuits/{}/peerings/{}/peerConnections" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . circuit_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, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PeerExpressRouteCircuitConnectionListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod express_route_circuits {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets information about the specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of express route circuit."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates an express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the circuit."]
#[doc = "* `parameters`: Parameters supplied to the create or update express route circuit operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
parameters: impl Into<models::ExpressRouteCircuit>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an express route circuit tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the circuit."]
#[doc = "* `parameters`: Parameters supplied to update express route circuit tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified express route circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the currently advertised ARP table associated with the express route circuit in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `device_path`: The path of the device."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_arp_table(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
device_path: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_arp_table::Builder {
list_arp_table::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
device_path: device_path.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the currently advertised routes table associated with the express route circuit in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `device_path`: The path of the device."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_routes_table(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
device_path: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_routes_table::Builder {
list_routes_table::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
device_path: device_path.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the currently advertised routes table summary associated with the express route circuit in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `device_path`: The path of the device."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_routes_table_summary(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
device_path: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_routes_table_summary::Builder {
list_routes_table_summary::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
device_path: device_path.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the stats from an express route circuit in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_stats(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_stats::Builder {
get_stats::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all stats from an express route circuit in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `circuit_name`: The name of the express route circuit."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_peering_stats(
&self,
resource_group_name: impl Into<String>,
circuit_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_peering_stats::Builder {
get_peering_stats::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
circuit_name: circuit_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the express route circuits in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the express route circuits in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRouteCircuit;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCircuits/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuit = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::ExpressRouteCircuit),
Ok200(models::ExpressRouteCircuit),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) parameters: models::ExpressRouteCircuit,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuit = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuit = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::ExpressRouteCircuit;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCircuits/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuit = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_arp_table {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteCircuitsArpTableListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) device_path: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}/arpTables/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . circuit_name , & this . peering_name , & this . device_path)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitsArpTableListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_routes_table {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteCircuitsRoutesTableListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) device_path: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}/routeTables/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . circuit_name , & this . peering_name , & this . device_path)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitsRoutesTableListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_routes_table_summary {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteCircuitsRoutesTableSummaryListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) device_path: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}/routeTablesSummary/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . circuit_name , & this . peering_name , & this . device_path)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitsRoutesTableSummaryListResult =
serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_stats {
use super::models;
type Response = models::ExpressRouteCircuitStats;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCircuits/{}/stats",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitStats = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_peering_stats {
use super::models;
type Response = models::ExpressRouteCircuitStats;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) circuit_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCircuits/{}/peerings/{}/stats",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.circuit_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitStats = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRouteCircuitListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteCircuits",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_all {
use super::models;
type Response = models::ExpressRouteCircuitListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteCircuits",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod express_route_service_providers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all the available express route service providers."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRouteServiceProviderListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteServiceProviders",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteServiceProviderListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_wans {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a VirtualWAN."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The resource group name of the VirtualWan."]
#[doc = "* `virtual_wan_name`: The name of the VirtualWAN being retrieved."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
virtual_wan_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_wan_name: virtual_wan_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualWan."]
#[doc = "* `virtual_wan_name`: The name of the VirtualWAN being created or updated."]
#[doc = "* `wan_parameters`: Parameters supplied to create or update VirtualWAN."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_wan_name: impl Into<String>,
wan_parameters: impl Into<models::VirtualWan>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_wan_name: virtual_wan_name.into(),
wan_parameters: wan_parameters.into(),
}
}
#[doc = "Updates a VirtualWAN tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualWan."]
#[doc = "* `virtual_wan_name`: The name of the VirtualWAN being updated."]
#[doc = "* `wan_parameters`: Parameters supplied to Update VirtualWAN tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_wan_name: impl Into<String>,
wan_parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_wan_name: virtual_wan_name.into(),
wan_parameters: wan_parameters.into(),
}
}
#[doc = "Deletes a VirtualWAN."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualWan."]
#[doc = "* `virtual_wan_name`: The name of the VirtualWAN being deleted."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_wan_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_wan_name: virtual_wan_name.into(),
}
}
#[doc = "Lists all the VirtualWANs in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualWan."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Lists all the VirtualWANs in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualWan;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_wan_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualWans/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_wan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualWan = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualWan),
Created201(models::VirtualWan),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_wan_name: String,
pub(crate) wan_parameters: models::VirtualWan,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualWans/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_wan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.wan_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualWan = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualWan = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::VirtualWan;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_wan_name: String,
pub(crate) wan_parameters: models::TagsObject,
}
impl Builder {
pub fn into_future(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.Network/virtualWans/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_wan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.wan_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualWan = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_wan_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualWans/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_wan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ListVirtualWaNsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualWans",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVirtualWaNsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::ListVirtualWaNsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualWans",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVirtualWaNsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod vpn_sites {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a VPN site."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnSite."]
#[doc = "* `vpn_site_name`: The name of the VpnSite being retrieved."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_site_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_site_name: vpn_site_name.into(),
}
}
#[doc = "Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnSite."]
#[doc = "* `vpn_site_name`: The name of the VpnSite being created or updated."]
#[doc = "* `vpn_site_parameters`: Parameters supplied to create or update VpnSite."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_site_name: impl Into<String>,
vpn_site_parameters: impl Into<models::VpnSite>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_site_name: vpn_site_name.into(),
vpn_site_parameters: vpn_site_parameters.into(),
}
}
#[doc = "Updates VpnSite tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnSite."]
#[doc = "* `vpn_site_name`: The name of the VpnSite being updated."]
#[doc = "* `vpn_site_parameters`: Parameters supplied to update VpnSite tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_site_name: impl Into<String>,
vpn_site_parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_site_name: vpn_site_name.into(),
vpn_site_parameters: vpn_site_parameters.into(),
}
}
#[doc = "Deletes a VpnSite."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnSite."]
#[doc = "* `vpn_site_name`: The name of the VpnSite being deleted."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_site_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_site_name: vpn_site_name.into(),
}
}
#[doc = "Lists all the vpnSites in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnSite."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Lists all the VpnSites in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VpnSite;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_site_name: String,
}
impl Builder {
pub fn into_future(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.Network/vpnSites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_site_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnSite = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnSite),
Created201(models::VpnSite),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_site_name: String,
pub(crate) vpn_site_parameters: models::VpnSite,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnSites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_site_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.vpn_site_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnSite = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnSite = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::VpnSite;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_site_name: String,
pub(crate) vpn_site_parameters: models::TagsObject,
}
impl Builder {
pub fn into_future(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.Network/vpnSites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_site_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.vpn_site_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnSite = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_site_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnSites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_site_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ListVpnSitesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnSites",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnSitesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::ListVpnSitesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnSites",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnSitesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod vpn_site_links {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a VPN site link."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnSite."]
#[doc = "* `vpn_site_name`: The name of the VpnSite."]
#[doc = "* `vpn_site_link_name`: The name of the VpnSiteLink being retrieved."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_site_name: impl Into<String>,
vpn_site_link_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_site_name: vpn_site_name.into(),
vpn_site_link_name: vpn_site_link_name.into(),
}
}
#[doc = "Lists all the vpnSiteLinks in a resource group for a vpn site."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnSite."]
#[doc = "* `vpn_site_name`: The name of the VpnSite."]
pub fn list_by_vpn_site(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_site_name: impl Into<String>,
) -> list_by_vpn_site::Builder {
list_by_vpn_site::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_site_name: vpn_site_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VpnSiteLink;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_site_name: String,
pub(crate) vpn_site_link_name: String,
}
impl Builder {
pub fn into_future(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.Network/vpnSites/{}/vpnSiteLinks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_site_name,
&this.vpn_site_link_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnSiteLink = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_vpn_site {
use super::models;
type Response = models::ListVpnSiteLinksResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_site_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnSites/{}/vpnSiteLinks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_site_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnSiteLinksResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod vpn_sites_configuration {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gives the sas-url to download the configurations for vpn-sites in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name."]
#[doc = "* `virtual_wan_name`: The name of the VirtualWAN for which configuration of all vpn-sites is needed."]
#[doc = "* `request`: Parameters supplied to download vpn-sites configuration."]
pub fn download(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_wan_name: impl Into<String>,
request: impl Into<models::GetVpnSitesConfigurationRequest>,
) -> download::Builder {
download::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_wan_name: virtual_wan_name.into(),
request: request.into(),
}
}
}
pub mod download {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_wan_name: String,
pub(crate) request: models::GetVpnSitesConfigurationRequest,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualWans/{}/vpnConfiguration",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_wan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.request)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod vpn_server_configurations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a VpnServerConfiguration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnServerConfiguration."]
#[doc = "* `vpn_server_configuration_name`: The name of the VpnServerConfiguration being retrieved."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_server_configuration_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_server_configuration_name: vpn_server_configuration_name.into(),
}
}
#[doc = "Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnServerConfiguration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnServerConfiguration."]
#[doc = "* `vpn_server_configuration_name`: The name of the VpnServerConfiguration being created or updated."]
#[doc = "* `vpn_server_configuration_parameters`: Parameters supplied to create or update VpnServerConfiguration."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_server_configuration_name: impl Into<String>,
vpn_server_configuration_parameters: impl Into<models::VpnServerConfiguration>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_server_configuration_name: vpn_server_configuration_name.into(),
vpn_server_configuration_parameters: vpn_server_configuration_parameters.into(),
}
}
#[doc = "Updates VpnServerConfiguration tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnServerConfiguration."]
#[doc = "* `vpn_server_configuration_name`: The name of the VpnServerConfiguration being updated."]
#[doc = "* `vpn_server_configuration_parameters`: Parameters supplied to update VpnServerConfiguration tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_server_configuration_name: impl Into<String>,
vpn_server_configuration_parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_server_configuration_name: vpn_server_configuration_name.into(),
vpn_server_configuration_parameters: vpn_server_configuration_parameters.into(),
}
}
#[doc = "Deletes a VpnServerConfiguration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnServerConfiguration."]
#[doc = "* `vpn_server_configuration_name`: The name of the VpnServerConfiguration being deleted."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vpn_server_configuration_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vpn_server_configuration_name: vpn_server_configuration_name.into(),
}
}
#[doc = "Lists all the vpnServerConfigurations in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnServerConfiguration."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Lists all the VpnServerConfigurations in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VpnServerConfiguration;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_server_configuration_name: String,
}
impl Builder {
pub fn into_future(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.Network/vpnServerConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_server_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnServerConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnServerConfiguration),
Created201(models::VpnServerConfiguration),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_server_configuration_name: String,
pub(crate) vpn_server_configuration_parameters: models::VpnServerConfiguration,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnServerConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_server_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.vpn_server_configuration_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnServerConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnServerConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::VpnServerConfiguration;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_server_configuration_name: String,
pub(crate) vpn_server_configuration_parameters: models::TagsObject,
}
impl Builder {
pub fn into_future(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.Network/vpnServerConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_server_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.vpn_server_configuration_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnServerConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vpn_server_configuration_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnServerConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.vpn_server_configuration_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ListVpnServerConfigurationsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnServerConfigurations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnServerConfigurationsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::ListVpnServerConfigurationsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnServerConfigurations",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnServerConfigurationsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_hubs {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a VirtualHub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
}
}
#[doc = "Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `virtual_hub_parameters`: Parameters supplied to create or update VirtualHub."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
virtual_hub_parameters: impl Into<models::VirtualHub>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
virtual_hub_parameters: virtual_hub_parameters.into(),
}
}
#[doc = "Updates VirtualHub tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `virtual_hub_parameters`: Parameters supplied to update VirtualHub tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
virtual_hub_parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
virtual_hub_parameters: virtual_hub_parameters.into(),
}
}
#[doc = "Deletes a VirtualHub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
}
}
#[doc = "Lists all the VirtualHubs in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Lists all the VirtualHubs in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the effective routes configured for the Virtual Hub resource or the specified resource ."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
pub fn get_effective_virtual_hub_routes(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
) -> get_effective_virtual_hub_routes::Builder {
get_effective_virtual_hub_routes::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
effective_routes_parameters: None,
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualHub;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
}
impl Builder {
pub fn into_future(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.Network/virtualHubs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualHub = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualHub),
Created201(models::VirtualHub),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) virtual_hub_parameters: models::VirtualHub,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.virtual_hub_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualHub = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualHub = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::VirtualHub;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) virtual_hub_parameters: models::TagsObject,
}
impl Builder {
pub fn into_future(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.Network/virtualHubs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.virtual_hub_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualHub = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ListVirtualHubsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualHubs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVirtualHubsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::ListVirtualHubsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualHubs",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVirtualHubsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_effective_virtual_hub_routes {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) effective_routes_parameters: Option<models::EffectiveRoutesParameters>,
}
impl Builder {
#[doc = "Parameters supplied to get the effective routes for a specific resource."]
pub fn effective_routes_parameters(
mut self,
effective_routes_parameters: impl Into<models::EffectiveRoutesParameters>,
) -> Self {
self.effective_routes_parameters = Some(effective_routes_parameters.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/effectiveRoutes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = if let Some(effective_routes_parameters) = &this.effective_routes_parameters {
req.insert_header("content-type", "application/json");
azure_core::to_json(effective_routes_parameters)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod hub_virtual_network_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a HubVirtualNetworkConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `connection_name`: The name of the vpn connection."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
connection_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
connection_name: connection_name.into(),
}
}
#[doc = "Creates a hub virtual network connection if it doesn't exist else updates the existing one."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the HubVirtualNetworkConnection."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `connection_name`: The name of the HubVirtualNetworkConnection."]
#[doc = "* `hub_virtual_network_connection_parameters`: Parameters supplied to create or update a hub virtual network connection."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
connection_name: impl Into<String>,
hub_virtual_network_connection_parameters: impl Into<models::HubVirtualNetworkConnection>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
connection_name: connection_name.into(),
hub_virtual_network_connection_parameters: hub_virtual_network_connection_parameters.into(),
}
}
#[doc = "Deletes a HubVirtualNetworkConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `connection_name`: The name of the HubVirtualNetworkConnection."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
connection_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
connection_name: connection_name.into(),
}
}
#[doc = "Retrieves the details of all HubVirtualNetworkConnections."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::HubVirtualNetworkConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) connection_name: String,
}
impl Builder {
pub fn into_future(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.Network/virtualHubs/{}/hubVirtualNetworkConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_hub_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::HubVirtualNetworkConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::HubVirtualNetworkConnection),
Created201(models::HubVirtualNetworkConnection),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) connection_name: String,
pub(crate) hub_virtual_network_connection_parameters: models::HubVirtualNetworkConnection,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/hubVirtualNetworkConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_hub_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.hub_virtual_network_connection_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::HubVirtualNetworkConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::HubVirtualNetworkConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) connection_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/hubVirtualNetworkConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_hub_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ListHubVirtualNetworkConnectionsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualHubs/{}/hubVirtualNetworkConnections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListHubVirtualNetworkConnectionsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod vpn_gateways {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a virtual wan vpn gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
}
}
#[doc = "Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `vpn_gateway_parameters`: Parameters supplied to create or Update a virtual wan vpn gateway."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
vpn_gateway_parameters: impl Into<models::VpnGateway>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
vpn_gateway_parameters: vpn_gateway_parameters.into(),
}
}
#[doc = "Updates virtual wan vpn gateway tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `vpn_gateway_parameters`: Parameters supplied to update a virtual wan vpn gateway tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
vpn_gateway_parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
vpn_gateway_parameters: vpn_gateway_parameters.into(),
}
}
#[doc = "Deletes a virtual wan vpn gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
}
}
#[doc = "Resets the primary of the vpn gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn reset(
&self,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> reset::Builder {
reset::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Starts packet capture on vpn gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn start_packet_capture(
&self,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> start_packet_capture::Builder {
start_packet_capture::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
subscription_id: subscription_id.into(),
parameters: None,
}
}
#[doc = "Stops packet capture on vpn gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn stop_packet_capture(
&self,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> stop_packet_capture::Builder {
stop_packet_capture::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
subscription_id: subscription_id.into(),
parameters: None,
}
}
#[doc = "Lists all the VpnGateways in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Lists all the VpnGateways in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VpnGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
}
impl Builder {
pub fn into_future(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.Network/vpnGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnGateway),
Created201(models::VpnGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) vpn_gateway_parameters: models::VpnGateway,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.vpn_gateway_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(models::VpnGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) vpn_gateway_parameters: models::TagsObject,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.vpn_gateway_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod reset {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnGateway),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/reset",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod start_packet_capture {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(String),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) subscription_id: String,
pub(crate) parameters: Option<models::VpnGatewayPacketCaptureStartParameters>,
}
impl Builder {
#[doc = "Vpn gateway packet capture parameters supplied to start packet capture on vpn gateway."]
pub fn parameters(mut self, parameters: impl Into<models::VpnGatewayPacketCaptureStartParameters>) -> Self {
self.parameters = Some(parameters.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/startpacketcapture",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = if let Some(parameters) = &this.parameters {
req.insert_header("content-type", "application/json");
azure_core::to_json(parameters)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod stop_packet_capture {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(String),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) subscription_id: String,
pub(crate) parameters: Option<models::VpnGatewayPacketCaptureStopParameters>,
}
impl Builder {
#[doc = "Vpn gateway packet capture parameters supplied to stop packet capture on vpn gateway."]
pub fn parameters(mut self, parameters: impl Into<models::VpnGatewayPacketCaptureStopParameters>) -> Self {
self.parameters = Some(parameters.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/stoppacketcapture",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = if let Some(parameters) = &this.parameters {
req.insert_header("content-type", "application/json");
azure_core::to_json(parameters)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ListVpnGatewaysResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnGateways",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnGatewaysResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::ListVpnGatewaysResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnGateways",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnGatewaysResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod vpn_link_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Resets the VpnLink connection specified."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `connection_name`: The name of the vpn connection."]
#[doc = "* `link_connection_name`: The name of the vpn link connection."]
pub fn reset_connection(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
connection_name: impl Into<String>,
link_connection_name: impl Into<String>,
) -> reset_connection::Builder {
reset_connection::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
connection_name: connection_name.into(),
link_connection_name: link_connection_name.into(),
}
}
#[doc = "Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `connection_name`: The name of the vpn connection."]
#[doc = "* `link_connection_name`: The name of the vpn link connection."]
pub fn get_ike_sas(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
connection_name: impl Into<String>,
link_connection_name: impl Into<String>,
) -> get_ike_sas::Builder {
get_ike_sas::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
connection_name: connection_name.into(),
link_connection_name: link_connection_name.into(),
}
}
#[doc = "Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the vpn gateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `connection_name`: The name of the vpn connection."]
pub fn list_by_vpn_connection(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
connection_name: impl Into<String>,
) -> list_by_vpn_connection::Builder {
list_by_vpn_connection::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
connection_name: connection_name.into(),
}
}
}
pub mod reset_connection {
use super::models;
type Response = ();
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) connection_name: String,
pub(crate) link_connection_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/vpnConnections/{}/vpnLinkConnections/{}/resetconnection" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . gateway_name , & this . connection_name , & this . link_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(()),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_ike_sas {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(String),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) connection_name: String,
pub(crate) link_connection_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/vpnConnections/{}/vpnLinkConnections/{}/getikesas" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . gateway_name , & this . connection_name , & this . link_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_vpn_connection {
use super::models;
type Response = models::ListVpnSiteLinkConnectionsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) connection_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnGateways/{}/vpnConnections/{}/vpnLinkConnections" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . gateway_name , & this . connection_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnSiteLinkConnectionsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod vpn_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a vpn connection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `connection_name`: The name of the vpn connection."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
connection_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
connection_name: connection_name.into(),
}
}
#[doc = "Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing connection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `connection_name`: The name of the connection."]
#[doc = "* `vpn_connection_parameters`: Parameters supplied to create or Update a VPN Connection."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
connection_name: impl Into<String>,
vpn_connection_parameters: impl Into<models::VpnConnection>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
connection_name: connection_name.into(),
vpn_connection_parameters: vpn_connection_parameters.into(),
}
}
#[doc = "Deletes a vpn connection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `connection_name`: The name of the connection."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
connection_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
connection_name: connection_name.into(),
}
}
#[doc = "Starts packet capture on Vpn connection in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `vpn_connection_name`: The name of the vpn connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn start_packet_capture(
&self,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
vpn_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> start_packet_capture::Builder {
start_packet_capture::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
vpn_connection_name: vpn_connection_name.into(),
subscription_id: subscription_id.into(),
parameters: None,
}
}
#[doc = "Stops packet capture on Vpn connection in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `vpn_connection_name`: The name of the vpn connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn stop_packet_capture(
&self,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
vpn_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> stop_packet_capture::Builder {
stop_packet_capture::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
vpn_connection_name: vpn_connection_name.into(),
subscription_id: subscription_id.into(),
parameters: None,
}
}
#[doc = "Retrieves all vpn connections for a particular virtual wan vpn gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
pub fn list_by_vpn_gateway(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
) -> list_by_vpn_gateway::Builder {
list_by_vpn_gateway::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VpnConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) connection_name: String,
}
impl Builder {
pub fn into_future(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.Network/vpnGateways/{}/vpnConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name,
&this.connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnConnection),
Created201(models::VpnConnection),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) connection_name: String,
pub(crate) vpn_connection_parameters: models::VpnConnection,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/vpnConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name,
&this.connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.vpn_connection_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) connection_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/vpnConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name,
&this.connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod start_packet_capture {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(String),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) vpn_connection_name: String,
pub(crate) subscription_id: String,
pub(crate) parameters: Option<models::VpnConnectionPacketCaptureStartParameters>,
}
impl Builder {
#[doc = "Vpn Connection packet capture parameters supplied to start packet capture on gateway connection."]
pub fn parameters(mut self, parameters: impl Into<models::VpnConnectionPacketCaptureStartParameters>) -> Self {
self.parameters = Some(parameters.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/vpnConnections/{}/startpacketcapture" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . gateway_name , & this . vpn_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = if let Some(parameters) = &this.parameters {
req.insert_header("content-type", "application/json");
azure_core::to_json(parameters)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod stop_packet_capture {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(String),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) vpn_connection_name: String,
pub(crate) subscription_id: String,
pub(crate) parameters: Option<models::VpnConnectionPacketCaptureStopParameters>,
}
impl Builder {
#[doc = "Vpn Connection packet capture parameters supplied to stop packet capture on gateway connection."]
pub fn parameters(mut self, parameters: impl Into<models::VpnConnectionPacketCaptureStopParameters>) -> Self {
self.parameters = Some(parameters.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/vpnConnections/{}/stoppacketcapture" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . gateway_name , & this . vpn_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = if let Some(parameters) = &this.parameters {
req.insert_header("content-type", "application/json");
azure_core::to_json(parameters)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_vpn_gateway {
use super::models;
type Response = models::ListVpnConnectionsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnGateways/{}/vpnConnections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnConnectionsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod vpn_site_link_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a vpn site link connection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `connection_name`: The name of the vpn connection."]
#[doc = "* `link_connection_name`: The name of the vpn connection."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
connection_name: impl Into<String>,
link_connection_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
connection_name: connection_name.into(),
link_connection_name: link_connection_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VpnSiteLinkConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) connection_name: String,
pub(crate) link_connection_name: String,
}
impl Builder {
pub fn into_future(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.Network/vpnGateways/{}/vpnConnections/{}/vpnLinkConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . gateway_name , & this . connection_name , & this . link_connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnSiteLinkConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod nat_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a nat ruleGet."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `nat_rule_name`: The name of the nat rule."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
nat_rule_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
nat_rule_name: nat_rule_name.into(),
}
}
#[doc = "Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat rules."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `nat_rule_name`: The name of the nat rule."]
#[doc = "* `nat_rule_parameters`: Parameters supplied to create or Update a Nat Rule."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
nat_rule_name: impl Into<String>,
nat_rule_parameters: impl Into<models::VpnGatewayNatRule>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
nat_rule_name: nat_rule_name.into(),
nat_rule_parameters: nat_rule_parameters.into(),
}
}
#[doc = "Deletes a nat rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `nat_rule_name`: The name of the nat rule."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
nat_rule_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
nat_rule_name: nat_rule_name.into(),
}
}
#[doc = "Retrieves all nat rules for a particular virtual wan vpn gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
pub fn list_by_vpn_gateway(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
) -> list_by_vpn_gateway::Builder {
list_by_vpn_gateway::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VpnGatewayNatRule;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) nat_rule_name: String,
}
impl Builder {
pub fn into_future(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.Network/vpnGateways/{}/natRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name,
&this.nat_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnGatewayNatRule = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnGatewayNatRule),
Created201(models::VpnGatewayNatRule),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) nat_rule_name: String,
pub(crate) nat_rule_parameters: models::VpnGatewayNatRule,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/natRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name,
&this.nat_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.nat_rule_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnGatewayNatRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnGatewayNatRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) nat_rule_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/vpnGateways/{}/natRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name,
&this.nat_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_vpn_gateway {
use super::models;
type Response = models::ListVpnGatewayNatRulesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/vpnGateways/{}/natRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVpnGatewayNatRulesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod p2s_vpn_gateways {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a virtual wan p2s vpn gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the P2SVpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
}
}
#[doc = "Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the P2SVpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `p2_s_vpn_gateway_parameters`: Parameters supplied to create or Update a virtual wan p2s vpn gateway."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
p2_s_vpn_gateway_parameters: impl Into<models::P2sVpnGateway>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
p2_s_vpn_gateway_parameters: p2_s_vpn_gateway_parameters.into(),
}
}
#[doc = "Updates virtual wan p2s vpn gateway tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the P2SVpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `p2_s_vpn_gateway_parameters`: Parameters supplied to update a virtual wan p2s vpn gateway tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
p2_s_vpn_gateway_parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
p2_s_vpn_gateway_parameters: p2_s_vpn_gateway_parameters.into(),
}
}
#[doc = "Deletes a virtual wan p2s vpn gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the P2SVpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
}
}
#[doc = "Lists all the P2SVpnGateways in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the P2SVpnGateway."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Lists all the P2SVpnGateways in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Resets the primary of the p2s vpn gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The resource group name of the P2SVpnGateway."]
#[doc = "* `gateway_name`: The name of the gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn reset(
&self,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> reset::Builder {
reset::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `gateway_name`: The name of the P2SVpnGateway."]
#[doc = "* `parameters`: Parameters supplied to the generate P2SVpnGateway VPN client package operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn generate_vpn_profile(
&self,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
parameters: impl Into<models::P2sVpnProfileParameters>,
subscription_id: impl Into<String>,
) -> generate_vpn_profile::Builder {
generate_vpn_profile::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `gateway_name`: The name of the P2SVpnGateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_p2s_vpn_connection_health(
&self,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_p2s_vpn_connection_health::Builder {
get_p2s_vpn_connection_health::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the sas url to get the connection health detail of P2S clients of the virtual wan P2SVpnGateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `gateway_name`: The name of the P2SVpnGateway."]
#[doc = "* `request`: Request parameters supplied to get p2s vpn connections detailed health."]
pub fn get_p2s_vpn_connection_health_detailed(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
gateway_name: impl Into<String>,
request: impl Into<models::P2sVpnConnectionHealthRequest>,
) -> get_p2s_vpn_connection_health_detailed::Builder {
get_p2s_vpn_connection_health_detailed::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
gateway_name: gateway_name.into(),
request: request.into(),
}
}
#[doc = "Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `p2s_vpn_gateway_name`: The name of the P2S Vpn Gateway."]
#[doc = "* `request`: The parameters are supplied to disconnect p2s vpn connections."]
pub fn disconnect_p2s_vpn_connections(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
p2s_vpn_gateway_name: impl Into<String>,
request: impl Into<models::P2sVpnConnectionRequest>,
) -> disconnect_p2s_vpn_connections::Builder {
disconnect_p2s_vpn_connections::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
p2s_vpn_gateway_name: p2s_vpn_gateway_name.into(),
request: request.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::P2sVpnGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
}
impl Builder {
pub fn into_future(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.Network/p2svpnGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::P2sVpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::P2sVpnGateway),
Created201(models::P2sVpnGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) p2_s_vpn_gateway_parameters: models::P2sVpnGateway,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/p2svpnGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.p2_s_vpn_gateway_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::P2sVpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::P2sVpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(models::P2sVpnGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) p2_s_vpn_gateway_parameters: models::TagsObject,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/p2svpnGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.p2_s_vpn_gateway_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::P2sVpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/p2svpnGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ListP2sVpnGatewaysResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/p2svpnGateways",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListP2sVpnGatewaysResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::ListP2sVpnGatewaysResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/p2svpnGateways",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListP2sVpnGatewaysResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod reset {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::P2sVpnGateway),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/p2svpnGateways/{}/reset",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::P2sVpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod generate_vpn_profile {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnProfileResponse),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) parameters: models::P2sVpnProfileParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/p2svpnGateways/{}/generatevpnprofile",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnProfileResponse = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_p2s_vpn_connection_health {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::P2sVpnGateway),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/p2svpnGateways/{}/getP2sVpnConnectionHealth",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::P2sVpnGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_p2s_vpn_connection_health_detailed {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::P2sVpnConnectionHealth),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) gateway_name: String,
pub(crate) request: models::P2sVpnConnectionHealthRequest,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/p2svpnGateways/{}/getP2sVpnConnectionHealthDetailed" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.request)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::P2sVpnConnectionHealth = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod disconnect_p2s_vpn_connections {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) p2s_vpn_gateway_name: String,
pub(crate) request: models::P2sVpnConnectionRequest,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/p2svpnGateways/{}/disconnectP2sVpnConnections" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . p2s_vpn_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.request)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod vpn_server_configurations_associated_with_virtual_wan {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name."]
#[doc = "* `virtual_wan_name`: The name of the VirtualWAN whose associated VpnServerConfigurations is needed."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_wan_name: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_wan_name: virtual_wan_name.into(),
}
}
}
pub mod list {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnServerConfigurationsResponse),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_wan_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualWans/{}/vpnServerConfigurations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_wan_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnServerConfigurationsResponse = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod virtual_hub_route_table_v2s {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a VirtualHubRouteTableV2."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHubRouteTableV2."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `route_table_name`: The name of the VirtualHubRouteTableV2."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
route_table_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
route_table_name: route_table_name.into(),
}
}
#[doc = "Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing VirtualHubRouteTableV2."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `route_table_name`: The name of the VirtualHubRouteTableV2."]
#[doc = "* `virtual_hub_route_table_v2_parameters`: Parameters supplied to create or update VirtualHubRouteTableV2."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
route_table_name: impl Into<String>,
virtual_hub_route_table_v2_parameters: impl Into<models::VirtualHubRouteTableV2>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
route_table_name: route_table_name.into(),
virtual_hub_route_table_v2_parameters: virtual_hub_route_table_v2_parameters.into(),
}
}
#[doc = "Deletes a VirtualHubRouteTableV2."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHubRouteTableV2."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `route_table_name`: The name of the VirtualHubRouteTableV2."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
route_table_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
route_table_name: route_table_name.into(),
}
}
#[doc = "Retrieves the details of all VirtualHubRouteTableV2s."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualHubRouteTableV2;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) route_table_name: String,
}
impl Builder {
pub fn into_future(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.Network/virtualHubs/{}/routeTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualHubRouteTableV2 = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualHubRouteTableV2),
Created201(models::VirtualHubRouteTableV2),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) route_table_name: String,
pub(crate) virtual_hub_route_table_v2_parameters: models::VirtualHubRouteTableV2,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/routeTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.virtual_hub_route_table_v2_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualHubRouteTableV2 = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualHubRouteTableV2 = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) route_table_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/routeTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ListVirtualHubRouteTableV2sResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualHubs/{}/routeTables",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVirtualHubRouteTableV2sResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod express_route_gateways {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists ExpressRoute gateways under a given subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_subscription(&self, subscription_id: impl Into<String>) -> list_by_subscription::Builder {
list_by_subscription::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists ExpressRoute gateways in a given resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Fetches the details of a ExpressRoute gateway in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_gateway_name`: The name of the ExpressRoute gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
express_route_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
express_route_gateway_name: express_route_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a ExpressRoute gateway in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_gateway_name`: The name of the ExpressRoute gateway."]
#[doc = "* `put_express_route_gateway_parameters`: Parameters required in an ExpressRoute gateway PUT operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
express_route_gateway_name: impl Into<String>,
put_express_route_gateway_parameters: impl Into<models::ExpressRouteGateway>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
express_route_gateway_name: express_route_gateway_name.into(),
put_express_route_gateway_parameters: put_express_route_gateway_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates express route gateway tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the ExpressRouteGateway."]
#[doc = "* `express_route_gateway_name`: The name of the gateway."]
#[doc = "* `express_route_gateway_parameters`: Parameters supplied to update a virtual wan express route gateway tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
express_route_gateway_name: impl Into<String>,
express_route_gateway_parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
express_route_gateway_name: express_route_gateway_name.into(),
express_route_gateway_parameters: express_route_gateway_parameters.into(),
}
}
#[doc = "Deletes the specified ExpressRoute gateway in a resource group. An ExpressRoute gateway resource can only be deleted when there are no connection subresources."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_gateway_name`: The name of the ExpressRoute gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
express_route_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
express_route_gateway_name: express_route_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_subscription {
use super::models;
type Response = models::ExpressRouteGatewayList;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteGateways",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteGatewayList = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ExpressRouteGatewayList;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteGateways",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteGatewayList = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRouteGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) express_route_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteGateway),
Created201(models::ExpressRouteGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) express_route_gateway_name: String,
pub(crate) put_express_route_gateway_parameters: models::ExpressRouteGateway,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.put_express_route_gateway_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(models::ExpressRouteGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) express_route_gateway_name: String,
pub(crate) express_route_gateway_parameters: models::TagsObject,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.express_route_gateway_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) express_route_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod express_route_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified ExpressRouteConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_gateway_name`: The name of the ExpressRoute gateway."]
#[doc = "* `connection_name`: The name of the ExpressRoute connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
express_route_gateway_name: impl Into<String>,
connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
express_route_gateway_name: express_route_gateway_name.into(),
connection_name: connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_gateway_name`: The name of the ExpressRoute gateway."]
#[doc = "* `connection_name`: The name of the connection subresource."]
#[doc = "* `put_express_route_connection_parameters`: Parameters required in an ExpressRouteConnection PUT operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
express_route_gateway_name: impl Into<String>,
connection_name: impl Into<String>,
put_express_route_connection_parameters: impl Into<models::ExpressRouteConnection>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
express_route_gateway_name: express_route_gateway_name.into(),
connection_name: connection_name.into(),
put_express_route_connection_parameters: put_express_route_connection_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a connection to a ExpressRoute circuit."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_gateway_name`: The name of the ExpressRoute gateway."]
#[doc = "* `connection_name`: The name of the connection subresource."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
express_route_gateway_name: impl Into<String>,
connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
express_route_gateway_name: express_route_gateway_name.into(),
connection_name: connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists ExpressRouteConnections."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_gateway_name`: The name of the ExpressRoute gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
express_route_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
express_route_gateway_name: express_route_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRouteConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) express_route_gateway_name: String,
pub(crate) connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteGateways/{}/expressRouteConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . express_route_gateway_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteConnection),
Created201(models::ExpressRouteConnection),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) express_route_gateway_name: String,
pub(crate) connection_name: String,
pub(crate) put_express_route_connection_parameters: models::ExpressRouteConnection,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteGateways/{}/expressRouteConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . express_route_gateway_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.put_express_route_connection_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) express_route_gateway_name: String,
pub(crate) connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteGateways/{}/expressRouteConnections/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . express_route_gateway_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRouteConnectionList;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) express_route_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteGateways/{}/expressRouteConnections" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . express_route_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteConnectionList = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod virtual_hub_bgp_connection {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a Virtual Hub Bgp Connection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `connection_name`: The name of the connection."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
connection_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
connection_name: connection_name.into(),
}
}
#[doc = "Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing VirtualHubBgpConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `connection_name`: The name of the connection."]
#[doc = "* `parameters`: Parameters of Bgp connection."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
connection_name: impl Into<String>,
parameters: impl Into<models::BgpConnection>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
connection_name: connection_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes a VirtualHubBgpConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHubBgpConnection."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `connection_name`: The name of the connection."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
connection_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
connection_name: connection_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::BgpConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) connection_name: String,
}
impl Builder {
pub fn into_future(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.Network/virtualHubs/{}/bgpConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BgpConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::BgpConnection),
Created201(models::BgpConnection),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) connection_name: String,
pub(crate) parameters: models::BgpConnection,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/bgpConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BgpConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BgpConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) connection_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/bgpConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod virtual_hub_bgp_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of all VirtualHubBgpConnections."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
}
}
#[doc = "Retrieves a list of routes the virtual hub bgp connection has learned."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `hub_name`: The name of the virtual hub."]
#[doc = "* `connection_name`: The name of the virtual hub bgp connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_learned_routes(
&self,
resource_group_name: impl Into<String>,
hub_name: impl Into<String>,
connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_learned_routes::Builder {
list_learned_routes::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
hub_name: hub_name.into(),
connection_name: connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Retrieves a list of routes the virtual hub bgp connection is advertising to the specified peer."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `hub_name`: The name of the virtual hub."]
#[doc = "* `connection_name`: The name of the virtual hub bgp connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_advertised_routes(
&self,
resource_group_name: impl Into<String>,
hub_name: impl Into<String>,
connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_advertised_routes::Builder {
list_advertised_routes::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
hub_name: hub_name.into(),
connection_name: connection_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::ListVirtualHubBgpConnectionResults;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualHubs/{}/bgpConnections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVirtualHubBgpConnectionResults = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_learned_routes {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::PeerRouteList),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) hub_name: String,
pub(crate) connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/bgpConnections/{}/learnedRoutes" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . hub_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PeerRouteList = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_advertised_routes {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::PeerRouteList),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) hub_name: String,
pub(crate) connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/bgpConnections/{}/advertisedRoutes" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . hub_name , & this . connection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PeerRouteList = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod virtual_hub_ip_configuration {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a Virtual Hub Ip configuration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `ip_config_name`: The name of the ipconfig."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
ip_config_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
ip_config_name: ip_config_name.into(),
}
}
#[doc = "Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing VirtualHubIpConfiguration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `ip_config_name`: The name of the ipconfig."]
#[doc = "* `parameters`: Hub Ip Configuration parameters."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
ip_config_name: impl Into<String>,
parameters: impl Into<models::HubIpConfiguration>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
ip_config_name: ip_config_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes a VirtualHubIpConfiguration."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHubBgpConnection."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `ip_config_name`: The name of the ipconfig."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
ip_config_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
ip_config_name: ip_config_name.into(),
}
}
#[doc = "Retrieves the details of all VirtualHubIpConfigurations."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::HubIpConfiguration;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) ip_config_name: String,
}
impl Builder {
pub fn into_future(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.Network/virtualHubs/{}/ipConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.ip_config_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::HubIpConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::HubIpConfiguration),
Created201(models::HubIpConfiguration),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) ip_config_name: String,
pub(crate) parameters: models::HubIpConfiguration,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/ipConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.ip_config_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::HubIpConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::HubIpConfiguration = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) ip_config_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/ipConfigurations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.ip_config_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ListVirtualHubIpConfigurationResults;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualHubs/{}/ipConfigurations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVirtualHubIpConfigurationResults = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod hub_route_tables {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a RouteTable."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `route_table_name`: The name of the RouteTable."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
route_table_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
route_table_name: route_table_name.into(),
}
}
#[doc = "Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `route_table_name`: The name of the RouteTable."]
#[doc = "* `route_table_parameters`: Parameters supplied to create or update RouteTable."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
route_table_name: impl Into<String>,
route_table_parameters: impl Into<models::HubRouteTable>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
route_table_name: route_table_name.into(),
route_table_parameters: route_table_parameters.into(),
}
}
#[doc = "Deletes a RouteTable."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the RouteTable."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `route_table_name`: The name of the RouteTable."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
route_table_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
route_table_name: route_table_name.into(),
}
}
#[doc = "Retrieves the details of all RouteTables."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::HubRouteTable;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) route_table_name: String,
}
impl Builder {
pub fn into_future(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.Network/virtualHubs/{}/hubRouteTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::HubRouteTable = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::HubRouteTable),
Created201(models::HubRouteTable),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) route_table_name: String,
pub(crate) route_table_parameters: models::HubRouteTable,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/hubRouteTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.route_table_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::HubRouteTable = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::HubRouteTable = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) route_table_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/hubRouteTables/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.route_table_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ListHubRouteTablesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualHubs/{}/hubRouteTables",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListHubRouteTablesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod routing_intent {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a RoutingIntent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the RoutingIntent."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `routing_intent_name`: The name of the RoutingIntent."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
routing_intent_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
routing_intent_name: routing_intent_name.into(),
}
}
#[doc = "Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the RoutingIntent."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `routing_intent_name`: The name of the per VirtualHub singleton Routing Intent resource."]
#[doc = "* `routing_intent_parameters`: Parameters supplied to create or update RoutingIntent."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
routing_intent_name: impl Into<String>,
routing_intent_parameters: impl Into<models::RoutingIntent>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
routing_intent_name: routing_intent_name.into(),
routing_intent_parameters: routing_intent_parameters.into(),
}
}
#[doc = "Deletes a RoutingIntent."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the RoutingIntent."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
#[doc = "* `routing_intent_name`: The name of the RoutingIntent."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
routing_intent_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
routing_intent_name: routing_intent_name.into(),
}
}
#[doc = "Retrieves the details of all RoutingIntent child resources of the VirtualHub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the VirtualHub."]
#[doc = "* `virtual_hub_name`: The name of the VirtualHub."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_hub_name: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_hub_name: virtual_hub_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::RoutingIntent;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) routing_intent_name: String,
}
impl Builder {
pub fn into_future(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.Network/virtualHubs/{}/routingIntent/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.routing_intent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RoutingIntent = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::RoutingIntent),
Created201(models::RoutingIntent),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) routing_intent_name: String,
pub(crate) routing_intent_parameters: models::RoutingIntent,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/routingIntent/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.routing_intent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.routing_intent_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RoutingIntent = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RoutingIntent = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
pub(crate) routing_intent_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualHubs/{}/routingIntent/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name,
&this.routing_intent_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ListRoutingIntentResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_hub_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualHubs/{}/routingIntent",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_hub_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListRoutingIntentResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_network_gateways {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified virtual network gateway by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a virtual network gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `parameters`: Parameters supplied to create or update virtual network gateway operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
parameters: impl Into<models::VirtualNetworkGateway>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a virtual network gateway tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `parameters`: Parameters supplied to update virtual network gateway tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified virtual network gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all virtual network gateways by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the connections in a virtual network gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_connections(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_connections::Builder {
list_connections::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Resets the primary of the virtual network gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn reset(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> reset::Builder {
reset::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
gateway_vip: None,
}
}
#[doc = "Resets the VPN client shared key of the virtual network gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn reset_vpn_client_shared_key(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> reset_vpn_client_shared_key::Builder {
reset_vpn_client_shared_key::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Generates VPN client package for P2S client of the virtual network gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `parameters`: Parameters supplied to the generate virtual network gateway VPN client package operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn generatevpnclientpackage(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
parameters: impl Into<models::VpnClientParameters>,
subscription_id: impl Into<String>,
) -> generatevpnclientpackage::Builder {
generatevpnclientpackage::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Generates VPN profile for P2S client of the virtual network gateway in the specified resource group. Used for IKEV2 and radius based authentication."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `parameters`: Parameters supplied to the generate virtual network gateway VPN client package operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn generate_vpn_profile(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
parameters: impl Into<models::VpnClientParameters>,
subscription_id: impl Into<String>,
) -> generate_vpn_profile::Builder {
generate_vpn_profile::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified resource group. The profile needs to be generated first using generateVpnProfile."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_vpn_profile_package_url(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_vpn_profile_package_url::Builder {
get_vpn_profile_package_url::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "The GetBgpPeerStatus operation retrieves the status of all BGP peers."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_bgp_peer_status(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_bgp_peer_status::Builder {
get_bgp_peer_status::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
peer: None,
}
}
#[doc = "Gets a xml format representation for supported vpn devices."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn supported_vpn_devices(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> supported_vpn_devices::Builder {
supported_vpn_devices::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_learned_routes(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_learned_routes::Builder {
get_learned_routes::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "This operation retrieves a list of routes the virtual network gateway is advertising to the specified peer."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `peer`: The IP address of the peer."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_advertised_routes(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
peer: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_advertised_routes::Builder {
get_advertised_routes::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
peer: peer.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `vpnclient_ipsec_params`: Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S client operation through Network resource provider."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn set_vpnclient_ipsec_parameters(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
vpnclient_ipsec_params: impl Into<models::VpnClientIPsecParameters>,
subscription_id: impl Into<String>,
) -> set_vpnclient_ipsec_parameters::Builder {
set_vpnclient_ipsec_parameters::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
vpnclient_ipsec_params: vpnclient_ipsec_params.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The virtual network gateway name."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_vpnclient_ipsec_parameters(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_vpnclient_ipsec_parameters::Builder {
get_vpnclient_ipsec_parameters::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a xml format representation for vpn device configuration script."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The name of the virtual network gateway connection for which the configuration script is generated."]
#[doc = "* `parameters`: Parameters supplied to the generate vpn device script operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn vpn_device_configuration_script(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
parameters: impl Into<models::VpnDeviceScriptParameters>,
subscription_id: impl Into<String>,
) -> vpn_device_configuration_script::Builder {
vpn_device_configuration_script::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Starts packet capture on virtual network gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn start_packet_capture(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> start_packet_capture::Builder {
start_packet_capture::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
parameters: None,
}
}
#[doc = "Stops packet capture on virtual network gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `parameters`: Virtual network gateway packet capture parameters supplied to stop packet capture on gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn stop_packet_capture(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
parameters: impl Into<models::VpnPacketCaptureStopParameters>,
subscription_id: impl Into<String>,
) -> stop_packet_capture::Builder {
stop_packet_capture::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get VPN client connection health detail per P2S client connection of the virtual network gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_vpnclient_connection_health(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_vpnclient_connection_health::Builder {
get_vpnclient_connection_health::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Disconnect vpn connections of virtual network gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_name`: The name of the virtual network gateway."]
#[doc = "* `request`: The parameters are supplied to disconnect vpn connections."]
pub fn disconnect_virtual_network_gateway_vpn_connections(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
request: impl Into<models::P2sVpnConnectionRequest>,
) -> disconnect_virtual_network_gateway_vpn_connections::Builder {
disconnect_virtual_network_gateway_vpn_connections::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
request: request.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualNetworkGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworkGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualNetworkGateway),
Created201(models::VirtualNetworkGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) parameters: models::VirtualNetworkGateway,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(models::VirtualNetworkGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::VirtualNetworkGatewayListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworkGateways",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_connections {
use super::models;
type Response = models::VirtualNetworkGatewayListConnectionsResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworkGateways/{}/connections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayListConnectionsResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod reset {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(models::VirtualNetworkGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
pub(crate) gateway_vip: Option<String>,
}
impl Builder {
#[doc = "Virtual network gateway vip address supplied to the begin reset of the active-active feature enabled gateway."]
pub fn gateway_vip(mut self, gateway_vip: impl Into<String>) -> Self {
self.gateway_vip = Some(gateway_vip.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/reset",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
if let Some(gateway_vip) = &this.gateway_vip {
req.url_mut().query_pairs_mut().append_pair("gatewayVip", gateway_vip);
}
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod reset_vpn_client_shared_key {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/resetvpnclientsharedkey" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod generatevpnclientpackage {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(String),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) parameters: models::VpnClientParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/generatevpnclientpackage" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod generate_vpn_profile {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(String),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) parameters: models::VpnClientParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/generatevpnprofile" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_vpn_profile_package_url {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(String),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/getvpnprofilepackageurl" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_bgp_peer_status {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::BgpPeerStatusListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
pub(crate) peer: Option<String>,
}
impl Builder {
#[doc = "The IP address of the peer to retrieve the status of."]
pub fn peer(mut self, peer: impl Into<String>) -> Self {
self.peer = Some(peer.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/getBgpPeerStatus",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
if let Some(peer) = &this.peer {
req.url_mut().query_pairs_mut().append_pair("peer", peer);
}
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BgpPeerStatusListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod supported_vpn_devices {
use super::models;
type Response = String;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworkGateways/{}/supportedvpndevices" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_learned_routes {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::GatewayRouteListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/getLearnedRoutes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::GatewayRouteListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_advertised_routes {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::GatewayRouteListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) peer: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/getAdvertisedRoutes" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let peer = &this.peer;
req.url_mut().query_pairs_mut().append_pair("peer", peer);
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::GatewayRouteListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod set_vpnclient_ipsec_parameters {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(models::VpnClientIPsecParameters),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) vpnclient_ipsec_params: models::VpnClientIPsecParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/setvpnclientipsecparameters" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.vpnclient_ipsec_params)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnClientIPsecParameters = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_vpnclient_ipsec_parameters {
use super::models;
type Response = models::VpnClientIPsecParameters;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/getvpnclientipsecparameters" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnClientIPsecParameters = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod vpn_device_configuration_script {
use super::models;
type Response = String;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) parameters: models::VpnDeviceScriptParameters,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/connections/{}/vpndeviceconfigurationscript",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod start_packet_capture {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(String),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
pub(crate) parameters: Option<models::VpnPacketCaptureStartParameters>,
}
impl Builder {
#[doc = "Virtual network gateway packet capture parameters supplied to start packet capture on gateway."]
pub fn parameters(mut self, parameters: impl Into<models::VpnPacketCaptureStartParameters>) -> Self {
self.parameters = Some(parameters.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/startPacketCapture" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = if let Some(parameters) = &this.parameters {
req.insert_header("content-type", "application/json");
azure_core::to_json(parameters)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod stop_packet_capture {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(String),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) parameters: models::VpnPacketCaptureStopParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/stopPacketCapture",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_vpnclient_connection_health {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VpnClientConnectionHealthDetailListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/getVpnClientConnectionHealth" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VpnClientConnectionHealthDetailListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod disconnect_virtual_network_gateway_vpn_connections {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) request: models::P2sVpnConnectionRequest,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/disconnectVirtualNetworkGatewayVpnConnections" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . virtual_network_gateway_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.request)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod virtual_network_gateway_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified virtual network gateway connection by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The name of the virtual network gateway connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a virtual network gateway connection in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The name of the virtual network gateway connection."]
#[doc = "* `parameters`: Parameters supplied to the create or update virtual network gateway connection operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
parameters: impl Into<models::VirtualNetworkGatewayConnection>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a virtual network gateway connection tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The name of the virtual network gateway connection."]
#[doc = "* `parameters`: Parameters supplied to update virtual network gateway connection tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified virtual network Gateway connection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The name of the virtual network gateway connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the specified virtual network gateway connection shared key through Network resource provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The virtual network gateway connection shared key name."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_shared_key(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_shared_key::Builder {
get_shared_key::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The virtual network gateway connection name."]
#[doc = "* `parameters`: Parameters supplied to the Begin Set Virtual Network Gateway connection Shared key operation throughNetwork resource provider."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn set_shared_key(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
parameters: impl Into<models::ConnectionSharedKey>,
subscription_id: impl Into<String>,
) -> set_shared_key::Builder {
set_shared_key::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections created."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The virtual network gateway connection reset shared key Name."]
#[doc = "* `parameters`: Parameters supplied to the begin reset virtual network gateway connection shared key operation through network resource provider."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn reset_shared_key(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
parameters: impl Into<models::ConnectionResetSharedKey>,
subscription_id: impl Into<String>,
) -> reset_shared_key::Builder {
reset_shared_key::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Starts packet capture on virtual network gateway connection in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The name of the virtual network gateway connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn start_packet_capture(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> start_packet_capture::Builder {
start_packet_capture::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
subscription_id: subscription_id.into(),
parameters: None,
}
}
#[doc = "Stops packet capture on virtual network gateway connection in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The name of the virtual network gateway Connection."]
#[doc = "* `parameters`: Virtual network gateway packet capture parameters supplied to stop packet capture on gateway connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn stop_packet_capture(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
parameters: impl Into<models::VpnPacketCaptureStopParameters>,
subscription_id: impl Into<String>,
) -> stop_packet_capture::Builder {
stop_packet_capture::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists IKE Security Associations for the virtual network gateway connection in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The name of the virtual network gateway Connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get_ike_sas(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_ike_sas::Builder {
get_ike_sas::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Resets the virtual network gateway connection specified."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_network_gateway_connection_name`: The name of the virtual network gateway Connection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn reset_connection(
&self,
resource_group_name: impl Into<String>,
virtual_network_gateway_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> reset_connection::Builder {
reset_connection::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_connection_name: virtual_network_gateway_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualNetworkGatewayConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/connections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualNetworkGatewayConnection),
Created201(models::VirtualNetworkGatewayConnection),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) parameters: models::VirtualNetworkGatewayConnection,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/connections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(models::VirtualNetworkGatewayConnection),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/connections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayConnection = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/connections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_shared_key {
use super::models;
type Response = models::ConnectionSharedKey;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/connections/{}/sharedkey",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionSharedKey = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod set_shared_key {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::ConnectionSharedKey),
Ok200(models::ConnectionSharedKey),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) parameters: models::ConnectionSharedKey,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/connections/{}/sharedkey",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionSharedKey = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionSharedKey = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::VirtualNetworkGatewayConnectionListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/connections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayConnectionListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod reset_shared_key {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ConnectionResetSharedKey),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) parameters: models::ConnectionResetSharedKey,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/connections/{}/sharedkey/reset",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ConnectionResetSharedKey = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod start_packet_capture {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(String),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) subscription_id: String,
pub(crate) parameters: Option<models::VpnPacketCaptureStartParameters>,
}
impl Builder {
#[doc = "Virtual network gateway packet capture parameters supplied to start packet capture on gateway connection."]
pub fn parameters(mut self, parameters: impl Into<models::VpnPacketCaptureStartParameters>) -> Self {
self.parameters = Some(parameters.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/connections/{}/startPacketCapture",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = if let Some(parameters) = &this.parameters {
req.insert_header("content-type", "application/json");
azure_core::to_json(parameters)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod stop_packet_capture {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(String),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) parameters: models::VpnPacketCaptureStopParameters,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/connections/{}/stopPacketCapture",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod get_ike_sas {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200(String),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/connections/{}/getikesas",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: String = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod reset_connection {
use super::models;
type Response = ();
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/connections/{}/resetconnection",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(()),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod local_network_gateways {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified local network gateway in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `local_network_gateway_name`: The name of the local network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
local_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
local_network_gateway_name: local_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a local network gateway in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `local_network_gateway_name`: The name of the local network gateway."]
#[doc = "* `parameters`: Parameters supplied to the create or update local network gateway operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
local_network_gateway_name: impl Into<String>,
parameters: impl Into<models::LocalNetworkGateway>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
local_network_gateway_name: local_network_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a local network gateway tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `local_network_gateway_name`: The name of the local network gateway."]
#[doc = "* `parameters`: Parameters supplied to update local network gateway tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
local_network_gateway_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
local_network_gateway_name: local_network_gateway_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified local network gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `local_network_gateway_name`: The name of the local network gateway."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
local_network_gateway_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
local_network_gateway_name: local_network_gateway_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the local network gateways in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::LocalNetworkGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) local_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/localNetworkGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.local_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LocalNetworkGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::LocalNetworkGateway),
Ok200(models::LocalNetworkGateway),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) local_network_gateway_name: String,
pub(crate) parameters: models::LocalNetworkGateway,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/localNetworkGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.local_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LocalNetworkGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LocalNetworkGateway = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::LocalNetworkGateway;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) local_network_gateway_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/localNetworkGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.local_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LocalNetworkGateway = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Ok200,
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) local_network_gateway_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/localNetworkGateways/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.local_network_gateway_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::LocalNetworkGatewayListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/localNetworkGateways",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::LocalNetworkGatewayListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_network_gateway_nat_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the details of a nat rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the Virtual Network Gateway."]
#[doc = "* `virtual_network_gateway_name`: The name of the gateway."]
#[doc = "* `nat_rule_name`: The name of the nat rule."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
nat_rule_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
nat_rule_name: nat_rule_name.into(),
}
}
#[doc = "Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the existing nat rules."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the Virtual Network Gateway."]
#[doc = "* `virtual_network_gateway_name`: The name of the gateway."]
#[doc = "* `nat_rule_name`: The name of the nat rule."]
#[doc = "* `nat_rule_parameters`: Parameters supplied to create or Update a Nat Rule."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
nat_rule_name: impl Into<String>,
nat_rule_parameters: impl Into<models::VirtualNetworkGatewayNatRule>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
nat_rule_name: nat_rule_name.into(),
nat_rule_parameters: nat_rule_parameters.into(),
}
}
#[doc = "Deletes a nat rule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the Virtual Network Gateway."]
#[doc = "* `virtual_network_gateway_name`: The name of the gateway."]
#[doc = "* `nat_rule_name`: The name of the nat rule."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
nat_rule_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
nat_rule_name: nat_rule_name.into(),
}
}
#[doc = "Retrieves all nat rules for a particular virtual network gateway."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of the virtual network gateway."]
#[doc = "* `virtual_network_gateway_name`: The name of the gateway."]
pub fn list_by_virtual_network_gateway(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
virtual_network_gateway_name: impl Into<String>,
) -> list_by_virtual_network_gateway::Builder {
list_by_virtual_network_gateway::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
virtual_network_gateway_name: virtual_network_gateway_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualNetworkGatewayNatRule;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) nat_rule_name: String,
}
impl Builder {
pub fn into_future(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.Network/virtualNetworkGateways/{}/natRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name,
&this.nat_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayNatRule = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualNetworkGatewayNatRule),
Created201(models::VirtualNetworkGatewayNatRule),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) nat_rule_name: String,
pub(crate) nat_rule_parameters: models::VirtualNetworkGatewayNatRule,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/natRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name,
&this.nat_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.nat_rule_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayNatRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualNetworkGatewayNatRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
pub(crate) nat_rule_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualNetworkGateways/{}/natRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name,
&this.nat_rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_virtual_network_gateway {
use super::models;
type Response = models::ListVirtualNetworkGatewayNatRulesResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) virtual_network_gateway_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualNetworkGateways/{}/natRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_network_gateway_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ListVirtualNetworkGatewayNatRulesResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod express_route_cross_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves all the ExpressRouteCrossConnections in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Retrieves all the ExpressRouteCrossConnections in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets details about the specified ExpressRouteCrossConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group (peering location of the circuit)."]
#[doc = "* `cross_connection_name`: The name of the ExpressRouteCrossConnection (service key of the circuit)."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Update the specified ExpressRouteCrossConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cross_connection_name`: The name of the ExpressRouteCrossConnection."]
#[doc = "* `parameters`: Parameters supplied to the update express route crossConnection operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
parameters: impl Into<models::ExpressRouteCrossConnection>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates an express route cross connection tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cross_connection_name`: The name of the cross connection."]
#[doc = "* `cross_connection_parameters`: Parameters supplied to update express route cross connection tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
cross_connection_parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
cross_connection_parameters: cross_connection_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the currently advertised ARP table associated with the express route cross connection in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cross_connection_name`: The name of the ExpressRouteCrossConnection."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `device_path`: The path of the device."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_arp_table(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
peering_name: impl Into<String>,
device_path: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_arp_table::Builder {
list_arp_table::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
peering_name: peering_name.into(),
device_path: device_path.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the route table summary associated with the express route cross connection in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cross_connection_name`: The name of the ExpressRouteCrossConnection."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `device_path`: The path of the device."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_routes_table_summary(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
peering_name: impl Into<String>,
device_path: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_routes_table_summary::Builder {
list_routes_table_summary::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
peering_name: peering_name.into(),
device_path: device_path.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the currently advertised routes table associated with the express route cross connection in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cross_connection_name`: The name of the ExpressRouteCrossConnection."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `device_path`: The path of the device."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_routes_table(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
peering_name: impl Into<String>,
device_path: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_routes_table::Builder {
list_routes_table::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
peering_name: peering_name.into(),
device_path: device_path.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRouteCrossConnectionListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteCrossConnections",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnectionListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ExpressRouteCrossConnectionListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteCrossConnections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnectionListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRouteCrossConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCrossConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.cross_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
type Response = models::ExpressRouteCrossConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) parameters: models::ExpressRouteCrossConnection,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCrossConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.cross_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::ExpressRouteCrossConnection;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) cross_connection_parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCrossConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.cross_connection_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.cross_connection_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnection = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_arp_table {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteCircuitsArpTableListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) peering_name: String,
pub(crate) device_path: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCrossConnections/{}/peerings/{}/arpTables/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . cross_connection_name , & this . peering_name , & this . device_path)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitsArpTableListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_routes_table_summary {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteCrossConnectionsRoutesTableSummaryListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) peering_name: String,
pub(crate) device_path: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCrossConnections/{}/peerings/{}/routeTablesSummary/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . cross_connection_name , & this . peering_name , & this . device_path)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnectionsRoutesTableSummaryListResult =
serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_routes_table {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteCircuitsRoutesTableListResult),
Accepted202,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) peering_name: String,
pub(crate) device_path: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCrossConnections/{}/peerings/{}/routeTables/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . cross_connection_name , & this . peering_name , & this . device_path)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCircuitsRoutesTableListResult = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod express_route_cross_connection_peerings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all peerings in a specified ExpressRouteCrossConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cross_connection_name`: The name of the ExpressRouteCrossConnection."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the specified peering for the ExpressRouteCrossConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cross_connection_name`: The name of the ExpressRouteCrossConnection."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a peering in the specified ExpressRouteCrossConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cross_connection_name`: The name of the ExpressRouteCrossConnection."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `peering_parameters`: Parameters supplied to the create or update ExpressRouteCrossConnection peering operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
peering_name: impl Into<String>,
peering_parameters: impl Into<models::ExpressRouteCrossConnectionPeering>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
peering_name: peering_name.into(),
peering_parameters: peering_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified peering from the ExpressRouteCrossConnection."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `cross_connection_name`: The name of the ExpressRouteCrossConnection."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
cross_connection_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
cross_connection_name: cross_connection_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRouteCrossConnectionPeeringList;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/expressRouteCrossConnections/{}/peerings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.cross_connection_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnectionPeeringList = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRouteCrossConnectionPeering;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/expressRouteCrossConnections/{}/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.cross_connection_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnectionPeering = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRouteCrossConnectionPeering),
Created201(models::ExpressRouteCrossConnectionPeering),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) peering_name: String,
pub(crate) peering_parameters: models::ExpressRouteCrossConnectionPeering,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCrossConnections/{}/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.cross_connection_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, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.peering_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnectionPeering = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteCrossConnectionPeering = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) cross_connection_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/expressRouteCrossConnections/{}/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.cross_connection_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod express_route_ports_locations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each location. Available bandwidths can only be obtained when retrieving a specific peering location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths available at said peering location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `location_name`: Name of the requested ExpressRoutePort peering location."]
pub fn get(&self, subscription_id: impl Into<String>, location_name: impl Into<String>) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
location_name: location_name.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRoutePortsLocationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ExpressRoutePortsLocations",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRoutePortsLocationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRoutePortsLocation;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) location_name: String,
}
impl Builder {
pub fn into_future(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.Network/ExpressRoutePortsLocations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.location_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRoutePortsLocation = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod express_route_ports {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the requested ExpressRoutePort resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_port_name`: The name of ExpressRoutePort."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
express_route_port_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
express_route_port_name: express_route_port_name.into(),
}
}
#[doc = "Creates or updates the specified ExpressRoutePort resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_port_name`: The name of the ExpressRoutePort resource."]
#[doc = "* `parameters`: Parameters supplied to the create ExpressRoutePort operation."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
express_route_port_name: impl Into<String>,
parameters: impl Into<models::ExpressRoutePort>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
express_route_port_name: express_route_port_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Update ExpressRoutePort tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_port_name`: The name of the ExpressRoutePort resource."]
#[doc = "* `parameters`: Parameters supplied to update ExpressRoutePort resource tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
express_route_port_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
express_route_port_name: express_route_port_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes the specified ExpressRoutePort resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_port_name`: The name of the ExpressRoutePort resource."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
express_route_port_name: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
express_route_port_name: express_route_port_name.into(),
}
}
#[doc = "List all the ExpressRoutePort resources in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "List all the ExpressRoutePort resources in the specified subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Generate a letter of authorization for the requested ExpressRoutePort resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_port_name`: The name of ExpressRoutePort."]
#[doc = "* `request`: Request parameters supplied to generate a letter of authorization."]
pub fn generate_loa(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
express_route_port_name: impl Into<String>,
request: impl Into<models::GenerateExpressRoutePortsLoaRequest>,
) -> generate_loa::Builder {
generate_loa::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
express_route_port_name: express_route_port_name.into(),
request: request.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRoutePort;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) express_route_port_name: String,
}
impl Builder {
pub fn into_future(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.Network/ExpressRoutePorts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_port_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRoutePort = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::ExpressRoutePort),
Created201(models::ExpressRoutePort),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) express_route_port_name: String,
pub(crate) parameters: models::ExpressRoutePort,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/ExpressRoutePorts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_port_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRoutePort = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRoutePort = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::ExpressRoutePort;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) express_route_port_name: String,
pub(crate) parameters: models::TagsObject,
}
impl Builder {
pub fn into_future(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.Network/ExpressRoutePorts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_port_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRoutePort = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) express_route_port_name: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/ExpressRoutePorts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_port_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::ExpressRoutePortListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ExpressRoutePorts",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRoutePortListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRoutePortListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ExpressRoutePorts",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRoutePortListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod generate_loa {
use super::models;
type Response = models::GenerateExpressRoutePortsLoaResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) express_route_port_name: String,
pub(crate) request: models::GenerateExpressRoutePortsLoaRequest,
}
impl Builder {
pub fn into_future(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.Network/expressRoutePorts/{}/generateLoa",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_port_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.request)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::GenerateExpressRoutePortsLoaResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod express_route_links {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the specified ExpressRouteLink resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_port_name`: The name of the ExpressRoutePort resource."]
#[doc = "* `link_name`: The name of the ExpressRouteLink resource."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
express_route_port_name: impl Into<String>,
link_name: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
express_route_port_name: express_route_port_name.into(),
link_name: link_name.into(),
}
}
#[doc = "Retrieve the ExpressRouteLink sub-resources of the specified ExpressRoutePort resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `express_route_port_name`: The name of the ExpressRoutePort resource."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
express_route_port_name: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
express_route_port_name: express_route_port_name.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::ExpressRouteLink;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) express_route_port_name: String,
pub(crate) link_name: String,
}
impl Builder {
pub fn into_future(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.Network/ExpressRoutePorts/{}/links/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_port_name,
&this.link_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteLink = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::ExpressRouteLinkListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) express_route_port_name: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ExpressRoutePorts/{}/links",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.express_route_port_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ExpressRouteLinkListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod firewall_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Firewall Policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates the specified Firewall Policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `parameters`: Parameters supplied to the create or update Firewall Policy operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
parameters: impl Into<models::FirewallPolicy>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified Firewall Policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all Firewall Policies in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the Firewall Policies in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::FirewallPolicy;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/firewallPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FirewallPolicy = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::FirewallPolicy),
Ok200(models::FirewallPolicy),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) parameters: models::FirewallPolicy,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/firewallPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FirewallPolicy = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FirewallPolicy = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/firewallPolicies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::FirewallPolicyListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/firewallPolicies",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FirewallPolicyListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_all {
use super::models;
type Response = models::FirewallPolicyListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/firewallPolicies",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FirewallPolicyListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod firewall_policy_rule_collection_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified FirewallPolicyRuleCollectionGroup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `rule_collection_group_name`: The name of the FirewallPolicyRuleCollectionGroup."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
rule_collection_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
rule_collection_group_name: rule_collection_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the specified FirewallPolicyRuleCollectionGroup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `rule_collection_group_name`: The name of the FirewallPolicyRuleCollectionGroup."]
#[doc = "* `parameters`: Parameters supplied to the create or update FirewallPolicyRuleCollectionGroup operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
rule_collection_group_name: impl Into<String>,
parameters: impl Into<models::FirewallPolicyRuleCollectionGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
rule_collection_group_name: rule_collection_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified FirewallPolicyRuleCollectionGroup."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `rule_collection_group_name`: The name of the FirewallPolicyRuleCollectionGroup."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
rule_collection_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
rule_collection_group_name: rule_collection_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::FirewallPolicyRuleCollectionGroup;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) rule_collection_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/firewallPolicies/{}/ruleCollectionGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_name,
&this.rule_collection_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FirewallPolicyRuleCollectionGroup = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::FirewallPolicyRuleCollectionGroup),
Ok200(models::FirewallPolicyRuleCollectionGroup),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) rule_collection_group_name: String,
pub(crate) parameters: models::FirewallPolicyRuleCollectionGroup,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/firewallPolicies/{}/ruleCollectionGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_name,
&this.rule_collection_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FirewallPolicyRuleCollectionGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FirewallPolicyRuleCollectionGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) rule_collection_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/firewallPolicies/{}/ruleCollectionGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_name,
&this.rule_collection_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::FirewallPolicyRuleCollectionGroupListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/firewallPolicies/{}/ruleCollectionGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::FirewallPolicyRuleCollectionGroupListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod firewall_policy_idps_signatures {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the current status of IDPS signatures for the relevant policy"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
parameters: impl Into<models::IdpsQueryObject>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
subscription_id: subscription_id.into(),
parameters: parameters.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::QueryResults;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) subscription_id: String,
pub(crate) parameters: models::IdpsQueryObject,
}
impl Builder {
pub fn into_future(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.Network/firewallPolicies/{}/listIdpsSignatures",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::QueryResults = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod firewall_policy_idps_signatures_overrides {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Returns all signatures overrides for a specific policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Will override/create a new signature overrides for the policy's IDPS"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `parameters`: Will contain all properties of the object to put"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn put(
&self,
parameters: impl Into<models::SignaturesOverrides>,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> put::Builder {
put::Builder {
client: self.0.clone(),
parameters: parameters.into(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Will update the status of policy's signature overrides for IDPS"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `parameters`: Will contain all properties of the object to put"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn patch(
&self,
parameters: impl Into<models::SignaturesOverrides>,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> patch::Builder {
patch::Builder {
client: self.0.clone(),
parameters: parameters.into(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Returns all signatures overrides objects for a specific policy as a list containing a single value."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::SignaturesOverrides;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/firewallPolicies/{}/signatureOverrides/default" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . firewall_policy_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()),
);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SignaturesOverrides = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod put {
use super::models;
type Response = models::SignaturesOverrides;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) parameters: models::SignaturesOverrides,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/firewallPolicies/{}/signatureOverrides/default" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . firewall_policy_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.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SignaturesOverrides = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod patch {
use super::models;
type Response = models::SignaturesOverrides;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) parameters: models::SignaturesOverrides,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/firewallPolicies/{}/signatureOverrides/default" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . firewall_policy_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.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SignaturesOverrides = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::SignaturesOverridesList;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/firewallPolicies/{}/signatureOverrides",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_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()),
);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SignaturesOverridesList = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod firewall_policy_idps_signatures_filter_values {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Retrieves the current filter values for the signatures overrides"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `firewall_policy_name`: The name of the Firewall Policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
parameters: impl Into<models::SignatureOverridesFilterValuesQuery>,
resource_group_name: impl Into<String>,
firewall_policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
parameters: parameters.into(),
resource_group_name: resource_group_name.into(),
firewall_policy_name: firewall_policy_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::SignatureOverridesFilterValuesResponse;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) parameters: models::SignatureOverridesFilterValuesQuery,
pub(crate) resource_group_name: String,
pub(crate) firewall_policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/firewallPolicies/{}/listIdpsFilterOptions",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.firewall_policy_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SignatureOverridesFilterValuesResponse = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod ip_allocations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified IpAllocation by resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ip_allocation_name`: The name of the IpAllocation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
ip_allocation_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ip_allocation_name: ip_allocation_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates an IpAllocation in the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ip_allocation_name`: The name of the IpAllocation."]
#[doc = "* `parameters`: Parameters supplied to the create or update virtual network operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
ip_allocation_name: impl Into<String>,
parameters: impl Into<models::IpAllocation>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ip_allocation_name: ip_allocation_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a IpAllocation tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ip_allocation_name`: The name of the IpAllocation."]
#[doc = "* `parameters`: Parameters supplied to update IpAllocation tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
ip_allocation_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ip_allocation_name: ip_allocation_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified IpAllocation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ip_allocation_name`: The name of the IpAllocation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
ip_allocation_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ip_allocation_name: ip_allocation_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all IpAllocations in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all IpAllocations in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::IpAllocation;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ip_allocation_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/IpAllocations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ip_allocation_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpAllocation = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::IpAllocation),
Created201(models::IpAllocation),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ip_allocation_name: String,
pub(crate) parameters: models::IpAllocation,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/IpAllocations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ip_allocation_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpAllocation = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpAllocation = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::IpAllocation;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ip_allocation_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/IpAllocations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ip_allocation_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpAllocation = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ip_allocation_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/IpAllocations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ip_allocation_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::IpAllocationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/IpAllocations",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpAllocationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::IpAllocationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/IpAllocations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpAllocationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod ip_groups {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified ipGroups."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ip_groups_name`: The name of the ipGroups."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
ip_groups_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ip_groups_name: ip_groups_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates an ipGroups in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ip_groups_name`: The name of the ipGroups."]
#[doc = "* `parameters`: Parameters supplied to the create or update IpGroups operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
ip_groups_name: impl Into<String>,
parameters: impl Into<models::IpGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ip_groups_name: ip_groups_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates tags of an IpGroups resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ip_groups_name`: The name of the ipGroups."]
#[doc = "* `parameters`: Parameters supplied to the update ipGroups operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_groups(
&self,
resource_group_name: impl Into<String>,
ip_groups_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_groups::Builder {
update_groups::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ip_groups_name: ip_groups_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified ipGroups."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `ip_groups_name`: The name of the ipGroups."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
ip_groups_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
ip_groups_name: ip_groups_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all IpGroups in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all IpGroups in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::IpGroup;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ip_groups_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands resourceIds (of Firewalls/Network Security Groups etc.) back referenced by the IpGroups resource."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/ipGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ip_groups_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpGroup = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::IpGroup),
Created201(models::IpGroup),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ip_groups_name: String,
pub(crate) parameters: models::IpGroup,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/ipGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ip_groups_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpGroup = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_groups {
use super::models;
type Response = models::IpGroup;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ip_groups_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/ipGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ip_groups_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpGroup = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) ip_groups_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/ipGroups/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.ip_groups_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::IpGroupListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ipGroups",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpGroupListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::IpGroupListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ipGroups",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::IpGroupListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod network_virtual_appliances {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Network Virtual Appliance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_virtual_appliance_name`: The name of Network Virtual Appliance."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_virtual_appliance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_virtual_appliance_name: network_virtual_appliance_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates the specified Network Virtual Appliance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_virtual_appliance_name`: The name of Network Virtual Appliance."]
#[doc = "* `parameters`: Parameters supplied to the create or update Network Virtual Appliance."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_virtual_appliance_name: impl Into<String>,
parameters: impl Into<models::NetworkVirtualAppliance>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_virtual_appliance_name: network_virtual_appliance_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a Network Virtual Appliance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `resource_group_name`: The resource group name of Network Virtual Appliance."]
#[doc = "* `network_virtual_appliance_name`: The name of Network Virtual Appliance being updated."]
#[doc = "* `parameters`: Parameters supplied to Update Network Virtual Appliance Tags."]
pub fn update_tags(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
network_virtual_appliance_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
network_virtual_appliance_name: network_virtual_appliance_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes the specified Network Virtual Appliance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_virtual_appliance_name`: The name of Network Virtual Appliance."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_virtual_appliance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_virtual_appliance_name: network_virtual_appliance_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all Network Virtual Appliances in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all Network Virtual Appliances in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::NetworkVirtualAppliance;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_virtual_appliance_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/networkVirtualAppliances/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_virtual_appliance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkVirtualAppliance = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::NetworkVirtualAppliance),
Created201(models::NetworkVirtualAppliance),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_virtual_appliance_name: String,
pub(crate) parameters: models::NetworkVirtualAppliance,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkVirtualAppliances/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_virtual_appliance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkVirtualAppliance = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkVirtualAppliance = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::NetworkVirtualAppliance;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) network_virtual_appliance_name: String,
pub(crate) parameters: models::TagsObject,
}
impl Builder {
pub fn into_future(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.Network/networkVirtualAppliances/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_virtual_appliance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkVirtualAppliance = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_virtual_appliance_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkVirtualAppliances/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.network_virtual_appliance_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::NetworkVirtualApplianceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkVirtualAppliances",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkVirtualApplianceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkVirtualApplianceListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkVirtualAppliances",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkVirtualApplianceListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_appliance_sites {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Virtual Appliance Site."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_virtual_appliance_name`: The name of the Network Virtual Appliance."]
#[doc = "* `site_name`: The name of the site."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
network_virtual_appliance_name: impl Into<String>,
site_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_virtual_appliance_name: network_virtual_appliance_name.into(),
site_name: site_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the specified Network Virtual Appliance Site."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_virtual_appliance_name`: The name of the Network Virtual Appliance."]
#[doc = "* `site_name`: The name of the site."]
#[doc = "* `parameters`: Parameters supplied to the create or update Network Virtual Appliance Site operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_virtual_appliance_name: impl Into<String>,
site_name: impl Into<String>,
parameters: impl Into<models::VirtualApplianceSite>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_virtual_appliance_name: network_virtual_appliance_name.into(),
site_name: site_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified site from a Virtual Appliance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_virtual_appliance_name`: The name of the Network Virtual Appliance."]
#[doc = "* `site_name`: The name of the site."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
network_virtual_appliance_name: impl Into<String>,
site_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_virtual_appliance_name: network_virtual_appliance_name.into(),
site_name: site_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all Network Virtual Appliance Sites in a Network Virtual Appliance resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_virtual_appliance_name`: The name of the Network Virtual Appliance."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
network_virtual_appliance_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_virtual_appliance_name: network_virtual_appliance_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualApplianceSite;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_virtual_appliance_name: String,
pub(crate) site_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/networkVirtualAppliances/{}/virtualApplianceSites/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_virtual_appliance_name , & this . site_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualApplianceSite = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::VirtualApplianceSite),
Created201(models::VirtualApplianceSite),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_virtual_appliance_name: String,
pub(crate) site_name: String,
pub(crate) parameters: models::VirtualApplianceSite,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkVirtualAppliances/{}/virtualApplianceSites/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_virtual_appliance_name , & this . site_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualApplianceSite = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualApplianceSite = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200,
Accepted202,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_virtual_appliance_name: String,
pub(crate) site_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkVirtualAppliances/{}/virtualApplianceSites/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_virtual_appliance_name , & this . site_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkVirtualApplianceSiteListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_virtual_appliance_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkVirtualAppliances/{}/virtualApplianceSites" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_virtual_appliance_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkVirtualApplianceSiteListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_appliance_skus {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List all SKUs available for a virtual appliance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Retrieves a single available sku for network virtual appliance."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `sku_name`: Name of the Sku."]
pub fn get(&self, subscription_id: impl Into<String>, sku_name: impl Into<String>) -> get::Builder {
get::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
sku_name: sku_name.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::NetworkVirtualApplianceSkuListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/networkVirtualApplianceSkus",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkVirtualApplianceSkuListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::NetworkVirtualApplianceSku;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) sku_name: String,
}
impl Builder {
pub fn into_future(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.Network/networkVirtualApplianceSkus/{}",
this.client.endpoint(),
&this.subscription_id,
&this.sku_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::NetworkVirtualApplianceSku = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod inbound_security_rule {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Creates or updates the specified Network Virtual Appliance Inbound Security Rules."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `network_virtual_appliance_name`: The name of the Network Virtual Appliance."]
#[doc = "* `rule_collection_name`: The name of security rule collection."]
#[doc = "* `parameters`: Parameters supplied to the create or update Network Virtual Appliance Inbound Security Rules operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
network_virtual_appliance_name: impl Into<String>,
rule_collection_name: impl Into<String>,
parameters: impl Into<models::InboundSecurityRule>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
network_virtual_appliance_name: network_virtual_appliance_name.into(),
rule_collection_name: rule_collection_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::InboundSecurityRule),
Created201(models::InboundSecurityRule),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) network_virtual_appliance_name: String,
pub(crate) rule_collection_name: String,
pub(crate) parameters: models::InboundSecurityRule,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/networkVirtualAppliances/{}/inboundSecurityRules/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . network_virtual_appliance_name , & this . rule_collection_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::InboundSecurityRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::InboundSecurityRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available Network Rest API operations."]
pub fn list(&self) -> list::Builder {
list::Builder { client: self.0.clone() }
}
}
pub mod list {
use super::models;
type Response = models::OperationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/operations", this.client.endpoint(),))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::OperationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod public_ip_prefixes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified public IP prefix in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `public_ip_prefix_name`: The name of the public IP prefix."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
public_ip_prefix_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
public_ip_prefix_name: public_ip_prefix_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a static or dynamic public IP prefix."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `public_ip_prefix_name`: The name of the public IP prefix."]
#[doc = "* `parameters`: Parameters supplied to the create or update public IP prefix operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
public_ip_prefix_name: impl Into<String>,
parameters: impl Into<models::PublicIpPrefix>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
public_ip_prefix_name: public_ip_prefix_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates public IP prefix tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `public_ip_prefix_name`: The name of the public IP prefix."]
#[doc = "* `parameters`: Parameters supplied to update public IP prefix tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
public_ip_prefix_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
public_ip_prefix_name: public_ip_prefix_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified public IP prefix."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `public_ip_prefix_name`: The name of the PublicIpPrefix."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
public_ip_prefix_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
public_ip_prefix_name: public_ip_prefix_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the public IP prefixes in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all public IP prefixes in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::PublicIpPrefix;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) public_ip_prefix_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/publicIPPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.public_ip_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, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpPrefix = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::PublicIpPrefix),
Ok200(models::PublicIpPrefix),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) public_ip_prefix_name: String,
pub(crate) parameters: models::PublicIpPrefix,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/publicIPPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.public_ip_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, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpPrefix = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpPrefix = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::PublicIpPrefix;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) public_ip_prefix_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/publicIPPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.public_ip_prefix_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpPrefix = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
NoContent204,
Accepted202,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) public_ip_prefix_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/publicIPPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.public_ip_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_all {
use super::models;
type Response = models::PublicIpPrefixListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/publicIPPrefixes",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpPrefixListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::PublicIpPrefixListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/publicIPPrefixes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::PublicIpPrefixListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod route_filters {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified route filter."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_filter_name`: The name of the route filter."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
route_filter_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_filter_name: route_filter_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates a route filter in a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_filter_name`: The name of the route filter."]
#[doc = "* `route_filter_parameters`: Parameters supplied to the create or update route filter operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
route_filter_name: impl Into<String>,
route_filter_parameters: impl Into<models::RouteFilter>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_filter_name: route_filter_name.into(),
route_filter_parameters: route_filter_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates tags of a route filter."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_filter_name`: The name of the route filter."]
#[doc = "* `parameters`: Parameters supplied to update route filter tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
route_filter_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_filter_name: route_filter_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified route filter."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_filter_name`: The name of the route filter."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
route_filter_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_filter_name: route_filter_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all route filters in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all route filters in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::RouteFilter;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_filter_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced express route bgp peering resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/routeFilters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_filter_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilter = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::RouteFilter),
Created201(models::RouteFilter),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_filter_name: String,
pub(crate) route_filter_parameters: models::RouteFilter,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/routeFilters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_filter_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.route_filter_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilter = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilter = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::RouteFilter;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_filter_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/routeFilters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_filter_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilter = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_filter_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/routeFilters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_filter_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::RouteFilterListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/routeFilters",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilterListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::RouteFilterListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/routeFilters",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilterListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod route_filter_rules {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified rule from a route filter."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_filter_name`: The name of the route filter."]
#[doc = "* `rule_name`: The name of the rule."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
route_filter_name: impl Into<String>,
rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_filter_name: route_filter_name.into(),
rule_name: rule_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a route in the specified route filter."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_filter_name`: The name of the route filter."]
#[doc = "* `rule_name`: The name of the route filter rule."]
#[doc = "* `route_filter_rule_parameters`: Parameters supplied to the create or update route filter rule operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
route_filter_name: impl Into<String>,
rule_name: impl Into<String>,
route_filter_rule_parameters: impl Into<models::RouteFilterRule>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_filter_name: route_filter_name.into(),
rule_name: rule_name.into(),
route_filter_rule_parameters: route_filter_rule_parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified rule from a route filter."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_filter_name`: The name of the route filter."]
#[doc = "* `rule_name`: The name of the rule."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
route_filter_name: impl Into<String>,
rule_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_filter_name: route_filter_name.into(),
rule_name: rule_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all RouteFilterRules in a route filter."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `route_filter_name`: The name of the route filter."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_route_filter(
&self,
resource_group_name: impl Into<String>,
route_filter_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_route_filter::Builder {
list_by_route_filter::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
route_filter_name: route_filter_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::RouteFilterRule;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_filter_name: String,
pub(crate) rule_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/routeFilters/{}/routeFilterRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_filter_name,
&this.rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilterRule = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::RouteFilterRule),
Created201(models::RouteFilterRule),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_filter_name: String,
pub(crate) rule_name: String,
pub(crate) route_filter_rule_parameters: models::RouteFilterRule,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/routeFilters/{}/routeFilterRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_filter_name,
&this.rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.route_filter_rule_parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilterRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilterRule = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
Ok200,
NoContent204,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_filter_name: String,
pub(crate) rule_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/routeFilters/{}/routeFilterRules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_filter_name,
&this.rule_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_route_filter {
use super::models;
type Response = models::RouteFilterRuleListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) route_filter_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/routeFilters/{}/routeFilterRules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.route_filter_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::RouteFilterRuleListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod security_partner_providers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Security Partner Provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `security_partner_provider_name`: The name of the Security Partner Provider."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
security_partner_provider_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
security_partner_provider_name: security_partner_provider_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the specified Security Partner Provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `security_partner_provider_name`: The name of the Security Partner Provider."]
#[doc = "* `parameters`: Parameters supplied to the create or update Security Partner Provider operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
security_partner_provider_name: impl Into<String>,
parameters: impl Into<models::SecurityPartnerProvider>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
security_partner_provider_name: security_partner_provider_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates tags of a Security Partner Provider resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `security_partner_provider_name`: The name of the Security Partner Provider."]
#[doc = "* `parameters`: Parameters supplied to update Security Partner Provider tags."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
security_partner_provider_name: impl Into<String>,
parameters: impl Into<models::TagsObject>,
subscription_id: impl Into<String>,
) -> update_tags::Builder {
update_tags::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
security_partner_provider_name: security_partner_provider_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified Security Partner Provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `security_partner_provider_name`: The name of the Security Partner Provider."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
security_partner_provider_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
security_partner_provider_name: security_partner_provider_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all Security Partner Providers in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the Security Partner Providers in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::SecurityPartnerProvider;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) security_partner_provider_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/securityPartnerProviders/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.security_partner_provider_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityPartnerProvider = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::SecurityPartnerProvider),
Ok200(models::SecurityPartnerProvider),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) security_partner_provider_name: String,
pub(crate) parameters: models::SecurityPartnerProvider,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/securityPartnerProviders/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.security_partner_provider_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityPartnerProvider = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityPartnerProvider = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod update_tags {
use super::models;
type Response = models::SecurityPartnerProvider;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) security_partner_provider_name: String,
pub(crate) parameters: models::TagsObject,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/securityPartnerProviders/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.security_partner_provider_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityPartnerProvider = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) security_partner_provider_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/securityPartnerProviders/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.security_partner_provider_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::SecurityPartnerProviderListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/securityPartnerProviders",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityPartnerProviderListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::SecurityPartnerProviderListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/securityPartnerProviders",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::SecurityPartnerProviderListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod bgp_service_communities {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets all the available bgp service communities."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::BgpServiceCommunityListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/bgpServiceCommunities",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::BgpServiceCommunityListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod service_tags {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of service tag information resources."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to)."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, location: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
location: location.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::ServiceTagsListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/locations/{}/serviceTags",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceTagsListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}
pub mod service_tag_information {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of service tag information resources with pagination."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location that will be used as a reference for cloud (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to)."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, location: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
location: location.into(),
subscription_id: subscription_id.into(),
no_address_prefixes: None,
tag_name: None,
}
}
}
pub mod list {
use super::models;
type Response = models::ServiceTagInformationListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) subscription_id: String,
pub(crate) no_address_prefixes: Option<bool>,
pub(crate) tag_name: Option<String>,
}
impl Builder {
#[doc = "Do not return address prefixes for the tag(s)."]
pub fn no_address_prefixes(mut self, no_address_prefixes: bool) -> Self {
self.no_address_prefixes = Some(no_address_prefixes);
self
}
#[doc = "Return tag information for a particular tag."]
pub fn tag_name(mut self, tag_name: impl Into<String>) -> Self {
self.tag_name = Some(tag_name.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/serviceTagDetails",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
if let Some(no_address_prefixes) = &this.no_address_prefixes {
req.url_mut()
.query_pairs_mut()
.append_pair("noAddressPrefixes", &no_address_prefixes.to_string());
}
if let Some(tag_name) = &this.tag_name {
req.url_mut().query_pairs_mut().append_pair("tagName", tag_name);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::ServiceTagInformationListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod usages {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List network usages for a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `location`: The location where resource usage is queried."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, location: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
location: location.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::UsagesListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) location: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/locations/{}/usages",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::UsagesListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_routers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Virtual Router."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_router_name`: The name of the Virtual Router."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
virtual_router_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_router_name: virtual_router_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates or updates the specified Virtual Router."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_router_name`: The name of the Virtual Router."]
#[doc = "* `parameters`: Parameters supplied to the create or update Virtual Router."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
virtual_router_name: impl Into<String>,
parameters: impl Into<models::VirtualRouter>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_router_name: virtual_router_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified Virtual Router."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_router_name`: The name of the Virtual Router."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
virtual_router_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_router_name: virtual_router_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all Virtual Routers in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::Builder {
list_by_resource_group::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the Virtual Routers in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualRouter;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_router_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl Builder {
#[doc = "Expands referenced resources."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_future(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.Network/virtualRouters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_router_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-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);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualRouter = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::VirtualRouter),
Ok200(models::VirtualRouter),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_router_name: String,
pub(crate) parameters: models::VirtualRouter,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualRouters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_router_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualRouter = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualRouter = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_router_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualRouters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_router_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
type Response = models::VirtualRouterListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualRouters",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualRouterListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list {
use super::models;
type Response = models::VirtualRouterListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualRouters",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualRouterListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod virtual_router_peerings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the specified Virtual Router Peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_router_name`: The name of the Virtual Router."]
#[doc = "* `peering_name`: The name of the Virtual Router Peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
virtual_router_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_router_name: virtual_router_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates the specified Virtual Router Peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_router_name`: The name of the Virtual Router."]
#[doc = "* `peering_name`: The name of the Virtual Router Peering."]
#[doc = "* `parameters`: Parameters supplied to the create or update Virtual Router Peering operation."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
virtual_router_name: impl Into<String>,
peering_name: impl Into<String>,
parameters: impl Into<models::VirtualRouterPeering>,
subscription_id: impl Into<String>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_router_name: virtual_router_name.into(),
peering_name: peering_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes the specified peering from a Virtual Router."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_router_name`: The name of the Virtual Router."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
virtual_router_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_router_name: virtual_router_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all Virtual Router Peerings in a Virtual Router resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `virtual_router_name`: The name of the Virtual Router."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
virtual_router_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
virtual_router_name: virtual_router_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
type Response = models::VirtualRouterPeering;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_router_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/virtualRouters/{}/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_router_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualRouterPeering = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Created201(models::VirtualRouterPeering),
Ok200(models::VirtualRouterPeering),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_router_name: String,
pub(crate) peering_name: String,
pub(crate) parameters: models::VirtualRouterPeering,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualRouters/{}/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_router_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, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualRouterPeering = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualRouterPeering = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_router_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/virtualRouters/{}/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_router_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, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod list {
use super::models;
type Response = models::VirtualRouterPeeringListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) virtual_router_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/virtualRouters/{}/peerings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.virtual_router_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::VirtualRouterPeeringListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod web_application_firewall_policies {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the protection policies within a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> list::Builder {
list::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all the WAF policies in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn list_all(&self, subscription_id: impl Into<String>) -> list_all::Builder {
list_all::Builder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Retrieve protection policy with specified name within a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `policy_name`: The name of the policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::Builder {
get::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
policy_name: policy_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or update policy with specified rule set name within a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `policy_name`: The name of the policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
#[doc = "* `parameters`: Policy to be created."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
policy_name: impl Into<String>,
subscription_id: impl Into<String>,
parameters: impl Into<models::WebApplicationFirewallPolicy>,
) -> create_or_update::Builder {
create_or_update::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
policy_name: policy_name.into(),
subscription_id: subscription_id.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes Policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `policy_name`: The name of the policy."]
#[doc = "* `subscription_id`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
policy_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::Builder {
delete::Builder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
policy_name: policy_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
type Response = models::WebApplicationFirewallPolicyListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ApplicationGatewayWebApplicationFirewallPolicies" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name)) ? ;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::WebApplicationFirewallPolicyListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_all {
use super::models;
type Response = models::WebApplicationFirewallPolicyListResult;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_stream(self) -> azure_core::Pageable<Response, 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.Network/ApplicationGatewayWebApplicationFirewallPolicies",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::WebApplicationFirewallPolicyListResult = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
type Response = models::WebApplicationFirewallPolicy;
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
pub fn into_future(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.Network/ApplicationGatewayWebApplicationFirewallPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::WebApplicationFirewallPolicy = serde_json::from_slice(&rsp_body)?;
Ok(rsp_value)
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod create_or_update {
use super::models;
#[derive(Debug)]
pub enum Response {
Ok200(models::WebApplicationFirewallPolicy),
Created201(models::WebApplicationFirewallPolicy),
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) policy_name: String,
pub(crate) subscription_id: String,
pub(crate) parameters: models::WebApplicationFirewallPolicy,
}
impl Builder {
pub fn into_future(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.Network/ApplicationGatewayWebApplicationFirewallPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Ok => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::WebApplicationFirewallPolicy = serde_json::from_slice(&rsp_body)?;
Ok(Response::Ok200(rsp_value))
}
azure_core::StatusCode::Created => {
let rsp_body = rsp_stream.collect().await?;
let rsp_value: models::WebApplicationFirewallPolicy = serde_json::from_slice(&rsp_body)?;
Ok(Response::Created201(rsp_value))
}
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
pub mod delete {
use super::models;
#[derive(Debug)]
pub enum Response {
Accepted202,
NoContent204,
Ok200,
}
#[derive(Clone)]
pub struct Builder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) policy_name: String,
pub(crate) subscription_id: String,
}
impl Builder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
pub fn into_future(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.Network/ApplicationGatewayWebApplicationFirewallPolicies/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . policy_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
let rsp = this.client.send(&mut req).await?;
let (rsp_status, rsp_headers, rsp_stream) = rsp.deconstruct();
match rsp_status {
azure_core::StatusCode::Accepted => Ok(Response::Accepted202),
azure_core::StatusCode::NoContent => Ok(Response::NoContent204),
azure_core::StatusCode::Ok => Ok(Response::Ok200),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
}
}
})
}
}
}
}