use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct DlpDatasetsRead<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
dataset_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpDatasetsRead<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dataset_id: Err("dataset_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn dataset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.dataset_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for dataset_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,
dataset_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dataset_id = dataset_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/datasets/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dataset_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: "dlp_datasets_read",
};
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 DlpDatasetsUpdate<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
dataset_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpDatasetsUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dataset_id: Err("dataset_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn dataset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.dataset_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for dataset_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,
dataset_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dataset_id = dataset_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/datasets/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dataset_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: "dlp_datasets_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 DlpDatasetsDelete<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
dataset_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpDatasetsDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dataset_id: Err("dataset_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn dataset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.dataset_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for dataset_id failed".to_string());
self
}
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self {
client,
account_id,
dataset_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dataset_id = dataset_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/datasets/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dataset_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).headers(header_map).build()?;
let info = OperationInfo {
operation_id: "dlp_datasets_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 => Ok(ResponseValue::empty(response)),
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DlpDatasetsCreateVersion<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
dataset_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpDatasetsCreateVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dataset_id: Err("dataset_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn dataset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.dataset_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for dataset_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,
dataset_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dataset_id = dataset_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/datasets/{}/upload",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dataset_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: "dlp_datasets_create_version",
};
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)]
pub struct DlpDatasetsUploadVersion<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
dataset_id: Result<::uuid::Uuid, String>,
version: Result<i64, String>,
body: Result<reqwest::Body, String>,
}
impl<'a> DlpDatasetsUploadVersion<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dataset_id: Err("dataset_id was not initialized".to_string()),
version: Err("version 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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn dataset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.dataset_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for dataset_id failed".to_string());
self
}
pub fn version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.version = value
.try_into()
.map_err(|_| "conversion to `i64` for version failed".to_string());
self
}
pub fn body<B>(mut self, value: B) -> Self
where
B: std::convert::TryInto<reqwest::Body>,
{
self.body = value
.try_into()
.map_err(|_| "conversion to `reqwest::Body` 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,
dataset_id,
version,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dataset_id = dataset_id.map_err(Error::InvalidRequest)?;
let version = version.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/datasets/{}/upload/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dataset_id.to_string()),
encode_path(&version.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"),
)
.header(
::reqwest::header::CONTENT_TYPE,
::reqwest::header::HeaderValue::from_static("application/octet-stream"),
)
.body(body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dlp_datasets_upload_version",
};
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 DlpDatasetsDefineColumns<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
dataset_id: Result<::uuid::Uuid, String>,
version: Result<i64, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpDatasetsDefineColumns<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dataset_id: Err("dataset_id was not initialized".to_string()),
version: Err("version 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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn dataset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.dataset_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for dataset_id failed".to_string());
self
}
pub fn version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.version = value
.try_into()
.map_err(|_| "conversion to `i64` for version 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,
dataset_id,
version,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dataset_id = dataset_id.map_err(Error::InvalidRequest)?;
let version = version.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/datasets/{}/versions/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dataset_id.to_string()),
encode_path(&version.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: "dlp_datasets_define_columns",
};
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)]
pub struct DlpDatasetsUploadDatasetColumn<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
dataset_id: Result<::uuid::Uuid, String>,
version: Result<i64, String>,
entry_id: Result<::uuid::Uuid, String>,
body: Result<reqwest::Body, String>,
}
impl<'a> DlpDatasetsUploadDatasetColumn<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
dataset_id: Err("dataset_id was not initialized".to_string()),
version: Err("version was not initialized".to_string()),
entry_id: Err("entry_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn dataset_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.dataset_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for dataset_id failed".to_string());
self
}
pub fn version<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.version = value
.try_into()
.map_err(|_| "conversion to `i64` for version failed".to_string());
self
}
pub fn entry_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.entry_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for entry_id failed".to_string());
self
}
pub fn body<B>(mut self, value: B) -> Self
where
B: std::convert::TryInto<reqwest::Body>,
{
self.body = value
.try_into()
.map_err(|_| "conversion to `reqwest::Body` 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,
dataset_id,
version,
entry_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let dataset_id = dataset_id.map_err(Error::InvalidRequest)?;
let version = version.map_err(Error::InvalidRequest)?;
let entry_id = entry_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/datasets/{}/versions/{}/entries/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&dataset_id.to_string()),
encode_path(&version.to_string()),
encode_path(&entry_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"),
)
.header(
::reqwest::header::CONTENT_TYPE,
::reqwest::header::HeaderValue::from_static("application/octet-stream"),
)
.body(body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dlp_datasets_upload_dataset_column",
};
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 DlpDocumentFingerprintsReadAll<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
}
impl<'a> DlpDocumentFingerprintsReadAll<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` 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/{}/dlp/document_fingerprints",
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: "dlp_document_fingerprints_read_all",
};
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 DlpDocumentFingerprintsCreate<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpDocumentFingerprintsCreate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/document_fingerprints",
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: "dlp_document_fingerprints_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 DlpDocumentFingerprintsRead<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
document_fingerprint_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpDocumentFingerprintsRead<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
document_fingerprint_id: Err(
"document_fingerprint_id was not initialized".to_string()
),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn document_fingerprint_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.document_fingerprint_id = value.try_into().map_err(|_| {
"conversion to `:: uuid :: Uuid` for document_fingerprint_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,
document_fingerprint_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let document_fingerprint_id = document_fingerprint_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/document_fingerprints/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&document_fingerprint_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: "dlp_document_fingerprints_read",
};
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 DlpDocumentFingerprintsUpload<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
document_fingerprint_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpDocumentFingerprintsUpload<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
document_fingerprint_id: Err(
"document_fingerprint_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn document_fingerprint_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.document_fingerprint_id = value.try_into().map_err(|_| {
"conversion to `:: uuid :: Uuid` for document_fingerprint_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,
document_fingerprint_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let document_fingerprint_id = document_fingerprint_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/document_fingerprints/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&document_fingerprint_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: "dlp_document_fingerprints_upload",
};
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 DlpDocumentFingerprintsUpdate<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
document_fingerprint_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpDocumentFingerprintsUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
document_fingerprint_id: Err(
"document_fingerprint_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn document_fingerprint_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.document_fingerprint_id = value.try_into().map_err(|_| {
"conversion to `:: uuid :: Uuid` for document_fingerprint_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,
document_fingerprint_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let document_fingerprint_id = document_fingerprint_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/document_fingerprints/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&document_fingerprint_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: "dlp_document_fingerprints_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 DlpDocumentFingerprintsDelete<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
document_fingerprint_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpDocumentFingerprintsDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
document_fingerprint_id: Err(
"document_fingerprint_id was not initialized".to_string()
),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn document_fingerprint_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.document_fingerprint_id = value.try_into().map_err(|_| {
"conversion to `:: uuid :: Uuid` for document_fingerprint_id failed".to_string()
});
self
}
pub async fn send(self) -> Result<ResponseValue<()>, Error<()>> {
let Self {
client,
account_id,
document_fingerprint_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let document_fingerprint_id = document_fingerprint_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/document_fingerprints/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&document_fingerprint_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).headers(header_map).build()?;
let info = OperationInfo {
operation_id: "dlp_document_fingerprints_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 => Ok(ResponseValue::empty(response)),
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DlpEmailScannerGetAccountMapping<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
}
impl<'a> DlpEmailScannerGetAccountMapping<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` 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/{}/dlp/email/account_mapping",
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: "dlp_email_scanner_get_account_mapping",
};
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 DlpEmailScannerCreateAccountMapping<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpEmailScannerCreateAccountMapping<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/email/account_mapping",
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: "dlp_email_scanner_create_account_mapping",
};
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 DlpEmailScannerGetRule<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
rule_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpEmailScannerGetRule<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
rule_id: Err("rule_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn rule_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.rule_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for rule_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,
rule_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let rule_id = rule_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/email/rules/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&rule_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dlp_email_scanner_get_rule",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DlpEmailScannerUpdateRule<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
rule_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpEmailScannerUpdateRule<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
rule_id: Err("rule_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn rule_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.rule_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for rule_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
rule_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let rule_id = rule_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/email/rules/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&rule_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dlp_email_scanner_update_rule",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DlpEmailScannerDeleteRule<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
rule_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpEmailScannerDeleteRule<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
rule_id: Err("rule_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn rule_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.rule_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for rule_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,
rule_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let rule_id = rule_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/email/rules/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&rule_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dlp_email_scanner_delete_rule",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct DlpEntriesGetDlpEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
entry_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpEntriesGetDlpEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
entry_id: Err("entry_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn entry_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.entry_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for entry_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,
entry_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let entry_id = entry_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&entry_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: "dlp_entries_get_dlp_entry",
};
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 DlpEntriesUpdateEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
entry_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpEntriesUpdateEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
entry_id: Err("entry_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn entry_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.entry_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for entry_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,
entry_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let entry_id = entry_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&entry_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: "dlp_entries_update_entry",
};
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 DlpEntriesDeleteEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
entry_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpEntriesDeleteEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
entry_id: Err("entry_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn entry_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.entry_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for entry_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,
entry_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let entry_id = entry_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&entry_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: "dlp_entries_delete_entry",
};
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 DlpEntriesUpdateCustomEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
entry_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpEntriesUpdateCustomEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
entry_id: Err("entry_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn entry_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.entry_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for entry_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,
entry_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let entry_id = entry_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/custom/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&entry_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: "dlp_entries_update_custom_entry",
};
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 DlpEntriesCreateIntegrationEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpEntriesCreateIntegrationEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/integration",
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: "dlp_entries_create_integration_entry",
};
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 DlpEntriesUpdateIntegrationEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
entry_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpEntriesUpdateIntegrationEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
entry_id: Err("entry_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn entry_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.entry_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for entry_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,
entry_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let entry_id = entry_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/integration/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&entry_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: "dlp_entries_update_integration_entry",
};
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 DlpEntriesDeleteIntegrationEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
entry_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpEntriesDeleteIntegrationEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
entry_id: Err("entry_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn entry_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.entry_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for entry_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,
entry_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let entry_id = entry_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/integration/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&entry_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: "dlp_entries_delete_integration_entry",
};
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 DlpEntriesCreatePredefinedEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpEntriesCreatePredefinedEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/predefined",
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: "dlp_entries_create_predefined_entry",
};
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 DlpEntriesUpdatePredefinedEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
entry_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpEntriesUpdatePredefinedEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
entry_id: Err("entry_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn entry_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.entry_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for entry_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,
entry_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let entry_id = entry_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/predefined/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&entry_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: "dlp_entries_update_predefined_entry",
};
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 DlpEntriesDeletePredefinedEntry<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
entry_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpEntriesDeletePredefinedEntry<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
entry_id: Err("entry_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn entry_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.entry_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for entry_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,
entry_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let entry_id = entry_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/entries/predefined/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&entry_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: "dlp_entries_delete_predefined_entry",
};
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 DlpPatternValidate<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpPatternValidate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/patterns/validate",
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: "dlp_pattern_validate",
};
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 DlpProfilesGetDlpProfile<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpProfilesGetDlpProfile<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_get_dlp_profile",
};
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 DlpProfilesListAllCustomProfiles<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
}
impl<'a> DlpProfilesListAllCustomProfiles<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` 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/{}/dlp/profiles/custom",
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: "dlp_profiles_list_all_custom_profiles",
};
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 DlpProfilesCreateCustomProfiles<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpProfilesCreateCustomProfiles<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/custom",
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: "dlp_profiles_create_custom_profiles",
};
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 DlpProfilesGetCustomProfile<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpProfilesGetCustomProfile<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/custom/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_get_custom_profile",
};
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 DlpProfilesUpdateCustomProfile<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpProfilesUpdateCustomProfile<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/custom/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_update_custom_profile",
};
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 DlpProfilesDeleteCustomProfile<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpProfilesDeleteCustomProfile<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/custom/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_delete_custom_profile",
};
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 DlpProfilesCreatePredefinedProfile<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpProfilesCreatePredefinedProfile<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/predefined",
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: "dlp_profiles_create_predefined_profile",
};
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 DlpProfilesGetPredefinedProfile<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpProfilesGetPredefinedProfile<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/predefined/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_get_predefined_profile",
};
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 DlpProfilesUpdatePredefinedProfile<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpProfilesUpdatePredefinedProfile<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/predefined/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_update_predefined_profile",
};
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 DlpProfilesDeletePredefinedProfile<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpProfilesDeletePredefinedProfile<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/predefined/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_delete_predefined_profile",
};
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 DlpProfilesGetPredefinedProfileConfig<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpProfilesGetPredefinedProfileConfig<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/predefined/{}/config",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_get_predefined_profile_config",
};
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 DlpProfilesUpdatePredefinedProfileConfig<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpProfilesUpdatePredefinedProfileConfig<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/predefined/{}/config",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_update_predefined_profile_config",
};
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 DlpProfilesCreatePredefinedProfileConfig<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
profile_id: Result<::uuid::Uuid, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpProfilesCreatePredefinedProfileConfig<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
profile_id: Err("profile_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn profile_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.profile_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` for profile_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,
profile_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let profile_id = profile_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/dlp/profiles/predefined/{}/config",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&profile_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: "dlp_profiles_create_predefined_profile_config",
};
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 DlpRiskScoreSummaryGetForUser<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
user_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpRiskScoreSummaryGetForUser<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` 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/{}/zt_risk_scoring/{}",
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: "dlp_risk_score_summary_get_for_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 DlpRiskScoreResetPost<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
user_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpRiskScoreResetPost<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn user_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.user_id = value
.try_into()
.map_err(|_| "conversion to `:: uuid :: Uuid` 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/{}/zt_risk_scoring/{}/reset",
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
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "dlp_risk_score_reset_post",
};
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 DlpRiskScoreBehaviorsGet<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
}
impl<'a> DlpRiskScoreBehaviorsGet<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` 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/{}/zt_risk_scoring/behaviors",
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: "dlp_risk_score_behaviors_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 DlpRiskScoreBehaviorsPut<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> DlpRiskScoreBehaviorsPut<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_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,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zt_risk_scoring/behaviors",
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: "dlp_risk_score_behaviors_put",
};
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 DlpZtRiskScoreIntegrationList<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
}
impl<'a> DlpZtRiskScoreIntegrationList<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` 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/{}/zt_risk_scoring/integrations",
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: "dlp_zt_risk_score_integration_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 DlpZtRiskScoreIntegrationCreate<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
body: Result<types::builder::DlpCreateIntegrationBody, String>,
}
impl<'a> DlpZtRiskScoreIntegrationCreate<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DlpCreateIntegrationBody>,
<V as std::convert::TryInto<types::DlpCreateIntegrationBody>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `DlpCreateIntegrationBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::DlpCreateIntegrationBody,
) -> types::builder::DlpCreateIntegrationBody,
{
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::DlpCreateIntegrationBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zt_risk_scoring/integrations",
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: "dlp_zt_risk_score_integration_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 DlpZtRiskScoreIntegrationGet<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
integration_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpZtRiskScoreIntegrationGet<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
integration_id: Err("integration_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn integration_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.integration_id = value.try_into().map_err(|_| {
"conversion to `:: uuid :: Uuid` for integration_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,
integration_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let integration_id = integration_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zt_risk_scoring/integrations/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&integration_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: "dlp_zt_risk_score_integration_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 DlpZtRiskScoreIntegrationUpdate<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
integration_id: Result<::uuid::Uuid, String>,
body: Result<types::builder::DlpUpdateIntegrationBody, String>,
}
impl<'a> DlpZtRiskScoreIntegrationUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
integration_id: Err("integration_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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn integration_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.integration_id = value.try_into().map_err(|_| {
"conversion to `:: uuid :: Uuid` for integration_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::DlpUpdateIntegrationBody>,
<V as std::convert::TryInto<types::DlpUpdateIntegrationBody>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `DlpUpdateIntegrationBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::DlpUpdateIntegrationBody,
) -> types::builder::DlpUpdateIntegrationBody,
{
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,
integration_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let integration_id = integration_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::DlpUpdateIntegrationBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zt_risk_scoring/integrations/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&integration_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: "dlp_zt_risk_score_integration_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 DlpZtRiskScoreIntegrationDelete<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
integration_id: Result<::uuid::Uuid, String>,
}
impl<'a> DlpZtRiskScoreIntegrationDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
integration_id: Err("integration_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for account_id failed".to_string()
});
self
}
pub fn integration_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::uuid::Uuid>,
{
self.integration_id = value.try_into().map_err(|_| {
"conversion to `:: uuid :: Uuid` for integration_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,
integration_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let integration_id = integration_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/zt_risk_scoring/integrations/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&integration_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: "dlp_zt_risk_score_integration_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 DlpRiskScoreSummaryGet<'a> {
client: &'a crate::Client,
account_id: Result<::std::string::String, String>,
}
impl<'a> DlpRiskScoreSummaryGet<'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<::std::string::String>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` 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/{}/zt_risk_scoring/summary",
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: "dlp_risk_score_summary_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)),
}
}
}