use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct ZeroTrustUsersGetUser<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
user_id: Result<types::AccessUuid, String>,
}
impl<'a> ZeroTrustUsersGetUser<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_id: Err("user_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for user_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,
user_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_id = user_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/users/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_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: "zero_trust_users_get_user",
};
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 ZeroTrustUsersUpdateUser<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
user_id: Result<types::AccessUuid, String>,
body: Result<types::builder::ZeroTrustUsersUpdateUserBody, String>,
}
impl<'a> ZeroTrustUsersUpdateUser<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_id: Err("user_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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for user_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustUsersUpdateUserBody>,
<V as std::convert::TryInto<types::ZeroTrustUsersUpdateUserBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ZeroTrustUsersUpdateUserBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustUsersUpdateUserBody,
) -> types::builder::ZeroTrustUsersUpdateUserBody,
{
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,
user_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_id = user_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::ZeroTrustUsersUpdateUserBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/users/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_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: "zero_trust_users_update_user",
};
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 ZeroTrustUsersDeleteUser<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
user_id: Result<types::AccessUuid, String>,
}
impl<'a> ZeroTrustUsersDeleteUser<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_id: Err("user_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for user_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,
user_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_id = user_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/users/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_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: "zero_trust_users_delete_user",
};
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() {
202u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ZeroTrustUsersGetActiveSessions<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
user_id: Result<types::AccessUuid, String>,
}
impl<'a> ZeroTrustUsersGetActiveSessions<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_id: Err("user_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for user_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,
user_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_id = user_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/users/{}/active_sessions",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_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: "zero_trust_users_get_active_sessions",
};
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 ZeroTrustUsersGetActiveSession<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
user_id: Result<types::AccessUuid, String>,
nonce: Result<types::AccessNonce, String>,
}
impl<'a> ZeroTrustUsersGetActiveSession<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_id: Err("user_id was not initialized".to_string()),
nonce: Err("nonce was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for user_id failed".to_string());
self
}
pub fn nonce<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessNonce>,
{
self.nonce = value
.try_into()
.map_err(|_| "conversion to `AccessNonce` for nonce 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,
user_id,
nonce,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_id = user_id.map_err(Error::InvalidRequest)?;
let nonce = nonce.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/users/{}/active_sessions/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_id.to_string()),
encode_path(&nonce.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: "zero_trust_users_get_active_session",
};
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 ZeroTrustUsersGetFailedLogins<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
user_id: Result<types::AccessUuid, String>,
}
impl<'a> ZeroTrustUsersGetFailedLogins<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_id: Err("user_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for user_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,
user_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_id = user_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/users/{}/failed_logins",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_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: "zero_trust_users_get_failed_logins",
};
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 ZeroTrustUsersGetLastSeenIdentity<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
user_id: Result<types::AccessUuid, String>,
}
impl<'a> ZeroTrustUsersGetLastSeenIdentity<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_id: Err("user_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for user_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,
user_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_id = user_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/users/{}/last_seen_identity",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_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: "zero_trust_users_get_last_seen_identity",
};
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 ZeroTrustUsersDeleteMfaAuthenticator<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
user_id: Result<types::AccessUuid, String>,
authenticator_id: Result<types::AccessAuthenticatorId, String>,
}
impl<'a> ZeroTrustUsersDeleteMfaAuthenticator<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_id: Err("user_id was not initialized".to_string()),
authenticator_id: Err("authenticator_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for user_id failed".to_string());
self
}
pub fn authenticator_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessAuthenticatorId>,
{
self.authenticator_id = value.try_into().map_err(|_| {
"conversion to `AccessAuthenticatorId` for authenticator_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,
user_id,
authenticator_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_id = user_id.map_err(Error::InvalidRequest)?;
let authenticator_id = authenticator_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/users/{}/mfa_authenticators/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_id.to_string()),
encode_path(&authenticator_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: "zero_trust_users_delete_mfa_authenticator",
};
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 ZeroTrustApplicationsReviewStatusList<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewayComponentsSchemasIdentifier, String>,
}
impl<'a> ZeroTrustApplicationsReviewStatusList<'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::ZeroTrustGatewayComponentsSchemasIdentifier>,
{
self . account_id = value . try_into () . map_err (| _ | "conversion to `ZeroTrustGatewayComponentsSchemasIdentifier` 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/{}/gateway/apps/review_status",
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: "zero_trust_applications_review_status_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ZeroTrustApplicationsReviewStatusUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewayComponentsSchemasIdentifier, String>,
body: Result<types::builder::ZeroTrustApplicationsReviewStatusUpdateBody, String>,
}
impl<'a> ZeroTrustApplicationsReviewStatusUpdate<'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::ZeroTrustGatewayComponentsSchemasIdentifier>,
{
self . account_id = value . try_into () . map_err (| _ | "conversion to `ZeroTrustGatewayComponentsSchemasIdentifier` for account_id failed" . to_string ()) ;
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustApplicationsReviewStatusUpdateBody>,
<V as std::convert::TryInto<types::ZeroTrustApplicationsReviewStatusUpdateBody>>::Error:
std::fmt::Display,
{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `ZeroTrustApplicationsReviewStatusUpdateBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustApplicationsReviewStatusUpdateBody,
)
-> types::builder::ZeroTrustApplicationsReviewStatusUpdateBody,
{
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::ZeroTrustApplicationsReviewStatusUpdateBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/apps/review_status",
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: "zero_trust_applications_review_status_update",
};
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 ZeroTrustGetAuditSshSettings<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
}
impl<'a> ZeroTrustGetAuditSshSettings<'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::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` 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/{}/gateway/audit_ssh_settings",
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: "zero_trust_get_audit_ssh_settings",
};
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 ZeroTrustUpdateAuditSshSettings<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
body: Result<types::builder::ZeroTrustUpdateAuditSshSettingsBody, String>,
}
impl<'a> ZeroTrustUpdateAuditSshSettings<'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::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustUpdateAuditSshSettingsBody>,
<V as std::convert::TryInto<types::ZeroTrustUpdateAuditSshSettingsBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ZeroTrustUpdateAuditSshSettingsBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustUpdateAuditSshSettingsBody,
) -> types::builder::ZeroTrustUpdateAuditSshSettingsBody,
{
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::ZeroTrustUpdateAuditSshSettingsBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/audit_ssh_settings",
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: "zero_trust_update_audit_ssh_settings",
};
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 ZeroTrustRotateSshAccountSeed<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
}
impl<'a> ZeroTrustRotateSshAccountSeed<'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::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` 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/{}/gateway/audit_ssh_settings/rotate_seed",
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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "zero_trust_rotate_ssh_account_seed",
};
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 ZeroTrustListsZeroTrustListDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
list_id: Result<types::ZeroTrustGatewaySchemasUuid, String>,
}
impl<'a> ZeroTrustListsZeroTrustListDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewaySchemasUuid>,
{
self.list_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasUuid` for list_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,
list_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/lists/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_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: "zero_trust_lists_zero_trust_list_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 ZeroTrustListsUpdateZeroTrustList<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
list_id: Result<types::ZeroTrustGatewaySchemasUuid, String>,
body: Result<types::builder::ZeroTrustListsUpdateZeroTrustListBody, String>,
}
impl<'a> ZeroTrustListsUpdateZeroTrustList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_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::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewaySchemasUuid>,
{
self.list_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasUuid` for list_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustListsUpdateZeroTrustListBody>,
<V as std::convert::TryInto<types::ZeroTrustListsUpdateZeroTrustListBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ZeroTrustListsUpdateZeroTrustListBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustListsUpdateZeroTrustListBody,
)
-> types::builder::ZeroTrustListsUpdateZeroTrustListBody,
{
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,
list_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::ZeroTrustListsUpdateZeroTrustListBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/lists/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_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: "zero_trust_lists_update_zero_trust_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ZeroTrustListsDeleteZeroTrustList<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
list_id: Result<types::ZeroTrustGatewaySchemasUuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> ZeroTrustListsDeleteZeroTrustList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_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::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewaySchemasUuid>,
{
self.list_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasUuid` for list_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,
list_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/lists/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_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: "zero_trust_lists_delete_zero_trust_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ZeroTrustListsPatchZeroTrustList<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
list_id: Result<types::ZeroTrustGatewaySchemasUuid, String>,
body: Result<types::builder::ZeroTrustListsPatchZeroTrustListBody, String>,
}
impl<'a> ZeroTrustListsPatchZeroTrustList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_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::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewaySchemasUuid>,
{
self.list_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasUuid` for list_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustListsPatchZeroTrustListBody>,
<V as std::convert::TryInto<types::ZeroTrustListsPatchZeroTrustListBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ZeroTrustListsPatchZeroTrustListBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustListsPatchZeroTrustListBody,
)
-> types::builder::ZeroTrustListsPatchZeroTrustListBody,
{
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,
list_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::ZeroTrustListsPatchZeroTrustListBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/lists/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_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: "zero_trust_lists_patch_zero_trust_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ZeroTrustListsZeroTrustListItems<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
list_id: Result<types::ZeroTrustGatewaySchemasUuid, String>,
}
impl<'a> ZeroTrustListsZeroTrustListItems<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
list_id: Err("list_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn list_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewaySchemasUuid>,
{
self.list_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasUuid` for list_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,
list_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let list_id = list_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/lists/{}/items",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&list_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: "zero_trust_lists_zero_trust_list_items",
};
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 ZeroTrustGatewayPacfilesDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
pacfile_id: Result<types::ZeroTrustGatewayComponentsSchemasUuid, String>,
}
impl<'a> ZeroTrustGatewayPacfilesDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pacfile_id: Err("pacfile_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pacfile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewayComponentsSchemasUuid>,
{
self.pacfile_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewayComponentsSchemasUuid` for pacfile_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,
pacfile_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pacfile_id = pacfile_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/pacfiles/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pacfile_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: "zero_trust_gateway_pacfiles_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 ZeroTrustGatewayPacfilesUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
pacfile_id: Result<types::ZeroTrustGatewayComponentsSchemasUuid, String>,
body: Result<types::builder::ZeroTrustGatewayPacfilesUpdateBody, String>,
}
impl<'a> ZeroTrustGatewayPacfilesUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pacfile_id: Err("pacfile_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::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pacfile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewayComponentsSchemasUuid>,
{
self.pacfile_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewayComponentsSchemasUuid` for pacfile_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewayPacfilesUpdateBody>,
<V as std::convert::TryInto<types::ZeroTrustGatewayPacfilesUpdateBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ZeroTrustGatewayPacfilesUpdateBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustGatewayPacfilesUpdateBody,
) -> types::builder::ZeroTrustGatewayPacfilesUpdateBody,
{
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,
pacfile_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pacfile_id = pacfile_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::ZeroTrustGatewayPacfilesUpdateBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/pacfiles/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pacfile_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: "zero_trust_gateway_pacfiles_update",
};
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 ZeroTrustGatewayPacfilesDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::ZeroTrustGatewaySchemasIdentifier, String>,
pacfile_id: Result<types::ZeroTrustGatewayComponentsSchemasUuid, String>,
}
impl<'a> ZeroTrustGatewayPacfilesDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pacfile_id: Err("pacfile_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewaySchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewaySchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pacfile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustGatewayComponentsSchemasUuid>,
{
self.pacfile_id = value.try_into().map_err(|_| {
"conversion to `ZeroTrustGatewayComponentsSchemasUuid` for pacfile_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,
pacfile_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pacfile_id = pacfile_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/gateway/pacfiles/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pacfile_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: "zero_trust_gateway_pacfiles_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 ZeroTrustAccountsGetConnectivitySettings<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
}
impl<'a> ZeroTrustAccountsGetConnectivitySettings<'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::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` 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/{}/zerotrust/connectivity_settings",
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: "zero_trust_accounts_get_connectivity_settings",
};
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 ZeroTrustAccountsPatchConnectivitySettings<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
body: Result<types::builder::ZeroTrustAccountsPatchConnectivitySettingsBody, String>,
}
impl<'a> ZeroTrustAccountsPatchConnectivitySettings<'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::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
} pub fn body < V > (mut self , value : V) -> Self where V : std :: convert :: TryInto < types :: ZeroTrustAccountsPatchConnectivitySettingsBody > , < V as std :: convert :: TryInto < types :: ZeroTrustAccountsPatchConnectivitySettingsBody >> :: Error : std :: fmt :: Display ,{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `ZeroTrustAccountsPatchConnectivitySettingsBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustAccountsPatchConnectivitySettingsBody,
)
-> types::builder::ZeroTrustAccountsPatchConnectivitySettingsBody,
{
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::ZeroTrustAccountsPatchConnectivitySettingsBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/connectivity_settings",
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
.patch(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "zero_trust_accounts_patch_connectivity_settings",
};
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 ZeroTrustNetworksRouteHostnameList<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
comment: Result<types::TunnelHostnameQueryComment, String>,
existed_at: Result<types::TunnelExistedAt, String>,
hostname: Result<types::TunnelHostname, String>,
id: Result<types::TunnelHostnameRouteId, String>,
is_deleted: Result<bool, String>,
page: Result<types::TunnelPageNumber, String>,
per_page: Result<types::TunnelPerPage, String>,
tunnel_id: Result<types::TunnelComponentsSchemasTunnelId, String>,
}
impl<'a> ZeroTrustNetworksRouteHostnameList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
comment: Err("comment was not initialized".to_string()),
existed_at: Err("existed_at was not initialized".to_string()),
hostname: Err("hostname was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
is_deleted: Err("is_deleted was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
tunnel_id: Err("tunnel_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
}
pub fn comment<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelHostnameQueryComment>,
{
self.comment = value.try_into().map_err(|_| {
"conversion to `TunnelHostnameQueryComment` for comment failed".to_string()
});
self
}
pub fn existed_at<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelExistedAt>,
{
self.existed_at = value
.try_into()
.map_err(|_| "conversion to `TunnelExistedAt` for existed_at failed".to_string());
self
}
pub fn hostname<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelHostname>,
{
self.hostname = value
.try_into()
.map_err(|_| "conversion to `TunnelHostname` for hostname failed".to_string());
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelHostnameRouteId>,
{
self.id = value
.try_into()
.map_err(|_| "conversion to `TunnelHostnameRouteId` for id failed".to_string());
self
}
pub fn is_deleted<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<bool>,
{
self.is_deleted = value
.try_into()
.map_err(|_| "conversion to `bool` for is_deleted failed".to_string());
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelPageNumber>,
{
self.page = value
.try_into()
.map_err(|_| "conversion to `TunnelPageNumber` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelPerPage>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `TunnelPerPage` for per_page failed".to_string());
self
}
pub fn tunnel_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelComponentsSchemasTunnelId>,
{
self.tunnel_id = value.try_into().map_err(|_| {
"conversion to `TunnelComponentsSchemasTunnelId` for tunnel_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,
comment,
existed_at,
hostname,
id,
is_deleted,
page,
per_page,
tunnel_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let comment = comment.map_err(Error::InvalidRequest)?;
let existed_at = existed_at.map_err(Error::InvalidRequest)?;
let hostname = hostname.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let is_deleted = is_deleted.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let tunnel_id = tunnel_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/routes/hostname",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("comment", &comment))
.query(&progenitor_client::QueryParam::new(
"existed_at",
&existed_at,
))
.query(&progenitor_client::QueryParam::new("hostname", &hostname))
.query(&progenitor_client::QueryParam::new("id", &id))
.query(&progenitor_client::QueryParam::new(
"is_deleted",
&is_deleted,
))
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("tunnel_id", &tunnel_id))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "zero_trust_networks_route_hostname_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct ZeroTrustNetworksRouteHostnameCreate<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
body: Result<types::builder::ZeroTrustNetworksRouteHostnameCreateBody, String>,
}
impl<'a> ZeroTrustNetworksRouteHostnameCreate<'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::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustNetworksRouteHostnameCreateBody>,
<V as std::convert::TryInto<types::ZeroTrustNetworksRouteHostnameCreateBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ZeroTrustNetworksRouteHostnameCreateBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustNetworksRouteHostnameCreateBody,
)
-> types::builder::ZeroTrustNetworksRouteHostnameCreateBody,
{
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::ZeroTrustNetworksRouteHostnameCreateBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/routes/hostname",
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: "zero_trust_networks_route_hostname_create",
};
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 ZeroTrustNetworksRouteHostnameGet<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
hostname_route_id: Result<types::TunnelHostnameRouteId, String>,
}
impl<'a> ZeroTrustNetworksRouteHostnameGet<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
hostname_route_id: Err("hostname_route_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
}
pub fn hostname_route_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelHostnameRouteId>,
{
self.hostname_route_id = value.try_into().map_err(|_| {
"conversion to `TunnelHostnameRouteId` for hostname_route_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,
hostname_route_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let hostname_route_id = hostname_route_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/routes/hostname/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&hostname_route_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: "zero_trust_networks_route_hostname_get",
};
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 ZeroTrustNetworksRouteHostnameDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
hostname_route_id: Result<types::TunnelHostnameRouteId, String>,
}
impl<'a> ZeroTrustNetworksRouteHostnameDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
hostname_route_id: Err("hostname_route_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
}
pub fn hostname_route_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelHostnameRouteId>,
{
self.hostname_route_id = value.try_into().map_err(|_| {
"conversion to `TunnelHostnameRouteId` for hostname_route_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,
hostname_route_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let hostname_route_id = hostname_route_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/routes/hostname/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&hostname_route_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: "zero_trust_networks_route_hostname_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 ZeroTrustNetworksRouteHostnameUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
hostname_route_id: Result<types::TunnelHostnameRouteId, String>,
body: Result<types::builder::ZeroTrustNetworksRouteHostnameUpdateBody, String>,
}
impl<'a> ZeroTrustNetworksRouteHostnameUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
hostname_route_id: Err("hostname_route_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::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
}
pub fn hostname_route_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelHostnameRouteId>,
{
self.hostname_route_id = value.try_into().map_err(|_| {
"conversion to `TunnelHostnameRouteId` for hostname_route_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustNetworksRouteHostnameUpdateBody>,
<V as std::convert::TryInto<types::ZeroTrustNetworksRouteHostnameUpdateBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ZeroTrustNetworksRouteHostnameUpdateBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustNetworksRouteHostnameUpdateBody,
)
-> types::builder::ZeroTrustNetworksRouteHostnameUpdateBody,
{
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,
hostname_route_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let hostname_route_id = hostname_route_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::ZeroTrustNetworksRouteHostnameUpdateBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/routes/hostname/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&hostname_route_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: "zero_trust_networks_route_hostname_update",
};
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 ZeroTrustNetworksSubnetCreateWarp<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
body: Result<types::builder::ZeroTrustNetworksSubnetCreateWarpBody, String>,
}
impl<'a> ZeroTrustNetworksSubnetCreateWarp<'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::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustNetworksSubnetCreateWarpBody>,
<V as std::convert::TryInto<types::ZeroTrustNetworksSubnetCreateWarpBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ZeroTrustNetworksSubnetCreateWarpBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustNetworksSubnetCreateWarpBody,
)
-> types::builder::ZeroTrustNetworksSubnetCreateWarpBody,
{
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::ZeroTrustNetworksSubnetCreateWarpBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/subnets/warp",
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: "zero_trust_networks_subnet_create_warp",
};
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 ZeroTrustNetworksSubnetGetWarp<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
subnet_id: Result<types::TunnelSubnetId, String>,
}
impl<'a> ZeroTrustNetworksSubnetGetWarp<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
subnet_id: Err("subnet_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
}
pub fn subnet_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelSubnetId>,
{
self.subnet_id = value
.try_into()
.map_err(|_| "conversion to `TunnelSubnetId` for subnet_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,
subnet_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let subnet_id = subnet_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/subnets/warp/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&subnet_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: "zero_trust_networks_subnet_get_warp",
};
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 ZeroTrustNetworksSubnetDeleteWarp<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
subnet_id: Result<types::TunnelSubnetId, String>,
}
impl<'a> ZeroTrustNetworksSubnetDeleteWarp<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
subnet_id: Err("subnet_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
}
pub fn subnet_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelSubnetId>,
{
self.subnet_id = value
.try_into()
.map_err(|_| "conversion to `TunnelSubnetId` for subnet_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,
subnet_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let subnet_id = subnet_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/subnets/warp/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&subnet_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: "zero_trust_networks_subnet_delete_warp",
};
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 ZeroTrustNetworksSubnetUpdateWarp<'a> {
client: &'a crate::Client,
account_id: Result<types::TunnelAccountId, String>,
subnet_id: Result<types::TunnelSubnetId, String>,
body: Result<types::builder::ZeroTrustNetworksSubnetUpdateWarpBody, String>,
}
impl<'a> ZeroTrustNetworksSubnetUpdateWarp<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
subnet_id: Err("subnet_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::TunnelAccountId>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `TunnelAccountId` for account_id failed".to_string());
self
}
pub fn subnet_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TunnelSubnetId>,
{
self.subnet_id = value
.try_into()
.map_err(|_| "conversion to `TunnelSubnetId` for subnet_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::ZeroTrustNetworksSubnetUpdateWarpBody>,
<V as std::convert::TryInto<types::ZeroTrustNetworksSubnetUpdateWarpBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `ZeroTrustNetworksSubnetUpdateWarpBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::ZeroTrustNetworksSubnetUpdateWarpBody,
)
-> types::builder::ZeroTrustNetworksSubnetUpdateWarpBody,
{
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,
subnet_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let subnet_id = subnet_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::ZeroTrustNetworksSubnetUpdateWarpBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zerotrust/subnets/warp/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&subnet_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: "zero_trust_networks_subnet_update_warp",
};
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)),
}
}
}