#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeThreatListDiffRequest {
#[prost(enumeration = "ThreatType", tag = "1")]
pub threat_type: i32,
#[prost(bytes = "vec", tag = "2")]
pub version_token: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag = "3")]
pub constraints: ::core::option::Option<compute_threat_list_diff_request::Constraints>,
}
pub mod compute_threat_list_diff_request {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Constraints {
#[prost(int32, tag = "1")]
pub max_diff_entries: i32,
#[prost(int32, tag = "2")]
pub max_database_entries: i32,
#[prost(enumeration = "super::CompressionType", repeated, tag = "3")]
pub supported_compressions: ::prost::alloc::vec::Vec<i32>,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeThreatListDiffResponse {
#[prost(enumeration = "compute_threat_list_diff_response::ResponseType", tag = "4")]
pub response_type: i32,
#[prost(message, optional, tag = "5")]
pub additions: ::core::option::Option<ThreatEntryAdditions>,
#[prost(message, optional, tag = "6")]
pub removals: ::core::option::Option<ThreatEntryRemovals>,
#[prost(bytes = "vec", tag = "7")]
pub new_version_token: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag = "8")]
pub checksum: ::core::option::Option<compute_threat_list_diff_response::Checksum>,
#[prost(message, optional, tag = "2")]
pub recommended_next_diff: ::core::option::Option<::prost_types::Timestamp>,
}
pub mod compute_threat_list_diff_response {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Checksum {
#[prost(bytes = "vec", tag = "1")]
pub sha256: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ResponseType {
Unspecified = 0,
Diff = 1,
Reset = 2,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchUrisRequest {
#[prost(string, tag = "1")]
pub uri: ::prost::alloc::string::String,
#[prost(enumeration = "ThreatType", repeated, packed = "false", tag = "2")]
pub threat_types: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchUrisResponse {
#[prost(message, optional, tag = "1")]
pub threat: ::core::option::Option<search_uris_response::ThreatUri>,
}
pub mod search_uris_response {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ThreatUri {
#[prost(enumeration = "super::ThreatType", repeated, tag = "1")]
pub threat_types: ::prost::alloc::vec::Vec<i32>,
#[prost(message, optional, tag = "2")]
pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchHashesRequest {
#[prost(bytes = "vec", tag = "1")]
pub hash_prefix: ::prost::alloc::vec::Vec<u8>,
#[prost(enumeration = "ThreatType", repeated, packed = "false", tag = "2")]
pub threat_types: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchHashesResponse {
#[prost(message, repeated, tag = "1")]
pub threats: ::prost::alloc::vec::Vec<search_hashes_response::ThreatHash>,
#[prost(message, optional, tag = "2")]
pub negative_expire_time: ::core::option::Option<::prost_types::Timestamp>,
}
pub mod search_hashes_response {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ThreatHash {
#[prost(enumeration = "super::ThreatType", repeated, tag = "1")]
pub threat_types: ::prost::alloc::vec::Vec<i32>,
#[prost(bytes = "vec", tag = "2")]
pub hash: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag = "3")]
pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ThreatEntryAdditions {
#[prost(message, repeated, tag = "1")]
pub raw_hashes: ::prost::alloc::vec::Vec<RawHashes>,
#[prost(message, optional, tag = "2")]
pub rice_hashes: ::core::option::Option<RiceDeltaEncoding>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ThreatEntryRemovals {
#[prost(message, optional, tag = "1")]
pub raw_indices: ::core::option::Option<RawIndices>,
#[prost(message, optional, tag = "2")]
pub rice_indices: ::core::option::Option<RiceDeltaEncoding>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawIndices {
#[prost(int32, repeated, tag = "1")]
pub indices: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawHashes {
#[prost(int32, tag = "1")]
pub prefix_size: i32,
#[prost(bytes = "vec", tag = "2")]
pub raw_hashes: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RiceDeltaEncoding {
#[prost(int64, tag = "1")]
pub first_value: i64,
#[prost(int32, tag = "2")]
pub rice_parameter: i32,
#[prost(int32, tag = "3")]
pub entry_count: i32,
#[prost(bytes = "vec", tag = "4")]
pub encoded_data: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ThreatType {
Unspecified = 0,
Malware = 1,
SocialEngineering = 2,
UnwantedSoftware = 3,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CompressionType {
Unspecified = 0,
Raw = 1,
Rice = 2,
}
#[doc = r" Generated client implementations."]
pub mod web_risk_service_v1_beta1_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Web Risk v1beta1 API defines an interface to detect malicious URLs on your"]
#[doc = " website and in client applications."]
#[derive(Debug, Clone)]
pub struct WebRiskServiceV1Beta1Client<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> WebRiskServiceV1Beta1Client<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> WebRiskServiceV1Beta1Client<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
WebRiskServiceV1Beta1Client::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Gets the most recent threat list diffs."]
pub async fn compute_threat_list_diff(
&mut self,
request: impl tonic::IntoRequest<super::ComputeThreatListDiffRequest>,
) -> Result<tonic::Response<super::ComputeThreatListDiffResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1/ComputeThreatListDiff",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " This method is used to check whether a URI is on a given threatList."]
pub async fn search_uris(
&mut self,
request: impl tonic::IntoRequest<super::SearchUrisRequest>,
) -> Result<tonic::Response<super::SearchUrisResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1/SearchUris",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the full hashes that match the requested hash prefix."]
#[doc = " This is used after a hash prefix is looked up in a threatList"]
#[doc = " and there is a match. The client side threatList only holds partial hashes"]
#[doc = " so the client must query this method to determine if there is a full"]
#[doc = " hash match of a threat."]
pub async fn search_hashes(
&mut self,
request: impl tonic::IntoRequest<super::SearchHashesRequest>,
) -> Result<tonic::Response<super::SearchHashesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1/SearchHashes",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}