#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Captcha {
#[prost(string, tag = "21")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub folder_id: ::prost::alloc::string::String,
#[prost(string, tag = "12")]
pub cloud_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub client_key: ::prost::alloc::string::String,
#[prost(message, optional, tag = "5")]
pub created_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "7")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "8")]
pub allowed_sites: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(enumeration = "CaptchaComplexity", tag = "9")]
pub complexity: i32,
#[prost(string, tag = "10")]
pub style_json: ::prost::alloc::string::String,
#[prost(bool, tag = "13")]
pub suspend: bool,
#[prost(bool, tag = "14")]
pub turn_off_hostname_check: bool,
#[prost(enumeration = "CaptchaPreCheckType", tag = "16")]
pub pre_check_type: i32,
#[prost(enumeration = "CaptchaChallengeType", tag = "17")]
pub challenge_type: i32,
#[prost(message, repeated, tag = "19")]
pub security_rules: ::prost::alloc::vec::Vec<SecurityRule>,
#[prost(bool, tag = "22")]
pub deletion_protection: bool,
#[prost(message, repeated, tag = "23")]
pub override_variants: ::prost::alloc::vec::Vec<OverrideVariant>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OverrideVariant {
#[prost(string, tag = "1")]
pub uuid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(enumeration = "CaptchaComplexity", tag = "3")]
pub complexity: i32,
#[prost(enumeration = "CaptchaPreCheckType", tag = "4")]
pub pre_check_type: i32,
#[prost(enumeration = "CaptchaChallengeType", tag = "5")]
pub challenge_type: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CaptchaSecretKey {
#[prost(string, tag = "1")]
pub server_key: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SecurityRule {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub priority: i64,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(message, optional, tag = "4")]
pub condition: ::core::option::Option<Condition>,
#[prost(string, tag = "6")]
pub override_variant_uuid: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Condition {
#[prost(message, optional, tag = "1")]
pub host: ::core::option::Option<condition::HostMatcher>,
#[prost(message, optional, tag = "2")]
pub uri: ::core::option::Option<condition::UriMatcher>,
#[prost(message, repeated, tag = "3")]
pub headers: ::prost::alloc::vec::Vec<condition::HeaderMatcher>,
#[prost(message, optional, tag = "4")]
pub source_ip: ::core::option::Option<condition::IpMatcher>,
}
pub mod condition {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StringMatcher {
#[prost(oneof = "string_matcher::Match", tags = "1, 2, 3, 4, 5, 6")]
pub r#match: ::core::option::Option<string_matcher::Match>,
}
pub mod string_matcher {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Match {
#[prost(string, tag = "1")]
ExactMatch(::prost::alloc::string::String),
#[prost(string, tag = "2")]
ExactNotMatch(::prost::alloc::string::String),
#[prost(string, tag = "3")]
PrefixMatch(::prost::alloc::string::String),
#[prost(string, tag = "4")]
PrefixNotMatch(::prost::alloc::string::String),
#[prost(string, tag = "5")]
PireRegexMatch(::prost::alloc::string::String),
#[prost(string, tag = "6")]
PireRegexNotMatch(::prost::alloc::string::String),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HostMatcher {
#[prost(message, repeated, tag = "1")]
pub hosts: ::prost::alloc::vec::Vec<StringMatcher>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UriMatcher {
#[prost(message, optional, tag = "1")]
pub path: ::core::option::Option<StringMatcher>,
#[prost(message, repeated, tag = "2")]
pub queries: ::prost::alloc::vec::Vec<QueryMatcher>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryMatcher {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub value: ::core::option::Option<StringMatcher>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HeaderMatcher {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub value: ::core::option::Option<StringMatcher>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IpMatcher {
#[prost(message, optional, tag = "1")]
pub ip_ranges_match: ::core::option::Option<IpRangesMatcher>,
#[prost(message, optional, tag = "2")]
pub ip_ranges_not_match: ::core::option::Option<IpRangesMatcher>,
#[prost(message, optional, tag = "3")]
pub geo_ip_match: ::core::option::Option<GeoIpMatcher>,
#[prost(message, optional, tag = "4")]
pub geo_ip_not_match: ::core::option::Option<GeoIpMatcher>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IpRangesMatcher {
#[prost(string, repeated, tag = "1")]
pub ip_ranges: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GeoIpMatcher {
#[prost(string, repeated, tag = "1")]
pub locations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CaptchaComplexity {
Unspecified = 0,
Easy = 1,
Medium = 2,
Hard = 3,
ForceHard = 4,
}
impl CaptchaComplexity {
pub fn as_str_name(&self) -> &'static str {
match self {
CaptchaComplexity::Unspecified => "CAPTCHA_COMPLEXITY_UNSPECIFIED",
CaptchaComplexity::Easy => "EASY",
CaptchaComplexity::Medium => "MEDIUM",
CaptchaComplexity::Hard => "HARD",
CaptchaComplexity::ForceHard => "FORCE_HARD",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CAPTCHA_COMPLEXITY_UNSPECIFIED" => Some(Self::Unspecified),
"EASY" => Some(Self::Easy),
"MEDIUM" => Some(Self::Medium),
"HARD" => Some(Self::Hard),
"FORCE_HARD" => Some(Self::ForceHard),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CaptchaPreCheckType {
Unspecified = 0,
Checkbox = 1,
Slider = 2,
}
impl CaptchaPreCheckType {
pub fn as_str_name(&self) -> &'static str {
match self {
CaptchaPreCheckType::Unspecified => "CAPTCHA_PRE_CHECK_TYPE_UNSPECIFIED",
CaptchaPreCheckType::Checkbox => "CHECKBOX",
CaptchaPreCheckType::Slider => "SLIDER",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CAPTCHA_PRE_CHECK_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"CHECKBOX" => Some(Self::Checkbox),
"SLIDER" => Some(Self::Slider),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CaptchaChallengeType {
Unspecified = 0,
ImageText = 1,
Silhouettes = 2,
Kaleidoscope = 3,
}
impl CaptchaChallengeType {
pub fn as_str_name(&self) -> &'static str {
match self {
CaptchaChallengeType::Unspecified => "CAPTCHA_CHALLENGE_TYPE_UNSPECIFIED",
CaptchaChallengeType::ImageText => "IMAGE_TEXT",
CaptchaChallengeType::Silhouettes => "SILHOUETTES",
CaptchaChallengeType::Kaleidoscope => "KALEIDOSCOPE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CAPTCHA_CHALLENGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"IMAGE_TEXT" => Some(Self::ImageText),
"SILHOUETTES" => Some(Self::Silhouettes),
"KALEIDOSCOPE" => Some(Self::Kaleidoscope),
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCaptchaRequest {
#[prost(string, tag = "1")]
pub captcha_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListCaptchasRequest {
#[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 ListCaptchasResponse {
#[prost(message, repeated, tag = "3")]
pub resources: ::prost::alloc::vec::Vec<Captcha>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateCaptchaRequest {
#[prost(string, tag = "1")]
pub folder_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub allowed_sites: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(enumeration = "CaptchaComplexity", tag = "4")]
pub complexity: i32,
#[prost(string, tag = "5")]
pub style_json: ::prost::alloc::string::String,
#[prost(bool, tag = "6")]
pub turn_off_hostname_check: bool,
#[prost(enumeration = "CaptchaPreCheckType", tag = "8")]
pub pre_check_type: i32,
#[prost(enumeration = "CaptchaChallengeType", tag = "9")]
pub challenge_type: i32,
#[prost(message, repeated, tag = "11")]
pub security_rules: ::prost::alloc::vec::Vec<SecurityRule>,
#[prost(bool, tag = "12")]
pub deletion_protection: bool,
#[prost(message, repeated, tag = "13")]
pub override_variants: ::prost::alloc::vec::Vec<OverrideVariant>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateCaptchaMetadata {
#[prost(string, tag = "1")]
pub captcha_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteCaptchaRequest {
#[prost(string, tag = "1")]
pub captcha_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteCaptchaMetadata {
#[prost(string, tag = "1")]
pub captcha_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateCaptchaRequest {
#[prost(string, tag = "1")]
pub captcha_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, repeated, tag = "4")]
pub allowed_sites: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(enumeration = "CaptchaComplexity", tag = "5")]
pub complexity: i32,
#[prost(string, tag = "6")]
pub style_json: ::prost::alloc::string::String,
#[prost(bool, tag = "7")]
pub turn_off_hostname_check: bool,
#[prost(enumeration = "CaptchaPreCheckType", tag = "9")]
pub pre_check_type: i32,
#[prost(enumeration = "CaptchaChallengeType", tag = "10")]
pub challenge_type: i32,
#[prost(message, repeated, tag = "12")]
pub security_rules: ::prost::alloc::vec::Vec<SecurityRule>,
#[prost(bool, tag = "13")]
pub deletion_protection: bool,
#[prost(message, repeated, tag = "14")]
pub override_variants: ::prost::alloc::vec::Vec<OverrideVariant>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateCaptchaMetadata {
#[prost(string, tag = "1")]
pub captcha_id: ::prost::alloc::string::String,
}
pub mod captcha_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 CaptchaServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl CaptchaServiceClient<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> CaptchaServiceClient<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,
) -> CaptchaServiceClient<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,
{
CaptchaServiceClient::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::GetCaptchaRequest>,
) -> std::result::Result<tonic::Response<super::Captcha>, 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.smartcaptcha.v1.CaptchaService/Get",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("yandex.cloud.smartcaptcha.v1.CaptchaService", "Get"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_secret_key(
&mut self,
request: impl tonic::IntoRequest<super::GetCaptchaRequest>,
) -> std::result::Result<
tonic::Response<super::CaptchaSecretKey>,
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.smartcaptcha.v1.CaptchaService/GetSecretKey",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartcaptcha.v1.CaptchaService",
"GetSecretKey",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListCaptchasRequest>,
) -> std::result::Result<
tonic::Response<super::ListCaptchasResponse>,
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.smartcaptcha.v1.CaptchaService/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartcaptcha.v1.CaptchaService",
"List",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn create(
&mut self,
request: impl tonic::IntoRequest<super::CreateCaptchaRequest>,
) -> std::result::Result<
tonic::Response<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.smartcaptcha.v1.CaptchaService/Create",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartcaptcha.v1.CaptchaService",
"Create",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::UpdateCaptchaRequest>,
) -> std::result::Result<
tonic::Response<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.smartcaptcha.v1.CaptchaService/Update",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartcaptcha.v1.CaptchaService",
"Update",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::DeleteCaptchaRequest>,
) -> std::result::Result<
tonic::Response<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.smartcaptcha.v1.CaptchaService/Delete",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.smartcaptcha.v1.CaptchaService",
"Delete",
),
);
self.inner.unary(req, path, codec).await
}
}
}