use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct DnsFirewallDnsFirewallClusterDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::DnsFirewallIdentifier, String>,
dns_firewall_id: Result<types::DnsFirewallIdentifier, String>,
}
impl<'a> DnsFirewallDnsFirewallClusterDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dns_firewall_id: Err("dns_firewall_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsFirewallIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `DnsFirewallIdentifier` for account_id failed".to_string()
});
self
}
pub fn dns_firewall_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsFirewallIdentifier>,
{
self.dns_firewall_id = value.try_into().map_err(|_| {
"conversion to `DnsFirewallIdentifier` for dns_firewall_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,
dns_firewall_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dns_firewall_id = dns_firewall_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dns_firewall/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dns_firewall_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: "dns_firewall_dns_firewall_cluster_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 DnsFirewallDeleteDnsFirewallCluster<'a> {
client: &'a crate::Client,
account_id: Result<types::DnsFirewallIdentifier, String>,
dns_firewall_id: Result<types::DnsFirewallIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DnsFirewallDeleteDnsFirewallCluster<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dns_firewall_id: Err("dns_firewall_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::DnsFirewallIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `DnsFirewallIdentifier` for account_id failed".to_string()
});
self
}
pub fn dns_firewall_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsFirewallIdentifier>,
{
self.dns_firewall_id = value.try_into().map_err(|_| {
"conversion to `DnsFirewallIdentifier` for dns_firewall_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,
dns_firewall_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dns_firewall_id = dns_firewall_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dns_firewall/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dns_firewall_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: "dns_firewall_delete_dns_firewall_cluster",
};
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 DnsFirewallUpdateDnsFirewallCluster<'a> {
client: &'a crate::Client,
account_id: Result<types::DnsFirewallIdentifier, String>,
dns_firewall_id: Result<types::DnsFirewallIdentifier, String>,
body: Result<types::DnsFirewallDnsFirewallClusterPatch, String>,
}
impl<'a> DnsFirewallUpdateDnsFirewallCluster<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dns_firewall_id: Err("dns_firewall_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::DnsFirewallIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `DnsFirewallIdentifier` for account_id failed".to_string()
});
self
}
pub fn dns_firewall_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsFirewallIdentifier>,
{
self.dns_firewall_id = value.try_into().map_err(|_| {
"conversion to `DnsFirewallIdentifier` for dns_firewall_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsFirewallDnsFirewallClusterPatch>,
{
self.body = value.try_into().map_err(|_| {
"conversion to `DnsFirewallDnsFirewallClusterPatch` 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,
dns_firewall_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dns_firewall_id = dns_firewall_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dns_firewall/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dns_firewall_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: "dns_firewall_update_dns_firewall_cluster",
};
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 DnsFirewallAnalyticsTable<'a> {
client: &'a crate::Client,
account_id: Result<types::DnsAnalyticsIdentifier, String>,
dns_firewall_id: Result<types::DnsAnalyticsIdentifier, String>,
dimensions: Result<types::DnsAnalyticsDimensions, String>,
filters: Result<types::DnsAnalyticsFilters, String>,
limit: Result<types::DnsAnalyticsLimit, String>,
metrics: Result<types::DnsAnalyticsMetrics, String>,
since: Result<types::DnsAnalyticsSince, String>,
sort: Result<types::DnsAnalyticsSort, String>,
until: Result<types::DnsAnalyticsUntil, String>,
}
impl<'a> DnsFirewallAnalyticsTable<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dns_firewall_id: Err("dns_firewall_id was not initialized".to_string()),
dimensions: Err("dimensions was not initialized".to_string()),
filters: Err("filters was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
metrics: Err("metrics was not initialized".to_string()),
since: Err("since was not initialized".to_string()),
sort: Err("sort was not initialized".to_string()),
until: Err("until was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsIdentifier` for account_id failed".to_string()
});
self
}
pub fn dns_firewall_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsIdentifier>,
{
self.dns_firewall_id = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsIdentifier` for dns_firewall_id failed".to_string()
});
self
}
pub fn dimensions<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsDimensions>,
{
self.dimensions = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsDimensions` for dimensions failed".to_string()
});
self
}
pub fn filters<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsFilters>,
{
self.filters = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsFilters` for filters failed".to_string());
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsLimit>,
{
self.limit = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsLimit` for limit failed".to_string());
self
}
pub fn metrics<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsMetrics>,
{
self.metrics = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsMetrics` for metrics failed".to_string());
self
}
pub fn since<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsSince>,
{
self.since = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsSince` for since failed".to_string());
self
}
pub fn sort<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsSort>,
{
self.sort = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsSort` for sort failed".to_string());
self
}
pub fn until<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsUntil>,
{
self.until = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsUntil` for until 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,
dns_firewall_id,
dimensions,
filters,
limit,
metrics,
since,
sort,
until,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dns_firewall_id = dns_firewall_id.map_err(Error::InvalidRequest)?;
let dimensions = dimensions.map_err(Error::InvalidRequest)?;
let filters = filters.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let metrics = metrics.map_err(Error::InvalidRequest)?;
let since = since.map_err(Error::InvalidRequest)?;
let sort = sort.map_err(Error::InvalidRequest)?;
let until = until.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dns_firewall/{}/dns_analytics/report",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dns_firewall_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(
"dimensions",
&dimensions,
))
.query(&progenitor_client::QueryParam::new("filters", &filters))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("metrics", &metrics))
.query(&progenitor_client::QueryParam::new("since", &since))
.query(&progenitor_client::QueryParam::new("sort", &sort))
.query(&progenitor_client::QueryParam::new("until", &until))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dns_firewall_analytics_table",
};
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 DnsFirewallAnalyticsByTime<'a> {
client: &'a crate::Client,
account_id: Result<types::DnsAnalyticsIdentifier, String>,
dns_firewall_id: Result<types::DnsAnalyticsIdentifier, String>,
dimensions: Result<types::DnsAnalyticsDimensions, String>,
filters: Result<types::DnsAnalyticsFilters, String>,
limit: Result<types::DnsAnalyticsLimit, String>,
metrics: Result<types::DnsAnalyticsMetrics, String>,
since: Result<types::DnsAnalyticsSince, String>,
sort: Result<types::DnsAnalyticsSort, String>,
time_delta: Result<types::DnsAnalyticsTimeDelta, String>,
until: Result<types::DnsAnalyticsUntil, String>,
}
impl<'a> DnsFirewallAnalyticsByTime<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dns_firewall_id: Err("dns_firewall_id was not initialized".to_string()),
dimensions: Err("dimensions was not initialized".to_string()),
filters: Err("filters was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
metrics: Err("metrics was not initialized".to_string()),
since: Err("since was not initialized".to_string()),
sort: Err("sort was not initialized".to_string()),
time_delta: Err("time_delta was not initialized".to_string()),
until: Err("until was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsIdentifier` for account_id failed".to_string()
});
self
}
pub fn dns_firewall_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsIdentifier>,
{
self.dns_firewall_id = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsIdentifier` for dns_firewall_id failed".to_string()
});
self
}
pub fn dimensions<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsDimensions>,
{
self.dimensions = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsDimensions` for dimensions failed".to_string()
});
self
}
pub fn filters<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsFilters>,
{
self.filters = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsFilters` for filters failed".to_string());
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsLimit>,
{
self.limit = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsLimit` for limit failed".to_string());
self
}
pub fn metrics<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsMetrics>,
{
self.metrics = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsMetrics` for metrics failed".to_string());
self
}
pub fn since<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsSince>,
{
self.since = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsSince` for since failed".to_string());
self
}
pub fn sort<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsSort>,
{
self.sort = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsSort` for sort failed".to_string());
self
}
pub fn time_delta<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsTimeDelta>,
{
self.time_delta = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsTimeDelta` for time_delta failed".to_string()
});
self
}
pub fn until<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsUntil>,
{
self.until = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsUntil` for until 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,
dns_firewall_id,
dimensions,
filters,
limit,
metrics,
since,
sort,
time_delta,
until,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dns_firewall_id = dns_firewall_id.map_err(Error::InvalidRequest)?;
let dimensions = dimensions.map_err(Error::InvalidRequest)?;
let filters = filters.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let metrics = metrics.map_err(Error::InvalidRequest)?;
let since = since.map_err(Error::InvalidRequest)?;
let sort = sort.map_err(Error::InvalidRequest)?;
let time_delta = time_delta.map_err(Error::InvalidRequest)?;
let until = until.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dns_firewall/{}/dns_analytics/report/bytime",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dns_firewall_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(
"dimensions",
&dimensions,
))
.query(&progenitor_client::QueryParam::new("filters", &filters))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("metrics", &metrics))
.query(&progenitor_client::QueryParam::new("since", &since))
.query(&progenitor_client::QueryParam::new("sort", &sort))
.query(&progenitor_client::QueryParam::new(
"time_delta",
&time_delta,
))
.query(&progenitor_client::QueryParam::new("until", &until))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dns_firewall_analytics_by_time",
};
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 DnsViewsForAnAccountGetInternalDnsView<'a> {
client: &'a crate::Client,
account_id: Result<types::DnsSettingsIdentifier, String>,
view_id: Result<types::DnsSettingsIdentifier, String>,
}
impl<'a> DnsViewsForAnAccountGetInternalDnsView<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
view_id: Err("view_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsSettingsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `DnsSettingsIdentifier` for account_id failed".to_string()
});
self
}
pub fn view_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsSettingsIdentifier>,
{
self.view_id = value.try_into().map_err(|_| {
"conversion to `DnsSettingsIdentifier` for view_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,
view_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let view_id = view_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dns_settings/views/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&view_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: "dns_views_for_an_account_get_internal_dns_view",
};
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 DnsAnalyticsByTime<'a> {
client: &'a crate::Client,
zone_id: Result<types::DnsAnalyticsIdentifier, String>,
dimensions: Result<types::DnsAnalyticsDimensions, String>,
filters: Result<types::DnsAnalyticsFilters, String>,
limit: Result<types::DnsAnalyticsLimit, String>,
metrics: Result<types::DnsAnalyticsMetrics, String>,
since: Result<types::DnsAnalyticsSince, String>,
sort: Result<types::DnsAnalyticsSort, String>,
time_delta: Result<types::DnsAnalyticsTimeDelta, String>,
until: Result<types::DnsAnalyticsUntil, String>,
}
impl<'a> DnsAnalyticsByTime<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
dimensions: Err("dimensions was not initialized".to_string()),
filters: Err("filters was not initialized".to_string()),
limit: Err("limit was not initialized".to_string()),
metrics: Err("metrics was not initialized".to_string()),
since: Err("since was not initialized".to_string()),
sort: Err("sort was not initialized".to_string()),
time_delta: Err("time_delta was not initialized".to_string()),
until: Err("until was not initialized".to_string()),
}
}
pub fn zone_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsIdentifier` for zone_id failed".to_string()
});
self
}
pub fn dimensions<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsDimensions>,
{
self.dimensions = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsDimensions` for dimensions failed".to_string()
});
self
}
pub fn filters<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsFilters>,
{
self.filters = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsFilters` for filters failed".to_string());
self
}
pub fn limit<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsLimit>,
{
self.limit = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsLimit` for limit failed".to_string());
self
}
pub fn metrics<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsMetrics>,
{
self.metrics = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsMetrics` for metrics failed".to_string());
self
}
pub fn since<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsSince>,
{
self.since = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsSince` for since failed".to_string());
self
}
pub fn sort<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsSort>,
{
self.sort = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsSort` for sort failed".to_string());
self
}
pub fn time_delta<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsTimeDelta>,
{
self.time_delta = value.try_into().map_err(|_| {
"conversion to `DnsAnalyticsTimeDelta` for time_delta failed".to_string()
});
self
}
pub fn until<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsAnalyticsUntil>,
{
self.until = value
.try_into()
.map_err(|_| "conversion to `DnsAnalyticsUntil` for until 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,
dimensions,
filters,
limit,
metrics,
since,
sort,
time_delta,
until,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let dimensions = dimensions.map_err(Error::InvalidRequest)?;
let filters = filters.map_err(Error::InvalidRequest)?;
let limit = limit.map_err(Error::InvalidRequest)?;
let metrics = metrics.map_err(Error::InvalidRequest)?;
let since = since.map_err(Error::InvalidRequest)?;
let sort = sort.map_err(Error::InvalidRequest)?;
let time_delta = time_delta.map_err(Error::InvalidRequest)?;
let until = until.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/dns_analytics/report/bytime",
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"),
)
.query(&progenitor_client::QueryParam::new(
"dimensions",
&dimensions,
))
.query(&progenitor_client::QueryParam::new("filters", &filters))
.query(&progenitor_client::QueryParam::new("limit", &limit))
.query(&progenitor_client::QueryParam::new("metrics", &metrics))
.query(&progenitor_client::QueryParam::new("since", &since))
.query(&progenitor_client::QueryParam::new("sort", &sort))
.query(&progenitor_client::QueryParam::new(
"time_delta",
&time_delta,
))
.query(&progenitor_client::QueryParam::new("until", &until))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dns_analytics_by_time",
};
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 DnsRecordsForAZoneDnsRecordDetails<'a> {
client: &'a crate::Client,
zone_id: Result<types::DnsRecordsIdentifier, String>,
dns_record_id: Result<types::DnsRecordsIdentifier, String>,
}
impl<'a> DnsRecordsForAZoneDnsRecordDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
dns_record_id: Err("dns_record_id was not initialized".to_string()),
}
}
pub fn zone_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsRecordsIdentifier>,
{
self.zone_id = value
.try_into()
.map_err(|_| "conversion to `DnsRecordsIdentifier` for zone_id failed".to_string());
self
}
pub fn dns_record_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsRecordsIdentifier>,
{
self.dns_record_id = value.try_into().map_err(|_| {
"conversion to `DnsRecordsIdentifier` for dns_record_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,
dns_record_id,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let dns_record_id = dns_record_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/dns_records/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&dns_record_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: "dns_records_for_a_zone_dns_record_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 DnsRecordsForAZoneUpdateDnsRecord<'a> {
client: &'a crate::Client,
zone_id: Result<types::DnsRecordsIdentifier, String>,
dns_record_id: Result<types::DnsRecordsIdentifier, String>,
body: Result<types::builder::DnsRecordsDnsRecordPost, String>,
}
impl<'a> DnsRecordsForAZoneUpdateDnsRecord<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
dns_record_id: Err("dns_record_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::DnsRecordsIdentifier>,
{
self.zone_id = value
.try_into()
.map_err(|_| "conversion to `DnsRecordsIdentifier` for zone_id failed".to_string());
self
}
pub fn dns_record_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsRecordsIdentifier>,
{
self.dns_record_id = value.try_into().map_err(|_| {
"conversion to `DnsRecordsIdentifier` for dns_record_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsRecordsDnsRecordPost>,
<V as std::convert::TryInto<types::DnsRecordsDnsRecordPost>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `DnsRecordsDnsRecordPost` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::DnsRecordsDnsRecordPost,
) -> types::builder::DnsRecordsDnsRecordPost,
{
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,
dns_record_id,
body,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let dns_record_id = dns_record_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::DnsRecordsDnsRecordPost::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/dns_records/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&dns_record_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: "dns_records_for_a_zone_update_dns_record",
};
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 DnsRecordsForAZoneDeleteDnsRecord<'a> {
client: &'a crate::Client,
zone_id: Result<types::DnsRecordsIdentifier, String>,
dns_record_id: Result<types::DnsRecordsIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DnsRecordsForAZoneDeleteDnsRecord<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
dns_record_id: Err("dns_record_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn zone_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsRecordsIdentifier>,
{
self.zone_id = value
.try_into()
.map_err(|_| "conversion to `DnsRecordsIdentifier` for zone_id failed".to_string());
self
}
pub fn dns_record_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsRecordsIdentifier>,
{
self.dns_record_id = value.try_into().map_err(|_| {
"conversion to `DnsRecordsIdentifier` for dns_record_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,
zone_id,
dns_record_id,
body,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let dns_record_id = dns_record_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/dns_records/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&dns_record_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: "dns_records_for_a_zone_delete_dns_record",
};
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 DnsRecordsForAZonePatchDnsRecord<'a> {
client: &'a crate::Client,
zone_id: Result<types::DnsRecordsIdentifier, String>,
dns_record_id: Result<types::DnsRecordsIdentifier, String>,
body: Result<types::builder::DnsRecordsDnsRecordPatch, String>,
}
impl<'a> DnsRecordsForAZonePatchDnsRecord<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
dns_record_id: Err("dns_record_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::DnsRecordsIdentifier>,
{
self.zone_id = value
.try_into()
.map_err(|_| "conversion to `DnsRecordsIdentifier` for zone_id failed".to_string());
self
}
pub fn dns_record_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsRecordsIdentifier>,
{
self.dns_record_id = value.try_into().map_err(|_| {
"conversion to `DnsRecordsIdentifier` for dns_record_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsRecordsDnsRecordPatch>,
<V as std::convert::TryInto<types::DnsRecordsDnsRecordPatch>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `DnsRecordsDnsRecordPatch` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::DnsRecordsDnsRecordPatch,
) -> types::builder::DnsRecordsDnsRecordPatch,
{
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,
dns_record_id,
body,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let dns_record_id = dns_record_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::DnsRecordsDnsRecordPatch::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/dns_records/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&dns_record_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: "dns_records_for_a_zone_patch_dns_record",
};
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 DnsRecordsForAZoneTriggerDnsScan<'a> {
client: &'a crate::Client,
zone_id: Result<types::DnsRecordsIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DnsRecordsForAZoneTriggerDnsScan<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn zone_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DnsRecordsIdentifier>,
{
self.zone_id = value
.try_into()
.map_err(|_| "conversion to `DnsRecordsIdentifier` for zone_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,
zone_id,
body,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/dns_records/scan/trigger",
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
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dns_records_for_a_zone_trigger_dns_scan",
};
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)),
}
}
}