1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct CreateAssessmentRequest {
4 #[prost(string, tag="1")]
7 pub parent: std::string::String,
8 #[prost(message, optional, tag="2")]
10 pub assessment: ::std::option::Option<Assessment>,
11}
12#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct AnnotateAssessmentRequest {
15 #[prost(string, tag="1")]
18 pub name: std::string::String,
19 #[prost(enumeration="annotate_assessment_request::Annotation", tag="2")]
21 pub annotation: i32,
22}
23pub mod annotate_assessment_request {
24 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
26 #[repr(i32)]
27 pub enum Annotation {
28 Unspecified = 0,
30 Legitimate = 1,
32 Fraudulent = 2,
34 PasswordCorrect = 3,
37 PasswordIncorrect = 4,
40 }
41}
42#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct AnnotateAssessmentResponse {
45}
46#[derive(Clone, PartialEq, ::prost::Message)]
48pub struct Assessment {
49 #[prost(string, tag="1")]
52 pub name: std::string::String,
53 #[prost(message, optional, tag="2")]
55 pub event: ::std::option::Option<Event>,
56 #[prost(message, optional, tag="3")]
58 pub risk_analysis: ::std::option::Option<RiskAnalysis>,
59 #[prost(message, optional, tag="4")]
61 pub token_properties: ::std::option::Option<TokenProperties>,
62}
63#[derive(Clone, PartialEq, ::prost::Message)]
64pub struct Event {
65 #[prost(string, tag="1")]
68 pub token: std::string::String,
69 #[prost(string, tag="2")]
72 pub site_key: std::string::String,
73 #[prost(string, tag="3")]
76 pub user_agent: std::string::String,
77 #[prost(string, tag="4")]
79 pub user_ip_address: std::string::String,
80 #[prost(string, tag="5")]
84 pub expected_action: std::string::String,
85}
86#[derive(Clone, PartialEq, ::prost::Message)]
88pub struct RiskAnalysis {
89 #[prost(float, tag="1")]
93 pub score: f32,
94 #[prost(enumeration="risk_analysis::ClassificationReason", repeated, tag="2")]
96 pub reasons: ::std::vec::Vec<i32>,
97}
98pub mod risk_analysis {
99 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
102 #[repr(i32)]
103 pub enum ClassificationReason {
104 Unspecified = 0,
106 Automation = 1,
108 UnexpectedEnvironment = 2,
110 TooMuchTraffic = 3,
112 UnexpectedUsagePatterns = 4,
115 LowConfidenceScore = 5,
118 }
119}
120#[derive(Clone, PartialEq, ::prost::Message)]
121pub struct TokenProperties {
122 #[prost(bool, tag="1")]
128 pub valid: bool,
129 #[prost(enumeration="token_properties::InvalidReason", tag="2")]
131 pub invalid_reason: i32,
132 #[prost(message, optional, tag="3")]
134 pub create_time: ::std::option::Option<::prost_types::Timestamp>,
135 #[prost(string, tag="4")]
137 pub hostname: std::string::String,
138 #[prost(string, tag="5")]
140 pub action: std::string::String,
141}
142pub mod token_properties {
143 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
146 #[repr(i32)]
147 pub enum InvalidReason {
148 Unspecified = 0,
150 UnknownInvalidReason = 1,
152 Malformed = 2,
154 Expired = 3,
156 Dupe = 4,
158 Missing = 5,
160 }
161}
162#[derive(Clone, PartialEq, ::prost::Message)]
164pub struct CreateKeyRequest {
165 #[prost(string, tag="1")]
168 pub parent: std::string::String,
169 #[prost(message, optional, tag="2")]
171 pub key: ::std::option::Option<Key>,
172}
173#[derive(Clone, PartialEq, ::prost::Message)]
175pub struct ListKeysRequest {
176 #[prost(string, tag="1")]
179 pub parent: std::string::String,
180 #[prost(int32, tag="2")]
183 pub page_size: i32,
184 #[prost(string, tag="3")]
187 pub page_token: std::string::String,
188}
189#[derive(Clone, PartialEq, ::prost::Message)]
191pub struct ListKeysResponse {
192 #[prost(message, repeated, tag="1")]
194 pub keys: ::std::vec::Vec<Key>,
195 #[prost(string, tag="2")]
198 pub next_page_token: std::string::String,
199}
200#[derive(Clone, PartialEq, ::prost::Message)]
202pub struct GetKeyRequest {
203 #[prost(string, tag="1")]
206 pub name: std::string::String,
207}
208#[derive(Clone, PartialEq, ::prost::Message)]
210pub struct UpdateKeyRequest {
211 #[prost(message, optional, tag="1")]
213 pub key: ::std::option::Option<Key>,
214 #[prost(message, optional, tag="2")]
217 pub update_mask: ::std::option::Option<::prost_types::FieldMask>,
218}
219#[derive(Clone, PartialEq, ::prost::Message)]
221pub struct DeleteKeyRequest {
222 #[prost(string, tag="1")]
225 pub name: std::string::String,
226}
227#[derive(Clone, PartialEq, ::prost::Message)]
230pub struct Key {
231 #[prost(string, tag="1")]
234 pub name: std::string::String,
235 #[prost(string, tag="2")]
237 pub display_name: std::string::String,
238 #[prost(map="string, string", tag="6")]
241 pub labels: ::std::collections::HashMap<std::string::String, std::string::String>,
242 #[prost(message, optional, tag="7")]
244 pub create_time: ::std::option::Option<::prost_types::Timestamp>,
245 #[prost(oneof="key::PlatformSettings", tags="3, 4, 5")]
248 pub platform_settings: ::std::option::Option<key::PlatformSettings>,
249}
250pub mod key {
251 #[derive(Clone, PartialEq, ::prost::Oneof)]
254 pub enum PlatformSettings {
255 #[prost(message, tag="3")]
257 WebSettings(super::WebKeySettings),
258 #[prost(message, tag="4")]
260 AndroidSettings(super::AndroidKeySettings),
261 #[prost(message, tag="5")]
263 IosSettings(super::IosKeySettings),
264 }
265}
266#[derive(Clone, PartialEq, ::prost::Message)]
268pub struct WebKeySettings {
269 #[prost(bool, tag="3")]
271 pub allow_all_domains: bool,
272 #[prost(string, repeated, tag="1")]
277 pub allowed_domains: ::std::vec::Vec<std::string::String>,
278 #[prost(bool, tag="2")]
280 pub allow_amp_traffic: bool,
281 #[prost(enumeration="web_key_settings::IntegrationType", tag="4")]
283 pub integration_type: i32,
284 #[prost(enumeration="web_key_settings::ChallengeSecurityPreference", tag="5")]
288 pub challenge_security_preference: i32,
289}
290pub mod web_key_settings {
291 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
293 #[repr(i32)]
294 pub enum IntegrationType {
295 Unspecified = 0,
299 Score = 1,
302 Checkbox = 2,
305 Invisible = 3,
308 }
309 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
312 #[repr(i32)]
313 pub enum ChallengeSecurityPreference {
314 Unspecified = 0,
316 Usability = 1,
318 Balance = 2,
320 Security = 3,
322 }
323}
324#[derive(Clone, PartialEq, ::prost::Message)]
326pub struct AndroidKeySettings {
327 #[prost(string, repeated, tag="1")]
330 pub allowed_package_names: ::std::vec::Vec<std::string::String>,
331}
332#[derive(Clone, PartialEq, ::prost::Message)]
334pub struct IosKeySettings {
335 #[prost(string, repeated, tag="1")]
338 pub allowed_bundle_ids: ::std::vec::Vec<std::string::String>,
339}
340# [ doc = r" Generated client implementations." ] pub mod recaptcha_enterprise_service_client { # ! [ allow ( unused_variables , dead_code , missing_docs ) ] use tonic :: codegen :: * ; # [ doc = " Service to determine the likelihood an event is legitimate." ] pub struct RecaptchaEnterpriseServiceClient < T > { inner : tonic :: client :: Grpc < T > , } impl < T > RecaptchaEnterpriseServiceClient < T > where T : tonic :: client :: GrpcService < tonic :: body :: BoxBody > , T :: ResponseBody : Body + HttpBody + Send + 'static , T :: Error : Into < StdError > , < T :: ResponseBody as HttpBody > :: Error : Into < StdError > + Send , { pub fn new ( inner : T ) -> Self { let inner = tonic :: client :: Grpc :: new ( inner ) ; Self { inner } } pub fn with_interceptor ( inner : T , interceptor : impl Into < tonic :: Interceptor > ) -> Self { let inner = tonic :: client :: Grpc :: with_interceptor ( inner , interceptor ) ; Self { inner } } # [ doc = " Creates an Assessment of the likelihood an event is legitimate." ] pub async fn create_assessment ( & mut self , request : impl tonic :: IntoRequest < super :: CreateAssessmentRequest > , ) -> Result < tonic :: Response < super :: Assessment > , 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.recaptchaenterprise.v1.RecaptchaEnterpriseService/CreateAssessment" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Annotates a previously created Assessment to provide additional information" ] # [ doc = " on whether the event turned out to be authentic or fradulent." ] pub async fn annotate_assessment ( & mut self , request : impl tonic :: IntoRequest < super :: AnnotateAssessmentRequest > , ) -> Result < tonic :: Response < super :: AnnotateAssessmentResponse > , 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.recaptchaenterprise.v1.RecaptchaEnterpriseService/AnnotateAssessment" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Creates a new reCAPTCHA Enterprise key." ] pub async fn create_key ( & mut self , request : impl tonic :: IntoRequest < super :: CreateKeyRequest > , ) -> Result < tonic :: Response < super :: Key > , 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.recaptchaenterprise.v1.RecaptchaEnterpriseService/CreateKey" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Returns the list of all keys that belong to a project." ] pub async fn list_keys ( & mut self , request : impl tonic :: IntoRequest < super :: ListKeysRequest > , ) -> Result < tonic :: Response < super :: ListKeysResponse > , 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.recaptchaenterprise.v1.RecaptchaEnterpriseService/ListKeys" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Returns the specified key." ] pub async fn get_key ( & mut self , request : impl tonic :: IntoRequest < super :: GetKeyRequest > , ) -> Result < tonic :: Response < super :: Key > , 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.recaptchaenterprise.v1.RecaptchaEnterpriseService/GetKey" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Updates the specified key." ] pub async fn update_key ( & mut self , request : impl tonic :: IntoRequest < super :: UpdateKeyRequest > , ) -> Result < tonic :: Response < super :: Key > , 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.recaptchaenterprise.v1.RecaptchaEnterpriseService/UpdateKey" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Deletes the specified key." ] pub async fn delete_key ( & mut self , request : impl tonic :: IntoRequest < super :: DeleteKeyRequest > , ) -> Result < tonic :: Response < ( ) > , 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.recaptchaenterprise.v1.RecaptchaEnterpriseService/DeleteKey" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } } impl < T : Clone > Clone for RecaptchaEnterpriseServiceClient < T > { fn clone ( & self ) -> Self { Self { inner : self . inner . clone ( ) , } } } impl < T > std :: fmt :: Debug for RecaptchaEnterpriseServiceClient < T > { fn fmt ( & self , f : & mut std :: fmt :: Formatter < '_ > ) -> std :: fmt :: Result { write ! ( f , "RecaptchaEnterpriseServiceClient {{ ... }}" ) } } }use serde :: { Serialize , Deserialize } ;