use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct CustomIndicatorFeedsGetIndicatorFeeds<'a> {
client: &'a crate::Client,
account_id: Result<types::CustomIndicatorFeedsIdentifier, String>,
}
impl<'a> CustomIndicatorFeedsGetIndicatorFeeds<'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::CustomIndicatorFeedsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CustomIndicatorFeedsIdentifier` 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/{}/intel/indicator-feeds",
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: "custom_indicator_feeds_get_indicator_feeds",
};
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 CustomIndicatorFeedsCreateIndicatorFeeds<'a> {
client: &'a crate::Client,
account_id: Result<types::CustomIndicatorFeedsIdentifier, String>,
body: Result<types::builder::CustomIndicatorFeedsCreateFeed, String>,
}
impl<'a> CustomIndicatorFeedsCreateIndicatorFeeds<'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::CustomIndicatorFeedsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CustomIndicatorFeedsIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomIndicatorFeedsCreateFeed>,
<V as std::convert::TryInto<types::CustomIndicatorFeedsCreateFeed>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CustomIndicatorFeedsCreateFeed` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CustomIndicatorFeedsCreateFeed,
) -> types::builder::CustomIndicatorFeedsCreateFeed,
{
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::CustomIndicatorFeedsCreateFeed::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/intel/indicator-feeds",
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: "custom_indicator_feeds_create_indicator_feeds",
};
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 CustomIndicatorFeedsGetIndicatorFeedData<'a> {
client: &'a crate::Client,
account_id: Result<types::CustomIndicatorFeedsIdentifier, String>,
feed_id: Result<types::CustomIndicatorFeedsFeedId, String>,
}
impl<'a> CustomIndicatorFeedsGetIndicatorFeedData<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
feed_id: Err("feed_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomIndicatorFeedsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CustomIndicatorFeedsIdentifier` for account_id failed".to_string()
});
self
}
pub fn feed_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomIndicatorFeedsFeedId>,
{
self.feed_id = value.try_into().map_err(|_| {
"conversion to `CustomIndicatorFeedsFeedId` for feed_id failed".to_string()
});
self
}
pub async fn send(self) -> Result<ResponseValue<ByteStream>, Error<()>> {
let Self {
client,
account_id,
feed_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let feed_id = feed_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/intel/indicator-feeds/{}/data",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&feed_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).headers(header_map).build()?;
let info = OperationInfo {
operation_id: "custom_indicator_feeds_get_indicator_feed_data",
};
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 => Ok(ResponseValue::stream(response)),
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct CustomIndicatorFeedsAddPermission<'a> {
client: &'a crate::Client,
account_id: Result<types::CustomIndicatorFeedsIdentifier, String>,
body: Result<types::builder::CustomIndicatorFeedsPermissionsRequest, String>,
}
impl<'a> CustomIndicatorFeedsAddPermission<'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::CustomIndicatorFeedsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CustomIndicatorFeedsIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomIndicatorFeedsPermissionsRequest>,
<V as std::convert::TryInto<types::CustomIndicatorFeedsPermissionsRequest>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CustomIndicatorFeedsPermissionsRequest` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CustomIndicatorFeedsPermissionsRequest,
)
-> types::builder::CustomIndicatorFeedsPermissionsRequest,
{
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::CustomIndicatorFeedsPermissionsRequest::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/intel/indicator-feeds/permissions/add",
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: "custom_indicator_feeds_add_permission",
};
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 CustomIndicatorFeedsRemovePermission<'a> {
client: &'a crate::Client,
account_id: Result<types::CustomIndicatorFeedsIdentifier, String>,
body: Result<types::builder::CustomIndicatorFeedsPermissionsRequest, String>,
}
impl<'a> CustomIndicatorFeedsRemovePermission<'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::CustomIndicatorFeedsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CustomIndicatorFeedsIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomIndicatorFeedsPermissionsRequest>,
<V as std::convert::TryInto<types::CustomIndicatorFeedsPermissionsRequest>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CustomIndicatorFeedsPermissionsRequest` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CustomIndicatorFeedsPermissionsRequest,
)
-> types::builder::CustomIndicatorFeedsPermissionsRequest,
{
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::CustomIndicatorFeedsPermissionsRequest::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/intel/indicator-feeds/permissions/remove",
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: "custom_indicator_feeds_remove_permission",
};
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 CustomIndicatorFeedsViewPermissions<'a> {
client: &'a crate::Client,
account_id: Result<types::CustomIndicatorFeedsIdentifier, String>,
}
impl<'a> CustomIndicatorFeedsViewPermissions<'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::CustomIndicatorFeedsIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `CustomIndicatorFeedsIdentifier` 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/{}/intel/indicator-feeds/permissions/view",
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: "custom_indicator_feeds_view_permissions",
};
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 CustomPagesForAnAccountListCustomPages<'a> {
client: &'a crate::Client,
account_identifier: Result<types::CustomPagesIdentifier, String>,
}
impl<'a> CustomPagesForAnAccountListCustomPages<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_identifier: Err("account_identifier was not initialized".to_string()),
}
}
pub fn account_identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesIdentifier>,
{
self.account_identifier = value.try_into().map_err(|_| {
"conversion to `CustomPagesIdentifier` for account_identifier 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_identifier,
} = self;
let account_identifier = account_identifier.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/custom_pages",
client.baseurl,
encode_path(&account_identifier.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: "custom_pages_for_an_account_list_custom_pages",
};
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 CustomPagesForAnAccountGetACustomPage<'a> {
client: &'a crate::Client,
account_identifier: Result<types::CustomPagesIdentifier, String>,
identifier: Result<types::CustomPagesErrorPageType, String>,
}
impl<'a> CustomPagesForAnAccountGetACustomPage<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_identifier: Err("account_identifier was not initialized".to_string()),
identifier: Err("identifier was not initialized".to_string()),
}
}
pub fn account_identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesIdentifier>,
{
self.account_identifier = value.try_into().map_err(|_| {
"conversion to `CustomPagesIdentifier` for account_identifier failed".to_string()
});
self
}
pub fn identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesErrorPageType>,
{
self.identifier = value.try_into().map_err(|_| {
"conversion to `CustomPagesErrorPageType` for identifier 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_identifier,
identifier,
} = self;
let account_identifier = account_identifier.map_err(Error::InvalidRequest)?;
let identifier = identifier.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/custom_pages/{}",
client.baseurl,
encode_path(&account_identifier.to_string()),
encode_path(&identifier.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: "custom_pages_for_an_account_get_a_custom_page",
};
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 CustomPagesForAnAccountUpdateACustomPage<'a> {
client: &'a crate::Client,
account_identifier: Result<types::CustomPagesIdentifier, String>,
identifier: Result<types::CustomPagesErrorPageType, String>,
body: Result<types::builder::CustomPagesForAnAccountUpdateACustomPageBody, String>,
}
impl<'a> CustomPagesForAnAccountUpdateACustomPage<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_identifier: Err("account_identifier was not initialized".to_string()),
identifier: Err("identifier was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesIdentifier>,
{
self.account_identifier = value.try_into().map_err(|_| {
"conversion to `CustomPagesIdentifier` for account_identifier failed".to_string()
});
self
}
pub fn identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesErrorPageType>,
{
self.identifier = value.try_into().map_err(|_| {
"conversion to `CustomPagesErrorPageType` for identifier failed".to_string()
});
self
} pub fn body < V > (mut self , value : V) -> Self where V : std :: convert :: TryInto < types :: CustomPagesForAnAccountUpdateACustomPageBody > , < V as std :: convert :: TryInto < types :: CustomPagesForAnAccountUpdateACustomPageBody >> :: Error : std :: fmt :: Display ,{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `CustomPagesForAnAccountUpdateACustomPageBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CustomPagesForAnAccountUpdateACustomPageBody,
)
-> types::builder::CustomPagesForAnAccountUpdateACustomPageBody,
{
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_identifier,
identifier,
body,
} = self;
let account_identifier = account_identifier.map_err(Error::InvalidRequest)?;
let identifier = identifier.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CustomPagesForAnAccountUpdateACustomPageBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/custom_pages/{}",
client.baseurl,
encode_path(&account_identifier.to_string()),
encode_path(&identifier.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: "custom_pages_for_an_account_update_a_custom_page",
};
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 CustomOriginTrustStoreDetails<'a> {
client: &'a crate::Client,
zone_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
custom_origin_trust_store_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
}
impl<'a> CustomOriginTrustStoreDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
custom_origin_trust_store_id: Err(
"custom_origin_trust_store_id was not initialized".to_string(),
),
}
}
pub fn zone_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TlsCertificatesAndHostnamesIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `TlsCertificatesAndHostnamesIdentifier` for zone_id failed"
.to_string()
});
self
}
pub fn custom_origin_trust_store_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TlsCertificatesAndHostnamesIdentifier>,
{
self . custom_origin_trust_store_id = value . try_into () . map_err (| _ | "conversion to `TlsCertificatesAndHostnamesIdentifier` for custom_origin_trust_store_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,
custom_origin_trust_store_id,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let custom_origin_trust_store_id =
custom_origin_trust_store_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/acm/custom_trust_store/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&custom_origin_trust_store_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: "custom_origin_trust_store_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 CustomOriginTrustStoreDelete<'a> {
client: &'a crate::Client,
zone_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
custom_origin_trust_store_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
}
impl<'a> CustomOriginTrustStoreDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
custom_origin_trust_store_id: Err(
"custom_origin_trust_store_id was not initialized".to_string(),
),
}
}
pub fn zone_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TlsCertificatesAndHostnamesIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `TlsCertificatesAndHostnamesIdentifier` for zone_id failed"
.to_string()
});
self
}
pub fn custom_origin_trust_store_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TlsCertificatesAndHostnamesIdentifier>,
{
self . custom_origin_trust_store_id = value . try_into () . map_err (| _ | "conversion to `TlsCertificatesAndHostnamesIdentifier` for custom_origin_trust_store_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,
custom_origin_trust_store_id,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let custom_origin_trust_store_id =
custom_origin_trust_store_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/acm/custom_trust_store/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&custom_origin_trust_store_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: "custom_origin_trust_store_delete",
};
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 CustomSslForAZoneSslConfigurationDetails<'a> {
client: &'a crate::Client,
zone_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
custom_certificate_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
}
impl<'a> CustomSslForAZoneSslConfigurationDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
custom_certificate_id: Err("custom_certificate_id was not initialized".to_string()),
}
}
pub fn zone_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TlsCertificatesAndHostnamesIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `TlsCertificatesAndHostnamesIdentifier` for zone_id failed"
.to_string()
});
self
}
pub fn custom_certificate_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TlsCertificatesAndHostnamesIdentifier>,
{
self . custom_certificate_id = value . try_into () . map_err (| _ | "conversion to `TlsCertificatesAndHostnamesIdentifier` for custom_certificate_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,
custom_certificate_id,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let custom_certificate_id = custom_certificate_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/custom_certificates/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&custom_certificate_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: "custom_ssl_for_a_zone_ssl_configuration_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 CustomSslForAZoneDeleteSslConfiguration<'a> {
client: &'a crate::Client,
zone_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
custom_certificate_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> CustomSslForAZoneDeleteSslConfiguration<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
custom_certificate_id: Err("custom_certificate_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::TlsCertificatesAndHostnamesIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `TlsCertificatesAndHostnamesIdentifier` for zone_id failed"
.to_string()
});
self
}
pub fn custom_certificate_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TlsCertificatesAndHostnamesIdentifier>,
{
self . custom_certificate_id = value . try_into () . map_err (| _ | "conversion to `TlsCertificatesAndHostnamesIdentifier` for custom_certificate_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,
custom_certificate_id,
body,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let custom_certificate_id = custom_certificate_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/custom_certificates/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&custom_certificate_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: "custom_ssl_for_a_zone_delete_ssl_configuration",
};
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 CustomSslForAZoneEditSslConfiguration<'a> {
client: &'a crate::Client,
zone_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
custom_certificate_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
body: Result<types::builder::CustomSslForAZoneEditSslConfigurationBody, String>,
}
impl<'a> CustomSslForAZoneEditSslConfiguration<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
custom_certificate_id: Err("custom_certificate_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::TlsCertificatesAndHostnamesIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `TlsCertificatesAndHostnamesIdentifier` for zone_id failed"
.to_string()
});
self
}
pub fn custom_certificate_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TlsCertificatesAndHostnamesIdentifier>,
{
self . custom_certificate_id = value . try_into () . map_err (| _ | "conversion to `TlsCertificatesAndHostnamesIdentifier` for custom_certificate_id failed" . to_string ()) ;
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomSslForAZoneEditSslConfigurationBody>,
<V as std::convert::TryInto<types::CustomSslForAZoneEditSslConfigurationBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CustomSslForAZoneEditSslConfigurationBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CustomSslForAZoneEditSslConfigurationBody,
)
-> types::builder::CustomSslForAZoneEditSslConfigurationBody,
{
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,
custom_certificate_id,
body,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let custom_certificate_id = custom_certificate_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CustomSslForAZoneEditSslConfigurationBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/custom_certificates/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&custom_certificate_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: "custom_ssl_for_a_zone_edit_ssl_configuration",
};
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 CustomHostnameForAZoneEditCustomHostname<'a> {
client: &'a crate::Client,
zone_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
custom_hostname_id: Result<types::TlsCertificatesAndHostnamesIdentifier, String>,
body: Result<types::builder::CustomHostnameForAZoneEditCustomHostnameBody, String>,
}
impl<'a> CustomHostnameForAZoneEditCustomHostname<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_id: Err("zone_id was not initialized".to_string()),
custom_hostname_id: Err("custom_hostname_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::TlsCertificatesAndHostnamesIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `TlsCertificatesAndHostnamesIdentifier` for zone_id failed"
.to_string()
});
self
}
pub fn custom_hostname_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TlsCertificatesAndHostnamesIdentifier>,
{
self . custom_hostname_id = value . try_into () . map_err (| _ | "conversion to `TlsCertificatesAndHostnamesIdentifier` for custom_hostname_id failed" . to_string ()) ;
self
} pub fn body < V > (mut self , value : V) -> Self where V : std :: convert :: TryInto < types :: CustomHostnameForAZoneEditCustomHostnameBody > , < V as std :: convert :: TryInto < types :: CustomHostnameForAZoneEditCustomHostnameBody >> :: Error : std :: fmt :: Display ,{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `CustomHostnameForAZoneEditCustomHostnameBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CustomHostnameForAZoneEditCustomHostnameBody,
)
-> types::builder::CustomHostnameForAZoneEditCustomHostnameBody,
{
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,
custom_hostname_id,
body,
} = self;
let zone_id = zone_id.map_err(Error::InvalidRequest)?;
let custom_hostname_id = custom_hostname_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CustomHostnameForAZoneEditCustomHostnameBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/custom_hostnames/{}",
client.baseurl,
encode_path(&zone_id.to_string()),
encode_path(&custom_hostname_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: "custom_hostname_for_a_zone_edit_custom_hostname",
};
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 CustomPagesForAZoneGetACustomPage<'a> {
client: &'a crate::Client,
zone_identifier: Result<types::CustomPagesIdentifier, String>,
identifier: Result<types::CustomPagesErrorPageType, String>,
}
impl<'a> CustomPagesForAZoneGetACustomPage<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_identifier: Err("zone_identifier was not initialized".to_string()),
identifier: Err("identifier was not initialized".to_string()),
}
}
pub fn zone_identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesIdentifier>,
{
self.zone_identifier = value.try_into().map_err(|_| {
"conversion to `CustomPagesIdentifier` for zone_identifier failed".to_string()
});
self
}
pub fn identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesErrorPageType>,
{
self.identifier = value.try_into().map_err(|_| {
"conversion to `CustomPagesErrorPageType` for identifier 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_identifier,
identifier,
} = self;
let zone_identifier = zone_identifier.map_err(Error::InvalidRequest)?;
let identifier = identifier.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/custom_pages/{}",
client.baseurl,
encode_path(&zone_identifier.to_string()),
encode_path(&identifier.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: "custom_pages_for_a_zone_get_a_custom_page",
};
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 CustomPagesForAZoneUpdateACustomPage<'a> {
client: &'a crate::Client,
zone_identifier: Result<types::CustomPagesIdentifier, String>,
identifier: Result<types::CustomPagesErrorPageType, String>,
body: Result<types::builder::CustomPagesForAZoneUpdateACustomPageBody, String>,
}
impl<'a> CustomPagesForAZoneUpdateACustomPage<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
zone_identifier: Err("zone_identifier was not initialized".to_string()),
identifier: Err("identifier was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn zone_identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesIdentifier>,
{
self.zone_identifier = value.try_into().map_err(|_| {
"conversion to `CustomPagesIdentifier` for zone_identifier failed".to_string()
});
self
}
pub fn identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesErrorPageType>,
{
self.identifier = value.try_into().map_err(|_| {
"conversion to `CustomPagesErrorPageType` for identifier failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::CustomPagesForAZoneUpdateACustomPageBody>,
<V as std::convert::TryInto<types::CustomPagesForAZoneUpdateACustomPageBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `CustomPagesForAZoneUpdateACustomPageBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::CustomPagesForAZoneUpdateACustomPageBody,
)
-> types::builder::CustomPagesForAZoneUpdateACustomPageBody,
{
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_identifier,
identifier,
body,
} = self;
let zone_identifier = zone_identifier.map_err(Error::InvalidRequest)?;
let identifier = identifier.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::CustomPagesForAZoneUpdateACustomPageBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/zones/{}/custom_pages/{}",
client.baseurl,
encode_path(&zone_identifier.to_string()),
encode_path(&identifier.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: "custom_pages_for_a_zone_update_a_custom_page",
};
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)),
}
}
}