use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct SecondaryDnsAclCreateAcl<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
body: Result<types::builder::SecondaryDnsAclCreateAclBody, String>,
}
impl<'a> SecondaryDnsAclCreateAcl<'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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsAclCreateAclBody>,
<V as std::convert::TryInto<types::SecondaryDnsAclCreateAclBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `SecondaryDnsAclCreateAclBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::SecondaryDnsAclCreateAclBody,
) -> types::builder::SecondaryDnsAclCreateAclBody,
{
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::SecondaryDnsAclCreateAclBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/acls",
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: "secondary_dns_acl_create_acl",
};
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 SecondaryDnsAclAclDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
acl_id: Result<types::SecondaryDnsComponentsSchemasIdentifier, String>,
}
impl<'a> SecondaryDnsAclAclDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
acl_id: Err("acl_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn acl_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsComponentsSchemasIdentifier>,
{
self.acl_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsComponentsSchemasIdentifier` for acl_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,
acl_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let acl_id = acl_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/acls/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&acl_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: "secondary_dns_acl_acl_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 SecondaryDnsAclUpdateAcl<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
acl_id: Result<types::SecondaryDnsComponentsSchemasIdentifier, String>,
body: Result<types::builder::SecondaryDnsAcl, String>,
}
impl<'a> SecondaryDnsAclUpdateAcl<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
acl_id: Err("acl_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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn acl_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsComponentsSchemasIdentifier>,
{
self.acl_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsComponentsSchemasIdentifier` for acl_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsAcl>,
<V as std::convert::TryInto<types::SecondaryDnsAcl>>::Error: std::fmt::Display,
{
self.body = value
.try_into()
.map(From::from)
.map_err(|s| format!("conversion to `SecondaryDnsAcl` for body failed: {}", s));
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(types::builder::SecondaryDnsAcl) -> types::builder::SecondaryDnsAcl,
{
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,
acl_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let acl_id = acl_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::SecondaryDnsAcl::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/acls/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&acl_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: "secondary_dns_acl_update_acl",
};
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 SecondaryDnsAclDeleteAcl<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
acl_id: Result<types::SecondaryDnsComponentsSchemasIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> SecondaryDnsAclDeleteAcl<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
acl_id: Err("acl_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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn acl_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsComponentsSchemasIdentifier>,
{
self.acl_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsComponentsSchemasIdentifier` for acl_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,
acl_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let acl_id = acl_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/acls/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&acl_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: "secondary_dns_acl_delete_acl",
};
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 SecondaryDnsPeerListPeers<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
}
impl<'a> SecondaryDnsPeerListPeers<'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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` 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/{}/secondary_dns/peers",
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: "secondary_dns_peer_list_peers",
};
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 SecondaryDnsPeerCreatePeer<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
body: Result<types::builder::SecondaryDnsPeerCreatePeerBody, String>,
}
impl<'a> SecondaryDnsPeerCreatePeer<'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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsPeerCreatePeerBody>,
<V as std::convert::TryInto<types::SecondaryDnsPeerCreatePeerBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `SecondaryDnsPeerCreatePeerBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::SecondaryDnsPeerCreatePeerBody,
) -> types::builder::SecondaryDnsPeerCreatePeerBody,
{
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::SecondaryDnsPeerCreatePeerBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/peers",
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: "secondary_dns_peer_create_peer",
};
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 SecondaryDnsPeerPeerDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
peer_id: Result<types::SecondaryDnsComponentsSchemasIdentifier, String>,
}
impl<'a> SecondaryDnsPeerPeerDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
peer_id: Err("peer_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn peer_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsComponentsSchemasIdentifier>,
{
self.peer_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsComponentsSchemasIdentifier` for peer_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,
peer_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let peer_id = peer_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/peers/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&peer_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: "secondary_dns_peer_peer_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 SecondaryDnsPeerUpdatePeer<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
peer_id: Result<types::SecondaryDnsComponentsSchemasIdentifier, String>,
body: Result<types::builder::SecondaryDnsPeer, String>,
}
impl<'a> SecondaryDnsPeerUpdatePeer<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
peer_id: Err("peer_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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn peer_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsComponentsSchemasIdentifier>,
{
self.peer_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsComponentsSchemasIdentifier` for peer_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsPeer>,
<V as std::convert::TryInto<types::SecondaryDnsPeer>>::Error: std::fmt::Display,
{
self.body = value
.try_into()
.map(From::from)
.map_err(|s| format!("conversion to `SecondaryDnsPeer` for body failed: {}", s));
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::SecondaryDnsPeer,
) -> types::builder::SecondaryDnsPeer,
{
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,
peer_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let peer_id = peer_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::SecondaryDnsPeer::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/peers/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&peer_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: "secondary_dns_peer_update_peer",
};
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 SecondaryDnsPeerDeletePeer<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
peer_id: Result<types::SecondaryDnsComponentsSchemasIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> SecondaryDnsPeerDeletePeer<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
peer_id: Err("peer_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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn peer_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsComponentsSchemasIdentifier>,
{
self.peer_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsComponentsSchemasIdentifier` for peer_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,
peer_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let peer_id = peer_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/peers/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&peer_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: "secondary_dns_peer_delete_peer",
};
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 SecondaryDnsTsigListTsiGs<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
}
impl<'a> SecondaryDnsTsigListTsiGs<'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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` 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/{}/secondary_dns/tsigs",
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: "secondary_dns_tsig_list_tsi_gs",
};
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 SecondaryDnsTsigCreateTsig<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
body: Result<types::builder::SecondaryDnsTsig, String>,
}
impl<'a> SecondaryDnsTsigCreateTsig<'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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsTsig>,
<V as std::convert::TryInto<types::SecondaryDnsTsig>>::Error: std::fmt::Display,
{
self.body = value
.try_into()
.map(From::from)
.map_err(|s| format!("conversion to `SecondaryDnsTsig` for body failed: {}", s));
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::SecondaryDnsTsig,
) -> types::builder::SecondaryDnsTsig,
{
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::SecondaryDnsTsig::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/tsigs",
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: "secondary_dns_tsig_create_tsig",
};
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 SecondaryDnsTsigTsigDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
tsig_id: Result<types::SecondaryDnsSchemasIdentifier, String>,
}
impl<'a> SecondaryDnsTsigTsigDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
tsig_id: Err("tsig_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn tsig_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsSchemasIdentifier>,
{
self.tsig_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsSchemasIdentifier` for tsig_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,
tsig_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let tsig_id = tsig_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/tsigs/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&tsig_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: "secondary_dns_tsig_tsig_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 SecondaryDnsTsigUpdateTsig<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
tsig_id: Result<types::SecondaryDnsSchemasIdentifier, String>,
body: Result<types::builder::SecondaryDnsTsig, String>,
}
impl<'a> SecondaryDnsTsigUpdateTsig<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
tsig_id: Err("tsig_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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn tsig_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsSchemasIdentifier>,
{
self.tsig_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsSchemasIdentifier` for tsig_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsTsig>,
<V as std::convert::TryInto<types::SecondaryDnsTsig>>::Error: std::fmt::Display,
{
self.body = value
.try_into()
.map(From::from)
.map_err(|s| format!("conversion to `SecondaryDnsTsig` for body failed: {}", s));
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::SecondaryDnsTsig,
) -> types::builder::SecondaryDnsTsig,
{
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,
tsig_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let tsig_id = tsig_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::SecondaryDnsTsig::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/tsigs/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&tsig_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: "secondary_dns_tsig_update_tsig",
};
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 SecondaryDnsTsigDeleteTsig<'a> {
client: &'a crate::Client,
account_id: Result<types::SecondaryDnsAccountIdentifier, String>,
tsig_id: Result<types::SecondaryDnsSchemasIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> SecondaryDnsTsigDeleteTsig<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
tsig_id: Err("tsig_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::SecondaryDnsAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn tsig_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::SecondaryDnsSchemasIdentifier>,
{
self.tsig_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsSchemasIdentifier` for tsig_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,
tsig_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let tsig_id = tsig_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/secondary_dns/tsigs/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&tsig_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: "secondary_dns_tsig_delete_tsig",
};
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 SecondaryDnsSecondaryZoneForceAxfr<'a> {
client: &'a crate::Client,
zone_id: Result<types::SecondaryDnsIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> SecondaryDnsSecondaryZoneForceAxfr<'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::SecondaryDnsIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsIdentifier` 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/{}/secondary_dns/force_axfr",
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: "secondary_dns_secondary_zone_force_axfr",
};
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 SecondaryDnsPrimaryZoneForceDnsNotify<'a> {
client: &'a crate::Client,
zone_id: Result<types::SecondaryDnsIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> SecondaryDnsPrimaryZoneForceDnsNotify<'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::SecondaryDnsIdentifier>,
{
self.zone_id = value.try_into().map_err(|_| {
"conversion to `SecondaryDnsIdentifier` 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/{}/secondary_dns/outgoing/force_notify",
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: "secondary_dns_primary_zone_force_dns_notify",
};
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)),
}
}
}