use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct DevicesDeviceDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
device_id: Result<types::TeamsDevicesRegistrationId, String>,
}
impl<'a> DevicesDeviceDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
device_id: Err("device_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn device_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesRegistrationId>,
{
self.device_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesRegistrationId` for device_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
device_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let device_id = device_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&device_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_device_details",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesListAdminOverrideCodeForDevice<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
device_id: Result<types::TeamsDevicesRegistrationId, String>,
}
impl<'a> DevicesListAdminOverrideCodeForDevice<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
device_id: Err("device_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn device_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesRegistrationId>,
{
self.device_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesRegistrationId` for device_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
device_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let device_id = device_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/{}/override_codes",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&device_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_list_admin_override_code_for_device",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesGetDeviceSettingsPolicyById<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
policy_id: Result<types::TeamsDevicesSchemasUuid, String>,
}
impl<'a> DevicesGetDeviceSettingsPolicyById<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
policy_id: Err("policy_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesSchemasUuid>,
{
self.policy_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesSchemasUuid` for policy_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
policy_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/policy/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&policy_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_get_device_settings_policy_by_id",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesDeleteDeviceSettingsPolicy<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
policy_id: Result<types::TeamsDevicesSchemasUuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DevicesDeleteDeviceSettingsPolicy<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
policy_id: Err("policy_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesSchemasUuid>,
{
self.policy_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesSchemasUuid` for policy_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
policy_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/policy/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&policy_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_delete_device_settings_policy",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesUpdateDeviceSettingsPolicy<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
policy_id: Result<types::TeamsDevicesSchemasUuid, String>,
body: Result<types::builder::DevicesUpdateDeviceSettingsPolicyBody, String>,
}
impl<'a> DevicesUpdateDeviceSettingsPolicy<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
policy_id: Err("policy_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesSchemasUuid>,
{
self.policy_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesSchemasUuid` for policy_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DevicesUpdateDeviceSettingsPolicyBody>,
<V as std::convert::TryInto<types::DevicesUpdateDeviceSettingsPolicyBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `DevicesUpdateDeviceSettingsPolicyBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::DevicesUpdateDeviceSettingsPolicyBody,
)
-> types::builder::DevicesUpdateDeviceSettingsPolicyBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
policy_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::DevicesUpdateDeviceSettingsPolicyBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/policy/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&policy_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.patch(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_update_device_settings_policy",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesGetSplitTunnelExcludeList<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
}
impl<'a> DevicesGetSplitTunnelExcludeList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self { client, account_id } = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/policy/exclude",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_get_split_tunnel_exclude_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesSetSplitTunnelExcludeList<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
body: Result<::std::vec::Vec<types::TeamsDevicesSplitTunnel>, String>,
}
impl<'a> DevicesSetSplitTunnelExcludeList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::TeamsDevicesSplitTunnel>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < TeamsDevicesSplitTunnel >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/policy/exclude",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_set_split_tunnel_exclude_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesGetLocalDomainFallbackList<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
}
impl<'a> DevicesGetLocalDomainFallbackList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self { client, account_id } = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/policy/fallback_domains",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_get_local_domain_fallback_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesSetLocalDomainFallbackList<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
body: Result<::std::vec::Vec<types::TeamsDevicesFallbackDomain>, String>,
}
impl<'a> DevicesSetLocalDomainFallbackList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::TeamsDevicesFallbackDomain>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < TeamsDevicesFallbackDomain >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/policy/fallback_domains",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_set_local_domain_fallback_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesGetSplitTunnelIncludeList<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
}
impl<'a> DevicesGetSplitTunnelIncludeList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self { client, account_id } = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/policy/include",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_get_split_tunnel_include_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesSetSplitTunnelIncludeList<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
body: Result<::std::vec::Vec<types::TeamsDevicesSplitTunnelInclude>, String>,
}
impl<'a> DevicesSetSplitTunnelIncludeList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::TeamsDevicesSplitTunnelInclude>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < TeamsDevicesSplitTunnelInclude >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/policy/include",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_set_split_tunnel_include_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicePostureRulesUpdateDevicePostureRule<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
rule_id: Result<types::TeamsDevicesUuid, String>,
body: Result<types::builder::DevicePostureRulesUpdateDevicePostureRuleBody, String>,
}
impl<'a> DevicePostureRulesUpdateDevicePostureRule<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
rule_id: Err("rule_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn rule_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesUuid>,
{
self.rule_id = value
.try_into()
.map_err(|_| "conversion to `TeamsDevicesUuid` for rule_id failed".to_string());
self
} pub fn body < V > (mut self , value : V) -> Self where V : std :: convert :: TryInto < types :: DevicePostureRulesUpdateDevicePostureRuleBody > , < V as std :: convert :: TryInto < types :: DevicePostureRulesUpdateDevicePostureRuleBody >> :: Error : std :: fmt :: Display ,{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `DevicePostureRulesUpdateDevicePostureRuleBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::DevicePostureRulesUpdateDevicePostureRuleBody,
)
-> types::builder::DevicePostureRulesUpdateDevicePostureRuleBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
rule_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let rule_id = rule_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::DevicePostureRulesUpdateDevicePostureRuleBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/posture/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&rule_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "device_posture_rules_update_device_posture_rule",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicePostureRulesDeleteDevicePostureRule<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
rule_id: Result<types::TeamsDevicesUuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DevicePostureRulesDeleteDevicePostureRule<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
rule_id: Err("rule_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn rule_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesUuid>,
{
self.rule_id = value
.try_into()
.map_err(|_| "conversion to `TeamsDevicesUuid` for rule_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
rule_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let rule_id = rule_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/posture/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&rule_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "device_posture_rules_delete_device_posture_rule",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesResilienceRetrieveGlobalWarpOverride<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
}
impl<'a> DevicesResilienceRetrieveGlobalWarpOverride<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self { client, account_id } = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/resilience/disconnect",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_resilience_retrieve_global_warp_override",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesResilienceSetGlobalWarpOverride<'a> {
client: &'a crate::Client,
account_id: Result<types::TeamsDevicesIdentifier, String>,
body: Result<types::builder::TeamsDevicesGlobalWarpOverrideRequest, String>,
}
impl<'a> DevicesResilienceSetGlobalWarpOverride<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesGlobalWarpOverrideRequest>,
<V as std::convert::TryInto<types::TeamsDevicesGlobalWarpOverrideRequest>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `TeamsDevicesGlobalWarpOverrideRequest` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::TeamsDevicesGlobalWarpOverrideRequest,
)
-> types::builder::TeamsDevicesGlobalWarpOverrideRequest,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::TeamsDevicesGlobalWarpOverrideRequest::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/devices/resilience/disconnect",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_resilience_set_global_warp_override",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesLiveStatus<'a> {
client: &'a crate::Client,
account_id: Result<types::DigitalExperienceMonitoringAccountIdentifier, String>,
device_id: Result<types::DigitalExperienceMonitoringDeviceId, String>,
colo: Result<types::DigitalExperienceMonitoringColo, String>,
since_minutes: Result<types::DigitalExperienceMonitoringSinceMinutes, String>,
time_now: Result<types::DigitalExperienceMonitoringTimeNow, String>,
}
impl<'a> DevicesLiveStatus<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
device_id: Err("device_id was not initialized".to_string()),
colo: Err("colo was not initialized".to_string()),
since_minutes: Err("since_minutes was not initialized".to_string()),
time_now: Err("time_now was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringAccountIdentifier>,
{
self . account_id = value . try_into () . map_err (| _ | "conversion to `DigitalExperienceMonitoringAccountIdentifier` for account_id failed" . to_string ()) ;
self
}
pub fn device_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringDeviceId>,
{
self.device_id = value.try_into().map_err(|_| {
"conversion to `DigitalExperienceMonitoringDeviceId` for device_id failed"
.to_string()
});
self
}
pub fn colo<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringColo>,
{
self.colo = value.try_into().map_err(|_| {
"conversion to `DigitalExperienceMonitoringColo` for colo failed".to_string()
});
self
}
pub fn since_minutes<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringSinceMinutes>,
{
self . since_minutes = value . try_into () . map_err (| _ | "conversion to `DigitalExperienceMonitoringSinceMinutes` for since_minutes failed" . to_string ()) ;
self
}
pub fn time_now<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringTimeNow>,
{
self.time_now = value.try_into().map_err(|_| {
"conversion to `DigitalExperienceMonitoringTimeNow` for time_now failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
device_id,
colo,
since_minutes,
time_now,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let device_id = device_id.map_err(Error::InvalidRequest)?;
let colo = colo.map_err(Error::InvalidRequest)?;
let since_minutes = since_minutes.map_err(Error::InvalidRequest)?;
let time_now = time_now.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dex/devices/{}/fleet-status/live",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&device_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("colo", &colo))
.query(&progenitor_client::QueryParam::new(
"since_minutes",
&since_minutes,
))
.query(&progenitor_client::QueryParam::new("time_now", &time_now))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_live_status",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceDexTestDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::DigitalExperienceMonitoringAccountIdentifier, String>,
kind: Result<types::DeviceDexTestDetailsKind, String>,
page: Result<f64, String>,
per_page: Result<f64, String>,
test_name: Result<::std::string::String, String>,
}
impl<'a> DeviceDexTestDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
kind: Err("kind was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
test_name: Err("test_name was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringAccountIdentifier>,
{
self . account_id = value . try_into () . map_err (| _ | "conversion to `DigitalExperienceMonitoringAccountIdentifier` for account_id failed" . to_string ()) ;
self
}
pub fn kind<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DeviceDexTestDetailsKind>,
{
self.kind = value.try_into().map_err(|_| {
"conversion to `DeviceDexTestDetailsKind` for kind failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.page = value
.try_into()
.map_err(|_| "conversion to `f64` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `f64` for per_page failed".to_string());
self
}
pub fn test_name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.test_name = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for test_name failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
kind,
page,
per_page,
test_name,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let kind = kind.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let test_name = test_name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dex/devices/dex_tests",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("kind", &kind))
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("testName", &test_name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "device_dex_test_details",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceDexTestCreateDeviceDexTest<'a> {
client: &'a crate::Client,
account_id: Result<types::DigitalExperienceMonitoringAccountIdentifier, String>,
body: Result<types::builder::DigitalExperienceMonitoringDeviceDexTestSchemasHttp, String>,
}
impl<'a> DeviceDexTestCreateDeviceDexTest<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringAccountIdentifier>,
{
self . account_id = value . try_into () . map_err (| _ | "conversion to `DigitalExperienceMonitoringAccountIdentifier` for account_id failed" . to_string ()) ;
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringDeviceDexTestSchemasHttp>,
<V as std::convert::TryInto<
types::DigitalExperienceMonitoringDeviceDexTestSchemasHttp,
>>::Error: std::fmt::Display,
{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `DigitalExperienceMonitoringDeviceDexTestSchemasHttp` for body failed: {}" , s)) ;
self
} pub fn body < F > (mut self , f : F) -> Self where F : std :: ops :: FnOnce (types :: builder :: DigitalExperienceMonitoringDeviceDexTestSchemasHttp) -> types :: builder :: DigitalExperienceMonitoringDeviceDexTestSchemasHttp ,{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::DigitalExperienceMonitoringDeviceDexTestSchemasHttp::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dex/devices/dex_tests",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "device_dex_test_create_device_dex_test",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceDexTestGetDeviceDexTest<'a> {
client: &'a crate::Client,
account_id: Result<types::DigitalExperienceMonitoringAccountIdentifier, String>,
dex_test_id: Result<types::DigitalExperienceMonitoringSchemasTestId, String>,
}
impl<'a> DeviceDexTestGetDeviceDexTest<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dex_test_id: Err("dex_test_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringAccountIdentifier>,
{
self . account_id = value . try_into () . map_err (| _ | "conversion to `DigitalExperienceMonitoringAccountIdentifier` for account_id failed" . to_string ()) ;
self
}
pub fn dex_test_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringSchemasTestId>,
{
self . dex_test_id = value . try_into () . map_err (| _ | "conversion to `DigitalExperienceMonitoringSchemasTestId` for dex_test_id failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
dex_test_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dex_test_id = dex_test_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dex/devices/dex_tests/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dex_test_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "device_dex_test_get_device_dex_test",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceDexTestUpdateDeviceDexTest<'a> {
client: &'a crate::Client,
account_id: Result<types::DigitalExperienceMonitoringAccountIdentifier, String>,
dex_test_id: Result<types::DigitalExperienceMonitoringUuid, String>,
body: Result<types::builder::DigitalExperienceMonitoringDeviceDexTestSchemasHttp, String>,
}
impl<'a> DeviceDexTestUpdateDeviceDexTest<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dex_test_id: Err("dex_test_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringAccountIdentifier>,
{
self . account_id = value . try_into () . map_err (| _ | "conversion to `DigitalExperienceMonitoringAccountIdentifier` for account_id failed" . to_string ()) ;
self
}
pub fn dex_test_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringUuid>,
{
self.dex_test_id = value.try_into().map_err(|_| {
"conversion to `DigitalExperienceMonitoringUuid` for dex_test_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringDeviceDexTestSchemasHttp>,
<V as std::convert::TryInto<
types::DigitalExperienceMonitoringDeviceDexTestSchemasHttp,
>>::Error: std::fmt::Display,
{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `DigitalExperienceMonitoringDeviceDexTestSchemasHttp` for body failed: {}" , s)) ;
self
} pub fn body < F > (mut self , f : F) -> Self where F : std :: ops :: FnOnce (types :: builder :: DigitalExperienceMonitoringDeviceDexTestSchemasHttp) -> types :: builder :: DigitalExperienceMonitoringDeviceDexTestSchemasHttp ,{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
dex_test_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dex_test_id = dex_test_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::DigitalExperienceMonitoringDeviceDexTestSchemasHttp::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dex/devices/dex_tests/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dex_test_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "device_dex_test_update_device_dex_test",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceDexTestDeleteDeviceDexTest<'a> {
client: &'a crate::Client,
account_id: Result<types::DigitalExperienceMonitoringAccountIdentifier, String>,
dex_test_id: Result<types::DigitalExperienceMonitoringUuid, String>,
}
impl<'a> DeviceDexTestDeleteDeviceDexTest<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dex_test_id: Err("dex_test_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringAccountIdentifier>,
{
self . account_id = value . try_into () . map_err (| _ | "conversion to `DigitalExperienceMonitoringAccountIdentifier` for account_id failed" . to_string ()) ;
self
}
pub fn dex_test_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DigitalExperienceMonitoringUuid>,
{
self.dex_test_id = value.try_into().map_err(|_| {
"conversion to `DigitalExperienceMonitoringUuid` for dex_test_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
dex_test_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dex_test_id = dex_test_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dex/devices/dex_tests/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dex_test_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "device_dex_test_delete_device_dex_test",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesGetPolicyCertificates<'a> {
client: &'a crate::Client,
zone_id: Result<types::TeamsDevicesIdentifier, String>,
}
impl<'a> DevicesGetPolicyCertificates<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
}
}
pub fn zone_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for zone_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self { client, zone_id } = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/devices/policy/certificates",
client.baseurl,
encode_path(&zone_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_get_policy_certificates",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DevicesUpdatePolicyCertificates<'a> {
client: &'a crate::Client,
zone_id: Result<types::TeamsDevicesIdentifier, String>,
body: Result<types::builder::TeamsDevicesDevicesPolicyCertificates, String>,
}
impl<'a> DevicesUpdatePolicyCertificates<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn zone_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `TeamsDevicesIdentifier` for zone_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TeamsDevicesDevicesPolicyCertificates>,
<V as std::convert::TryInto<types::TeamsDevicesDevicesPolicyCertificates>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `TeamsDevicesDevicesPolicyCertificates` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::TeamsDevicesDevicesPolicyCertificates,
)
-> types::builder::TeamsDevicesDevicesPolicyCertificates,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
zone_id,
body,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::TeamsDevicesDevicesPolicyCertificates::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/devices/policy/certificates",
client.baseurl,
encode_path(&zone_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.patch(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "devices_update_policy_certificates",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}