#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RuleSetDescriptor {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "4")]
pub rules: ::prost::alloc::vec::Vec<rule_set_descriptor::RuleDescription>,
}
pub mod rule_set_descriptor {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RuleDescription {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(int64, tag = "8")]
pub anomaly_score: i64,
#[prost(int64, tag = "9")]
pub paranoia_level: i64,
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRuleSetDescriptorRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
}
pub mod rule_set_descriptor_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct RuleSetDescriptorServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl RuleSetDescriptorServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> RuleSetDescriptorServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<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_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> RuleSetDescriptorServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
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,
{
RuleSetDescriptorServiceClient::new(
InterceptedService::new(inner, interceptor),
)
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::GetRuleSetDescriptorRequest>,
) -> std::result::Result<
tonic::Response<super::RuleSetDescriptor>,
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(
"/yandex.cloud.smartwebsecurity.v1.waf.RuleSetDescriptorService/Get",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartwebsecurity.v1.waf.RuleSetDescriptorService",
"Get",
),
);
self.inner.unary(req, path, codec).await
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WafProfile {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub folder_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub cloud_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub description: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "6")]
pub labels: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(message, optional, tag = "7")]
pub created_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, repeated, tag = "9")]
pub rules: ::prost::alloc::vec::Vec<WafProfileRule>,
#[prost(message, repeated, tag = "10")]
pub exclusion_rules: ::prost::alloc::vec::Vec<WafProfileExclusionRule>,
#[deprecated]
#[prost(message, optional, tag = "12")]
pub analyze_request_body: ::core::option::Option<waf_profile::AnalyzeRequestBody>,
#[prost(oneof = "waf_profile::RuleSet", tags = "11")]
pub rule_set: ::core::option::Option<waf_profile::RuleSet>,
}
pub mod waf_profile {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CoreRuleSet {
#[prost(int64, tag = "1")]
pub inbound_anomaly_score: i64,
#[prost(int64, tag = "2")]
pub paranoia_level: i64,
#[prost(message, optional, tag = "3")]
pub rule_set: ::core::option::Option<super::RuleSet>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeRequestBody {
#[prost(bool, tag = "1")]
pub is_enabled: bool,
#[prost(int64, tag = "2")]
pub size_limit: i64,
#[prost(enumeration = "analyze_request_body::Action", tag = "3")]
pub size_limit_action: i32,
}
pub mod analyze_request_body {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Action {
Unspecified = 0,
Ignore = 1,
Deny = 2,
}
impl Action {
pub fn as_str_name(&self) -> &'static str {
match self {
Action::Unspecified => "ACTION_UNSPECIFIED",
Action::Ignore => "IGNORE",
Action::Deny => "DENY",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ACTION_UNSPECIFIED" => Some(Self::Unspecified),
"IGNORE" => Some(Self::Ignore),
"DENY" => Some(Self::Deny),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum RuleSet {
#[prost(message, tag = "11")]
CoreRuleSet(CoreRuleSet),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WafProfileRule {
#[prost(string, tag = "1")]
pub rule_id: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub is_enabled: bool,
#[prost(bool, tag = "3")]
pub is_blocking: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WafProfileExclusionRule {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub condition: ::core::option::Option<super::Condition>,
#[prost(message, optional, tag = "4")]
pub exclude_rules: ::core::option::Option<waf_profile_exclusion_rule::ExcludeRules>,
#[prost(bool, tag = "5")]
pub log_excluded: bool,
}
pub mod waf_profile_exclusion_rule {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExcludeRules {
#[prost(bool, tag = "1")]
pub exclude_all: bool,
#[prost(string, repeated, tag = "2")]
pub rule_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RuleSet {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetWafProfileRequest {
#[prost(string, tag = "1")]
pub waf_profile_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListWafProfilesRequest {
#[prost(string, tag = "1")]
pub folder_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListWafProfilesResponse {
#[prost(message, repeated, tag = "1")]
pub waf_profiles: ::prost::alloc::vec::Vec<WafProfile>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateWafProfileRequest {
#[prost(string, tag = "1")]
pub folder_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "4")]
pub labels: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(message, repeated, tag = "5")]
pub rules: ::prost::alloc::vec::Vec<WafProfileRule>,
#[prost(message, repeated, tag = "6")]
pub exclusion_rules: ::prost::alloc::vec::Vec<WafProfileExclusionRule>,
#[prost(message, optional, tag = "8")]
pub analyze_request_body: ::core::option::Option<waf_profile::AnalyzeRequestBody>,
#[prost(oneof = "create_waf_profile_request::RuleSet", tags = "7")]
pub rule_set: ::core::option::Option<create_waf_profile_request::RuleSet>,
}
pub mod create_waf_profile_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum RuleSet {
#[prost(message, tag = "7")]
CoreRuleSet(super::waf_profile::CoreRuleSet),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateWafProfileMetadata {
#[prost(string, tag = "1")]
pub waf_profile_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateWafProfileRequest {
#[prost(string, tag = "1")]
pub waf_profile_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
#[prost(string, tag = "3")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub description: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "5")]
pub labels: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
#[prost(message, repeated, tag = "6")]
pub rules: ::prost::alloc::vec::Vec<WafProfileRule>,
#[prost(message, repeated, tag = "7")]
pub exclusion_rules: ::prost::alloc::vec::Vec<WafProfileExclusionRule>,
#[prost(message, optional, tag = "9")]
pub analyze_request_body: ::core::option::Option<waf_profile::AnalyzeRequestBody>,
#[prost(oneof = "update_waf_profile_request::RuleSet", tags = "8")]
pub rule_set: ::core::option::Option<update_waf_profile_request::RuleSet>,
}
pub mod update_waf_profile_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum RuleSet {
#[prost(message, tag = "8")]
CoreRuleSet(super::waf_profile::CoreRuleSet),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateWafProfileMetadata {
#[prost(string, tag = "1")]
pub waf_profile_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteWafProfileRequest {
#[prost(string, tag = "1")]
pub waf_profile_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteWafProfileMetadata {
#[prost(string, tag = "1")]
pub waf_profile_id: ::prost::alloc::string::String,
}
pub mod waf_profile_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct WafProfileServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl WafProfileServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> WafProfileServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<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_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> WafProfileServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
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,
{
WafProfileServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::GetWafProfileRequest>,
) -> std::result::Result<tonic::Response<super::WafProfile>, 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(
"/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/Get",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartwebsecurity.v1.waf.WafProfileService",
"Get",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListWafProfilesRequest>,
) -> std::result::Result<
tonic::Response<super::ListWafProfilesResponse>,
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(
"/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartwebsecurity.v1.waf.WafProfileService",
"List",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::CreateWafProfileRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::operation::Operation>,
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(
"/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/Create",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartwebsecurity.v1.waf.WafProfileService",
"Create",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::UpdateWafProfileRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::operation::Operation>,
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(
"/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/Update",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartwebsecurity.v1.waf.WafProfileService",
"Update",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::DeleteWafProfileRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::operation::Operation>,
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(
"/yandex.cloud.smartwebsecurity.v1.waf.WafProfileService/Delete",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartwebsecurity.v1.waf.WafProfileService",
"Delete",
),
);
self.inner.unary(req, path, codec).await
}
}
}