#![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 certificates_client(&self) -> certificates::Client {
certificates::Client(self.clone())
}
pub fn iot_hub_client(&self) -> iot_hub::Client {
iot_hub::Client(self.clone())
}
pub fn iot_hub_resource_client(&self) -> iot_hub_resource::Client {
iot_hub_resource::Client(self.clone())
}
pub fn operations_client(&self) -> operations::Client {
operations::Client(self.clone())
}
pub fn private_endpoint_connections_client(&self) -> private_endpoint_connections::Client {
private_endpoint_connections::Client(self.clone())
}
pub fn private_link_resources_client(&self) -> private_link_resources::Client {
private_link_resources::Client(self.clone())
}
pub fn resource_provider_common_client(&self) -> resource_provider_common::Client {
resource_provider_common::Client(self.clone())
}
}
pub mod operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available IoT Hub REST API operations."]
pub fn list(&self) -> list::RequestBuilder {
list::RequestBuilder { client: self.0.clone() }
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OperationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::OperationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::OperationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url =
azure_core::Url::parse(&format!("{}/providers/Microsoft.Devices/operations", this.client.endpoint(),))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod iot_hub_resource {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the non-security related metadata of an IoT hub"]
#[doc = "Get the non-security related metadata of an IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Create or update the metadata of an IoT hub."]
#[doc = "Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub metadata and security metadata, and then combine them with the modified values in a new body to update the IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `iot_hub_description`: The IoT hub metadata and security metadata."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
iot_hub_description: impl Into<models::IotHubDescription>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
iot_hub_description: iot_hub_description.into(),
if_match: None,
}
}
#[doc = "Update an existing IoT Hubs tags."]
#[doc = "Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: Resource group identifier."]
#[doc = "* `resource_name`: Name of iot hub to update."]
#[doc = "* `iot_hub_tags`: Updated tag information to set into the iot hub instance."]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
iot_hub_tags: impl Into<models::TagsResource>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
iot_hub_tags: iot_hub_tags.into(),
}
}
#[doc = "Delete an IoT hub"]
#[doc = "Delete an IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get all the IoT hubs in a subscription"]
#[doc = "Get all the IoT hubs in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
pub fn list_by_subscription(&self, subscription_id: impl Into<String>) -> list_by_subscription::RequestBuilder {
list_by_subscription::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get all the IoT hubs in a resource group"]
#[doc = "Get all the IoT hubs in a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Get the statistics from an IoT hub"]
#[doc = "Get the statistics from an IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn get_stats(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> get_stats::RequestBuilder {
get_stats::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get the list of valid SKUs for an IoT hub"]
#[doc = "Get the list of valid SKUs for an IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn get_valid_skus(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> get_valid_skus::RequestBuilder {
get_valid_skus::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub"]
#[doc = "Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `event_hub_endpoint_name`: The name of the Event Hub-compatible endpoint."]
pub fn list_event_hub_consumer_groups(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
event_hub_endpoint_name: impl Into<String>,
) -> list_event_hub_consumer_groups::RequestBuilder {
list_event_hub_consumer_groups::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
event_hub_endpoint_name: event_hub_endpoint_name.into(),
}
}
#[doc = "Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub"]
#[doc = "Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `event_hub_endpoint_name`: The name of the Event Hub-compatible endpoint in the IoT hub."]
#[doc = "* `name`: The name of the consumer group to retrieve."]
pub fn get_event_hub_consumer_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
event_hub_endpoint_name: impl Into<String>,
name: impl Into<String>,
) -> get_event_hub_consumer_group::RequestBuilder {
get_event_hub_consumer_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
event_hub_endpoint_name: event_hub_endpoint_name.into(),
name: name.into(),
}
}
#[doc = "Add a consumer group to an Event Hub-compatible endpoint in an IoT hub"]
#[doc = "Add a consumer group to an Event Hub-compatible endpoint in an IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `event_hub_endpoint_name`: The name of the Event Hub-compatible endpoint in the IoT hub."]
#[doc = "* `name`: The name of the consumer group to add."]
#[doc = "* `consumer_group_body`: The consumer group to add."]
pub fn create_event_hub_consumer_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
event_hub_endpoint_name: impl Into<String>,
name: impl Into<String>,
consumer_group_body: impl Into<models::EventHubConsumerGroupBodyDescription>,
) -> create_event_hub_consumer_group::RequestBuilder {
create_event_hub_consumer_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
event_hub_endpoint_name: event_hub_endpoint_name.into(),
name: name.into(),
consumer_group_body: consumer_group_body.into(),
}
}
#[doc = "Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub"]
#[doc = "Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `event_hub_endpoint_name`: The name of the Event Hub-compatible endpoint in the IoT hub."]
#[doc = "* `name`: The name of the consumer group to delete."]
pub fn delete_event_hub_consumer_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
event_hub_endpoint_name: impl Into<String>,
name: impl Into<String>,
) -> delete_event_hub_consumer_group::RequestBuilder {
delete_event_hub_consumer_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
event_hub_endpoint_name: event_hub_endpoint_name.into(),
name: name.into(),
}
}
#[doc = "Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry"]
#[doc = "Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn list_jobs(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> list_jobs::RequestBuilder {
list_jobs::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry"]
#[doc = "Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `job_id`: The job identifier."]
pub fn get_job(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
job_id: impl Into<String>,
) -> get_job::RequestBuilder {
get_job::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
job_id: job_id.into(),
}
}
#[doc = "Get the quota metrics for an IoT hub"]
#[doc = "Get the quota metrics for an IoT hub."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn get_quota_metrics(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> get_quota_metrics::RequestBuilder {
get_quota_metrics::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get the health for routing endpoints"]
#[doc = "Get the health for routing endpoints."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
pub fn get_endpoint_health(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
iot_hub_name: impl Into<String>,
) -> get_endpoint_health::RequestBuilder {
get_endpoint_health::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
iot_hub_name: iot_hub_name.into(),
}
}
#[doc = "Check if an IoT hub name is available"]
#[doc = "Check if an IoT hub name is available."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `operation_inputs`: Set the name parameter in the OperationInputs structure to the name of the IoT hub to check."]
pub fn check_name_availability(
&self,
subscription_id: impl Into<String>,
operation_inputs: impl Into<models::OperationInputs>,
) -> check_name_availability::RequestBuilder {
check_name_availability::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
operation_inputs: operation_inputs.into(),
}
}
#[doc = "Test all routes"]
#[doc = "Test all routes configured in this Iot Hub"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `input`: Input for testing all routes"]
#[doc = "* `iot_hub_name`: IotHub to be tested"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: resource group which Iot Hub belongs to"]
pub fn test_all_routes(
&self,
input: impl Into<models::TestAllRoutesInput>,
iot_hub_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> test_all_routes::RequestBuilder {
test_all_routes::RequestBuilder {
client: self.0.clone(),
input: input.into(),
iot_hub_name: iot_hub_name.into(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Test the new route"]
#[doc = "Test the new route for this Iot Hub"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `input`: Route that needs to be tested"]
#[doc = "* `iot_hub_name`: IotHub to be tested"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: resource group which Iot Hub belongs to"]
pub fn test_route(
&self,
input: impl Into<models::TestRouteInput>,
iot_hub_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> test_route::RequestBuilder {
test_route::RequestBuilder {
client: self.0.clone(),
input: input.into(),
iot_hub_name: iot_hub_name.into(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security"]
#[doc = "Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn list_keys(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> list_keys::RequestBuilder {
list_keys::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security"]
#[doc = "Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `key_name`: The name of the shared access policy."]
pub fn get_keys_for_key_name(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
key_name: impl Into<String>,
) -> get_keys_for_key_name::RequestBuilder {
get_keys_for_key_name::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
key_name: key_name.into(),
}
}
#[doc = "Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities"]
#[doc = "Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `export_devices_parameters`: The parameters that specify the export devices operation."]
pub fn export_devices(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
export_devices_parameters: impl Into<models::ExportDevicesRequest>,
) -> export_devices::RequestBuilder {
export_devices::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
export_devices_parameters: export_devices_parameters.into(),
}
}
#[doc = "Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities"]
#[doc = "Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `import_devices_parameters`: The parameters that specify the import devices operation."]
pub fn import_devices(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
import_devices_parameters: impl Into<models::ImportDevicesRequest>,
) -> import_devices::RequestBuilder {
import_devices::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
import_devices_parameters: import_devices_parameters.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IotHubDescription> {
let bytes = self.0.into_body().collect().await?;
let body: models::IotHubDescription = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::IotHubDescription>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IotHubDescription> {
let bytes = self.0.into_body().collect().await?;
let body: models::IotHubDescription = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to query for status of the operation."]
pub fn azure_async_operation(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("azure-asyncoperation"))
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) iot_hub_description: models::IotHubDescription,
pub(crate) if_match: Option<String>,
}
impl RequestBuilder {
#[doc = "ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required to update an existing IoT Hub."]
pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
self.if_match = Some(if_match.into());
self
}
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.iot_hub_description)?;
if let Some(if_match) = &this.if_match {
req.insert_header("if-match", if_match);
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::IotHubDescription>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IotHubDescription> {
let bytes = self.0.into_body().collect().await?;
let body: models::IotHubDescription = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to query for status of the operation."]
pub fn azure_async_operation(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("azure-asyncoperation"))
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) iot_hub_tags: models::TagsResource,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.iot_hub_tags)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::IotHubDescription>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IotHubDescription> {
let bytes = self.0.into_body().collect().await?;
let body: models::IotHubDescription = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to query for status of the operation."]
pub fn azure_async_operation(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("azure-asyncoperation"))
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::IotHubDescription>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_by_subscription {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IotHubDescriptionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::IotHubDescriptionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::IotHubDescriptionListResult, 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.Devices/IotHubs",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IotHubDescriptionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::IotHubDescriptionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::IotHubDescriptionListResult, 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.Devices/IotHubs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_stats {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RegistryStatistics> {
let bytes = self.0.into_body().collect().await?;
let body: models::RegistryStatistics = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/IotHubStats",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::RegistryStatistics>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_valid_skus {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IotHubSkuDescriptionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::IotHubSkuDescriptionListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::IotHubSkuDescriptionListResult, 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.Devices/IotHubs/{}/skus",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_event_hub_consumer_groups {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EventHubConsumerGroupsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::EventHubConsumerGroupsListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) event_hub_endpoint_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::EventHubConsumerGroupsListResult, 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.Devices/IotHubs/{}/eventHubEndpoints/{}/ConsumerGroups" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . resource_name , & this . event_hub_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, "2022-04-30-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_event_hub_consumer_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EventHubConsumerGroupInfo> {
let bytes = self.0.into_body().collect().await?;
let body: models::EventHubConsumerGroupInfo = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) event_hub_endpoint_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/eventHubEndpoints/{}/ConsumerGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . resource_name , & this . event_hub_endpoint_name , & 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, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::EventHubConsumerGroupInfo>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_event_hub_consumer_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EventHubConsumerGroupInfo> {
let bytes = self.0.into_body().collect().await?;
let body: models::EventHubConsumerGroupInfo = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) event_hub_endpoint_name: String,
pub(crate) name: String,
pub(crate) consumer_group_body: models::EventHubConsumerGroupBodyDescription,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/eventHubEndpoints/{}/ConsumerGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . resource_name , & this . event_hub_endpoint_name , & this . name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.consumer_group_body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::EventHubConsumerGroupInfo>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_event_hub_consumer_group {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) event_hub_endpoint_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/eventHubEndpoints/{}/ConsumerGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . resource_name , & this . event_hub_endpoint_name , & this . name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_jobs {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobResponseListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobResponseListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::JobResponseListResult, 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.Devices/IotHubs/{}/jobs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_job {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) job_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/jobs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.job_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_quota_metrics {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IotHubQuotaMetricInfoListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::IotHubQuotaMetricInfoListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::IotHubQuotaMetricInfoListResult, 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.Devices/IotHubs/{}/quotaMetrics",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_endpoint_health {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EndpointHealthDataListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::EndpointHealthDataListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) iot_hub_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::EndpointHealthDataListResult, 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.Devices/IotHubs/{}/routingEndpointsHealth",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.iot_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, "2022-04-30-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod check_name_availability {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::IotHubNameAvailabilityInfo> {
let bytes = self.0.into_body().collect().await?;
let body: models::IotHubNameAvailabilityInfo = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) operation_inputs: models::OperationInputs,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Devices/checkNameAvailability",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.operation_inputs)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::IotHubNameAvailabilityInfo>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod test_all_routes {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TestAllRoutesResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::TestAllRoutesResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) input: models::TestAllRoutesInput,
pub(crate) iot_hub_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/routing/routes/$testall",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.iot_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, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.input)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::TestAllRoutesResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod test_route {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TestRouteResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::TestRouteResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) input: models::TestRouteInput,
pub(crate) iot_hub_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/routing/routes/$testnew",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.iot_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, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.input)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::TestRouteResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_keys {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SharedAccessSignatureAuthorizationRuleListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::SharedAccessSignatureAuthorizationRuleListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
pub fn into_stream(
self,
) -> azure_core::Pageable<models::SharedAccessSignatureAuthorizationRuleListResult, 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.Devices/IotHubs/{}/listkeys",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::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, "2022-04-30-preview");
}
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, "2022-04-30-preview");
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 = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get_keys_for_key_name {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::SharedAccessSignatureAuthorizationRule> {
let bytes = self.0.into_body().collect().await?;
let body: models::SharedAccessSignatureAuthorizationRule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) key_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/IotHubKeys/{}/listkeys",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.key_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, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::SharedAccessSignatureAuthorizationRule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod export_devices {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) export_devices_parameters: models::ExportDevicesRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/exportDevices",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.export_devices_parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod import_devices {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::JobResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::JobResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) import_devices_parameters: models::ImportDevicesRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/importDevices",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.import_devices_parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::JobResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod resource_provider_common {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the number of iot hubs in the subscription"]
#[doc = "Get the number of free and paid iot hubs in the subscription"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
pub fn get_subscription_quota(&self, subscription_id: impl Into<String>) -> get_subscription_quota::RequestBuilder {
get_subscription_quota::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get_subscription_quota {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::UserSubscriptionQuotaListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::UserSubscriptionQuotaListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Devices/usages",
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, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::UserSubscriptionQuotaListResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod certificates {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get the certificate list."]
#[doc = "Returns the list of certificates."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn list_by_iot_hub(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> list_by_iot_hub::RequestBuilder {
list_by_iot_hub::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get the certificate."]
#[doc = "Returns the certificate."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `certificate_name`: The name of the certificate"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
certificate_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
certificate_name: certificate_name.into(),
}
}
#[doc = "Upload the certificate to the IoT hub."]
#[doc = "Adds new or replaces existing certificate."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `certificate_name`: The name of the certificate"]
#[doc = "* `certificate_description`: The certificate body."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
certificate_name: impl Into<String>,
certificate_description: impl Into<models::CertificateDescription>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
certificate_name: certificate_name.into(),
certificate_description: certificate_description.into(),
if_match: None,
}
}
#[doc = "Delete an X509 certificate."]
#[doc = "Deletes an existing X509 certificate or does nothing if it does not exist."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `certificate_name`: The name of the certificate"]
#[doc = "* `if_match`: ETag of the Certificate."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
certificate_name: impl Into<String>,
if_match: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
certificate_name: certificate_name.into(),
if_match: if_match.into(),
}
}
#[doc = "Generate verification code for proof of possession flow."]
#[doc = "Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `certificate_name`: The name of the certificate"]
#[doc = "* `if_match`: ETag of the Certificate."]
pub fn generate_verification_code(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
certificate_name: impl Into<String>,
if_match: impl Into<String>,
) -> generate_verification_code::RequestBuilder {
generate_verification_code::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
certificate_name: certificate_name.into(),
if_match: if_match.into(),
}
}
#[doc = "Verify certificate's private key possession."]
#[doc = "Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `certificate_name`: The name of the certificate"]
#[doc = "* `certificate_verification_body`: The name of the certificate"]
#[doc = "* `if_match`: ETag of the Certificate."]
pub fn verify(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
certificate_name: impl Into<String>,
certificate_verification_body: impl Into<models::CertificateVerificationDescription>,
if_match: impl Into<String>,
) -> verify::RequestBuilder {
verify::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
certificate_name: certificate_name.into(),
certificate_verification_body: certificate_verification_body.into(),
if_match: if_match.into(),
}
}
}
pub mod list_by_iot_hub {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CertificateListDescription> {
let bytes = self.0.into_body().collect().await?;
let body: models::CertificateListDescription = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/certificates",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CertificateListDescription>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CertificateDescription> {
let bytes = self.0.into_body().collect().await?;
let body: models::CertificateDescription = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) certificate_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/certificates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.certificate_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CertificateDescription>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CertificateDescription> {
let bytes = self.0.into_body().collect().await?;
let body: models::CertificateDescription = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) certificate_name: String,
pub(crate) certificate_description: models::CertificateDescription,
pub(crate) if_match: Option<String>,
}
impl RequestBuilder {
#[doc = "ETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate."]
pub fn if_match(mut self, if_match: impl Into<String>) -> Self {
self.if_match = Some(if_match.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/certificates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.certificate_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.certificate_description)?;
if let Some(if_match) = &this.if_match {
req.insert_header("if-match", if_match);
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CertificateDescription>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) certificate_name: String,
pub(crate) if_match: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/certificates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.certificate_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
req.insert_header("if-match", &this.if_match);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod generate_verification_code {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CertificateWithNonceDescription> {
let bytes = self.0.into_body().collect().await?;
let body: models::CertificateWithNonceDescription = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) certificate_name: String,
pub(crate) if_match: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/certificates/{}/generateVerificationCode" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . resource_name , & this . certificate_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, "2022-04-30-preview");
req.insert_header("if-match", &this.if_match);
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CertificateWithNonceDescription>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod verify {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CertificateDescription> {
let bytes = self.0.into_body().collect().await?;
let body: models::CertificateDescription = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) certificate_name: String,
pub(crate) certificate_verification_body: models::CertificateVerificationDescription,
pub(crate) if_match: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/certificates/{}/verify",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.certificate_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, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.certificate_verification_body)?;
req.insert_header("if-match", &this.if_match);
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CertificateDescription>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod iot_hub {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Manually initiate a failover for the IoT Hub to its secondary region"]
#[doc = "Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `iot_hub_name`: Name of the IoT hub to failover"]
#[doc = "* `failover_input`: Region to failover to. Must be the Azure paired region. Get the value from the secondary location in the locations property. To learn more, see https://aka.ms/manualfailover/region"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: Name of the resource group containing the IoT hub resource"]
pub fn manual_failover(
&self,
iot_hub_name: impl Into<String>,
failover_input: impl Into<models::FailoverInput>,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> manual_failover::RequestBuilder {
manual_failover::RequestBuilder {
client: self.0.clone(),
iot_hub_name: iot_hub_name.into(),
failover_input: failover_input.into(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
}
pub mod manual_failover {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) iot_hub_name: String,
pub(crate) failover_input: models::FailoverInput,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/IotHubs/{}/failover",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.iot_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, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.failover_input)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod private_link_resources {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List private link resources"]
#[doc = "List private link resources for the given IotHub"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get the specified private link resource"]
#[doc = "Get the specified private link resource for the given IotHub"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `group_id`: The name of the private link resource"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
group_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
group_id: group_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateLinkResources> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateLinkResources = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/iotHubs/{}/privateLinkResources",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PrivateLinkResources>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GroupIdInformation> {
let bytes = self.0.into_body().collect().await?;
let body: models::GroupIdInformation = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) group_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/iotHubs/{}/privateLinkResources/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.group_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::GroupIdInformation>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod private_endpoint_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List private endpoint connections"]
#[doc = "List private endpoint connection properties"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get private endpoint connection"]
#[doc = "Get private endpoint connection properties"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `private_endpoint_connection_name`: The name of the private endpoint connection"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
private_endpoint_connection_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
private_endpoint_connection_name: private_endpoint_connection_name.into(),
}
}
#[doc = "Update private endpoint connection"]
#[doc = "Update the status of a private endpoint connection with the specified name"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `private_endpoint_connection_name`: The name of the private endpoint connection"]
#[doc = "* `private_endpoint_connection`: The private endpoint connection with updated properties"]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
private_endpoint_connection_name: impl Into<String>,
private_endpoint_connection: impl Into<models::PrivateEndpointConnection>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
private_endpoint_connection_name: private_endpoint_connection_name.into(),
private_endpoint_connection: private_endpoint_connection.into(),
}
}
#[doc = "Delete private endpoint connection"]
#[doc = "Delete private endpoint connection with the specified name"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription identifier."]
#[doc = "* `resource_group_name`: The name of the resource group that contains the IoT hub."]
#[doc = "* `resource_name`: The name of the IoT hub."]
#[doc = "* `private_endpoint_connection_name`: The name of the private endpoint connection"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
private_endpoint_connection_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
private_endpoint_connection_name: private_endpoint_connection_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateEndpointConnectionsList> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateEndpointConnectionsList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/iotHubs/{}/privateEndpointConnections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PrivateEndpointConnectionsList>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateEndpointConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateEndpointConnection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) private_endpoint_connection_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/iotHubs/{}/privateEndpointConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.private_endpoint_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, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PrivateEndpointConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateEndpointConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateEndpointConnection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to query for status of the operation."]
pub fn azure_async_operation(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("azure-asyncoperation"))
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) private_endpoint_connection_name: String,
pub(crate) private_endpoint_connection: models::PrivateEndpointConnection,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/iotHubs/{}/privateEndpointConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.private_endpoint_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, "2022-04-30-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.private_endpoint_connection)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PrivateEndpointConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateEndpointConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateEndpointConnection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to query for status of the operation."]
pub fn azure_async_operation(&self) -> azure_core::Result<&str> {
self.0
.get_str(&azure_core::headers::HeaderName::from_static("azure-asyncoperation"))
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) private_endpoint_connection_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Devices/iotHubs/{}/privateEndpointConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.private_endpoint_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, "2022-04-30-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PrivateEndpointConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}