google_cloud_recaptchaenterprise_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_rpc;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// The create assessment request message.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct CreateAssessmentRequest {
42 /// Required. The name of the project in which the assessment is created,
43 /// in the format `projects/{project}`.
44 pub parent: std::string::String,
45
46 /// Required. The assessment details.
47 pub assessment: std::option::Option<crate::model::Assessment>,
48
49 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
50}
51
52impl CreateAssessmentRequest {
53 /// Creates a new default instance.
54 pub fn new() -> Self {
55 std::default::Default::default()
56 }
57
58 /// Sets the value of [parent][crate::model::CreateAssessmentRequest::parent].
59 ///
60 /// # Example
61 /// ```ignore,no_run
62 /// # use google_cloud_recaptchaenterprise_v1::model::CreateAssessmentRequest;
63 /// let x = CreateAssessmentRequest::new().set_parent("example");
64 /// ```
65 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
66 self.parent = v.into();
67 self
68 }
69
70 /// Sets the value of [assessment][crate::model::CreateAssessmentRequest::assessment].
71 ///
72 /// # Example
73 /// ```ignore,no_run
74 /// # use google_cloud_recaptchaenterprise_v1::model::CreateAssessmentRequest;
75 /// use google_cloud_recaptchaenterprise_v1::model::Assessment;
76 /// let x = CreateAssessmentRequest::new().set_assessment(Assessment::default()/* use setters */);
77 /// ```
78 pub fn set_assessment<T>(mut self, v: T) -> Self
79 where
80 T: std::convert::Into<crate::model::Assessment>,
81 {
82 self.assessment = std::option::Option::Some(v.into());
83 self
84 }
85
86 /// Sets or clears the value of [assessment][crate::model::CreateAssessmentRequest::assessment].
87 ///
88 /// # Example
89 /// ```ignore,no_run
90 /// # use google_cloud_recaptchaenterprise_v1::model::CreateAssessmentRequest;
91 /// use google_cloud_recaptchaenterprise_v1::model::Assessment;
92 /// let x = CreateAssessmentRequest::new().set_or_clear_assessment(Some(Assessment::default()/* use setters */));
93 /// let x = CreateAssessmentRequest::new().set_or_clear_assessment(None::<Assessment>);
94 /// ```
95 pub fn set_or_clear_assessment<T>(mut self, v: std::option::Option<T>) -> Self
96 where
97 T: std::convert::Into<crate::model::Assessment>,
98 {
99 self.assessment = v.map(|x| x.into());
100 self
101 }
102}
103
104impl wkt::message::Message for CreateAssessmentRequest {
105 fn typename() -> &'static str {
106 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.CreateAssessmentRequest"
107 }
108}
109
110/// Describes an event in the lifecycle of a payment transaction.
111#[derive(Clone, Default, PartialEq)]
112#[non_exhaustive]
113pub struct TransactionEvent {
114 /// Optional. The type of this transaction event.
115 pub event_type: crate::model::transaction_event::TransactionEventType,
116
117 /// Optional. The reason or standardized code that corresponds with this
118 /// transaction event, if one exists. For example, a CHARGEBACK event with code
119 /// 6005.
120 pub reason: std::string::String,
121
122 /// Optional. The value that corresponds with this transaction event, if one
123 /// exists. For example, a refund event where $5.00 was refunded. Currency is
124 /// obtained from the original transaction data.
125 pub value: f64,
126
127 /// Optional. Timestamp when this transaction event occurred; otherwise assumed
128 /// to be the time of the API call.
129 pub event_time: std::option::Option<wkt::Timestamp>,
130
131 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
132}
133
134impl TransactionEvent {
135 /// Creates a new default instance.
136 pub fn new() -> Self {
137 std::default::Default::default()
138 }
139
140 /// Sets the value of [event_type][crate::model::TransactionEvent::event_type].
141 ///
142 /// # Example
143 /// ```ignore,no_run
144 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionEvent;
145 /// use google_cloud_recaptchaenterprise_v1::model::transaction_event::TransactionEventType;
146 /// let x0 = TransactionEvent::new().set_event_type(TransactionEventType::MerchantApprove);
147 /// let x1 = TransactionEvent::new().set_event_type(TransactionEventType::MerchantDeny);
148 /// let x2 = TransactionEvent::new().set_event_type(TransactionEventType::ManualReview);
149 /// ```
150 pub fn set_event_type<
151 T: std::convert::Into<crate::model::transaction_event::TransactionEventType>,
152 >(
153 mut self,
154 v: T,
155 ) -> Self {
156 self.event_type = v.into();
157 self
158 }
159
160 /// Sets the value of [reason][crate::model::TransactionEvent::reason].
161 ///
162 /// # Example
163 /// ```ignore,no_run
164 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionEvent;
165 /// let x = TransactionEvent::new().set_reason("example");
166 /// ```
167 pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
168 self.reason = v.into();
169 self
170 }
171
172 /// Sets the value of [value][crate::model::TransactionEvent::value].
173 ///
174 /// # Example
175 /// ```ignore,no_run
176 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionEvent;
177 /// let x = TransactionEvent::new().set_value(42.0);
178 /// ```
179 pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
180 self.value = v.into();
181 self
182 }
183
184 /// Sets the value of [event_time][crate::model::TransactionEvent::event_time].
185 ///
186 /// # Example
187 /// ```ignore,no_run
188 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionEvent;
189 /// use wkt::Timestamp;
190 /// let x = TransactionEvent::new().set_event_time(Timestamp::default()/* use setters */);
191 /// ```
192 pub fn set_event_time<T>(mut self, v: T) -> Self
193 where
194 T: std::convert::Into<wkt::Timestamp>,
195 {
196 self.event_time = std::option::Option::Some(v.into());
197 self
198 }
199
200 /// Sets or clears the value of [event_time][crate::model::TransactionEvent::event_time].
201 ///
202 /// # Example
203 /// ```ignore,no_run
204 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionEvent;
205 /// use wkt::Timestamp;
206 /// let x = TransactionEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
207 /// let x = TransactionEvent::new().set_or_clear_event_time(None::<Timestamp>);
208 /// ```
209 pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
210 where
211 T: std::convert::Into<wkt::Timestamp>,
212 {
213 self.event_time = v.map(|x| x.into());
214 self
215 }
216}
217
218impl wkt::message::Message for TransactionEvent {
219 fn typename() -> &'static str {
220 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.TransactionEvent"
221 }
222}
223
224/// Defines additional types related to [TransactionEvent].
225pub mod transaction_event {
226 #[allow(unused_imports)]
227 use super::*;
228
229 /// Enum that represents an event in the payment transaction lifecycle.
230 /// Ensure that applications can handle values not explicitly listed.
231 ///
232 /// # Working with unknown values
233 ///
234 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
235 /// additional enum variants at any time. Adding new variants is not considered
236 /// a breaking change. Applications should write their code in anticipation of:
237 ///
238 /// - New values appearing in future releases of the client library, **and**
239 /// - New values received dynamically, without application changes.
240 ///
241 /// Please consult the [Working with enums] section in the user guide for some
242 /// guidelines.
243 ///
244 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
245 #[derive(Clone, Debug, PartialEq)]
246 #[non_exhaustive]
247 pub enum TransactionEventType {
248 /// Default, unspecified event type.
249 Unspecified,
250 /// Indicates that the transaction is approved by the merchant. The
251 /// accompanying reasons can include terms such as 'INHOUSE', 'ACCERTIFY',
252 /// 'CYBERSOURCE', or 'MANUAL_REVIEW'.
253 MerchantApprove,
254 /// Indicates that the transaction is denied and concluded due to risks
255 /// detected by the merchant. The accompanying reasons can include terms such
256 /// as 'INHOUSE', 'ACCERTIFY', 'CYBERSOURCE', or 'MANUAL_REVIEW'.
257 MerchantDeny,
258 /// Indicates that the transaction is being evaluated by a human, due to
259 /// suspicion or risk.
260 ManualReview,
261 /// Indicates that the authorization attempt with the card issuer succeeded.
262 Authorization,
263 /// Indicates that the authorization attempt with the card issuer failed.
264 /// The accompanying reasons can include Visa's '54' indicating that the card
265 /// is expired, or '82' indicating that the CVV is incorrect.
266 AuthorizationDecline,
267 /// Indicates that the transaction is completed because the funds were
268 /// settled.
269 PaymentCapture,
270 /// Indicates that the transaction could not be completed because the funds
271 /// were not settled.
272 PaymentCaptureDecline,
273 /// Indicates that the transaction has been canceled. Specify the reason
274 /// for the cancellation. For example, 'INSUFFICIENT_INVENTORY'.
275 Cancel,
276 /// Indicates that the merchant has received a chargeback inquiry due to
277 /// fraud for the transaction, requesting additional information before a
278 /// fraud chargeback is officially issued and a formal chargeback
279 /// notification is sent.
280 ChargebackInquiry,
281 /// Indicates that the merchant has received a chargeback alert due to fraud
282 /// for the transaction. The process of resolving the dispute without
283 /// involving the payment network is started.
284 ChargebackAlert,
285 /// Indicates that a fraud notification is issued for the transaction, sent
286 /// by the payment instrument's issuing bank because the transaction appears
287 /// to be fraudulent. We recommend including TC40 or SAFE data in the
288 /// `reason` field for this event type. For partial chargebacks, we recommend
289 /// that you include an amount in the `value` field.
290 FraudNotification,
291 /// Indicates that the merchant is informed by the payment network that the
292 /// transaction has entered the chargeback process due to fraud. Reason code
293 /// examples include Discover's '6005' and '6041'. For partial chargebacks,
294 /// we recommend that you include an amount in the `value` field.
295 Chargeback,
296 /// Indicates that the transaction has entered the chargeback process due to
297 /// fraud, and that the merchant has chosen to enter representment. Reason
298 /// examples include Discover's '6005' and '6041'. For partial chargebacks,
299 /// we recommend that you include an amount in the `value` field.
300 ChargebackRepresentment,
301 /// Indicates that the transaction has had a fraud chargeback which was
302 /// illegitimate and was reversed as a result. For partial chargebacks, we
303 /// recommend that you include an amount in the `value` field.
304 ChargebackReverse,
305 /// Indicates that the merchant has received a refund for a completed
306 /// transaction. For partial refunds, we recommend that you include an amount
307 /// in the `value` field. Reason example: 'TAX_EXEMPT' (partial refund of
308 /// exempt tax)
309 RefundRequest,
310 /// Indicates that the merchant has received a refund request for this
311 /// transaction, but that they have declined it. For partial refunds, we
312 /// recommend that you include an amount in the `value` field. Reason
313 /// example: 'TAX_EXEMPT' (partial refund of exempt tax)
314 RefundDecline,
315 /// Indicates that the completed transaction was refunded by the merchant.
316 /// For partial refunds, we recommend that you include an amount in the
317 /// `value` field. Reason example: 'TAX_EXEMPT' (partial refund of exempt
318 /// tax)
319 Refund,
320 /// Indicates that the completed transaction was refunded by the merchant,
321 /// and that this refund was reversed. For partial refunds, we recommend that
322 /// you include an amount in the `value` field.
323 RefundReverse,
324 /// If set, the enum was initialized with an unknown value.
325 ///
326 /// Applications can examine the value using [TransactionEventType::value] or
327 /// [TransactionEventType::name].
328 UnknownValue(transaction_event_type::UnknownValue),
329 }
330
331 #[doc(hidden)]
332 pub mod transaction_event_type {
333 #[allow(unused_imports)]
334 use super::*;
335 #[derive(Clone, Debug, PartialEq)]
336 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
337 }
338
339 impl TransactionEventType {
340 /// Gets the enum value.
341 ///
342 /// Returns `None` if the enum contains an unknown value deserialized from
343 /// the string representation of enums.
344 pub fn value(&self) -> std::option::Option<i32> {
345 match self {
346 Self::Unspecified => std::option::Option::Some(0),
347 Self::MerchantApprove => std::option::Option::Some(1),
348 Self::MerchantDeny => std::option::Option::Some(2),
349 Self::ManualReview => std::option::Option::Some(3),
350 Self::Authorization => std::option::Option::Some(4),
351 Self::AuthorizationDecline => std::option::Option::Some(5),
352 Self::PaymentCapture => std::option::Option::Some(6),
353 Self::PaymentCaptureDecline => std::option::Option::Some(7),
354 Self::Cancel => std::option::Option::Some(8),
355 Self::ChargebackInquiry => std::option::Option::Some(9),
356 Self::ChargebackAlert => std::option::Option::Some(10),
357 Self::FraudNotification => std::option::Option::Some(11),
358 Self::Chargeback => std::option::Option::Some(12),
359 Self::ChargebackRepresentment => std::option::Option::Some(13),
360 Self::ChargebackReverse => std::option::Option::Some(14),
361 Self::RefundRequest => std::option::Option::Some(15),
362 Self::RefundDecline => std::option::Option::Some(16),
363 Self::Refund => std::option::Option::Some(17),
364 Self::RefundReverse => std::option::Option::Some(18),
365 Self::UnknownValue(u) => u.0.value(),
366 }
367 }
368
369 /// Gets the enum value as a string.
370 ///
371 /// Returns `None` if the enum contains an unknown value deserialized from
372 /// the integer representation of enums.
373 pub fn name(&self) -> std::option::Option<&str> {
374 match self {
375 Self::Unspecified => {
376 std::option::Option::Some("TRANSACTION_EVENT_TYPE_UNSPECIFIED")
377 }
378 Self::MerchantApprove => std::option::Option::Some("MERCHANT_APPROVE"),
379 Self::MerchantDeny => std::option::Option::Some("MERCHANT_DENY"),
380 Self::ManualReview => std::option::Option::Some("MANUAL_REVIEW"),
381 Self::Authorization => std::option::Option::Some("AUTHORIZATION"),
382 Self::AuthorizationDecline => std::option::Option::Some("AUTHORIZATION_DECLINE"),
383 Self::PaymentCapture => std::option::Option::Some("PAYMENT_CAPTURE"),
384 Self::PaymentCaptureDecline => std::option::Option::Some("PAYMENT_CAPTURE_DECLINE"),
385 Self::Cancel => std::option::Option::Some("CANCEL"),
386 Self::ChargebackInquiry => std::option::Option::Some("CHARGEBACK_INQUIRY"),
387 Self::ChargebackAlert => std::option::Option::Some("CHARGEBACK_ALERT"),
388 Self::FraudNotification => std::option::Option::Some("FRAUD_NOTIFICATION"),
389 Self::Chargeback => std::option::Option::Some("CHARGEBACK"),
390 Self::ChargebackRepresentment => {
391 std::option::Option::Some("CHARGEBACK_REPRESENTMENT")
392 }
393 Self::ChargebackReverse => std::option::Option::Some("CHARGEBACK_REVERSE"),
394 Self::RefundRequest => std::option::Option::Some("REFUND_REQUEST"),
395 Self::RefundDecline => std::option::Option::Some("REFUND_DECLINE"),
396 Self::Refund => std::option::Option::Some("REFUND"),
397 Self::RefundReverse => std::option::Option::Some("REFUND_REVERSE"),
398 Self::UnknownValue(u) => u.0.name(),
399 }
400 }
401 }
402
403 impl std::default::Default for TransactionEventType {
404 fn default() -> Self {
405 use std::convert::From;
406 Self::from(0)
407 }
408 }
409
410 impl std::fmt::Display for TransactionEventType {
411 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
412 wkt::internal::display_enum(f, self.name(), self.value())
413 }
414 }
415
416 impl std::convert::From<i32> for TransactionEventType {
417 fn from(value: i32) -> Self {
418 match value {
419 0 => Self::Unspecified,
420 1 => Self::MerchantApprove,
421 2 => Self::MerchantDeny,
422 3 => Self::ManualReview,
423 4 => Self::Authorization,
424 5 => Self::AuthorizationDecline,
425 6 => Self::PaymentCapture,
426 7 => Self::PaymentCaptureDecline,
427 8 => Self::Cancel,
428 9 => Self::ChargebackInquiry,
429 10 => Self::ChargebackAlert,
430 11 => Self::FraudNotification,
431 12 => Self::Chargeback,
432 13 => Self::ChargebackRepresentment,
433 14 => Self::ChargebackReverse,
434 15 => Self::RefundRequest,
435 16 => Self::RefundDecline,
436 17 => Self::Refund,
437 18 => Self::RefundReverse,
438 _ => Self::UnknownValue(transaction_event_type::UnknownValue(
439 wkt::internal::UnknownEnumValue::Integer(value),
440 )),
441 }
442 }
443 }
444
445 impl std::convert::From<&str> for TransactionEventType {
446 fn from(value: &str) -> Self {
447 use std::string::ToString;
448 match value {
449 "TRANSACTION_EVENT_TYPE_UNSPECIFIED" => Self::Unspecified,
450 "MERCHANT_APPROVE" => Self::MerchantApprove,
451 "MERCHANT_DENY" => Self::MerchantDeny,
452 "MANUAL_REVIEW" => Self::ManualReview,
453 "AUTHORIZATION" => Self::Authorization,
454 "AUTHORIZATION_DECLINE" => Self::AuthorizationDecline,
455 "PAYMENT_CAPTURE" => Self::PaymentCapture,
456 "PAYMENT_CAPTURE_DECLINE" => Self::PaymentCaptureDecline,
457 "CANCEL" => Self::Cancel,
458 "CHARGEBACK_INQUIRY" => Self::ChargebackInquiry,
459 "CHARGEBACK_ALERT" => Self::ChargebackAlert,
460 "FRAUD_NOTIFICATION" => Self::FraudNotification,
461 "CHARGEBACK" => Self::Chargeback,
462 "CHARGEBACK_REPRESENTMENT" => Self::ChargebackRepresentment,
463 "CHARGEBACK_REVERSE" => Self::ChargebackReverse,
464 "REFUND_REQUEST" => Self::RefundRequest,
465 "REFUND_DECLINE" => Self::RefundDecline,
466 "REFUND" => Self::Refund,
467 "REFUND_REVERSE" => Self::RefundReverse,
468 _ => Self::UnknownValue(transaction_event_type::UnknownValue(
469 wkt::internal::UnknownEnumValue::String(value.to_string()),
470 )),
471 }
472 }
473 }
474
475 impl serde::ser::Serialize for TransactionEventType {
476 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
477 where
478 S: serde::Serializer,
479 {
480 match self {
481 Self::Unspecified => serializer.serialize_i32(0),
482 Self::MerchantApprove => serializer.serialize_i32(1),
483 Self::MerchantDeny => serializer.serialize_i32(2),
484 Self::ManualReview => serializer.serialize_i32(3),
485 Self::Authorization => serializer.serialize_i32(4),
486 Self::AuthorizationDecline => serializer.serialize_i32(5),
487 Self::PaymentCapture => serializer.serialize_i32(6),
488 Self::PaymentCaptureDecline => serializer.serialize_i32(7),
489 Self::Cancel => serializer.serialize_i32(8),
490 Self::ChargebackInquiry => serializer.serialize_i32(9),
491 Self::ChargebackAlert => serializer.serialize_i32(10),
492 Self::FraudNotification => serializer.serialize_i32(11),
493 Self::Chargeback => serializer.serialize_i32(12),
494 Self::ChargebackRepresentment => serializer.serialize_i32(13),
495 Self::ChargebackReverse => serializer.serialize_i32(14),
496 Self::RefundRequest => serializer.serialize_i32(15),
497 Self::RefundDecline => serializer.serialize_i32(16),
498 Self::Refund => serializer.serialize_i32(17),
499 Self::RefundReverse => serializer.serialize_i32(18),
500 Self::UnknownValue(u) => u.0.serialize(serializer),
501 }
502 }
503 }
504
505 impl<'de> serde::de::Deserialize<'de> for TransactionEventType {
506 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
507 where
508 D: serde::Deserializer<'de>,
509 {
510 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransactionEventType>::new(
511 ".google.cloud.recaptchaenterprise.v1.TransactionEvent.TransactionEventType",
512 ))
513 }
514 }
515}
516
517/// Details on a phone authentication event
518#[derive(Clone, Default, PartialEq)]
519#[non_exhaustive]
520pub struct PhoneAuthenticationEvent {
521 /// Required. Phone number in E.164 format for which a multi-factor
522 /// authentication challenge was initiated, succeeded, or failed.
523 pub phone_number: std::string::String,
524
525 /// Optional. The time at which the multi-factor authentication event
526 /// (challenge or verification) occurred.
527 pub event_time: std::option::Option<wkt::Timestamp>,
528
529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
530}
531
532impl PhoneAuthenticationEvent {
533 /// Creates a new default instance.
534 pub fn new() -> Self {
535 std::default::Default::default()
536 }
537
538 /// Sets the value of [phone_number][crate::model::PhoneAuthenticationEvent::phone_number].
539 ///
540 /// # Example
541 /// ```ignore,no_run
542 /// # use google_cloud_recaptchaenterprise_v1::model::PhoneAuthenticationEvent;
543 /// let x = PhoneAuthenticationEvent::new().set_phone_number("example");
544 /// ```
545 pub fn set_phone_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
546 self.phone_number = v.into();
547 self
548 }
549
550 /// Sets the value of [event_time][crate::model::PhoneAuthenticationEvent::event_time].
551 ///
552 /// # Example
553 /// ```ignore,no_run
554 /// # use google_cloud_recaptchaenterprise_v1::model::PhoneAuthenticationEvent;
555 /// use wkt::Timestamp;
556 /// let x = PhoneAuthenticationEvent::new().set_event_time(Timestamp::default()/* use setters */);
557 /// ```
558 pub fn set_event_time<T>(mut self, v: T) -> Self
559 where
560 T: std::convert::Into<wkt::Timestamp>,
561 {
562 self.event_time = std::option::Option::Some(v.into());
563 self
564 }
565
566 /// Sets or clears the value of [event_time][crate::model::PhoneAuthenticationEvent::event_time].
567 ///
568 /// # Example
569 /// ```ignore,no_run
570 /// # use google_cloud_recaptchaenterprise_v1::model::PhoneAuthenticationEvent;
571 /// use wkt::Timestamp;
572 /// let x = PhoneAuthenticationEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
573 /// let x = PhoneAuthenticationEvent::new().set_or_clear_event_time(None::<Timestamp>);
574 /// ```
575 pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
576 where
577 T: std::convert::Into<wkt::Timestamp>,
578 {
579 self.event_time = v.map(|x| x.into());
580 self
581 }
582}
583
584impl wkt::message::Message for PhoneAuthenticationEvent {
585 fn typename() -> &'static str {
586 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.PhoneAuthenticationEvent"
587 }
588}
589
590/// The request message to annotate an Assessment.
591#[derive(Clone, Default, PartialEq)]
592#[non_exhaustive]
593pub struct AnnotateAssessmentRequest {
594 /// Required. The resource name of the Assessment, in the format
595 /// `projects/{project}/assessments/{assessment}`.
596 pub name: std::string::String,
597
598 /// Optional. The annotation that is assigned to the Event. This field can be
599 /// left empty to provide reasons that apply to an event without concluding
600 /// whether the event is legitimate or fraudulent.
601 pub annotation: crate::model::annotate_assessment_request::Annotation,
602
603 /// Optional. Reasons for the annotation that are assigned to the event.
604 pub reasons: std::vec::Vec<crate::model::annotate_assessment_request::Reason>,
605
606 /// Optional. A stable account identifier to apply to the assessment. This is
607 /// an alternative to setting `account_id` in `CreateAssessment`, for example
608 /// when a stable account identifier is not yet known in the initial request.
609 pub account_id: std::string::String,
610
611 /// Optional. A stable hashed account identifier to apply to the assessment.
612 /// This is an alternative to setting `hashed_account_id` in
613 /// `CreateAssessment`, for example when a stable account identifier is not yet
614 /// known in the initial request.
615 pub hashed_account_id: ::bytes::Bytes,
616
617 /// Optional. If the assessment is part of a payment transaction, provide
618 /// details on payment lifecycle events that occur in the transaction.
619 pub transaction_event: std::option::Option<crate::model::TransactionEvent>,
620
621 /// Optional. If using an external multi-factor authentication provider,
622 /// provide phone authentication details for fraud detection purposes.
623 pub phone_authentication_event: std::option::Option<crate::model::PhoneAuthenticationEvent>,
624
625 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
626}
627
628impl AnnotateAssessmentRequest {
629 /// Creates a new default instance.
630 pub fn new() -> Self {
631 std::default::Default::default()
632 }
633
634 /// Sets the value of [name][crate::model::AnnotateAssessmentRequest::name].
635 ///
636 /// # Example
637 /// ```ignore,no_run
638 /// # use google_cloud_recaptchaenterprise_v1::model::AnnotateAssessmentRequest;
639 /// # let project_id = "project_id";
640 /// # let assessment_id = "assessment_id";
641 /// let x = AnnotateAssessmentRequest::new().set_name(format!("projects/{project_id}/assessments/{assessment_id}"));
642 /// ```
643 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
644 self.name = v.into();
645 self
646 }
647
648 /// Sets the value of [annotation][crate::model::AnnotateAssessmentRequest::annotation].
649 ///
650 /// # Example
651 /// ```ignore,no_run
652 /// # use google_cloud_recaptchaenterprise_v1::model::AnnotateAssessmentRequest;
653 /// use google_cloud_recaptchaenterprise_v1::model::annotate_assessment_request::Annotation;
654 /// let x0 = AnnotateAssessmentRequest::new().set_annotation(Annotation::Legitimate);
655 /// let x1 = AnnotateAssessmentRequest::new().set_annotation(Annotation::Fraudulent);
656 /// ```
657 pub fn set_annotation<
658 T: std::convert::Into<crate::model::annotate_assessment_request::Annotation>,
659 >(
660 mut self,
661 v: T,
662 ) -> Self {
663 self.annotation = v.into();
664 self
665 }
666
667 /// Sets the value of [reasons][crate::model::AnnotateAssessmentRequest::reasons].
668 ///
669 /// # Example
670 /// ```ignore,no_run
671 /// # use google_cloud_recaptchaenterprise_v1::model::AnnotateAssessmentRequest;
672 /// use google_cloud_recaptchaenterprise_v1::model::annotate_assessment_request::Reason;
673 /// let x = AnnotateAssessmentRequest::new().set_reasons([
674 /// Reason::Chargeback,
675 /// Reason::ChargebackFraud,
676 /// Reason::ChargebackDispute,
677 /// ]);
678 /// ```
679 pub fn set_reasons<T, V>(mut self, v: T) -> Self
680 where
681 T: std::iter::IntoIterator<Item = V>,
682 V: std::convert::Into<crate::model::annotate_assessment_request::Reason>,
683 {
684 use std::iter::Iterator;
685 self.reasons = v.into_iter().map(|i| i.into()).collect();
686 self
687 }
688
689 /// Sets the value of [account_id][crate::model::AnnotateAssessmentRequest::account_id].
690 ///
691 /// # Example
692 /// ```ignore,no_run
693 /// # use google_cloud_recaptchaenterprise_v1::model::AnnotateAssessmentRequest;
694 /// let x = AnnotateAssessmentRequest::new().set_account_id("example");
695 /// ```
696 pub fn set_account_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
697 self.account_id = v.into();
698 self
699 }
700
701 /// Sets the value of [hashed_account_id][crate::model::AnnotateAssessmentRequest::hashed_account_id].
702 ///
703 /// # Example
704 /// ```ignore,no_run
705 /// # use google_cloud_recaptchaenterprise_v1::model::AnnotateAssessmentRequest;
706 /// let x = AnnotateAssessmentRequest::new().set_hashed_account_id(bytes::Bytes::from_static(b"example"));
707 /// ```
708 pub fn set_hashed_account_id<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
709 self.hashed_account_id = v.into();
710 self
711 }
712
713 /// Sets the value of [transaction_event][crate::model::AnnotateAssessmentRequest::transaction_event].
714 ///
715 /// # Example
716 /// ```ignore,no_run
717 /// # use google_cloud_recaptchaenterprise_v1::model::AnnotateAssessmentRequest;
718 /// use google_cloud_recaptchaenterprise_v1::model::TransactionEvent;
719 /// let x = AnnotateAssessmentRequest::new().set_transaction_event(TransactionEvent::default()/* use setters */);
720 /// ```
721 pub fn set_transaction_event<T>(mut self, v: T) -> Self
722 where
723 T: std::convert::Into<crate::model::TransactionEvent>,
724 {
725 self.transaction_event = std::option::Option::Some(v.into());
726 self
727 }
728
729 /// Sets or clears the value of [transaction_event][crate::model::AnnotateAssessmentRequest::transaction_event].
730 ///
731 /// # Example
732 /// ```ignore,no_run
733 /// # use google_cloud_recaptchaenterprise_v1::model::AnnotateAssessmentRequest;
734 /// use google_cloud_recaptchaenterprise_v1::model::TransactionEvent;
735 /// let x = AnnotateAssessmentRequest::new().set_or_clear_transaction_event(Some(TransactionEvent::default()/* use setters */));
736 /// let x = AnnotateAssessmentRequest::new().set_or_clear_transaction_event(None::<TransactionEvent>);
737 /// ```
738 pub fn set_or_clear_transaction_event<T>(mut self, v: std::option::Option<T>) -> Self
739 where
740 T: std::convert::Into<crate::model::TransactionEvent>,
741 {
742 self.transaction_event = v.map(|x| x.into());
743 self
744 }
745
746 /// Sets the value of [phone_authentication_event][crate::model::AnnotateAssessmentRequest::phone_authentication_event].
747 ///
748 /// # Example
749 /// ```ignore,no_run
750 /// # use google_cloud_recaptchaenterprise_v1::model::AnnotateAssessmentRequest;
751 /// use google_cloud_recaptchaenterprise_v1::model::PhoneAuthenticationEvent;
752 /// let x = AnnotateAssessmentRequest::new().set_phone_authentication_event(PhoneAuthenticationEvent::default()/* use setters */);
753 /// ```
754 pub fn set_phone_authentication_event<T>(mut self, v: T) -> Self
755 where
756 T: std::convert::Into<crate::model::PhoneAuthenticationEvent>,
757 {
758 self.phone_authentication_event = std::option::Option::Some(v.into());
759 self
760 }
761
762 /// Sets or clears the value of [phone_authentication_event][crate::model::AnnotateAssessmentRequest::phone_authentication_event].
763 ///
764 /// # Example
765 /// ```ignore,no_run
766 /// # use google_cloud_recaptchaenterprise_v1::model::AnnotateAssessmentRequest;
767 /// use google_cloud_recaptchaenterprise_v1::model::PhoneAuthenticationEvent;
768 /// let x = AnnotateAssessmentRequest::new().set_or_clear_phone_authentication_event(Some(PhoneAuthenticationEvent::default()/* use setters */));
769 /// let x = AnnotateAssessmentRequest::new().set_or_clear_phone_authentication_event(None::<PhoneAuthenticationEvent>);
770 /// ```
771 pub fn set_or_clear_phone_authentication_event<T>(mut self, v: std::option::Option<T>) -> Self
772 where
773 T: std::convert::Into<crate::model::PhoneAuthenticationEvent>,
774 {
775 self.phone_authentication_event = v.map(|x| x.into());
776 self
777 }
778}
779
780impl wkt::message::Message for AnnotateAssessmentRequest {
781 fn typename() -> &'static str {
782 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest"
783 }
784}
785
786/// Defines additional types related to [AnnotateAssessmentRequest].
787pub mod annotate_assessment_request {
788 #[allow(unused_imports)]
789 use super::*;
790
791 /// Enum that represents the types of annotations.
792 ///
793 /// # Working with unknown values
794 ///
795 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
796 /// additional enum variants at any time. Adding new variants is not considered
797 /// a breaking change. Applications should write their code in anticipation of:
798 ///
799 /// - New values appearing in future releases of the client library, **and**
800 /// - New values received dynamically, without application changes.
801 ///
802 /// Please consult the [Working with enums] section in the user guide for some
803 /// guidelines.
804 ///
805 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
806 #[derive(Clone, Debug, PartialEq)]
807 #[non_exhaustive]
808 pub enum Annotation {
809 /// Default unspecified type.
810 Unspecified,
811 /// Provides information that the event turned out to be legitimate.
812 Legitimate,
813 /// Provides information that the event turned out to be fraudulent.
814 Fraudulent,
815 /// Provides information that the event was related to a login event in which
816 /// the user typed the correct password. Deprecated, prefer indicating
817 /// CORRECT_PASSWORD through the reasons field instead.
818 #[deprecated]
819 PasswordCorrect,
820 /// Provides information that the event was related to a login event in which
821 /// the user typed the incorrect password. Deprecated, prefer indicating
822 /// INCORRECT_PASSWORD through the reasons field instead.
823 #[deprecated]
824 PasswordIncorrect,
825 /// If set, the enum was initialized with an unknown value.
826 ///
827 /// Applications can examine the value using [Annotation::value] or
828 /// [Annotation::name].
829 UnknownValue(annotation::UnknownValue),
830 }
831
832 #[doc(hidden)]
833 pub mod annotation {
834 #[allow(unused_imports)]
835 use super::*;
836 #[derive(Clone, Debug, PartialEq)]
837 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
838 }
839
840 impl Annotation {
841 /// Gets the enum value.
842 ///
843 /// Returns `None` if the enum contains an unknown value deserialized from
844 /// the string representation of enums.
845 pub fn value(&self) -> std::option::Option<i32> {
846 match self {
847 Self::Unspecified => std::option::Option::Some(0),
848 Self::Legitimate => std::option::Option::Some(1),
849 Self::Fraudulent => std::option::Option::Some(2),
850 Self::PasswordCorrect => std::option::Option::Some(3),
851 Self::PasswordIncorrect => std::option::Option::Some(4),
852 Self::UnknownValue(u) => u.0.value(),
853 }
854 }
855
856 /// Gets the enum value as a string.
857 ///
858 /// Returns `None` if the enum contains an unknown value deserialized from
859 /// the integer representation of enums.
860 pub fn name(&self) -> std::option::Option<&str> {
861 match self {
862 Self::Unspecified => std::option::Option::Some("ANNOTATION_UNSPECIFIED"),
863 Self::Legitimate => std::option::Option::Some("LEGITIMATE"),
864 Self::Fraudulent => std::option::Option::Some("FRAUDULENT"),
865 Self::PasswordCorrect => std::option::Option::Some("PASSWORD_CORRECT"),
866 Self::PasswordIncorrect => std::option::Option::Some("PASSWORD_INCORRECT"),
867 Self::UnknownValue(u) => u.0.name(),
868 }
869 }
870 }
871
872 impl std::default::Default for Annotation {
873 fn default() -> Self {
874 use std::convert::From;
875 Self::from(0)
876 }
877 }
878
879 impl std::fmt::Display for Annotation {
880 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
881 wkt::internal::display_enum(f, self.name(), self.value())
882 }
883 }
884
885 impl std::convert::From<i32> for Annotation {
886 fn from(value: i32) -> Self {
887 match value {
888 0 => Self::Unspecified,
889 1 => Self::Legitimate,
890 2 => Self::Fraudulent,
891 3 => Self::PasswordCorrect,
892 4 => Self::PasswordIncorrect,
893 _ => Self::UnknownValue(annotation::UnknownValue(
894 wkt::internal::UnknownEnumValue::Integer(value),
895 )),
896 }
897 }
898 }
899
900 impl std::convert::From<&str> for Annotation {
901 fn from(value: &str) -> Self {
902 use std::string::ToString;
903 match value {
904 "ANNOTATION_UNSPECIFIED" => Self::Unspecified,
905 "LEGITIMATE" => Self::Legitimate,
906 "FRAUDULENT" => Self::Fraudulent,
907 "PASSWORD_CORRECT" => Self::PasswordCorrect,
908 "PASSWORD_INCORRECT" => Self::PasswordIncorrect,
909 _ => Self::UnknownValue(annotation::UnknownValue(
910 wkt::internal::UnknownEnumValue::String(value.to_string()),
911 )),
912 }
913 }
914 }
915
916 impl serde::ser::Serialize for Annotation {
917 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
918 where
919 S: serde::Serializer,
920 {
921 match self {
922 Self::Unspecified => serializer.serialize_i32(0),
923 Self::Legitimate => serializer.serialize_i32(1),
924 Self::Fraudulent => serializer.serialize_i32(2),
925 Self::PasswordCorrect => serializer.serialize_i32(3),
926 Self::PasswordIncorrect => serializer.serialize_i32(4),
927 Self::UnknownValue(u) => u.0.serialize(serializer),
928 }
929 }
930 }
931
932 impl<'de> serde::de::Deserialize<'de> for Annotation {
933 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
934 where
935 D: serde::Deserializer<'de>,
936 {
937 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Annotation>::new(
938 ".google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Annotation",
939 ))
940 }
941 }
942
943 /// Enum that represents potential reasons for annotating an assessment.
944 ///
945 /// # Working with unknown values
946 ///
947 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
948 /// additional enum variants at any time. Adding new variants is not considered
949 /// a breaking change. Applications should write their code in anticipation of:
950 ///
951 /// - New values appearing in future releases of the client library, **and**
952 /// - New values received dynamically, without application changes.
953 ///
954 /// Please consult the [Working with enums] section in the user guide for some
955 /// guidelines.
956 ///
957 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
958 #[derive(Clone, Debug, PartialEq)]
959 #[non_exhaustive]
960 pub enum Reason {
961 /// Unspecified reason. Do not use.
962 Unspecified,
963 /// Indicates that the transaction had a chargeback issued with no other
964 /// details. When possible, specify the type by using CHARGEBACK_FRAUD or
965 /// CHARGEBACK_DISPUTE instead.
966 Chargeback,
967 /// Indicates that the transaction had a chargeback issued related to an
968 /// alleged unauthorized transaction from the cardholder's perspective (for
969 /// example, the card number was stolen).
970 ChargebackFraud,
971 /// Indicates that the transaction had a chargeback issued related to the
972 /// cardholder having provided their card details but allegedly not being
973 /// satisfied with the purchase (for example, misrepresentation, attempted
974 /// cancellation).
975 ChargebackDispute,
976 /// Indicates that the completed payment transaction was refunded by the
977 /// seller.
978 Refund,
979 /// Indicates that the completed payment transaction was determined to be
980 /// fraudulent by the seller, and was cancelled and refunded as a result.
981 RefundFraud,
982 /// Indicates that the payment transaction was accepted, and the user was
983 /// charged.
984 TransactionAccepted,
985 /// Indicates that the payment transaction was declined, for example due to
986 /// invalid card details.
987 TransactionDeclined,
988 /// Indicates the transaction associated with the assessment is suspected of
989 /// being fraudulent based on the payment method, billing details, shipping
990 /// address or other transaction information.
991 PaymentHeuristics,
992 /// Indicates that the user was served a 2FA challenge. An old assessment
993 /// with `ENUM_VALUES.INITIATED_TWO_FACTOR` reason that has not been
994 /// overwritten with `PASSED_TWO_FACTOR` is treated as an abandoned 2FA flow.
995 /// This is equivalent to `FAILED_TWO_FACTOR`.
996 InitiatedTwoFactor,
997 /// Indicates that the user passed a 2FA challenge.
998 PassedTwoFactor,
999 /// Indicates that the user failed a 2FA challenge.
1000 FailedTwoFactor,
1001 /// Indicates the user provided the correct password.
1002 CorrectPassword,
1003 /// Indicates the user provided an incorrect password.
1004 IncorrectPassword,
1005 /// Indicates that the user sent unwanted and abusive messages to other users
1006 /// of the platform, such as spam, scams, phishing, or social engineering.
1007 SocialSpam,
1008 /// If set, the enum was initialized with an unknown value.
1009 ///
1010 /// Applications can examine the value using [Reason::value] or
1011 /// [Reason::name].
1012 UnknownValue(reason::UnknownValue),
1013 }
1014
1015 #[doc(hidden)]
1016 pub mod reason {
1017 #[allow(unused_imports)]
1018 use super::*;
1019 #[derive(Clone, Debug, PartialEq)]
1020 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1021 }
1022
1023 impl Reason {
1024 /// Gets the enum value.
1025 ///
1026 /// Returns `None` if the enum contains an unknown value deserialized from
1027 /// the string representation of enums.
1028 pub fn value(&self) -> std::option::Option<i32> {
1029 match self {
1030 Self::Unspecified => std::option::Option::Some(0),
1031 Self::Chargeback => std::option::Option::Some(1),
1032 Self::ChargebackFraud => std::option::Option::Some(8),
1033 Self::ChargebackDispute => std::option::Option::Some(9),
1034 Self::Refund => std::option::Option::Some(10),
1035 Self::RefundFraud => std::option::Option::Some(11),
1036 Self::TransactionAccepted => std::option::Option::Some(12),
1037 Self::TransactionDeclined => std::option::Option::Some(13),
1038 Self::PaymentHeuristics => std::option::Option::Some(2),
1039 Self::InitiatedTwoFactor => std::option::Option::Some(7),
1040 Self::PassedTwoFactor => std::option::Option::Some(3),
1041 Self::FailedTwoFactor => std::option::Option::Some(4),
1042 Self::CorrectPassword => std::option::Option::Some(5),
1043 Self::IncorrectPassword => std::option::Option::Some(6),
1044 Self::SocialSpam => std::option::Option::Some(14),
1045 Self::UnknownValue(u) => u.0.value(),
1046 }
1047 }
1048
1049 /// Gets the enum value as a string.
1050 ///
1051 /// Returns `None` if the enum contains an unknown value deserialized from
1052 /// the integer representation of enums.
1053 pub fn name(&self) -> std::option::Option<&str> {
1054 match self {
1055 Self::Unspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
1056 Self::Chargeback => std::option::Option::Some("CHARGEBACK"),
1057 Self::ChargebackFraud => std::option::Option::Some("CHARGEBACK_FRAUD"),
1058 Self::ChargebackDispute => std::option::Option::Some("CHARGEBACK_DISPUTE"),
1059 Self::Refund => std::option::Option::Some("REFUND"),
1060 Self::RefundFraud => std::option::Option::Some("REFUND_FRAUD"),
1061 Self::TransactionAccepted => std::option::Option::Some("TRANSACTION_ACCEPTED"),
1062 Self::TransactionDeclined => std::option::Option::Some("TRANSACTION_DECLINED"),
1063 Self::PaymentHeuristics => std::option::Option::Some("PAYMENT_HEURISTICS"),
1064 Self::InitiatedTwoFactor => std::option::Option::Some("INITIATED_TWO_FACTOR"),
1065 Self::PassedTwoFactor => std::option::Option::Some("PASSED_TWO_FACTOR"),
1066 Self::FailedTwoFactor => std::option::Option::Some("FAILED_TWO_FACTOR"),
1067 Self::CorrectPassword => std::option::Option::Some("CORRECT_PASSWORD"),
1068 Self::IncorrectPassword => std::option::Option::Some("INCORRECT_PASSWORD"),
1069 Self::SocialSpam => std::option::Option::Some("SOCIAL_SPAM"),
1070 Self::UnknownValue(u) => u.0.name(),
1071 }
1072 }
1073 }
1074
1075 impl std::default::Default for Reason {
1076 fn default() -> Self {
1077 use std::convert::From;
1078 Self::from(0)
1079 }
1080 }
1081
1082 impl std::fmt::Display for Reason {
1083 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1084 wkt::internal::display_enum(f, self.name(), self.value())
1085 }
1086 }
1087
1088 impl std::convert::From<i32> for Reason {
1089 fn from(value: i32) -> Self {
1090 match value {
1091 0 => Self::Unspecified,
1092 1 => Self::Chargeback,
1093 2 => Self::PaymentHeuristics,
1094 3 => Self::PassedTwoFactor,
1095 4 => Self::FailedTwoFactor,
1096 5 => Self::CorrectPassword,
1097 6 => Self::IncorrectPassword,
1098 7 => Self::InitiatedTwoFactor,
1099 8 => Self::ChargebackFraud,
1100 9 => Self::ChargebackDispute,
1101 10 => Self::Refund,
1102 11 => Self::RefundFraud,
1103 12 => Self::TransactionAccepted,
1104 13 => Self::TransactionDeclined,
1105 14 => Self::SocialSpam,
1106 _ => Self::UnknownValue(reason::UnknownValue(
1107 wkt::internal::UnknownEnumValue::Integer(value),
1108 )),
1109 }
1110 }
1111 }
1112
1113 impl std::convert::From<&str> for Reason {
1114 fn from(value: &str) -> Self {
1115 use std::string::ToString;
1116 match value {
1117 "REASON_UNSPECIFIED" => Self::Unspecified,
1118 "CHARGEBACK" => Self::Chargeback,
1119 "CHARGEBACK_FRAUD" => Self::ChargebackFraud,
1120 "CHARGEBACK_DISPUTE" => Self::ChargebackDispute,
1121 "REFUND" => Self::Refund,
1122 "REFUND_FRAUD" => Self::RefundFraud,
1123 "TRANSACTION_ACCEPTED" => Self::TransactionAccepted,
1124 "TRANSACTION_DECLINED" => Self::TransactionDeclined,
1125 "PAYMENT_HEURISTICS" => Self::PaymentHeuristics,
1126 "INITIATED_TWO_FACTOR" => Self::InitiatedTwoFactor,
1127 "PASSED_TWO_FACTOR" => Self::PassedTwoFactor,
1128 "FAILED_TWO_FACTOR" => Self::FailedTwoFactor,
1129 "CORRECT_PASSWORD" => Self::CorrectPassword,
1130 "INCORRECT_PASSWORD" => Self::IncorrectPassword,
1131 "SOCIAL_SPAM" => Self::SocialSpam,
1132 _ => Self::UnknownValue(reason::UnknownValue(
1133 wkt::internal::UnknownEnumValue::String(value.to_string()),
1134 )),
1135 }
1136 }
1137 }
1138
1139 impl serde::ser::Serialize for Reason {
1140 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1141 where
1142 S: serde::Serializer,
1143 {
1144 match self {
1145 Self::Unspecified => serializer.serialize_i32(0),
1146 Self::Chargeback => serializer.serialize_i32(1),
1147 Self::ChargebackFraud => serializer.serialize_i32(8),
1148 Self::ChargebackDispute => serializer.serialize_i32(9),
1149 Self::Refund => serializer.serialize_i32(10),
1150 Self::RefundFraud => serializer.serialize_i32(11),
1151 Self::TransactionAccepted => serializer.serialize_i32(12),
1152 Self::TransactionDeclined => serializer.serialize_i32(13),
1153 Self::PaymentHeuristics => serializer.serialize_i32(2),
1154 Self::InitiatedTwoFactor => serializer.serialize_i32(7),
1155 Self::PassedTwoFactor => serializer.serialize_i32(3),
1156 Self::FailedTwoFactor => serializer.serialize_i32(4),
1157 Self::CorrectPassword => serializer.serialize_i32(5),
1158 Self::IncorrectPassword => serializer.serialize_i32(6),
1159 Self::SocialSpam => serializer.serialize_i32(14),
1160 Self::UnknownValue(u) => u.0.serialize(serializer),
1161 }
1162 }
1163 }
1164
1165 impl<'de> serde::de::Deserialize<'de> for Reason {
1166 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1167 where
1168 D: serde::Deserializer<'de>,
1169 {
1170 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reason>::new(
1171 ".google.cloud.recaptchaenterprise.v1.AnnotateAssessmentRequest.Reason",
1172 ))
1173 }
1174 }
1175}
1176
1177/// Empty response for AnnotateAssessment.
1178#[derive(Clone, Default, PartialEq)]
1179#[non_exhaustive]
1180pub struct AnnotateAssessmentResponse {
1181 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1182}
1183
1184impl AnnotateAssessmentResponse {
1185 /// Creates a new default instance.
1186 pub fn new() -> Self {
1187 std::default::Default::default()
1188 }
1189}
1190
1191impl wkt::message::Message for AnnotateAssessmentResponse {
1192 fn typename() -> &'static str {
1193 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse"
1194 }
1195}
1196
1197/// Information about a verification endpoint that can be used for 2FA.
1198#[derive(Clone, Default, PartialEq)]
1199#[non_exhaustive]
1200pub struct EndpointVerificationInfo {
1201 /// Output only. Token to provide to the client to trigger endpoint
1202 /// verification. It must be used within 15 minutes.
1203 pub request_token: std::string::String,
1204
1205 /// Output only. Timestamp of the last successful verification for the
1206 /// endpoint, if any.
1207 pub last_verification_time: std::option::Option<wkt::Timestamp>,
1208
1209 #[allow(missing_docs)]
1210 pub endpoint: std::option::Option<crate::model::endpoint_verification_info::Endpoint>,
1211
1212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1213}
1214
1215impl EndpointVerificationInfo {
1216 /// Creates a new default instance.
1217 pub fn new() -> Self {
1218 std::default::Default::default()
1219 }
1220
1221 /// Sets the value of [request_token][crate::model::EndpointVerificationInfo::request_token].
1222 ///
1223 /// # Example
1224 /// ```ignore,no_run
1225 /// # use google_cloud_recaptchaenterprise_v1::model::EndpointVerificationInfo;
1226 /// let x = EndpointVerificationInfo::new().set_request_token("example");
1227 /// ```
1228 pub fn set_request_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1229 self.request_token = v.into();
1230 self
1231 }
1232
1233 /// Sets the value of [last_verification_time][crate::model::EndpointVerificationInfo::last_verification_time].
1234 ///
1235 /// # Example
1236 /// ```ignore,no_run
1237 /// # use google_cloud_recaptchaenterprise_v1::model::EndpointVerificationInfo;
1238 /// use wkt::Timestamp;
1239 /// let x = EndpointVerificationInfo::new().set_last_verification_time(Timestamp::default()/* use setters */);
1240 /// ```
1241 pub fn set_last_verification_time<T>(mut self, v: T) -> Self
1242 where
1243 T: std::convert::Into<wkt::Timestamp>,
1244 {
1245 self.last_verification_time = std::option::Option::Some(v.into());
1246 self
1247 }
1248
1249 /// Sets or clears the value of [last_verification_time][crate::model::EndpointVerificationInfo::last_verification_time].
1250 ///
1251 /// # Example
1252 /// ```ignore,no_run
1253 /// # use google_cloud_recaptchaenterprise_v1::model::EndpointVerificationInfo;
1254 /// use wkt::Timestamp;
1255 /// let x = EndpointVerificationInfo::new().set_or_clear_last_verification_time(Some(Timestamp::default()/* use setters */));
1256 /// let x = EndpointVerificationInfo::new().set_or_clear_last_verification_time(None::<Timestamp>);
1257 /// ```
1258 pub fn set_or_clear_last_verification_time<T>(mut self, v: std::option::Option<T>) -> Self
1259 where
1260 T: std::convert::Into<wkt::Timestamp>,
1261 {
1262 self.last_verification_time = v.map(|x| x.into());
1263 self
1264 }
1265
1266 /// Sets the value of [endpoint][crate::model::EndpointVerificationInfo::endpoint].
1267 ///
1268 /// Note that all the setters affecting `endpoint` are mutually
1269 /// exclusive.
1270 ///
1271 /// # Example
1272 /// ```ignore,no_run
1273 /// # use google_cloud_recaptchaenterprise_v1::model::EndpointVerificationInfo;
1274 /// use google_cloud_recaptchaenterprise_v1::model::endpoint_verification_info::Endpoint;
1275 /// let x = EndpointVerificationInfo::new().set_endpoint(Some(Endpoint::EmailAddress("example".to_string())));
1276 /// ```
1277 pub fn set_endpoint<
1278 T: std::convert::Into<std::option::Option<crate::model::endpoint_verification_info::Endpoint>>,
1279 >(
1280 mut self,
1281 v: T,
1282 ) -> Self {
1283 self.endpoint = v.into();
1284 self
1285 }
1286
1287 /// The value of [endpoint][crate::model::EndpointVerificationInfo::endpoint]
1288 /// if it holds a `EmailAddress`, `None` if the field is not set or
1289 /// holds a different branch.
1290 pub fn email_address(&self) -> std::option::Option<&std::string::String> {
1291 #[allow(unreachable_patterns)]
1292 self.endpoint.as_ref().and_then(|v| match v {
1293 crate::model::endpoint_verification_info::Endpoint::EmailAddress(v) => {
1294 std::option::Option::Some(v)
1295 }
1296 _ => std::option::Option::None,
1297 })
1298 }
1299
1300 /// Sets the value of [endpoint][crate::model::EndpointVerificationInfo::endpoint]
1301 /// to hold a `EmailAddress`.
1302 ///
1303 /// Note that all the setters affecting `endpoint` are
1304 /// mutually exclusive.
1305 ///
1306 /// # Example
1307 /// ```ignore,no_run
1308 /// # use google_cloud_recaptchaenterprise_v1::model::EndpointVerificationInfo;
1309 /// let x = EndpointVerificationInfo::new().set_email_address("example");
1310 /// assert!(x.email_address().is_some());
1311 /// assert!(x.phone_number().is_none());
1312 /// ```
1313 pub fn set_email_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1314 self.endpoint = std::option::Option::Some(
1315 crate::model::endpoint_verification_info::Endpoint::EmailAddress(v.into()),
1316 );
1317 self
1318 }
1319
1320 /// The value of [endpoint][crate::model::EndpointVerificationInfo::endpoint]
1321 /// if it holds a `PhoneNumber`, `None` if the field is not set or
1322 /// holds a different branch.
1323 pub fn phone_number(&self) -> std::option::Option<&std::string::String> {
1324 #[allow(unreachable_patterns)]
1325 self.endpoint.as_ref().and_then(|v| match v {
1326 crate::model::endpoint_verification_info::Endpoint::PhoneNumber(v) => {
1327 std::option::Option::Some(v)
1328 }
1329 _ => std::option::Option::None,
1330 })
1331 }
1332
1333 /// Sets the value of [endpoint][crate::model::EndpointVerificationInfo::endpoint]
1334 /// to hold a `PhoneNumber`.
1335 ///
1336 /// Note that all the setters affecting `endpoint` are
1337 /// mutually exclusive.
1338 ///
1339 /// # Example
1340 /// ```ignore,no_run
1341 /// # use google_cloud_recaptchaenterprise_v1::model::EndpointVerificationInfo;
1342 /// let x = EndpointVerificationInfo::new().set_phone_number("example");
1343 /// assert!(x.phone_number().is_some());
1344 /// assert!(x.email_address().is_none());
1345 /// ```
1346 pub fn set_phone_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1347 self.endpoint = std::option::Option::Some(
1348 crate::model::endpoint_verification_info::Endpoint::PhoneNumber(v.into()),
1349 );
1350 self
1351 }
1352}
1353
1354impl wkt::message::Message for EndpointVerificationInfo {
1355 fn typename() -> &'static str {
1356 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.EndpointVerificationInfo"
1357 }
1358}
1359
1360/// Defines additional types related to [EndpointVerificationInfo].
1361pub mod endpoint_verification_info {
1362 #[allow(unused_imports)]
1363 use super::*;
1364
1365 #[allow(missing_docs)]
1366 #[derive(Clone, Debug, PartialEq)]
1367 #[non_exhaustive]
1368 pub enum Endpoint {
1369 /// Email address for which to trigger a verification request.
1370 EmailAddress(std::string::String),
1371 /// Phone number for which to trigger a verification request. Should be given
1372 /// in E.164 format.
1373 PhoneNumber(std::string::String),
1374 }
1375}
1376
1377/// Information about account verification, used for identity verification.
1378#[derive(Clone, Default, PartialEq)]
1379#[non_exhaustive]
1380pub struct AccountVerificationInfo {
1381 /// Optional. Endpoints that can be used for identity verification.
1382 pub endpoints: std::vec::Vec<crate::model::EndpointVerificationInfo>,
1383
1384 /// Optional. Language code preference for the verification message, set as a
1385 /// IETF BCP 47 language code.
1386 pub language_code: std::string::String,
1387
1388 /// Output only. Result of the latest account verification challenge.
1389 pub latest_verification_result: crate::model::account_verification_info::Result,
1390
1391 /// Username of the account that is being verified. Deprecated. Customers
1392 /// should now provide the `account_id` field in `event.user_info`.
1393 #[deprecated]
1394 pub username: std::string::String,
1395
1396 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1397}
1398
1399impl AccountVerificationInfo {
1400 /// Creates a new default instance.
1401 pub fn new() -> Self {
1402 std::default::Default::default()
1403 }
1404
1405 /// Sets the value of [endpoints][crate::model::AccountVerificationInfo::endpoints].
1406 ///
1407 /// # Example
1408 /// ```ignore,no_run
1409 /// # use google_cloud_recaptchaenterprise_v1::model::AccountVerificationInfo;
1410 /// use google_cloud_recaptchaenterprise_v1::model::EndpointVerificationInfo;
1411 /// let x = AccountVerificationInfo::new()
1412 /// .set_endpoints([
1413 /// EndpointVerificationInfo::default()/* use setters */,
1414 /// EndpointVerificationInfo::default()/* use (different) setters */,
1415 /// ]);
1416 /// ```
1417 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
1418 where
1419 T: std::iter::IntoIterator<Item = V>,
1420 V: std::convert::Into<crate::model::EndpointVerificationInfo>,
1421 {
1422 use std::iter::Iterator;
1423 self.endpoints = v.into_iter().map(|i| i.into()).collect();
1424 self
1425 }
1426
1427 /// Sets the value of [language_code][crate::model::AccountVerificationInfo::language_code].
1428 ///
1429 /// # Example
1430 /// ```ignore,no_run
1431 /// # use google_cloud_recaptchaenterprise_v1::model::AccountVerificationInfo;
1432 /// let x = AccountVerificationInfo::new().set_language_code("example");
1433 /// ```
1434 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1435 self.language_code = v.into();
1436 self
1437 }
1438
1439 /// Sets the value of [latest_verification_result][crate::model::AccountVerificationInfo::latest_verification_result].
1440 ///
1441 /// # Example
1442 /// ```ignore,no_run
1443 /// # use google_cloud_recaptchaenterprise_v1::model::AccountVerificationInfo;
1444 /// use google_cloud_recaptchaenterprise_v1::model::account_verification_info::Result;
1445 /// let x0 = AccountVerificationInfo::new().set_latest_verification_result(Result::SuccessUserVerified);
1446 /// let x1 = AccountVerificationInfo::new().set_latest_verification_result(Result::ErrorUserNotVerified);
1447 /// let x2 = AccountVerificationInfo::new().set_latest_verification_result(Result::ErrorSiteOnboardingIncomplete);
1448 /// ```
1449 pub fn set_latest_verification_result<
1450 T: std::convert::Into<crate::model::account_verification_info::Result>,
1451 >(
1452 mut self,
1453 v: T,
1454 ) -> Self {
1455 self.latest_verification_result = v.into();
1456 self
1457 }
1458
1459 /// Sets the value of [username][crate::model::AccountVerificationInfo::username].
1460 ///
1461 /// # Example
1462 /// ```ignore,no_run
1463 /// # use google_cloud_recaptchaenterprise_v1::model::AccountVerificationInfo;
1464 /// let x = AccountVerificationInfo::new().set_username("example");
1465 /// ```
1466 #[deprecated]
1467 pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1468 self.username = v.into();
1469 self
1470 }
1471}
1472
1473impl wkt::message::Message for AccountVerificationInfo {
1474 fn typename() -> &'static str {
1475 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.AccountVerificationInfo"
1476 }
1477}
1478
1479/// Defines additional types related to [AccountVerificationInfo].
1480pub mod account_verification_info {
1481 #[allow(unused_imports)]
1482 use super::*;
1483
1484 /// Result of the account verification as contained in the verdict token issued
1485 /// at the end of the verification flow.
1486 /// Ensure that applications can handle values not explicitly listed.
1487 ///
1488 /// # Working with unknown values
1489 ///
1490 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1491 /// additional enum variants at any time. Adding new variants is not considered
1492 /// a breaking change. Applications should write their code in anticipation of:
1493 ///
1494 /// - New values appearing in future releases of the client library, **and**
1495 /// - New values received dynamically, without application changes.
1496 ///
1497 /// Please consult the [Working with enums] section in the user guide for some
1498 /// guidelines.
1499 ///
1500 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1501 #[derive(Clone, Debug, PartialEq)]
1502 #[non_exhaustive]
1503 pub enum Result {
1504 /// No information about the latest account verification.
1505 Unspecified,
1506 /// The user was successfully verified. This means the account verification
1507 /// challenge was successfully completed.
1508 SuccessUserVerified,
1509 /// The user failed the verification challenge.
1510 ErrorUserNotVerified,
1511 /// The site is not properly onboarded to use the account verification
1512 /// feature.
1513 ErrorSiteOnboardingIncomplete,
1514 /// The recipient is not allowed for account verification. This can occur
1515 /// during integration but should not occur in production.
1516 ErrorRecipientNotAllowed,
1517 /// The recipient has already been sent too many verification codes in a
1518 /// short amount of time.
1519 ErrorRecipientAbuseLimitExhausted,
1520 /// The verification flow could not be completed due to a critical internal
1521 /// error.
1522 ErrorCriticalInternal,
1523 /// The client has exceeded their two factor request quota for this period of
1524 /// time.
1525 ErrorCustomerQuotaExhausted,
1526 /// The request cannot be processed at the time because of an incident. This
1527 /// bypass can be restricted to a problematic destination email domain, a
1528 /// customer, or could affect the entire service.
1529 ErrorVerificationBypassed,
1530 /// The request parameters do not match with the token provided and cannot be
1531 /// processed.
1532 ErrorVerdictMismatch,
1533 /// If set, the enum was initialized with an unknown value.
1534 ///
1535 /// Applications can examine the value using [Result::value] or
1536 /// [Result::name].
1537 UnknownValue(result::UnknownValue),
1538 }
1539
1540 #[doc(hidden)]
1541 pub mod result {
1542 #[allow(unused_imports)]
1543 use super::*;
1544 #[derive(Clone, Debug, PartialEq)]
1545 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1546 }
1547
1548 impl Result {
1549 /// Gets the enum value.
1550 ///
1551 /// Returns `None` if the enum contains an unknown value deserialized from
1552 /// the string representation of enums.
1553 pub fn value(&self) -> std::option::Option<i32> {
1554 match self {
1555 Self::Unspecified => std::option::Option::Some(0),
1556 Self::SuccessUserVerified => std::option::Option::Some(1),
1557 Self::ErrorUserNotVerified => std::option::Option::Some(2),
1558 Self::ErrorSiteOnboardingIncomplete => std::option::Option::Some(3),
1559 Self::ErrorRecipientNotAllowed => std::option::Option::Some(4),
1560 Self::ErrorRecipientAbuseLimitExhausted => std::option::Option::Some(5),
1561 Self::ErrorCriticalInternal => std::option::Option::Some(6),
1562 Self::ErrorCustomerQuotaExhausted => std::option::Option::Some(7),
1563 Self::ErrorVerificationBypassed => std::option::Option::Some(8),
1564 Self::ErrorVerdictMismatch => std::option::Option::Some(9),
1565 Self::UnknownValue(u) => u.0.value(),
1566 }
1567 }
1568
1569 /// Gets the enum value as a string.
1570 ///
1571 /// Returns `None` if the enum contains an unknown value deserialized from
1572 /// the integer representation of enums.
1573 pub fn name(&self) -> std::option::Option<&str> {
1574 match self {
1575 Self::Unspecified => std::option::Option::Some("RESULT_UNSPECIFIED"),
1576 Self::SuccessUserVerified => std::option::Option::Some("SUCCESS_USER_VERIFIED"),
1577 Self::ErrorUserNotVerified => std::option::Option::Some("ERROR_USER_NOT_VERIFIED"),
1578 Self::ErrorSiteOnboardingIncomplete => {
1579 std::option::Option::Some("ERROR_SITE_ONBOARDING_INCOMPLETE")
1580 }
1581 Self::ErrorRecipientNotAllowed => {
1582 std::option::Option::Some("ERROR_RECIPIENT_NOT_ALLOWED")
1583 }
1584 Self::ErrorRecipientAbuseLimitExhausted => {
1585 std::option::Option::Some("ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED")
1586 }
1587 Self::ErrorCriticalInternal => std::option::Option::Some("ERROR_CRITICAL_INTERNAL"),
1588 Self::ErrorCustomerQuotaExhausted => {
1589 std::option::Option::Some("ERROR_CUSTOMER_QUOTA_EXHAUSTED")
1590 }
1591 Self::ErrorVerificationBypassed => {
1592 std::option::Option::Some("ERROR_VERIFICATION_BYPASSED")
1593 }
1594 Self::ErrorVerdictMismatch => std::option::Option::Some("ERROR_VERDICT_MISMATCH"),
1595 Self::UnknownValue(u) => u.0.name(),
1596 }
1597 }
1598 }
1599
1600 impl std::default::Default for Result {
1601 fn default() -> Self {
1602 use std::convert::From;
1603 Self::from(0)
1604 }
1605 }
1606
1607 impl std::fmt::Display for Result {
1608 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1609 wkt::internal::display_enum(f, self.name(), self.value())
1610 }
1611 }
1612
1613 impl std::convert::From<i32> for Result {
1614 fn from(value: i32) -> Self {
1615 match value {
1616 0 => Self::Unspecified,
1617 1 => Self::SuccessUserVerified,
1618 2 => Self::ErrorUserNotVerified,
1619 3 => Self::ErrorSiteOnboardingIncomplete,
1620 4 => Self::ErrorRecipientNotAllowed,
1621 5 => Self::ErrorRecipientAbuseLimitExhausted,
1622 6 => Self::ErrorCriticalInternal,
1623 7 => Self::ErrorCustomerQuotaExhausted,
1624 8 => Self::ErrorVerificationBypassed,
1625 9 => Self::ErrorVerdictMismatch,
1626 _ => Self::UnknownValue(result::UnknownValue(
1627 wkt::internal::UnknownEnumValue::Integer(value),
1628 )),
1629 }
1630 }
1631 }
1632
1633 impl std::convert::From<&str> for Result {
1634 fn from(value: &str) -> Self {
1635 use std::string::ToString;
1636 match value {
1637 "RESULT_UNSPECIFIED" => Self::Unspecified,
1638 "SUCCESS_USER_VERIFIED" => Self::SuccessUserVerified,
1639 "ERROR_USER_NOT_VERIFIED" => Self::ErrorUserNotVerified,
1640 "ERROR_SITE_ONBOARDING_INCOMPLETE" => Self::ErrorSiteOnboardingIncomplete,
1641 "ERROR_RECIPIENT_NOT_ALLOWED" => Self::ErrorRecipientNotAllowed,
1642 "ERROR_RECIPIENT_ABUSE_LIMIT_EXHAUSTED" => Self::ErrorRecipientAbuseLimitExhausted,
1643 "ERROR_CRITICAL_INTERNAL" => Self::ErrorCriticalInternal,
1644 "ERROR_CUSTOMER_QUOTA_EXHAUSTED" => Self::ErrorCustomerQuotaExhausted,
1645 "ERROR_VERIFICATION_BYPASSED" => Self::ErrorVerificationBypassed,
1646 "ERROR_VERDICT_MISMATCH" => Self::ErrorVerdictMismatch,
1647 _ => Self::UnknownValue(result::UnknownValue(
1648 wkt::internal::UnknownEnumValue::String(value.to_string()),
1649 )),
1650 }
1651 }
1652 }
1653
1654 impl serde::ser::Serialize for Result {
1655 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1656 where
1657 S: serde::Serializer,
1658 {
1659 match self {
1660 Self::Unspecified => serializer.serialize_i32(0),
1661 Self::SuccessUserVerified => serializer.serialize_i32(1),
1662 Self::ErrorUserNotVerified => serializer.serialize_i32(2),
1663 Self::ErrorSiteOnboardingIncomplete => serializer.serialize_i32(3),
1664 Self::ErrorRecipientNotAllowed => serializer.serialize_i32(4),
1665 Self::ErrorRecipientAbuseLimitExhausted => serializer.serialize_i32(5),
1666 Self::ErrorCriticalInternal => serializer.serialize_i32(6),
1667 Self::ErrorCustomerQuotaExhausted => serializer.serialize_i32(7),
1668 Self::ErrorVerificationBypassed => serializer.serialize_i32(8),
1669 Self::ErrorVerdictMismatch => serializer.serialize_i32(9),
1670 Self::UnknownValue(u) => u.0.serialize(serializer),
1671 }
1672 }
1673 }
1674
1675 impl<'de> serde::de::Deserialize<'de> for Result {
1676 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1677 where
1678 D: serde::Deserializer<'de>,
1679 {
1680 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Result>::new(
1681 ".google.cloud.recaptchaenterprise.v1.AccountVerificationInfo.Result",
1682 ))
1683 }
1684 }
1685}
1686
1687/// Private password leak verification info.
1688#[derive(Clone, Default, PartialEq)]
1689#[non_exhaustive]
1690pub struct PrivatePasswordLeakVerification {
1691 /// Required. Exactly 26-bit prefix of the SHA-256 hash of the canonicalized
1692 /// username. It is used to look up password leaks associated with that hash
1693 /// prefix.
1694 pub lookup_hash_prefix: ::bytes::Bytes,
1695
1696 /// Optional. Encrypted Scrypt hash of the canonicalized username+password. It
1697 /// is re-encrypted by the server and returned through
1698 /// `reencrypted_user_credentials_hash`.
1699 pub encrypted_user_credentials_hash: ::bytes::Bytes,
1700
1701 /// Output only. List of prefixes of the encrypted potential password leaks
1702 /// that matched the given parameters. They must be compared with the
1703 /// client-side decryption prefix of `reencrypted_user_credentials_hash`
1704 pub encrypted_leak_match_prefixes: std::vec::Vec<::bytes::Bytes>,
1705
1706 /// Output only. Corresponds to the re-encryption of the
1707 /// `encrypted_user_credentials_hash` field. It is used to match potential
1708 /// password leaks within `encrypted_leak_match_prefixes`.
1709 pub reencrypted_user_credentials_hash: ::bytes::Bytes,
1710
1711 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1712}
1713
1714impl PrivatePasswordLeakVerification {
1715 /// Creates a new default instance.
1716 pub fn new() -> Self {
1717 std::default::Default::default()
1718 }
1719
1720 /// Sets the value of [lookup_hash_prefix][crate::model::PrivatePasswordLeakVerification::lookup_hash_prefix].
1721 ///
1722 /// # Example
1723 /// ```ignore,no_run
1724 /// # use google_cloud_recaptchaenterprise_v1::model::PrivatePasswordLeakVerification;
1725 /// let x = PrivatePasswordLeakVerification::new().set_lookup_hash_prefix(bytes::Bytes::from_static(b"example"));
1726 /// ```
1727 pub fn set_lookup_hash_prefix<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1728 self.lookup_hash_prefix = v.into();
1729 self
1730 }
1731
1732 /// Sets the value of [encrypted_user_credentials_hash][crate::model::PrivatePasswordLeakVerification::encrypted_user_credentials_hash].
1733 ///
1734 /// # Example
1735 /// ```ignore,no_run
1736 /// # use google_cloud_recaptchaenterprise_v1::model::PrivatePasswordLeakVerification;
1737 /// let x = PrivatePasswordLeakVerification::new().set_encrypted_user_credentials_hash(bytes::Bytes::from_static(b"example"));
1738 /// ```
1739 pub fn set_encrypted_user_credentials_hash<T: std::convert::Into<::bytes::Bytes>>(
1740 mut self,
1741 v: T,
1742 ) -> Self {
1743 self.encrypted_user_credentials_hash = v.into();
1744 self
1745 }
1746
1747 /// Sets the value of [encrypted_leak_match_prefixes][crate::model::PrivatePasswordLeakVerification::encrypted_leak_match_prefixes].
1748 ///
1749 /// # Example
1750 /// ```ignore,no_run
1751 /// # use google_cloud_recaptchaenterprise_v1::model::PrivatePasswordLeakVerification;
1752 /// let b1 = bytes::Bytes::from_static(b"abc");
1753 /// let b2 = bytes::Bytes::from_static(b"xyz");
1754 /// let x = PrivatePasswordLeakVerification::new().set_encrypted_leak_match_prefixes([b1, b2]);
1755 /// ```
1756 pub fn set_encrypted_leak_match_prefixes<T, V>(mut self, v: T) -> Self
1757 where
1758 T: std::iter::IntoIterator<Item = V>,
1759 V: std::convert::Into<::bytes::Bytes>,
1760 {
1761 use std::iter::Iterator;
1762 self.encrypted_leak_match_prefixes = v.into_iter().map(|i| i.into()).collect();
1763 self
1764 }
1765
1766 /// Sets the value of [reencrypted_user_credentials_hash][crate::model::PrivatePasswordLeakVerification::reencrypted_user_credentials_hash].
1767 ///
1768 /// # Example
1769 /// ```ignore,no_run
1770 /// # use google_cloud_recaptchaenterprise_v1::model::PrivatePasswordLeakVerification;
1771 /// let x = PrivatePasswordLeakVerification::new().set_reencrypted_user_credentials_hash(bytes::Bytes::from_static(b"example"));
1772 /// ```
1773 pub fn set_reencrypted_user_credentials_hash<T: std::convert::Into<::bytes::Bytes>>(
1774 mut self,
1775 v: T,
1776 ) -> Self {
1777 self.reencrypted_user_credentials_hash = v.into();
1778 self
1779 }
1780}
1781
1782impl wkt::message::Message for PrivatePasswordLeakVerification {
1783 fn typename() -> &'static str {
1784 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification"
1785 }
1786}
1787
1788/// A reCAPTCHA Enterprise assessment resource.
1789#[derive(Clone, Default, PartialEq)]
1790#[non_exhaustive]
1791pub struct Assessment {
1792 /// Output only. Identifier. The resource name for the Assessment in the format
1793 /// `projects/{project}/assessments/{assessment}`.
1794 pub name: std::string::String,
1795
1796 /// Optional. The event being assessed.
1797 pub event: std::option::Option<crate::model::Event>,
1798
1799 /// Output only. The risk analysis result for the event being assessed.
1800 pub risk_analysis: std::option::Option<crate::model::RiskAnalysis>,
1801
1802 /// Output only. Properties of the provided event token.
1803 pub token_properties: std::option::Option<crate::model::TokenProperties>,
1804
1805 /// Optional. Account verification information for identity verification. The
1806 /// assessment event must include a token and site key to use this feature.
1807 pub account_verification: std::option::Option<crate::model::AccountVerificationInfo>,
1808
1809 /// Output only. Assessment returned by account defender when an account
1810 /// identifier is provided.
1811 pub account_defender_assessment: std::option::Option<crate::model::AccountDefenderAssessment>,
1812
1813 /// Optional. The private password leak verification field contains the
1814 /// parameters that are used to to check for leaks privately without sharing
1815 /// user credentials.
1816 pub private_password_leak_verification:
1817 std::option::Option<crate::model::PrivatePasswordLeakVerification>,
1818
1819 /// Output only. Assessment returned when firewall policies belonging to the
1820 /// project are evaluated using the field firewall_policy_evaluation.
1821 pub firewall_policy_assessment: std::option::Option<crate::model::FirewallPolicyAssessment>,
1822
1823 /// Output only. Assessment returned by Fraud Prevention when TransactionData
1824 /// is provided.
1825 pub fraud_prevention_assessment: std::option::Option<crate::model::FraudPreventionAssessment>,
1826
1827 /// Output only. Fraud Signals specific to the users involved in a payment
1828 /// transaction.
1829 pub fraud_signals: std::option::Option<crate::model::FraudSignals>,
1830
1831 /// Output only. Assessment returned when a site key, a token, and a phone
1832 /// number as `user_id` are provided. Account defender and SMS toll fraud
1833 /// protection need to be enabled.
1834 pub phone_fraud_assessment: std::option::Option<crate::model::PhoneFraudAssessment>,
1835
1836 /// Optional. The environment creating the assessment. This describes your
1837 /// environment (the system invoking CreateAssessment), NOT the environment of
1838 /// your user.
1839 pub assessment_environment: std::option::Option<crate::model::AssessmentEnvironment>,
1840
1841 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1842}
1843
1844impl Assessment {
1845 /// Creates a new default instance.
1846 pub fn new() -> Self {
1847 std::default::Default::default()
1848 }
1849
1850 /// Sets the value of [name][crate::model::Assessment::name].
1851 ///
1852 /// # Example
1853 /// ```ignore,no_run
1854 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
1855 /// # let project_id = "project_id";
1856 /// # let assessment_id = "assessment_id";
1857 /// let x = Assessment::new().set_name(format!("projects/{project_id}/assessments/{assessment_id}"));
1858 /// ```
1859 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1860 self.name = v.into();
1861 self
1862 }
1863
1864 /// Sets the value of [event][crate::model::Assessment::event].
1865 ///
1866 /// # Example
1867 /// ```ignore,no_run
1868 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
1869 /// use google_cloud_recaptchaenterprise_v1::model::Event;
1870 /// let x = Assessment::new().set_event(Event::default()/* use setters */);
1871 /// ```
1872 pub fn set_event<T>(mut self, v: T) -> Self
1873 where
1874 T: std::convert::Into<crate::model::Event>,
1875 {
1876 self.event = std::option::Option::Some(v.into());
1877 self
1878 }
1879
1880 /// Sets or clears the value of [event][crate::model::Assessment::event].
1881 ///
1882 /// # Example
1883 /// ```ignore,no_run
1884 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
1885 /// use google_cloud_recaptchaenterprise_v1::model::Event;
1886 /// let x = Assessment::new().set_or_clear_event(Some(Event::default()/* use setters */));
1887 /// let x = Assessment::new().set_or_clear_event(None::<Event>);
1888 /// ```
1889 pub fn set_or_clear_event<T>(mut self, v: std::option::Option<T>) -> Self
1890 where
1891 T: std::convert::Into<crate::model::Event>,
1892 {
1893 self.event = v.map(|x| x.into());
1894 self
1895 }
1896
1897 /// Sets the value of [risk_analysis][crate::model::Assessment::risk_analysis].
1898 ///
1899 /// # Example
1900 /// ```ignore,no_run
1901 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
1902 /// use google_cloud_recaptchaenterprise_v1::model::RiskAnalysis;
1903 /// let x = Assessment::new().set_risk_analysis(RiskAnalysis::default()/* use setters */);
1904 /// ```
1905 pub fn set_risk_analysis<T>(mut self, v: T) -> Self
1906 where
1907 T: std::convert::Into<crate::model::RiskAnalysis>,
1908 {
1909 self.risk_analysis = std::option::Option::Some(v.into());
1910 self
1911 }
1912
1913 /// Sets or clears the value of [risk_analysis][crate::model::Assessment::risk_analysis].
1914 ///
1915 /// # Example
1916 /// ```ignore,no_run
1917 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
1918 /// use google_cloud_recaptchaenterprise_v1::model::RiskAnalysis;
1919 /// let x = Assessment::new().set_or_clear_risk_analysis(Some(RiskAnalysis::default()/* use setters */));
1920 /// let x = Assessment::new().set_or_clear_risk_analysis(None::<RiskAnalysis>);
1921 /// ```
1922 pub fn set_or_clear_risk_analysis<T>(mut self, v: std::option::Option<T>) -> Self
1923 where
1924 T: std::convert::Into<crate::model::RiskAnalysis>,
1925 {
1926 self.risk_analysis = v.map(|x| x.into());
1927 self
1928 }
1929
1930 /// Sets the value of [token_properties][crate::model::Assessment::token_properties].
1931 ///
1932 /// # Example
1933 /// ```ignore,no_run
1934 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
1935 /// use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
1936 /// let x = Assessment::new().set_token_properties(TokenProperties::default()/* use setters */);
1937 /// ```
1938 pub fn set_token_properties<T>(mut self, v: T) -> Self
1939 where
1940 T: std::convert::Into<crate::model::TokenProperties>,
1941 {
1942 self.token_properties = std::option::Option::Some(v.into());
1943 self
1944 }
1945
1946 /// Sets or clears the value of [token_properties][crate::model::Assessment::token_properties].
1947 ///
1948 /// # Example
1949 /// ```ignore,no_run
1950 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
1951 /// use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
1952 /// let x = Assessment::new().set_or_clear_token_properties(Some(TokenProperties::default()/* use setters */));
1953 /// let x = Assessment::new().set_or_clear_token_properties(None::<TokenProperties>);
1954 /// ```
1955 pub fn set_or_clear_token_properties<T>(mut self, v: std::option::Option<T>) -> Self
1956 where
1957 T: std::convert::Into<crate::model::TokenProperties>,
1958 {
1959 self.token_properties = v.map(|x| x.into());
1960 self
1961 }
1962
1963 /// Sets the value of [account_verification][crate::model::Assessment::account_verification].
1964 ///
1965 /// # Example
1966 /// ```ignore,no_run
1967 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
1968 /// use google_cloud_recaptchaenterprise_v1::model::AccountVerificationInfo;
1969 /// let x = Assessment::new().set_account_verification(AccountVerificationInfo::default()/* use setters */);
1970 /// ```
1971 pub fn set_account_verification<T>(mut self, v: T) -> Self
1972 where
1973 T: std::convert::Into<crate::model::AccountVerificationInfo>,
1974 {
1975 self.account_verification = std::option::Option::Some(v.into());
1976 self
1977 }
1978
1979 /// Sets or clears the value of [account_verification][crate::model::Assessment::account_verification].
1980 ///
1981 /// # Example
1982 /// ```ignore,no_run
1983 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
1984 /// use google_cloud_recaptchaenterprise_v1::model::AccountVerificationInfo;
1985 /// let x = Assessment::new().set_or_clear_account_verification(Some(AccountVerificationInfo::default()/* use setters */));
1986 /// let x = Assessment::new().set_or_clear_account_verification(None::<AccountVerificationInfo>);
1987 /// ```
1988 pub fn set_or_clear_account_verification<T>(mut self, v: std::option::Option<T>) -> Self
1989 where
1990 T: std::convert::Into<crate::model::AccountVerificationInfo>,
1991 {
1992 self.account_verification = v.map(|x| x.into());
1993 self
1994 }
1995
1996 /// Sets the value of [account_defender_assessment][crate::model::Assessment::account_defender_assessment].
1997 ///
1998 /// # Example
1999 /// ```ignore,no_run
2000 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2001 /// use google_cloud_recaptchaenterprise_v1::model::AccountDefenderAssessment;
2002 /// let x = Assessment::new().set_account_defender_assessment(AccountDefenderAssessment::default()/* use setters */);
2003 /// ```
2004 pub fn set_account_defender_assessment<T>(mut self, v: T) -> Self
2005 where
2006 T: std::convert::Into<crate::model::AccountDefenderAssessment>,
2007 {
2008 self.account_defender_assessment = std::option::Option::Some(v.into());
2009 self
2010 }
2011
2012 /// Sets or clears the value of [account_defender_assessment][crate::model::Assessment::account_defender_assessment].
2013 ///
2014 /// # Example
2015 /// ```ignore,no_run
2016 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2017 /// use google_cloud_recaptchaenterprise_v1::model::AccountDefenderAssessment;
2018 /// let x = Assessment::new().set_or_clear_account_defender_assessment(Some(AccountDefenderAssessment::default()/* use setters */));
2019 /// let x = Assessment::new().set_or_clear_account_defender_assessment(None::<AccountDefenderAssessment>);
2020 /// ```
2021 pub fn set_or_clear_account_defender_assessment<T>(mut self, v: std::option::Option<T>) -> Self
2022 where
2023 T: std::convert::Into<crate::model::AccountDefenderAssessment>,
2024 {
2025 self.account_defender_assessment = v.map(|x| x.into());
2026 self
2027 }
2028
2029 /// Sets the value of [private_password_leak_verification][crate::model::Assessment::private_password_leak_verification].
2030 ///
2031 /// # Example
2032 /// ```ignore,no_run
2033 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2034 /// use google_cloud_recaptchaenterprise_v1::model::PrivatePasswordLeakVerification;
2035 /// let x = Assessment::new().set_private_password_leak_verification(PrivatePasswordLeakVerification::default()/* use setters */);
2036 /// ```
2037 pub fn set_private_password_leak_verification<T>(mut self, v: T) -> Self
2038 where
2039 T: std::convert::Into<crate::model::PrivatePasswordLeakVerification>,
2040 {
2041 self.private_password_leak_verification = std::option::Option::Some(v.into());
2042 self
2043 }
2044
2045 /// Sets or clears the value of [private_password_leak_verification][crate::model::Assessment::private_password_leak_verification].
2046 ///
2047 /// # Example
2048 /// ```ignore,no_run
2049 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2050 /// use google_cloud_recaptchaenterprise_v1::model::PrivatePasswordLeakVerification;
2051 /// let x = Assessment::new().set_or_clear_private_password_leak_verification(Some(PrivatePasswordLeakVerification::default()/* use setters */));
2052 /// let x = Assessment::new().set_or_clear_private_password_leak_verification(None::<PrivatePasswordLeakVerification>);
2053 /// ```
2054 pub fn set_or_clear_private_password_leak_verification<T>(
2055 mut self,
2056 v: std::option::Option<T>,
2057 ) -> Self
2058 where
2059 T: std::convert::Into<crate::model::PrivatePasswordLeakVerification>,
2060 {
2061 self.private_password_leak_verification = v.map(|x| x.into());
2062 self
2063 }
2064
2065 /// Sets the value of [firewall_policy_assessment][crate::model::Assessment::firewall_policy_assessment].
2066 ///
2067 /// # Example
2068 /// ```ignore,no_run
2069 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2070 /// use google_cloud_recaptchaenterprise_v1::model::FirewallPolicyAssessment;
2071 /// let x = Assessment::new().set_firewall_policy_assessment(FirewallPolicyAssessment::default()/* use setters */);
2072 /// ```
2073 pub fn set_firewall_policy_assessment<T>(mut self, v: T) -> Self
2074 where
2075 T: std::convert::Into<crate::model::FirewallPolicyAssessment>,
2076 {
2077 self.firewall_policy_assessment = std::option::Option::Some(v.into());
2078 self
2079 }
2080
2081 /// Sets or clears the value of [firewall_policy_assessment][crate::model::Assessment::firewall_policy_assessment].
2082 ///
2083 /// # Example
2084 /// ```ignore,no_run
2085 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2086 /// use google_cloud_recaptchaenterprise_v1::model::FirewallPolicyAssessment;
2087 /// let x = Assessment::new().set_or_clear_firewall_policy_assessment(Some(FirewallPolicyAssessment::default()/* use setters */));
2088 /// let x = Assessment::new().set_or_clear_firewall_policy_assessment(None::<FirewallPolicyAssessment>);
2089 /// ```
2090 pub fn set_or_clear_firewall_policy_assessment<T>(mut self, v: std::option::Option<T>) -> Self
2091 where
2092 T: std::convert::Into<crate::model::FirewallPolicyAssessment>,
2093 {
2094 self.firewall_policy_assessment = v.map(|x| x.into());
2095 self
2096 }
2097
2098 /// Sets the value of [fraud_prevention_assessment][crate::model::Assessment::fraud_prevention_assessment].
2099 ///
2100 /// # Example
2101 /// ```ignore,no_run
2102 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2103 /// use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
2104 /// let x = Assessment::new().set_fraud_prevention_assessment(FraudPreventionAssessment::default()/* use setters */);
2105 /// ```
2106 pub fn set_fraud_prevention_assessment<T>(mut self, v: T) -> Self
2107 where
2108 T: std::convert::Into<crate::model::FraudPreventionAssessment>,
2109 {
2110 self.fraud_prevention_assessment = std::option::Option::Some(v.into());
2111 self
2112 }
2113
2114 /// Sets or clears the value of [fraud_prevention_assessment][crate::model::Assessment::fraud_prevention_assessment].
2115 ///
2116 /// # Example
2117 /// ```ignore,no_run
2118 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2119 /// use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
2120 /// let x = Assessment::new().set_or_clear_fraud_prevention_assessment(Some(FraudPreventionAssessment::default()/* use setters */));
2121 /// let x = Assessment::new().set_or_clear_fraud_prevention_assessment(None::<FraudPreventionAssessment>);
2122 /// ```
2123 pub fn set_or_clear_fraud_prevention_assessment<T>(mut self, v: std::option::Option<T>) -> Self
2124 where
2125 T: std::convert::Into<crate::model::FraudPreventionAssessment>,
2126 {
2127 self.fraud_prevention_assessment = v.map(|x| x.into());
2128 self
2129 }
2130
2131 /// Sets the value of [fraud_signals][crate::model::Assessment::fraud_signals].
2132 ///
2133 /// # Example
2134 /// ```ignore,no_run
2135 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2136 /// use google_cloud_recaptchaenterprise_v1::model::FraudSignals;
2137 /// let x = Assessment::new().set_fraud_signals(FraudSignals::default()/* use setters */);
2138 /// ```
2139 pub fn set_fraud_signals<T>(mut self, v: T) -> Self
2140 where
2141 T: std::convert::Into<crate::model::FraudSignals>,
2142 {
2143 self.fraud_signals = std::option::Option::Some(v.into());
2144 self
2145 }
2146
2147 /// Sets or clears the value of [fraud_signals][crate::model::Assessment::fraud_signals].
2148 ///
2149 /// # Example
2150 /// ```ignore,no_run
2151 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2152 /// use google_cloud_recaptchaenterprise_v1::model::FraudSignals;
2153 /// let x = Assessment::new().set_or_clear_fraud_signals(Some(FraudSignals::default()/* use setters */));
2154 /// let x = Assessment::new().set_or_clear_fraud_signals(None::<FraudSignals>);
2155 /// ```
2156 pub fn set_or_clear_fraud_signals<T>(mut self, v: std::option::Option<T>) -> Self
2157 where
2158 T: std::convert::Into<crate::model::FraudSignals>,
2159 {
2160 self.fraud_signals = v.map(|x| x.into());
2161 self
2162 }
2163
2164 /// Sets the value of [phone_fraud_assessment][crate::model::Assessment::phone_fraud_assessment].
2165 ///
2166 /// # Example
2167 /// ```ignore,no_run
2168 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2169 /// use google_cloud_recaptchaenterprise_v1::model::PhoneFraudAssessment;
2170 /// let x = Assessment::new().set_phone_fraud_assessment(PhoneFraudAssessment::default()/* use setters */);
2171 /// ```
2172 pub fn set_phone_fraud_assessment<T>(mut self, v: T) -> Self
2173 where
2174 T: std::convert::Into<crate::model::PhoneFraudAssessment>,
2175 {
2176 self.phone_fraud_assessment = std::option::Option::Some(v.into());
2177 self
2178 }
2179
2180 /// Sets or clears the value of [phone_fraud_assessment][crate::model::Assessment::phone_fraud_assessment].
2181 ///
2182 /// # Example
2183 /// ```ignore,no_run
2184 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2185 /// use google_cloud_recaptchaenterprise_v1::model::PhoneFraudAssessment;
2186 /// let x = Assessment::new().set_or_clear_phone_fraud_assessment(Some(PhoneFraudAssessment::default()/* use setters */));
2187 /// let x = Assessment::new().set_or_clear_phone_fraud_assessment(None::<PhoneFraudAssessment>);
2188 /// ```
2189 pub fn set_or_clear_phone_fraud_assessment<T>(mut self, v: std::option::Option<T>) -> Self
2190 where
2191 T: std::convert::Into<crate::model::PhoneFraudAssessment>,
2192 {
2193 self.phone_fraud_assessment = v.map(|x| x.into());
2194 self
2195 }
2196
2197 /// Sets the value of [assessment_environment][crate::model::Assessment::assessment_environment].
2198 ///
2199 /// # Example
2200 /// ```ignore,no_run
2201 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2202 /// use google_cloud_recaptchaenterprise_v1::model::AssessmentEnvironment;
2203 /// let x = Assessment::new().set_assessment_environment(AssessmentEnvironment::default()/* use setters */);
2204 /// ```
2205 pub fn set_assessment_environment<T>(mut self, v: T) -> Self
2206 where
2207 T: std::convert::Into<crate::model::AssessmentEnvironment>,
2208 {
2209 self.assessment_environment = std::option::Option::Some(v.into());
2210 self
2211 }
2212
2213 /// Sets or clears the value of [assessment_environment][crate::model::Assessment::assessment_environment].
2214 ///
2215 /// # Example
2216 /// ```ignore,no_run
2217 /// # use google_cloud_recaptchaenterprise_v1::model::Assessment;
2218 /// use google_cloud_recaptchaenterprise_v1::model::AssessmentEnvironment;
2219 /// let x = Assessment::new().set_or_clear_assessment_environment(Some(AssessmentEnvironment::default()/* use setters */));
2220 /// let x = Assessment::new().set_or_clear_assessment_environment(None::<AssessmentEnvironment>);
2221 /// ```
2222 pub fn set_or_clear_assessment_environment<T>(mut self, v: std::option::Option<T>) -> Self
2223 where
2224 T: std::convert::Into<crate::model::AssessmentEnvironment>,
2225 {
2226 self.assessment_environment = v.map(|x| x.into());
2227 self
2228 }
2229}
2230
2231impl wkt::message::Message for Assessment {
2232 fn typename() -> &'static str {
2233 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.Assessment"
2234 }
2235}
2236
2237/// The event being assessed.
2238#[derive(Clone, Default, PartialEq)]
2239#[non_exhaustive]
2240pub struct Event {
2241 /// Optional. The user response token provided by the reCAPTCHA Enterprise
2242 /// client-side integration on your site.
2243 pub token: std::string::String,
2244
2245 /// Optional. The site key that was used to invoke reCAPTCHA Enterprise on your
2246 /// site and generate the token.
2247 pub site_key: std::string::String,
2248
2249 /// Optional. The user agent present in the request from the user's device
2250 /// related to this event.
2251 pub user_agent: std::string::String,
2252
2253 /// Optional. The IP address in the request from the user's device related to
2254 /// this event.
2255 pub user_ip_address: std::string::String,
2256
2257 /// Optional. The expected action for this type of event. This should be the
2258 /// same action provided at token generation time on client-side platforms
2259 /// already integrated with recaptcha enterprise.
2260 pub expected_action: std::string::String,
2261
2262 /// Optional. Deprecated: use `user_info.account_id` instead.
2263 /// Unique stable hashed user identifier for the request. The identifier must
2264 /// be hashed using hmac-sha256 with stable secret.
2265 #[deprecated]
2266 pub hashed_account_id: ::bytes::Bytes,
2267
2268 /// Optional. Flag for a reCAPTCHA express request for an assessment without a
2269 /// token. If enabled, `site_key` must reference an Express site key.
2270 pub express: bool,
2271
2272 /// Optional. The URI resource the user requested that triggered an assessment.
2273 pub requested_uri: std::string::String,
2274
2275 /// Optional. Flag for running Web Application Firewall (WAF) token assessment.
2276 /// If enabled, the token must be specified, and have been created by a
2277 /// WAF-enabled key.
2278 pub waf_token_assessment: bool,
2279
2280 /// Optional. JA3 fingerprint for SSL clients. To learn how to compute this
2281 /// fingerprint, please refer to <https://github.com/salesforce/ja3>.
2282 pub ja3: std::string::String,
2283
2284 /// Optional. JA4 fingerprint for SSL clients. To learn how to compute this
2285 /// fingerprint, please refer to <https://github.com/FoxIO-LLC/ja4>.
2286 pub ja4: std::string::String,
2287
2288 /// Optional. HTTP header information about the request.
2289 pub headers: std::vec::Vec<std::string::String>,
2290
2291 /// Optional. Flag for enabling firewall policy config assessment.
2292 /// If this flag is enabled, the firewall policy is evaluated and a
2293 /// suggested firewall action is returned in the response.
2294 pub firewall_policy_evaluation: bool,
2295
2296 /// Optional. Data describing a payment transaction to be assessed. Sending
2297 /// this data enables reCAPTCHA Enterprise Fraud Prevention and the
2298 /// FraudPreventionAssessment component in the response.
2299 pub transaction_data: std::option::Option<crate::model::TransactionData>,
2300
2301 /// Optional. Information about the user that generates this event, when they
2302 /// can be identified. They are often identified through the use of an account
2303 /// for logged-in requests or login/registration requests, or by providing user
2304 /// identifiers for guest actions like checkout.
2305 pub user_info: std::option::Option<crate::model::UserInfo>,
2306
2307 /// Optional. The Fraud Prevention setting for this assessment.
2308 pub fraud_prevention: crate::model::event::FraudPrevention,
2309
2310 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2311}
2312
2313impl Event {
2314 /// Creates a new default instance.
2315 pub fn new() -> Self {
2316 std::default::Default::default()
2317 }
2318
2319 /// Sets the value of [token][crate::model::Event::token].
2320 ///
2321 /// # Example
2322 /// ```ignore,no_run
2323 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2324 /// let x = Event::new().set_token("example");
2325 /// ```
2326 pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2327 self.token = v.into();
2328 self
2329 }
2330
2331 /// Sets the value of [site_key][crate::model::Event::site_key].
2332 ///
2333 /// # Example
2334 /// ```ignore,no_run
2335 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2336 /// let x = Event::new().set_site_key("example");
2337 /// ```
2338 pub fn set_site_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2339 self.site_key = v.into();
2340 self
2341 }
2342
2343 /// Sets the value of [user_agent][crate::model::Event::user_agent].
2344 ///
2345 /// # Example
2346 /// ```ignore,no_run
2347 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2348 /// let x = Event::new().set_user_agent("example");
2349 /// ```
2350 pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2351 self.user_agent = v.into();
2352 self
2353 }
2354
2355 /// Sets the value of [user_ip_address][crate::model::Event::user_ip_address].
2356 ///
2357 /// # Example
2358 /// ```ignore,no_run
2359 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2360 /// let x = Event::new().set_user_ip_address("example");
2361 /// ```
2362 pub fn set_user_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2363 self.user_ip_address = v.into();
2364 self
2365 }
2366
2367 /// Sets the value of [expected_action][crate::model::Event::expected_action].
2368 ///
2369 /// # Example
2370 /// ```ignore,no_run
2371 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2372 /// let x = Event::new().set_expected_action("example");
2373 /// ```
2374 pub fn set_expected_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2375 self.expected_action = v.into();
2376 self
2377 }
2378
2379 /// Sets the value of [hashed_account_id][crate::model::Event::hashed_account_id].
2380 ///
2381 /// # Example
2382 /// ```ignore,no_run
2383 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2384 /// let x = Event::new().set_hashed_account_id(bytes::Bytes::from_static(b"example"));
2385 /// ```
2386 #[deprecated]
2387 pub fn set_hashed_account_id<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2388 self.hashed_account_id = v.into();
2389 self
2390 }
2391
2392 /// Sets the value of [express][crate::model::Event::express].
2393 ///
2394 /// # Example
2395 /// ```ignore,no_run
2396 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2397 /// let x = Event::new().set_express(true);
2398 /// ```
2399 pub fn set_express<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2400 self.express = v.into();
2401 self
2402 }
2403
2404 /// Sets the value of [requested_uri][crate::model::Event::requested_uri].
2405 ///
2406 /// # Example
2407 /// ```ignore,no_run
2408 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2409 /// let x = Event::new().set_requested_uri("example");
2410 /// ```
2411 pub fn set_requested_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2412 self.requested_uri = v.into();
2413 self
2414 }
2415
2416 /// Sets the value of [waf_token_assessment][crate::model::Event::waf_token_assessment].
2417 ///
2418 /// # Example
2419 /// ```ignore,no_run
2420 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2421 /// let x = Event::new().set_waf_token_assessment(true);
2422 /// ```
2423 pub fn set_waf_token_assessment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2424 self.waf_token_assessment = v.into();
2425 self
2426 }
2427
2428 /// Sets the value of [ja3][crate::model::Event::ja3].
2429 ///
2430 /// # Example
2431 /// ```ignore,no_run
2432 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2433 /// let x = Event::new().set_ja3("example");
2434 /// ```
2435 pub fn set_ja3<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2436 self.ja3 = v.into();
2437 self
2438 }
2439
2440 /// Sets the value of [ja4][crate::model::Event::ja4].
2441 ///
2442 /// # Example
2443 /// ```ignore,no_run
2444 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2445 /// let x = Event::new().set_ja4("example");
2446 /// ```
2447 pub fn set_ja4<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2448 self.ja4 = v.into();
2449 self
2450 }
2451
2452 /// Sets the value of [headers][crate::model::Event::headers].
2453 ///
2454 /// # Example
2455 /// ```ignore,no_run
2456 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2457 /// let x = Event::new().set_headers(["a", "b", "c"]);
2458 /// ```
2459 pub fn set_headers<T, V>(mut self, v: T) -> Self
2460 where
2461 T: std::iter::IntoIterator<Item = V>,
2462 V: std::convert::Into<std::string::String>,
2463 {
2464 use std::iter::Iterator;
2465 self.headers = v.into_iter().map(|i| i.into()).collect();
2466 self
2467 }
2468
2469 /// Sets the value of [firewall_policy_evaluation][crate::model::Event::firewall_policy_evaluation].
2470 ///
2471 /// # Example
2472 /// ```ignore,no_run
2473 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2474 /// let x = Event::new().set_firewall_policy_evaluation(true);
2475 /// ```
2476 pub fn set_firewall_policy_evaluation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2477 self.firewall_policy_evaluation = v.into();
2478 self
2479 }
2480
2481 /// Sets the value of [transaction_data][crate::model::Event::transaction_data].
2482 ///
2483 /// # Example
2484 /// ```ignore,no_run
2485 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2486 /// use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2487 /// let x = Event::new().set_transaction_data(TransactionData::default()/* use setters */);
2488 /// ```
2489 pub fn set_transaction_data<T>(mut self, v: T) -> Self
2490 where
2491 T: std::convert::Into<crate::model::TransactionData>,
2492 {
2493 self.transaction_data = std::option::Option::Some(v.into());
2494 self
2495 }
2496
2497 /// Sets or clears the value of [transaction_data][crate::model::Event::transaction_data].
2498 ///
2499 /// # Example
2500 /// ```ignore,no_run
2501 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2502 /// use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2503 /// let x = Event::new().set_or_clear_transaction_data(Some(TransactionData::default()/* use setters */));
2504 /// let x = Event::new().set_or_clear_transaction_data(None::<TransactionData>);
2505 /// ```
2506 pub fn set_or_clear_transaction_data<T>(mut self, v: std::option::Option<T>) -> Self
2507 where
2508 T: std::convert::Into<crate::model::TransactionData>,
2509 {
2510 self.transaction_data = v.map(|x| x.into());
2511 self
2512 }
2513
2514 /// Sets the value of [user_info][crate::model::Event::user_info].
2515 ///
2516 /// # Example
2517 /// ```ignore,no_run
2518 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2519 /// use google_cloud_recaptchaenterprise_v1::model::UserInfo;
2520 /// let x = Event::new().set_user_info(UserInfo::default()/* use setters */);
2521 /// ```
2522 pub fn set_user_info<T>(mut self, v: T) -> Self
2523 where
2524 T: std::convert::Into<crate::model::UserInfo>,
2525 {
2526 self.user_info = std::option::Option::Some(v.into());
2527 self
2528 }
2529
2530 /// Sets or clears the value of [user_info][crate::model::Event::user_info].
2531 ///
2532 /// # Example
2533 /// ```ignore,no_run
2534 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2535 /// use google_cloud_recaptchaenterprise_v1::model::UserInfo;
2536 /// let x = Event::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
2537 /// let x = Event::new().set_or_clear_user_info(None::<UserInfo>);
2538 /// ```
2539 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
2540 where
2541 T: std::convert::Into<crate::model::UserInfo>,
2542 {
2543 self.user_info = v.map(|x| x.into());
2544 self
2545 }
2546
2547 /// Sets the value of [fraud_prevention][crate::model::Event::fraud_prevention].
2548 ///
2549 /// # Example
2550 /// ```ignore,no_run
2551 /// # use google_cloud_recaptchaenterprise_v1::model::Event;
2552 /// use google_cloud_recaptchaenterprise_v1::model::event::FraudPrevention;
2553 /// let x0 = Event::new().set_fraud_prevention(FraudPrevention::Enabled);
2554 /// let x1 = Event::new().set_fraud_prevention(FraudPrevention::Disabled);
2555 /// ```
2556 pub fn set_fraud_prevention<T: std::convert::Into<crate::model::event::FraudPrevention>>(
2557 mut self,
2558 v: T,
2559 ) -> Self {
2560 self.fraud_prevention = v.into();
2561 self
2562 }
2563}
2564
2565impl wkt::message::Message for Event {
2566 fn typename() -> &'static str {
2567 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.Event"
2568 }
2569}
2570
2571/// Defines additional types related to [Event].
2572pub mod event {
2573 #[allow(unused_imports)]
2574 use super::*;
2575
2576 /// Setting that controls Fraud Prevention assessments.
2577 /// Ensure that applications can handle values not explicitly listed.
2578 ///
2579 /// # Working with unknown values
2580 ///
2581 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2582 /// additional enum variants at any time. Adding new variants is not considered
2583 /// a breaking change. Applications should write their code in anticipation of:
2584 ///
2585 /// - New values appearing in future releases of the client library, **and**
2586 /// - New values received dynamically, without application changes.
2587 ///
2588 /// Please consult the [Working with enums] section in the user guide for some
2589 /// guidelines.
2590 ///
2591 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2592 #[derive(Clone, Debug, PartialEq)]
2593 #[non_exhaustive]
2594 pub enum FraudPrevention {
2595 /// Default, unspecified setting. `fraud_prevention_assessment` is returned
2596 /// if `transaction_data` is present in `Event` and Fraud Prevention is
2597 /// enabled in the Google Cloud console.
2598 Unspecified,
2599 /// Enable Fraud Prevention for this assessment, if Fraud Prevention is
2600 /// enabled in the Google Cloud console.
2601 Enabled,
2602 /// Disable Fraud Prevention for this assessment, regardless of the Google
2603 /// Cloud console settings.
2604 Disabled,
2605 /// If set, the enum was initialized with an unknown value.
2606 ///
2607 /// Applications can examine the value using [FraudPrevention::value] or
2608 /// [FraudPrevention::name].
2609 UnknownValue(fraud_prevention::UnknownValue),
2610 }
2611
2612 #[doc(hidden)]
2613 pub mod fraud_prevention {
2614 #[allow(unused_imports)]
2615 use super::*;
2616 #[derive(Clone, Debug, PartialEq)]
2617 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2618 }
2619
2620 impl FraudPrevention {
2621 /// Gets the enum value.
2622 ///
2623 /// Returns `None` if the enum contains an unknown value deserialized from
2624 /// the string representation of enums.
2625 pub fn value(&self) -> std::option::Option<i32> {
2626 match self {
2627 Self::Unspecified => std::option::Option::Some(0),
2628 Self::Enabled => std::option::Option::Some(1),
2629 Self::Disabled => std::option::Option::Some(2),
2630 Self::UnknownValue(u) => u.0.value(),
2631 }
2632 }
2633
2634 /// Gets the enum value as a string.
2635 ///
2636 /// Returns `None` if the enum contains an unknown value deserialized from
2637 /// the integer representation of enums.
2638 pub fn name(&self) -> std::option::Option<&str> {
2639 match self {
2640 Self::Unspecified => std::option::Option::Some("FRAUD_PREVENTION_UNSPECIFIED"),
2641 Self::Enabled => std::option::Option::Some("ENABLED"),
2642 Self::Disabled => std::option::Option::Some("DISABLED"),
2643 Self::UnknownValue(u) => u.0.name(),
2644 }
2645 }
2646 }
2647
2648 impl std::default::Default for FraudPrevention {
2649 fn default() -> Self {
2650 use std::convert::From;
2651 Self::from(0)
2652 }
2653 }
2654
2655 impl std::fmt::Display for FraudPrevention {
2656 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2657 wkt::internal::display_enum(f, self.name(), self.value())
2658 }
2659 }
2660
2661 impl std::convert::From<i32> for FraudPrevention {
2662 fn from(value: i32) -> Self {
2663 match value {
2664 0 => Self::Unspecified,
2665 1 => Self::Enabled,
2666 2 => Self::Disabled,
2667 _ => Self::UnknownValue(fraud_prevention::UnknownValue(
2668 wkt::internal::UnknownEnumValue::Integer(value),
2669 )),
2670 }
2671 }
2672 }
2673
2674 impl std::convert::From<&str> for FraudPrevention {
2675 fn from(value: &str) -> Self {
2676 use std::string::ToString;
2677 match value {
2678 "FRAUD_PREVENTION_UNSPECIFIED" => Self::Unspecified,
2679 "ENABLED" => Self::Enabled,
2680 "DISABLED" => Self::Disabled,
2681 _ => Self::UnknownValue(fraud_prevention::UnknownValue(
2682 wkt::internal::UnknownEnumValue::String(value.to_string()),
2683 )),
2684 }
2685 }
2686 }
2687
2688 impl serde::ser::Serialize for FraudPrevention {
2689 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2690 where
2691 S: serde::Serializer,
2692 {
2693 match self {
2694 Self::Unspecified => serializer.serialize_i32(0),
2695 Self::Enabled => serializer.serialize_i32(1),
2696 Self::Disabled => serializer.serialize_i32(2),
2697 Self::UnknownValue(u) => u.0.serialize(serializer),
2698 }
2699 }
2700 }
2701
2702 impl<'de> serde::de::Deserialize<'de> for FraudPrevention {
2703 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2704 where
2705 D: serde::Deserializer<'de>,
2706 {
2707 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FraudPrevention>::new(
2708 ".google.cloud.recaptchaenterprise.v1.Event.FraudPrevention",
2709 ))
2710 }
2711 }
2712}
2713
2714/// Transaction data associated with a payment protected by reCAPTCHA Enterprise.
2715#[derive(Clone, Default, PartialEq)]
2716#[non_exhaustive]
2717pub struct TransactionData {
2718 /// Unique identifier for the transaction. This custom identifier can be used
2719 /// to reference this transaction in the future, for example, labeling a refund
2720 /// or chargeback event. Two attempts at the same transaction should use the
2721 /// same transaction id.
2722 pub transaction_id: std::option::Option<std::string::String>,
2723
2724 /// Optional. The payment method for the transaction. The allowed values are:
2725 ///
2726 /// * credit-card
2727 /// * debit-card
2728 /// * gift-card
2729 /// * processor-{name} (If a third-party is used, for example,
2730 /// processor-paypal)
2731 /// * custom-{name} (If an alternative method is used, for example,
2732 /// custom-crypto)
2733 pub payment_method: std::string::String,
2734
2735 /// Optional. The Bank Identification Number - generally the first 6 or 8
2736 /// digits of the card.
2737 pub card_bin: std::string::String,
2738
2739 /// Optional. The last four digits of the card.
2740 pub card_last_four: std::string::String,
2741
2742 /// Optional. The currency code in ISO-4217 format.
2743 pub currency_code: std::string::String,
2744
2745 /// Optional. The decimal value of the transaction in the specified currency.
2746 pub value: f64,
2747
2748 /// Optional. The value of shipping in the specified currency. 0 for free or no
2749 /// shipping.
2750 pub shipping_value: f64,
2751
2752 /// Optional. Destination address if this transaction involves shipping a
2753 /// physical item.
2754 pub shipping_address: std::option::Option<crate::model::transaction_data::Address>,
2755
2756 /// Optional. Address associated with the payment method when applicable.
2757 pub billing_address: std::option::Option<crate::model::transaction_data::Address>,
2758
2759 /// Optional. Information about the user paying/initiating the transaction.
2760 pub user: std::option::Option<crate::model::transaction_data::User>,
2761
2762 /// Optional. Information about the user or users fulfilling the transaction.
2763 pub merchants: std::vec::Vec<crate::model::transaction_data::User>,
2764
2765 /// Optional. Items purchased in this transaction.
2766 pub items: std::vec::Vec<crate::model::transaction_data::Item>,
2767
2768 /// Optional. Information about the payment gateway's response to the
2769 /// transaction.
2770 pub gateway_info: std::option::Option<crate::model::transaction_data::GatewayInfo>,
2771
2772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2773}
2774
2775impl TransactionData {
2776 /// Creates a new default instance.
2777 pub fn new() -> Self {
2778 std::default::Default::default()
2779 }
2780
2781 /// Sets the value of [transaction_id][crate::model::TransactionData::transaction_id].
2782 ///
2783 /// # Example
2784 /// ```ignore,no_run
2785 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2786 /// let x = TransactionData::new().set_transaction_id("example");
2787 /// ```
2788 pub fn set_transaction_id<T>(mut self, v: T) -> Self
2789 where
2790 T: std::convert::Into<std::string::String>,
2791 {
2792 self.transaction_id = std::option::Option::Some(v.into());
2793 self
2794 }
2795
2796 /// Sets or clears the value of [transaction_id][crate::model::TransactionData::transaction_id].
2797 ///
2798 /// # Example
2799 /// ```ignore,no_run
2800 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2801 /// let x = TransactionData::new().set_or_clear_transaction_id(Some("example"));
2802 /// let x = TransactionData::new().set_or_clear_transaction_id(None::<String>);
2803 /// ```
2804 pub fn set_or_clear_transaction_id<T>(mut self, v: std::option::Option<T>) -> Self
2805 where
2806 T: std::convert::Into<std::string::String>,
2807 {
2808 self.transaction_id = v.map(|x| x.into());
2809 self
2810 }
2811
2812 /// Sets the value of [payment_method][crate::model::TransactionData::payment_method].
2813 ///
2814 /// # Example
2815 /// ```ignore,no_run
2816 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2817 /// let x = TransactionData::new().set_payment_method("example");
2818 /// ```
2819 pub fn set_payment_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2820 self.payment_method = v.into();
2821 self
2822 }
2823
2824 /// Sets the value of [card_bin][crate::model::TransactionData::card_bin].
2825 ///
2826 /// # Example
2827 /// ```ignore,no_run
2828 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2829 /// let x = TransactionData::new().set_card_bin("example");
2830 /// ```
2831 pub fn set_card_bin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2832 self.card_bin = v.into();
2833 self
2834 }
2835
2836 /// Sets the value of [card_last_four][crate::model::TransactionData::card_last_four].
2837 ///
2838 /// # Example
2839 /// ```ignore,no_run
2840 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2841 /// let x = TransactionData::new().set_card_last_four("example");
2842 /// ```
2843 pub fn set_card_last_four<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2844 self.card_last_four = v.into();
2845 self
2846 }
2847
2848 /// Sets the value of [currency_code][crate::model::TransactionData::currency_code].
2849 ///
2850 /// # Example
2851 /// ```ignore,no_run
2852 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2853 /// let x = TransactionData::new().set_currency_code("example");
2854 /// ```
2855 pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2856 self.currency_code = v.into();
2857 self
2858 }
2859
2860 /// Sets the value of [value][crate::model::TransactionData::value].
2861 ///
2862 /// # Example
2863 /// ```ignore,no_run
2864 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2865 /// let x = TransactionData::new().set_value(42.0);
2866 /// ```
2867 pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2868 self.value = v.into();
2869 self
2870 }
2871
2872 /// Sets the value of [shipping_value][crate::model::TransactionData::shipping_value].
2873 ///
2874 /// # Example
2875 /// ```ignore,no_run
2876 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2877 /// let x = TransactionData::new().set_shipping_value(42.0);
2878 /// ```
2879 pub fn set_shipping_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2880 self.shipping_value = v.into();
2881 self
2882 }
2883
2884 /// Sets the value of [shipping_address][crate::model::TransactionData::shipping_address].
2885 ///
2886 /// # Example
2887 /// ```ignore,no_run
2888 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2889 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
2890 /// let x = TransactionData::new().set_shipping_address(Address::default()/* use setters */);
2891 /// ```
2892 pub fn set_shipping_address<T>(mut self, v: T) -> Self
2893 where
2894 T: std::convert::Into<crate::model::transaction_data::Address>,
2895 {
2896 self.shipping_address = std::option::Option::Some(v.into());
2897 self
2898 }
2899
2900 /// Sets or clears the value of [shipping_address][crate::model::TransactionData::shipping_address].
2901 ///
2902 /// # Example
2903 /// ```ignore,no_run
2904 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2905 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
2906 /// let x = TransactionData::new().set_or_clear_shipping_address(Some(Address::default()/* use setters */));
2907 /// let x = TransactionData::new().set_or_clear_shipping_address(None::<Address>);
2908 /// ```
2909 pub fn set_or_clear_shipping_address<T>(mut self, v: std::option::Option<T>) -> Self
2910 where
2911 T: std::convert::Into<crate::model::transaction_data::Address>,
2912 {
2913 self.shipping_address = v.map(|x| x.into());
2914 self
2915 }
2916
2917 /// Sets the value of [billing_address][crate::model::TransactionData::billing_address].
2918 ///
2919 /// # Example
2920 /// ```ignore,no_run
2921 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2922 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
2923 /// let x = TransactionData::new().set_billing_address(Address::default()/* use setters */);
2924 /// ```
2925 pub fn set_billing_address<T>(mut self, v: T) -> Self
2926 where
2927 T: std::convert::Into<crate::model::transaction_data::Address>,
2928 {
2929 self.billing_address = std::option::Option::Some(v.into());
2930 self
2931 }
2932
2933 /// Sets or clears the value of [billing_address][crate::model::TransactionData::billing_address].
2934 ///
2935 /// # Example
2936 /// ```ignore,no_run
2937 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2938 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
2939 /// let x = TransactionData::new().set_or_clear_billing_address(Some(Address::default()/* use setters */));
2940 /// let x = TransactionData::new().set_or_clear_billing_address(None::<Address>);
2941 /// ```
2942 pub fn set_or_clear_billing_address<T>(mut self, v: std::option::Option<T>) -> Self
2943 where
2944 T: std::convert::Into<crate::model::transaction_data::Address>,
2945 {
2946 self.billing_address = v.map(|x| x.into());
2947 self
2948 }
2949
2950 /// Sets the value of [user][crate::model::TransactionData::user].
2951 ///
2952 /// # Example
2953 /// ```ignore,no_run
2954 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2955 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::User;
2956 /// let x = TransactionData::new().set_user(User::default()/* use setters */);
2957 /// ```
2958 pub fn set_user<T>(mut self, v: T) -> Self
2959 where
2960 T: std::convert::Into<crate::model::transaction_data::User>,
2961 {
2962 self.user = std::option::Option::Some(v.into());
2963 self
2964 }
2965
2966 /// Sets or clears the value of [user][crate::model::TransactionData::user].
2967 ///
2968 /// # Example
2969 /// ```ignore,no_run
2970 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2971 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::User;
2972 /// let x = TransactionData::new().set_or_clear_user(Some(User::default()/* use setters */));
2973 /// let x = TransactionData::new().set_or_clear_user(None::<User>);
2974 /// ```
2975 pub fn set_or_clear_user<T>(mut self, v: std::option::Option<T>) -> Self
2976 where
2977 T: std::convert::Into<crate::model::transaction_data::User>,
2978 {
2979 self.user = v.map(|x| x.into());
2980 self
2981 }
2982
2983 /// Sets the value of [merchants][crate::model::TransactionData::merchants].
2984 ///
2985 /// # Example
2986 /// ```ignore,no_run
2987 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
2988 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::User;
2989 /// let x = TransactionData::new()
2990 /// .set_merchants([
2991 /// User::default()/* use setters */,
2992 /// User::default()/* use (different) setters */,
2993 /// ]);
2994 /// ```
2995 pub fn set_merchants<T, V>(mut self, v: T) -> Self
2996 where
2997 T: std::iter::IntoIterator<Item = V>,
2998 V: std::convert::Into<crate::model::transaction_data::User>,
2999 {
3000 use std::iter::Iterator;
3001 self.merchants = v.into_iter().map(|i| i.into()).collect();
3002 self
3003 }
3004
3005 /// Sets the value of [items][crate::model::TransactionData::items].
3006 ///
3007 /// # Example
3008 /// ```ignore,no_run
3009 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
3010 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::Item;
3011 /// let x = TransactionData::new()
3012 /// .set_items([
3013 /// Item::default()/* use setters */,
3014 /// Item::default()/* use (different) setters */,
3015 /// ]);
3016 /// ```
3017 pub fn set_items<T, V>(mut self, v: T) -> Self
3018 where
3019 T: std::iter::IntoIterator<Item = V>,
3020 V: std::convert::Into<crate::model::transaction_data::Item>,
3021 {
3022 use std::iter::Iterator;
3023 self.items = v.into_iter().map(|i| i.into()).collect();
3024 self
3025 }
3026
3027 /// Sets the value of [gateway_info][crate::model::TransactionData::gateway_info].
3028 ///
3029 /// # Example
3030 /// ```ignore,no_run
3031 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
3032 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::GatewayInfo;
3033 /// let x = TransactionData::new().set_gateway_info(GatewayInfo::default()/* use setters */);
3034 /// ```
3035 pub fn set_gateway_info<T>(mut self, v: T) -> Self
3036 where
3037 T: std::convert::Into<crate::model::transaction_data::GatewayInfo>,
3038 {
3039 self.gateway_info = std::option::Option::Some(v.into());
3040 self
3041 }
3042
3043 /// Sets or clears the value of [gateway_info][crate::model::TransactionData::gateway_info].
3044 ///
3045 /// # Example
3046 /// ```ignore,no_run
3047 /// # use google_cloud_recaptchaenterprise_v1::model::TransactionData;
3048 /// use google_cloud_recaptchaenterprise_v1::model::transaction_data::GatewayInfo;
3049 /// let x = TransactionData::new().set_or_clear_gateway_info(Some(GatewayInfo::default()/* use setters */));
3050 /// let x = TransactionData::new().set_or_clear_gateway_info(None::<GatewayInfo>);
3051 /// ```
3052 pub fn set_or_clear_gateway_info<T>(mut self, v: std::option::Option<T>) -> Self
3053 where
3054 T: std::convert::Into<crate::model::transaction_data::GatewayInfo>,
3055 {
3056 self.gateway_info = v.map(|x| x.into());
3057 self
3058 }
3059}
3060
3061impl wkt::message::Message for TransactionData {
3062 fn typename() -> &'static str {
3063 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.TransactionData"
3064 }
3065}
3066
3067/// Defines additional types related to [TransactionData].
3068pub mod transaction_data {
3069 #[allow(unused_imports)]
3070 use super::*;
3071
3072 /// Structured address format for billing and shipping addresses.
3073 #[derive(Clone, Default, PartialEq)]
3074 #[non_exhaustive]
3075 pub struct Address {
3076 /// Optional. The recipient name, potentially including information such as
3077 /// "care of".
3078 pub recipient: std::string::String,
3079
3080 /// Optional. The first lines of the address. The first line generally
3081 /// contains the street name and number, and further lines may include
3082 /// information such as an apartment number.
3083 pub address: std::vec::Vec<std::string::String>,
3084
3085 /// Optional. The town/city of the address.
3086 pub locality: std::string::String,
3087
3088 /// Optional. The state, province, or otherwise administrative area of the
3089 /// address.
3090 pub administrative_area: std::string::String,
3091
3092 /// Optional. The CLDR country/region of the address.
3093 pub region_code: std::string::String,
3094
3095 /// Optional. The postal or ZIP code of the address.
3096 pub postal_code: std::string::String,
3097
3098 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3099 }
3100
3101 impl Address {
3102 /// Creates a new default instance.
3103 pub fn new() -> Self {
3104 std::default::Default::default()
3105 }
3106
3107 /// Sets the value of [recipient][crate::model::transaction_data::Address::recipient].
3108 ///
3109 /// # Example
3110 /// ```ignore,no_run
3111 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
3112 /// let x = Address::new().set_recipient("example");
3113 /// ```
3114 pub fn set_recipient<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3115 self.recipient = v.into();
3116 self
3117 }
3118
3119 /// Sets the value of [address][crate::model::transaction_data::Address::address].
3120 ///
3121 /// # Example
3122 /// ```ignore,no_run
3123 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
3124 /// let x = Address::new().set_address(["a", "b", "c"]);
3125 /// ```
3126 pub fn set_address<T, V>(mut self, v: T) -> Self
3127 where
3128 T: std::iter::IntoIterator<Item = V>,
3129 V: std::convert::Into<std::string::String>,
3130 {
3131 use std::iter::Iterator;
3132 self.address = v.into_iter().map(|i| i.into()).collect();
3133 self
3134 }
3135
3136 /// Sets the value of [locality][crate::model::transaction_data::Address::locality].
3137 ///
3138 /// # Example
3139 /// ```ignore,no_run
3140 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
3141 /// let x = Address::new().set_locality("example");
3142 /// ```
3143 pub fn set_locality<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3144 self.locality = v.into();
3145 self
3146 }
3147
3148 /// Sets the value of [administrative_area][crate::model::transaction_data::Address::administrative_area].
3149 ///
3150 /// # Example
3151 /// ```ignore,no_run
3152 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
3153 /// let x = Address::new().set_administrative_area("example");
3154 /// ```
3155 pub fn set_administrative_area<T: std::convert::Into<std::string::String>>(
3156 mut self,
3157 v: T,
3158 ) -> Self {
3159 self.administrative_area = v.into();
3160 self
3161 }
3162
3163 /// Sets the value of [region_code][crate::model::transaction_data::Address::region_code].
3164 ///
3165 /// # Example
3166 /// ```ignore,no_run
3167 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
3168 /// let x = Address::new().set_region_code("example");
3169 /// ```
3170 pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3171 self.region_code = v.into();
3172 self
3173 }
3174
3175 /// Sets the value of [postal_code][crate::model::transaction_data::Address::postal_code].
3176 ///
3177 /// # Example
3178 /// ```ignore,no_run
3179 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Address;
3180 /// let x = Address::new().set_postal_code("example");
3181 /// ```
3182 pub fn set_postal_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3183 self.postal_code = v.into();
3184 self
3185 }
3186 }
3187
3188 impl wkt::message::Message for Address {
3189 fn typename() -> &'static str {
3190 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.TransactionData.Address"
3191 }
3192 }
3193
3194 /// Details about a user's account involved in the transaction.
3195 #[derive(Clone, Default, PartialEq)]
3196 #[non_exhaustive]
3197 pub struct User {
3198 /// Optional. Unique account identifier for this user. If using account
3199 /// defender, this should match the hashed_account_id field. Otherwise, a
3200 /// unique and persistent identifier for this account.
3201 pub account_id: std::string::String,
3202
3203 /// Optional. The epoch milliseconds of the user's account creation.
3204 pub creation_ms: i64,
3205
3206 /// Optional. The email address of the user.
3207 pub email: std::string::String,
3208
3209 /// Optional. Whether the email has been verified to be accessible by the
3210 /// user (OTP or similar).
3211 pub email_verified: bool,
3212
3213 /// Optional. The phone number of the user, with country code.
3214 pub phone_number: std::string::String,
3215
3216 /// Optional. Whether the phone number has been verified to be accessible by
3217 /// the user (OTP or similar).
3218 pub phone_verified: bool,
3219
3220 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3221 }
3222
3223 impl User {
3224 /// Creates a new default instance.
3225 pub fn new() -> Self {
3226 std::default::Default::default()
3227 }
3228
3229 /// Sets the value of [account_id][crate::model::transaction_data::User::account_id].
3230 ///
3231 /// # Example
3232 /// ```ignore,no_run
3233 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::User;
3234 /// let x = User::new().set_account_id("example");
3235 /// ```
3236 pub fn set_account_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3237 self.account_id = v.into();
3238 self
3239 }
3240
3241 /// Sets the value of [creation_ms][crate::model::transaction_data::User::creation_ms].
3242 ///
3243 /// # Example
3244 /// ```ignore,no_run
3245 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::User;
3246 /// let x = User::new().set_creation_ms(42);
3247 /// ```
3248 pub fn set_creation_ms<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3249 self.creation_ms = v.into();
3250 self
3251 }
3252
3253 /// Sets the value of [email][crate::model::transaction_data::User::email].
3254 ///
3255 /// # Example
3256 /// ```ignore,no_run
3257 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::User;
3258 /// let x = User::new().set_email("example");
3259 /// ```
3260 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3261 self.email = v.into();
3262 self
3263 }
3264
3265 /// Sets the value of [email_verified][crate::model::transaction_data::User::email_verified].
3266 ///
3267 /// # Example
3268 /// ```ignore,no_run
3269 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::User;
3270 /// let x = User::new().set_email_verified(true);
3271 /// ```
3272 pub fn set_email_verified<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3273 self.email_verified = v.into();
3274 self
3275 }
3276
3277 /// Sets the value of [phone_number][crate::model::transaction_data::User::phone_number].
3278 ///
3279 /// # Example
3280 /// ```ignore,no_run
3281 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::User;
3282 /// let x = User::new().set_phone_number("example");
3283 /// ```
3284 pub fn set_phone_number<T: std::convert::Into<std::string::String>>(
3285 mut self,
3286 v: T,
3287 ) -> Self {
3288 self.phone_number = v.into();
3289 self
3290 }
3291
3292 /// Sets the value of [phone_verified][crate::model::transaction_data::User::phone_verified].
3293 ///
3294 /// # Example
3295 /// ```ignore,no_run
3296 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::User;
3297 /// let x = User::new().set_phone_verified(true);
3298 /// ```
3299 pub fn set_phone_verified<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3300 self.phone_verified = v.into();
3301 self
3302 }
3303 }
3304
3305 impl wkt::message::Message for User {
3306 fn typename() -> &'static str {
3307 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.TransactionData.User"
3308 }
3309 }
3310
3311 /// Line items being purchased in this transaction.
3312 #[derive(Clone, Default, PartialEq)]
3313 #[non_exhaustive]
3314 pub struct Item {
3315 /// Optional. The full name of the item.
3316 pub name: std::string::String,
3317
3318 /// Optional. The value per item that the user is paying, in the transaction
3319 /// currency, after discounts.
3320 pub value: f64,
3321
3322 /// Optional. The quantity of this item that is being purchased.
3323 pub quantity: i64,
3324
3325 /// Optional. When a merchant is specified, its corresponding account_id.
3326 /// Necessary to populate marketplace-style transactions.
3327 pub merchant_account_id: std::string::String,
3328
3329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3330 }
3331
3332 impl Item {
3333 /// Creates a new default instance.
3334 pub fn new() -> Self {
3335 std::default::Default::default()
3336 }
3337
3338 /// Sets the value of [name][crate::model::transaction_data::Item::name].
3339 ///
3340 /// # Example
3341 /// ```ignore,no_run
3342 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Item;
3343 /// let x = Item::new().set_name("example");
3344 /// ```
3345 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3346 self.name = v.into();
3347 self
3348 }
3349
3350 /// Sets the value of [value][crate::model::transaction_data::Item::value].
3351 ///
3352 /// # Example
3353 /// ```ignore,no_run
3354 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Item;
3355 /// let x = Item::new().set_value(42.0);
3356 /// ```
3357 pub fn set_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3358 self.value = v.into();
3359 self
3360 }
3361
3362 /// Sets the value of [quantity][crate::model::transaction_data::Item::quantity].
3363 ///
3364 /// # Example
3365 /// ```ignore,no_run
3366 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Item;
3367 /// let x = Item::new().set_quantity(42);
3368 /// ```
3369 pub fn set_quantity<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3370 self.quantity = v.into();
3371 self
3372 }
3373
3374 /// Sets the value of [merchant_account_id][crate::model::transaction_data::Item::merchant_account_id].
3375 ///
3376 /// # Example
3377 /// ```ignore,no_run
3378 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::Item;
3379 /// let x = Item::new().set_merchant_account_id("example");
3380 /// ```
3381 pub fn set_merchant_account_id<T: std::convert::Into<std::string::String>>(
3382 mut self,
3383 v: T,
3384 ) -> Self {
3385 self.merchant_account_id = v.into();
3386 self
3387 }
3388 }
3389
3390 impl wkt::message::Message for Item {
3391 fn typename() -> &'static str {
3392 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.TransactionData.Item"
3393 }
3394 }
3395
3396 /// Details about the transaction from the gateway.
3397 #[derive(Clone, Default, PartialEq)]
3398 #[non_exhaustive]
3399 pub struct GatewayInfo {
3400 /// Optional. Name of the gateway service (for example, stripe, square,
3401 /// paypal).
3402 pub name: std::string::String,
3403
3404 /// Optional. Gateway response code describing the state of the transaction.
3405 pub gateway_response_code: std::string::String,
3406
3407 /// Optional. AVS response code from the gateway
3408 /// (available only when reCAPTCHA Enterprise is called after authorization).
3409 pub avs_response_code: std::string::String,
3410
3411 /// Optional. CVV response code from the gateway
3412 /// (available only when reCAPTCHA Enterprise is called after authorization).
3413 pub cvv_response_code: std::string::String,
3414
3415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3416 }
3417
3418 impl GatewayInfo {
3419 /// Creates a new default instance.
3420 pub fn new() -> Self {
3421 std::default::Default::default()
3422 }
3423
3424 /// Sets the value of [name][crate::model::transaction_data::GatewayInfo::name].
3425 ///
3426 /// # Example
3427 /// ```ignore,no_run
3428 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::GatewayInfo;
3429 /// let x = GatewayInfo::new().set_name("example");
3430 /// ```
3431 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3432 self.name = v.into();
3433 self
3434 }
3435
3436 /// Sets the value of [gateway_response_code][crate::model::transaction_data::GatewayInfo::gateway_response_code].
3437 ///
3438 /// # Example
3439 /// ```ignore,no_run
3440 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::GatewayInfo;
3441 /// let x = GatewayInfo::new().set_gateway_response_code("example");
3442 /// ```
3443 pub fn set_gateway_response_code<T: std::convert::Into<std::string::String>>(
3444 mut self,
3445 v: T,
3446 ) -> Self {
3447 self.gateway_response_code = v.into();
3448 self
3449 }
3450
3451 /// Sets the value of [avs_response_code][crate::model::transaction_data::GatewayInfo::avs_response_code].
3452 ///
3453 /// # Example
3454 /// ```ignore,no_run
3455 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::GatewayInfo;
3456 /// let x = GatewayInfo::new().set_avs_response_code("example");
3457 /// ```
3458 pub fn set_avs_response_code<T: std::convert::Into<std::string::String>>(
3459 mut self,
3460 v: T,
3461 ) -> Self {
3462 self.avs_response_code = v.into();
3463 self
3464 }
3465
3466 /// Sets the value of [cvv_response_code][crate::model::transaction_data::GatewayInfo::cvv_response_code].
3467 ///
3468 /// # Example
3469 /// ```ignore,no_run
3470 /// # use google_cloud_recaptchaenterprise_v1::model::transaction_data::GatewayInfo;
3471 /// let x = GatewayInfo::new().set_cvv_response_code("example");
3472 /// ```
3473 pub fn set_cvv_response_code<T: std::convert::Into<std::string::String>>(
3474 mut self,
3475 v: T,
3476 ) -> Self {
3477 self.cvv_response_code = v.into();
3478 self
3479 }
3480 }
3481
3482 impl wkt::message::Message for GatewayInfo {
3483 fn typename() -> &'static str {
3484 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.TransactionData.GatewayInfo"
3485 }
3486 }
3487}
3488
3489/// User information associated with a request protected by reCAPTCHA Enterprise.
3490#[derive(Clone, Default, PartialEq)]
3491#[non_exhaustive]
3492pub struct UserInfo {
3493 /// Optional. Creation time for this account associated with this user. Leave
3494 /// blank for non logged-in actions, guest checkout, or when there is no
3495 /// account associated with the current user.
3496 pub create_account_time: std::option::Option<wkt::Timestamp>,
3497
3498 /// Optional. For logged-in requests or login/registration requests, the unique
3499 /// account identifier associated with this user. You can use the username if
3500 /// it is stable (meaning it is the same for every request associated with the
3501 /// same user), or any stable user ID of your choice. Leave blank for non
3502 /// logged-in actions or guest checkout.
3503 pub account_id: std::string::String,
3504
3505 /// Optional. Identifiers associated with this user or request.
3506 pub user_ids: std::vec::Vec<crate::model::UserId>,
3507
3508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3509}
3510
3511impl UserInfo {
3512 /// Creates a new default instance.
3513 pub fn new() -> Self {
3514 std::default::Default::default()
3515 }
3516
3517 /// Sets the value of [create_account_time][crate::model::UserInfo::create_account_time].
3518 ///
3519 /// # Example
3520 /// ```ignore,no_run
3521 /// # use google_cloud_recaptchaenterprise_v1::model::UserInfo;
3522 /// use wkt::Timestamp;
3523 /// let x = UserInfo::new().set_create_account_time(Timestamp::default()/* use setters */);
3524 /// ```
3525 pub fn set_create_account_time<T>(mut self, v: T) -> Self
3526 where
3527 T: std::convert::Into<wkt::Timestamp>,
3528 {
3529 self.create_account_time = std::option::Option::Some(v.into());
3530 self
3531 }
3532
3533 /// Sets or clears the value of [create_account_time][crate::model::UserInfo::create_account_time].
3534 ///
3535 /// # Example
3536 /// ```ignore,no_run
3537 /// # use google_cloud_recaptchaenterprise_v1::model::UserInfo;
3538 /// use wkt::Timestamp;
3539 /// let x = UserInfo::new().set_or_clear_create_account_time(Some(Timestamp::default()/* use setters */));
3540 /// let x = UserInfo::new().set_or_clear_create_account_time(None::<Timestamp>);
3541 /// ```
3542 pub fn set_or_clear_create_account_time<T>(mut self, v: std::option::Option<T>) -> Self
3543 where
3544 T: std::convert::Into<wkt::Timestamp>,
3545 {
3546 self.create_account_time = v.map(|x| x.into());
3547 self
3548 }
3549
3550 /// Sets the value of [account_id][crate::model::UserInfo::account_id].
3551 ///
3552 /// # Example
3553 /// ```ignore,no_run
3554 /// # use google_cloud_recaptchaenterprise_v1::model::UserInfo;
3555 /// let x = UserInfo::new().set_account_id("example");
3556 /// ```
3557 pub fn set_account_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3558 self.account_id = v.into();
3559 self
3560 }
3561
3562 /// Sets the value of [user_ids][crate::model::UserInfo::user_ids].
3563 ///
3564 /// # Example
3565 /// ```ignore,no_run
3566 /// # use google_cloud_recaptchaenterprise_v1::model::UserInfo;
3567 /// use google_cloud_recaptchaenterprise_v1::model::UserId;
3568 /// let x = UserInfo::new()
3569 /// .set_user_ids([
3570 /// UserId::default()/* use setters */,
3571 /// UserId::default()/* use (different) setters */,
3572 /// ]);
3573 /// ```
3574 pub fn set_user_ids<T, V>(mut self, v: T) -> Self
3575 where
3576 T: std::iter::IntoIterator<Item = V>,
3577 V: std::convert::Into<crate::model::UserId>,
3578 {
3579 use std::iter::Iterator;
3580 self.user_ids = v.into_iter().map(|i| i.into()).collect();
3581 self
3582 }
3583}
3584
3585impl wkt::message::Message for UserInfo {
3586 fn typename() -> &'static str {
3587 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.UserInfo"
3588 }
3589}
3590
3591/// An identifier associated with a user.
3592#[derive(Clone, Default, PartialEq)]
3593#[non_exhaustive]
3594pub struct UserId {
3595 #[allow(missing_docs)]
3596 pub id_oneof: std::option::Option<crate::model::user_id::IdOneof>,
3597
3598 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3599}
3600
3601impl UserId {
3602 /// Creates a new default instance.
3603 pub fn new() -> Self {
3604 std::default::Default::default()
3605 }
3606
3607 /// Sets the value of [id_oneof][crate::model::UserId::id_oneof].
3608 ///
3609 /// Note that all the setters affecting `id_oneof` are mutually
3610 /// exclusive.
3611 ///
3612 /// # Example
3613 /// ```ignore,no_run
3614 /// # use google_cloud_recaptchaenterprise_v1::model::UserId;
3615 /// use google_cloud_recaptchaenterprise_v1::model::user_id::IdOneof;
3616 /// let x = UserId::new().set_id_oneof(Some(IdOneof::Email("example".to_string())));
3617 /// ```
3618 pub fn set_id_oneof<
3619 T: std::convert::Into<std::option::Option<crate::model::user_id::IdOneof>>,
3620 >(
3621 mut self,
3622 v: T,
3623 ) -> Self {
3624 self.id_oneof = v.into();
3625 self
3626 }
3627
3628 /// The value of [id_oneof][crate::model::UserId::id_oneof]
3629 /// if it holds a `Email`, `None` if the field is not set or
3630 /// holds a different branch.
3631 pub fn email(&self) -> std::option::Option<&std::string::String> {
3632 #[allow(unreachable_patterns)]
3633 self.id_oneof.as_ref().and_then(|v| match v {
3634 crate::model::user_id::IdOneof::Email(v) => std::option::Option::Some(v),
3635 _ => std::option::Option::None,
3636 })
3637 }
3638
3639 /// Sets the value of [id_oneof][crate::model::UserId::id_oneof]
3640 /// to hold a `Email`.
3641 ///
3642 /// Note that all the setters affecting `id_oneof` are
3643 /// mutually exclusive.
3644 ///
3645 /// # Example
3646 /// ```ignore,no_run
3647 /// # use google_cloud_recaptchaenterprise_v1::model::UserId;
3648 /// let x = UserId::new().set_email("example");
3649 /// assert!(x.email().is_some());
3650 /// assert!(x.phone_number().is_none());
3651 /// assert!(x.username().is_none());
3652 /// ```
3653 pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3654 self.id_oneof = std::option::Option::Some(crate::model::user_id::IdOneof::Email(v.into()));
3655 self
3656 }
3657
3658 /// The value of [id_oneof][crate::model::UserId::id_oneof]
3659 /// if it holds a `PhoneNumber`, `None` if the field is not set or
3660 /// holds a different branch.
3661 pub fn phone_number(&self) -> std::option::Option<&std::string::String> {
3662 #[allow(unreachable_patterns)]
3663 self.id_oneof.as_ref().and_then(|v| match v {
3664 crate::model::user_id::IdOneof::PhoneNumber(v) => std::option::Option::Some(v),
3665 _ => std::option::Option::None,
3666 })
3667 }
3668
3669 /// Sets the value of [id_oneof][crate::model::UserId::id_oneof]
3670 /// to hold a `PhoneNumber`.
3671 ///
3672 /// Note that all the setters affecting `id_oneof` are
3673 /// mutually exclusive.
3674 ///
3675 /// # Example
3676 /// ```ignore,no_run
3677 /// # use google_cloud_recaptchaenterprise_v1::model::UserId;
3678 /// let x = UserId::new().set_phone_number("example");
3679 /// assert!(x.phone_number().is_some());
3680 /// assert!(x.email().is_none());
3681 /// assert!(x.username().is_none());
3682 /// ```
3683 pub fn set_phone_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3684 self.id_oneof =
3685 std::option::Option::Some(crate::model::user_id::IdOneof::PhoneNumber(v.into()));
3686 self
3687 }
3688
3689 /// The value of [id_oneof][crate::model::UserId::id_oneof]
3690 /// if it holds a `Username`, `None` if the field is not set or
3691 /// holds a different branch.
3692 pub fn username(&self) -> std::option::Option<&std::string::String> {
3693 #[allow(unreachable_patterns)]
3694 self.id_oneof.as_ref().and_then(|v| match v {
3695 crate::model::user_id::IdOneof::Username(v) => std::option::Option::Some(v),
3696 _ => std::option::Option::None,
3697 })
3698 }
3699
3700 /// Sets the value of [id_oneof][crate::model::UserId::id_oneof]
3701 /// to hold a `Username`.
3702 ///
3703 /// Note that all the setters affecting `id_oneof` are
3704 /// mutually exclusive.
3705 ///
3706 /// # Example
3707 /// ```ignore,no_run
3708 /// # use google_cloud_recaptchaenterprise_v1::model::UserId;
3709 /// let x = UserId::new().set_username("example");
3710 /// assert!(x.username().is_some());
3711 /// assert!(x.email().is_none());
3712 /// assert!(x.phone_number().is_none());
3713 /// ```
3714 pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3715 self.id_oneof =
3716 std::option::Option::Some(crate::model::user_id::IdOneof::Username(v.into()));
3717 self
3718 }
3719}
3720
3721impl wkt::message::Message for UserId {
3722 fn typename() -> &'static str {
3723 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.UserId"
3724 }
3725}
3726
3727/// Defines additional types related to [UserId].
3728pub mod user_id {
3729 #[allow(unused_imports)]
3730 use super::*;
3731
3732 #[allow(missing_docs)]
3733 #[derive(Clone, Debug, PartialEq)]
3734 #[non_exhaustive]
3735 pub enum IdOneof {
3736 /// Optional. An email address.
3737 Email(std::string::String),
3738 /// Optional. A phone number. Should use the E.164 format.
3739 PhoneNumber(std::string::String),
3740 /// Optional. A unique username, if different from all the other identifiers
3741 /// and `account_id` that are provided. Can be a unique login handle or
3742 /// display name for a user.
3743 Username(std::string::String),
3744 }
3745}
3746
3747/// Risk analysis result for an event.
3748#[derive(Clone, Default, PartialEq)]
3749#[non_exhaustive]
3750pub struct RiskAnalysis {
3751 /// Output only. Legitimate event score from 0.0 to 1.0.
3752 /// (1.0 means very likely legitimate traffic while 0.0 means very likely
3753 /// non-legitimate traffic).
3754 pub score: f32,
3755
3756 /// Output only. Reasons contributing to the risk analysis verdict.
3757 pub reasons: std::vec::Vec<crate::model::risk_analysis::ClassificationReason>,
3758
3759 /// Output only. Extended verdict reasons to be used for experimentation only.
3760 /// The set of possible reasons is subject to change.
3761 pub extended_verdict_reasons: std::vec::Vec<std::string::String>,
3762
3763 /// Output only. Challenge information for POLICY_BASED_CHALLENGE and INVISIBLE
3764 /// keys.
3765 pub challenge: crate::model::risk_analysis::Challenge,
3766
3767 /// Output only. Bots with identities that have been verified by reCAPTCHA and
3768 /// detected in the event.
3769 pub verified_bots: std::vec::Vec<crate::model::Bot>,
3770
3771 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3772}
3773
3774impl RiskAnalysis {
3775 /// Creates a new default instance.
3776 pub fn new() -> Self {
3777 std::default::Default::default()
3778 }
3779
3780 /// Sets the value of [score][crate::model::RiskAnalysis::score].
3781 ///
3782 /// # Example
3783 /// ```ignore,no_run
3784 /// # use google_cloud_recaptchaenterprise_v1::model::RiskAnalysis;
3785 /// let x = RiskAnalysis::new().set_score(42.0);
3786 /// ```
3787 pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3788 self.score = v.into();
3789 self
3790 }
3791
3792 /// Sets the value of [reasons][crate::model::RiskAnalysis::reasons].
3793 ///
3794 /// # Example
3795 /// ```ignore,no_run
3796 /// # use google_cloud_recaptchaenterprise_v1::model::RiskAnalysis;
3797 /// use google_cloud_recaptchaenterprise_v1::model::risk_analysis::ClassificationReason;
3798 /// let x = RiskAnalysis::new().set_reasons([
3799 /// ClassificationReason::Automation,
3800 /// ClassificationReason::UnexpectedEnvironment,
3801 /// ClassificationReason::TooMuchTraffic,
3802 /// ]);
3803 /// ```
3804 pub fn set_reasons<T, V>(mut self, v: T) -> Self
3805 where
3806 T: std::iter::IntoIterator<Item = V>,
3807 V: std::convert::Into<crate::model::risk_analysis::ClassificationReason>,
3808 {
3809 use std::iter::Iterator;
3810 self.reasons = v.into_iter().map(|i| i.into()).collect();
3811 self
3812 }
3813
3814 /// Sets the value of [extended_verdict_reasons][crate::model::RiskAnalysis::extended_verdict_reasons].
3815 ///
3816 /// # Example
3817 /// ```ignore,no_run
3818 /// # use google_cloud_recaptchaenterprise_v1::model::RiskAnalysis;
3819 /// let x = RiskAnalysis::new().set_extended_verdict_reasons(["a", "b", "c"]);
3820 /// ```
3821 pub fn set_extended_verdict_reasons<T, V>(mut self, v: T) -> Self
3822 where
3823 T: std::iter::IntoIterator<Item = V>,
3824 V: std::convert::Into<std::string::String>,
3825 {
3826 use std::iter::Iterator;
3827 self.extended_verdict_reasons = v.into_iter().map(|i| i.into()).collect();
3828 self
3829 }
3830
3831 /// Sets the value of [challenge][crate::model::RiskAnalysis::challenge].
3832 ///
3833 /// # Example
3834 /// ```ignore,no_run
3835 /// # use google_cloud_recaptchaenterprise_v1::model::RiskAnalysis;
3836 /// use google_cloud_recaptchaenterprise_v1::model::risk_analysis::Challenge;
3837 /// let x0 = RiskAnalysis::new().set_challenge(Challenge::Nocaptcha);
3838 /// let x1 = RiskAnalysis::new().set_challenge(Challenge::Passed);
3839 /// let x2 = RiskAnalysis::new().set_challenge(Challenge::Failed);
3840 /// ```
3841 pub fn set_challenge<T: std::convert::Into<crate::model::risk_analysis::Challenge>>(
3842 mut self,
3843 v: T,
3844 ) -> Self {
3845 self.challenge = v.into();
3846 self
3847 }
3848
3849 /// Sets the value of [verified_bots][crate::model::RiskAnalysis::verified_bots].
3850 ///
3851 /// # Example
3852 /// ```ignore,no_run
3853 /// # use google_cloud_recaptchaenterprise_v1::model::RiskAnalysis;
3854 /// use google_cloud_recaptchaenterprise_v1::model::Bot;
3855 /// let x = RiskAnalysis::new()
3856 /// .set_verified_bots([
3857 /// Bot::default()/* use setters */,
3858 /// Bot::default()/* use (different) setters */,
3859 /// ]);
3860 /// ```
3861 pub fn set_verified_bots<T, V>(mut self, v: T) -> Self
3862 where
3863 T: std::iter::IntoIterator<Item = V>,
3864 V: std::convert::Into<crate::model::Bot>,
3865 {
3866 use std::iter::Iterator;
3867 self.verified_bots = v.into_iter().map(|i| i.into()).collect();
3868 self
3869 }
3870}
3871
3872impl wkt::message::Message for RiskAnalysis {
3873 fn typename() -> &'static str {
3874 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.RiskAnalysis"
3875 }
3876}
3877
3878/// Defines additional types related to [RiskAnalysis].
3879pub mod risk_analysis {
3880 #[allow(unused_imports)]
3881 use super::*;
3882
3883 /// Reasons contributing to the risk analysis verdict.
3884 /// Ensure that applications can handle values not explicitly listed.
3885 ///
3886 /// # Working with unknown values
3887 ///
3888 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3889 /// additional enum variants at any time. Adding new variants is not considered
3890 /// a breaking change. Applications should write their code in anticipation of:
3891 ///
3892 /// - New values appearing in future releases of the client library, **and**
3893 /// - New values received dynamically, without application changes.
3894 ///
3895 /// Please consult the [Working with enums] section in the user guide for some
3896 /// guidelines.
3897 ///
3898 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3899 #[derive(Clone, Debug, PartialEq)]
3900 #[non_exhaustive]
3901 pub enum ClassificationReason {
3902 /// Default unspecified type.
3903 Unspecified,
3904 /// Interactions matched the behavior of an automated agent.
3905 Automation,
3906 /// The event originated from an illegitimate environment.
3907 UnexpectedEnvironment,
3908 /// Traffic volume from the event source is higher than normal.
3909 TooMuchTraffic,
3910 /// Interactions with the site were significantly different than expected
3911 /// patterns.
3912 UnexpectedUsagePatterns,
3913 /// Too little traffic has been received from this site thus far to generate
3914 /// quality risk analysis.
3915 LowConfidenceScore,
3916 /// The request matches behavioral characteristics of a carding attack.
3917 SuspectedCarding,
3918 /// The request matches behavioral characteristics of chargebacks for fraud.
3919 SuspectedChargeback,
3920 /// If set, the enum was initialized with an unknown value.
3921 ///
3922 /// Applications can examine the value using [ClassificationReason::value] or
3923 /// [ClassificationReason::name].
3924 UnknownValue(classification_reason::UnknownValue),
3925 }
3926
3927 #[doc(hidden)]
3928 pub mod classification_reason {
3929 #[allow(unused_imports)]
3930 use super::*;
3931 #[derive(Clone, Debug, PartialEq)]
3932 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3933 }
3934
3935 impl ClassificationReason {
3936 /// Gets the enum value.
3937 ///
3938 /// Returns `None` if the enum contains an unknown value deserialized from
3939 /// the string representation of enums.
3940 pub fn value(&self) -> std::option::Option<i32> {
3941 match self {
3942 Self::Unspecified => std::option::Option::Some(0),
3943 Self::Automation => std::option::Option::Some(1),
3944 Self::UnexpectedEnvironment => std::option::Option::Some(2),
3945 Self::TooMuchTraffic => std::option::Option::Some(3),
3946 Self::UnexpectedUsagePatterns => std::option::Option::Some(4),
3947 Self::LowConfidenceScore => std::option::Option::Some(5),
3948 Self::SuspectedCarding => std::option::Option::Some(6),
3949 Self::SuspectedChargeback => std::option::Option::Some(7),
3950 Self::UnknownValue(u) => u.0.value(),
3951 }
3952 }
3953
3954 /// Gets the enum value as a string.
3955 ///
3956 /// Returns `None` if the enum contains an unknown value deserialized from
3957 /// the integer representation of enums.
3958 pub fn name(&self) -> std::option::Option<&str> {
3959 match self {
3960 Self::Unspecified => std::option::Option::Some("CLASSIFICATION_REASON_UNSPECIFIED"),
3961 Self::Automation => std::option::Option::Some("AUTOMATION"),
3962 Self::UnexpectedEnvironment => std::option::Option::Some("UNEXPECTED_ENVIRONMENT"),
3963 Self::TooMuchTraffic => std::option::Option::Some("TOO_MUCH_TRAFFIC"),
3964 Self::UnexpectedUsagePatterns => {
3965 std::option::Option::Some("UNEXPECTED_USAGE_PATTERNS")
3966 }
3967 Self::LowConfidenceScore => std::option::Option::Some("LOW_CONFIDENCE_SCORE"),
3968 Self::SuspectedCarding => std::option::Option::Some("SUSPECTED_CARDING"),
3969 Self::SuspectedChargeback => std::option::Option::Some("SUSPECTED_CHARGEBACK"),
3970 Self::UnknownValue(u) => u.0.name(),
3971 }
3972 }
3973 }
3974
3975 impl std::default::Default for ClassificationReason {
3976 fn default() -> Self {
3977 use std::convert::From;
3978 Self::from(0)
3979 }
3980 }
3981
3982 impl std::fmt::Display for ClassificationReason {
3983 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3984 wkt::internal::display_enum(f, self.name(), self.value())
3985 }
3986 }
3987
3988 impl std::convert::From<i32> for ClassificationReason {
3989 fn from(value: i32) -> Self {
3990 match value {
3991 0 => Self::Unspecified,
3992 1 => Self::Automation,
3993 2 => Self::UnexpectedEnvironment,
3994 3 => Self::TooMuchTraffic,
3995 4 => Self::UnexpectedUsagePatterns,
3996 5 => Self::LowConfidenceScore,
3997 6 => Self::SuspectedCarding,
3998 7 => Self::SuspectedChargeback,
3999 _ => Self::UnknownValue(classification_reason::UnknownValue(
4000 wkt::internal::UnknownEnumValue::Integer(value),
4001 )),
4002 }
4003 }
4004 }
4005
4006 impl std::convert::From<&str> for ClassificationReason {
4007 fn from(value: &str) -> Self {
4008 use std::string::ToString;
4009 match value {
4010 "CLASSIFICATION_REASON_UNSPECIFIED" => Self::Unspecified,
4011 "AUTOMATION" => Self::Automation,
4012 "UNEXPECTED_ENVIRONMENT" => Self::UnexpectedEnvironment,
4013 "TOO_MUCH_TRAFFIC" => Self::TooMuchTraffic,
4014 "UNEXPECTED_USAGE_PATTERNS" => Self::UnexpectedUsagePatterns,
4015 "LOW_CONFIDENCE_SCORE" => Self::LowConfidenceScore,
4016 "SUSPECTED_CARDING" => Self::SuspectedCarding,
4017 "SUSPECTED_CHARGEBACK" => Self::SuspectedChargeback,
4018 _ => Self::UnknownValue(classification_reason::UnknownValue(
4019 wkt::internal::UnknownEnumValue::String(value.to_string()),
4020 )),
4021 }
4022 }
4023 }
4024
4025 impl serde::ser::Serialize for ClassificationReason {
4026 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4027 where
4028 S: serde::Serializer,
4029 {
4030 match self {
4031 Self::Unspecified => serializer.serialize_i32(0),
4032 Self::Automation => serializer.serialize_i32(1),
4033 Self::UnexpectedEnvironment => serializer.serialize_i32(2),
4034 Self::TooMuchTraffic => serializer.serialize_i32(3),
4035 Self::UnexpectedUsagePatterns => serializer.serialize_i32(4),
4036 Self::LowConfidenceScore => serializer.serialize_i32(5),
4037 Self::SuspectedCarding => serializer.serialize_i32(6),
4038 Self::SuspectedChargeback => serializer.serialize_i32(7),
4039 Self::UnknownValue(u) => u.0.serialize(serializer),
4040 }
4041 }
4042 }
4043
4044 impl<'de> serde::de::Deserialize<'de> for ClassificationReason {
4045 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4046 where
4047 D: serde::Deserializer<'de>,
4048 {
4049 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClassificationReason>::new(
4050 ".google.cloud.recaptchaenterprise.v1.RiskAnalysis.ClassificationReason",
4051 ))
4052 }
4053 }
4054
4055 /// Challenge information for POLICY_BASED_CHALLENGE and INVISIBLE keys.
4056 /// Ensure that applications can handle values not explicitly listed.
4057 ///
4058 /// # Working with unknown values
4059 ///
4060 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4061 /// additional enum variants at any time. Adding new variants is not considered
4062 /// a breaking change. Applications should write their code in anticipation of:
4063 ///
4064 /// - New values appearing in future releases of the client library, **and**
4065 /// - New values received dynamically, without application changes.
4066 ///
4067 /// Please consult the [Working with enums] section in the user guide for some
4068 /// guidelines.
4069 ///
4070 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4071 #[derive(Clone, Debug, PartialEq)]
4072 #[non_exhaustive]
4073 pub enum Challenge {
4074 /// Default unspecified type.
4075 Unspecified,
4076 /// No challenge was presented for solving.
4077 Nocaptcha,
4078 /// A solution was submitted that was correct.
4079 Passed,
4080 /// A solution was submitted that was incorrect or otherwise
4081 /// deemed suspicious.
4082 Failed,
4083 /// If set, the enum was initialized with an unknown value.
4084 ///
4085 /// Applications can examine the value using [Challenge::value] or
4086 /// [Challenge::name].
4087 UnknownValue(challenge::UnknownValue),
4088 }
4089
4090 #[doc(hidden)]
4091 pub mod challenge {
4092 #[allow(unused_imports)]
4093 use super::*;
4094 #[derive(Clone, Debug, PartialEq)]
4095 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4096 }
4097
4098 impl Challenge {
4099 /// Gets the enum value.
4100 ///
4101 /// Returns `None` if the enum contains an unknown value deserialized from
4102 /// the string representation of enums.
4103 pub fn value(&self) -> std::option::Option<i32> {
4104 match self {
4105 Self::Unspecified => std::option::Option::Some(0),
4106 Self::Nocaptcha => std::option::Option::Some(1),
4107 Self::Passed => std::option::Option::Some(2),
4108 Self::Failed => std::option::Option::Some(3),
4109 Self::UnknownValue(u) => u.0.value(),
4110 }
4111 }
4112
4113 /// Gets the enum value as a string.
4114 ///
4115 /// Returns `None` if the enum contains an unknown value deserialized from
4116 /// the integer representation of enums.
4117 pub fn name(&self) -> std::option::Option<&str> {
4118 match self {
4119 Self::Unspecified => std::option::Option::Some("CHALLENGE_UNSPECIFIED"),
4120 Self::Nocaptcha => std::option::Option::Some("NOCAPTCHA"),
4121 Self::Passed => std::option::Option::Some("PASSED"),
4122 Self::Failed => std::option::Option::Some("FAILED"),
4123 Self::UnknownValue(u) => u.0.name(),
4124 }
4125 }
4126 }
4127
4128 impl std::default::Default for Challenge {
4129 fn default() -> Self {
4130 use std::convert::From;
4131 Self::from(0)
4132 }
4133 }
4134
4135 impl std::fmt::Display for Challenge {
4136 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4137 wkt::internal::display_enum(f, self.name(), self.value())
4138 }
4139 }
4140
4141 impl std::convert::From<i32> for Challenge {
4142 fn from(value: i32) -> Self {
4143 match value {
4144 0 => Self::Unspecified,
4145 1 => Self::Nocaptcha,
4146 2 => Self::Passed,
4147 3 => Self::Failed,
4148 _ => Self::UnknownValue(challenge::UnknownValue(
4149 wkt::internal::UnknownEnumValue::Integer(value),
4150 )),
4151 }
4152 }
4153 }
4154
4155 impl std::convert::From<&str> for Challenge {
4156 fn from(value: &str) -> Self {
4157 use std::string::ToString;
4158 match value {
4159 "CHALLENGE_UNSPECIFIED" => Self::Unspecified,
4160 "NOCAPTCHA" => Self::Nocaptcha,
4161 "PASSED" => Self::Passed,
4162 "FAILED" => Self::Failed,
4163 _ => Self::UnknownValue(challenge::UnknownValue(
4164 wkt::internal::UnknownEnumValue::String(value.to_string()),
4165 )),
4166 }
4167 }
4168 }
4169
4170 impl serde::ser::Serialize for Challenge {
4171 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4172 where
4173 S: serde::Serializer,
4174 {
4175 match self {
4176 Self::Unspecified => serializer.serialize_i32(0),
4177 Self::Nocaptcha => serializer.serialize_i32(1),
4178 Self::Passed => serializer.serialize_i32(2),
4179 Self::Failed => serializer.serialize_i32(3),
4180 Self::UnknownValue(u) => u.0.serialize(serializer),
4181 }
4182 }
4183 }
4184
4185 impl<'de> serde::de::Deserialize<'de> for Challenge {
4186 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4187 where
4188 D: serde::Deserializer<'de>,
4189 {
4190 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Challenge>::new(
4191 ".google.cloud.recaptchaenterprise.v1.RiskAnalysis.Challenge",
4192 ))
4193 }
4194 }
4195}
4196
4197/// Bot information and metadata.
4198#[derive(Clone, Default, PartialEq)]
4199#[non_exhaustive]
4200pub struct Bot {
4201 /// Optional. Enumerated string value that indicates the identity of the bot,
4202 /// formatted in kebab-case.
4203 pub name: std::string::String,
4204
4205 /// Optional. Enumerated field representing the type of bot.
4206 pub bot_type: crate::model::bot::BotType,
4207
4208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4209}
4210
4211impl Bot {
4212 /// Creates a new default instance.
4213 pub fn new() -> Self {
4214 std::default::Default::default()
4215 }
4216
4217 /// Sets the value of [name][crate::model::Bot::name].
4218 ///
4219 /// # Example
4220 /// ```ignore,no_run
4221 /// # use google_cloud_recaptchaenterprise_v1::model::Bot;
4222 /// let x = Bot::new().set_name("example");
4223 /// ```
4224 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4225 self.name = v.into();
4226 self
4227 }
4228
4229 /// Sets the value of [bot_type][crate::model::Bot::bot_type].
4230 ///
4231 /// # Example
4232 /// ```ignore,no_run
4233 /// # use google_cloud_recaptchaenterprise_v1::model::Bot;
4234 /// use google_cloud_recaptchaenterprise_v1::model::bot::BotType;
4235 /// let x0 = Bot::new().set_bot_type(BotType::AiAgent);
4236 /// let x1 = Bot::new().set_bot_type(BotType::ContentScraper);
4237 /// let x2 = Bot::new().set_bot_type(BotType::SearchIndexer);
4238 /// ```
4239 pub fn set_bot_type<T: std::convert::Into<crate::model::bot::BotType>>(mut self, v: T) -> Self {
4240 self.bot_type = v.into();
4241 self
4242 }
4243}
4244
4245impl wkt::message::Message for Bot {
4246 fn typename() -> &'static str {
4247 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.Bot"
4248 }
4249}
4250
4251/// Defines additional types related to [Bot].
4252pub mod bot {
4253 #[allow(unused_imports)]
4254 use super::*;
4255
4256 /// Types of bots.
4257 /// Ensure that applications can handle values not explicitly listed.
4258 ///
4259 /// # Working with unknown values
4260 ///
4261 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4262 /// additional enum variants at any time. Adding new variants is not considered
4263 /// a breaking change. Applications should write their code in anticipation of:
4264 ///
4265 /// - New values appearing in future releases of the client library, **and**
4266 /// - New values received dynamically, without application changes.
4267 ///
4268 /// Please consult the [Working with enums] section in the user guide for some
4269 /// guidelines.
4270 ///
4271 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4272 #[derive(Clone, Debug, PartialEq)]
4273 #[non_exhaustive]
4274 pub enum BotType {
4275 /// Default unspecified type.
4276 Unspecified,
4277 /// Software program that interacts with a site and performs tasks
4278 /// autonomously.
4279 AiAgent,
4280 /// Software that extracts specific data from sites for use.
4281 ContentScraper,
4282 /// Software that crawls sites and stores content for the purpose of
4283 /// efficient retrieval, likely as part of a search engine.
4284 SearchIndexer,
4285 /// If set, the enum was initialized with an unknown value.
4286 ///
4287 /// Applications can examine the value using [BotType::value] or
4288 /// [BotType::name].
4289 UnknownValue(bot_type::UnknownValue),
4290 }
4291
4292 #[doc(hidden)]
4293 pub mod bot_type {
4294 #[allow(unused_imports)]
4295 use super::*;
4296 #[derive(Clone, Debug, PartialEq)]
4297 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4298 }
4299
4300 impl BotType {
4301 /// Gets the enum value.
4302 ///
4303 /// Returns `None` if the enum contains an unknown value deserialized from
4304 /// the string representation of enums.
4305 pub fn value(&self) -> std::option::Option<i32> {
4306 match self {
4307 Self::Unspecified => std::option::Option::Some(0),
4308 Self::AiAgent => std::option::Option::Some(1),
4309 Self::ContentScraper => std::option::Option::Some(2),
4310 Self::SearchIndexer => std::option::Option::Some(3),
4311 Self::UnknownValue(u) => u.0.value(),
4312 }
4313 }
4314
4315 /// Gets the enum value as a string.
4316 ///
4317 /// Returns `None` if the enum contains an unknown value deserialized from
4318 /// the integer representation of enums.
4319 pub fn name(&self) -> std::option::Option<&str> {
4320 match self {
4321 Self::Unspecified => std::option::Option::Some("BOT_TYPE_UNSPECIFIED"),
4322 Self::AiAgent => std::option::Option::Some("AI_AGENT"),
4323 Self::ContentScraper => std::option::Option::Some("CONTENT_SCRAPER"),
4324 Self::SearchIndexer => std::option::Option::Some("SEARCH_INDEXER"),
4325 Self::UnknownValue(u) => u.0.name(),
4326 }
4327 }
4328 }
4329
4330 impl std::default::Default for BotType {
4331 fn default() -> Self {
4332 use std::convert::From;
4333 Self::from(0)
4334 }
4335 }
4336
4337 impl std::fmt::Display for BotType {
4338 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4339 wkt::internal::display_enum(f, self.name(), self.value())
4340 }
4341 }
4342
4343 impl std::convert::From<i32> for BotType {
4344 fn from(value: i32) -> Self {
4345 match value {
4346 0 => Self::Unspecified,
4347 1 => Self::AiAgent,
4348 2 => Self::ContentScraper,
4349 3 => Self::SearchIndexer,
4350 _ => Self::UnknownValue(bot_type::UnknownValue(
4351 wkt::internal::UnknownEnumValue::Integer(value),
4352 )),
4353 }
4354 }
4355 }
4356
4357 impl std::convert::From<&str> for BotType {
4358 fn from(value: &str) -> Self {
4359 use std::string::ToString;
4360 match value {
4361 "BOT_TYPE_UNSPECIFIED" => Self::Unspecified,
4362 "AI_AGENT" => Self::AiAgent,
4363 "CONTENT_SCRAPER" => Self::ContentScraper,
4364 "SEARCH_INDEXER" => Self::SearchIndexer,
4365 _ => Self::UnknownValue(bot_type::UnknownValue(
4366 wkt::internal::UnknownEnumValue::String(value.to_string()),
4367 )),
4368 }
4369 }
4370 }
4371
4372 impl serde::ser::Serialize for BotType {
4373 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4374 where
4375 S: serde::Serializer,
4376 {
4377 match self {
4378 Self::Unspecified => serializer.serialize_i32(0),
4379 Self::AiAgent => serializer.serialize_i32(1),
4380 Self::ContentScraper => serializer.serialize_i32(2),
4381 Self::SearchIndexer => serializer.serialize_i32(3),
4382 Self::UnknownValue(u) => u.0.serialize(serializer),
4383 }
4384 }
4385 }
4386
4387 impl<'de> serde::de::Deserialize<'de> for BotType {
4388 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4389 where
4390 D: serde::Deserializer<'de>,
4391 {
4392 deserializer.deserialize_any(wkt::internal::EnumVisitor::<BotType>::new(
4393 ".google.cloud.recaptchaenterprise.v1.Bot.BotType",
4394 ))
4395 }
4396 }
4397}
4398
4399/// Properties of the provided event token.
4400#[derive(Clone, Default, PartialEq)]
4401#[non_exhaustive]
4402pub struct TokenProperties {
4403 /// Output only. Whether the provided user response token is valid. When valid
4404 /// = false, the reason could be specified in invalid_reason or it could also
4405 /// be due to a user failing to solve a challenge or a sitekey mismatch (i.e
4406 /// the sitekey used to generate the token was different than the one specified
4407 /// in the assessment).
4408 pub valid: bool,
4409
4410 /// Output only. Reason associated with the response when valid = false.
4411 pub invalid_reason: crate::model::token_properties::InvalidReason,
4412
4413 /// Output only. The timestamp corresponding to the generation of the token.
4414 pub create_time: std::option::Option<wkt::Timestamp>,
4415
4416 /// Output only. The hostname of the page on which the token was generated (Web
4417 /// keys only).
4418 pub hostname: std::string::String,
4419
4420 /// Output only. The name of the Android package with which the token was
4421 /// generated (Android keys only).
4422 pub android_package_name: std::string::String,
4423
4424 /// Output only. The ID of the iOS bundle with which the token was generated
4425 /// (iOS keys only).
4426 pub ios_bundle_id: std::string::String,
4427
4428 /// Output only. Action name provided at token generation.
4429 pub action: std::string::String,
4430
4431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4432}
4433
4434impl TokenProperties {
4435 /// Creates a new default instance.
4436 pub fn new() -> Self {
4437 std::default::Default::default()
4438 }
4439
4440 /// Sets the value of [valid][crate::model::TokenProperties::valid].
4441 ///
4442 /// # Example
4443 /// ```ignore,no_run
4444 /// # use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
4445 /// let x = TokenProperties::new().set_valid(true);
4446 /// ```
4447 pub fn set_valid<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4448 self.valid = v.into();
4449 self
4450 }
4451
4452 /// Sets the value of [invalid_reason][crate::model::TokenProperties::invalid_reason].
4453 ///
4454 /// # Example
4455 /// ```ignore,no_run
4456 /// # use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
4457 /// use google_cloud_recaptchaenterprise_v1::model::token_properties::InvalidReason;
4458 /// let x0 = TokenProperties::new().set_invalid_reason(InvalidReason::UnknownInvalidReason);
4459 /// let x1 = TokenProperties::new().set_invalid_reason(InvalidReason::Malformed);
4460 /// let x2 = TokenProperties::new().set_invalid_reason(InvalidReason::Expired);
4461 /// ```
4462 pub fn set_invalid_reason<
4463 T: std::convert::Into<crate::model::token_properties::InvalidReason>,
4464 >(
4465 mut self,
4466 v: T,
4467 ) -> Self {
4468 self.invalid_reason = v.into();
4469 self
4470 }
4471
4472 /// Sets the value of [create_time][crate::model::TokenProperties::create_time].
4473 ///
4474 /// # Example
4475 /// ```ignore,no_run
4476 /// # use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
4477 /// use wkt::Timestamp;
4478 /// let x = TokenProperties::new().set_create_time(Timestamp::default()/* use setters */);
4479 /// ```
4480 pub fn set_create_time<T>(mut self, v: T) -> Self
4481 where
4482 T: std::convert::Into<wkt::Timestamp>,
4483 {
4484 self.create_time = std::option::Option::Some(v.into());
4485 self
4486 }
4487
4488 /// Sets or clears the value of [create_time][crate::model::TokenProperties::create_time].
4489 ///
4490 /// # Example
4491 /// ```ignore,no_run
4492 /// # use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
4493 /// use wkt::Timestamp;
4494 /// let x = TokenProperties::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4495 /// let x = TokenProperties::new().set_or_clear_create_time(None::<Timestamp>);
4496 /// ```
4497 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4498 where
4499 T: std::convert::Into<wkt::Timestamp>,
4500 {
4501 self.create_time = v.map(|x| x.into());
4502 self
4503 }
4504
4505 /// Sets the value of [hostname][crate::model::TokenProperties::hostname].
4506 ///
4507 /// # Example
4508 /// ```ignore,no_run
4509 /// # use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
4510 /// let x = TokenProperties::new().set_hostname("example");
4511 /// ```
4512 pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4513 self.hostname = v.into();
4514 self
4515 }
4516
4517 /// Sets the value of [android_package_name][crate::model::TokenProperties::android_package_name].
4518 ///
4519 /// # Example
4520 /// ```ignore,no_run
4521 /// # use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
4522 /// let x = TokenProperties::new().set_android_package_name("example");
4523 /// ```
4524 pub fn set_android_package_name<T: std::convert::Into<std::string::String>>(
4525 mut self,
4526 v: T,
4527 ) -> Self {
4528 self.android_package_name = v.into();
4529 self
4530 }
4531
4532 /// Sets the value of [ios_bundle_id][crate::model::TokenProperties::ios_bundle_id].
4533 ///
4534 /// # Example
4535 /// ```ignore,no_run
4536 /// # use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
4537 /// let x = TokenProperties::new().set_ios_bundle_id("example");
4538 /// ```
4539 pub fn set_ios_bundle_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4540 self.ios_bundle_id = v.into();
4541 self
4542 }
4543
4544 /// Sets the value of [action][crate::model::TokenProperties::action].
4545 ///
4546 /// # Example
4547 /// ```ignore,no_run
4548 /// # use google_cloud_recaptchaenterprise_v1::model::TokenProperties;
4549 /// let x = TokenProperties::new().set_action("example");
4550 /// ```
4551 pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4552 self.action = v.into();
4553 self
4554 }
4555}
4556
4557impl wkt::message::Message for TokenProperties {
4558 fn typename() -> &'static str {
4559 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.TokenProperties"
4560 }
4561}
4562
4563/// Defines additional types related to [TokenProperties].
4564pub mod token_properties {
4565 #[allow(unused_imports)]
4566 use super::*;
4567
4568 /// Enum that represents the types of invalid token reasons.
4569 /// Ensure that applications can handle values not explicitly listed.
4570 ///
4571 /// # Working with unknown values
4572 ///
4573 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4574 /// additional enum variants at any time. Adding new variants is not considered
4575 /// a breaking change. Applications should write their code in anticipation of:
4576 ///
4577 /// - New values appearing in future releases of the client library, **and**
4578 /// - New values received dynamically, without application changes.
4579 ///
4580 /// Please consult the [Working with enums] section in the user guide for some
4581 /// guidelines.
4582 ///
4583 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4584 #[derive(Clone, Debug, PartialEq)]
4585 #[non_exhaustive]
4586 pub enum InvalidReason {
4587 /// Default unspecified type.
4588 Unspecified,
4589 /// If the failure reason was not accounted for.
4590 UnknownInvalidReason,
4591 /// The provided user verification token was malformed.
4592 Malformed,
4593 /// The user verification token had expired.
4594 Expired,
4595 /// The user verification had already been seen.
4596 Dupe,
4597 /// The user verification token was not present.
4598 Missing,
4599 /// A retriable error (such as network failure) occurred on the browser.
4600 /// Could easily be simulated by an attacker.
4601 BrowserError,
4602 /// The action provided at token generation was different than
4603 /// the `expected_action` in the assessment request. The comparison is
4604 /// case-insensitive. This reason can only be returned if all of the
4605 /// following are true:
4606 ///
4607 /// - your `site_key` has the POLICY_BASED_CHALLENGE integration type
4608 /// - you set an action score threshold higher than 0.0
4609 /// - you provided a non-empty `expected_action`
4610 UnexpectedAction,
4611 /// If set, the enum was initialized with an unknown value.
4612 ///
4613 /// Applications can examine the value using [InvalidReason::value] or
4614 /// [InvalidReason::name].
4615 UnknownValue(invalid_reason::UnknownValue),
4616 }
4617
4618 #[doc(hidden)]
4619 pub mod invalid_reason {
4620 #[allow(unused_imports)]
4621 use super::*;
4622 #[derive(Clone, Debug, PartialEq)]
4623 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4624 }
4625
4626 impl InvalidReason {
4627 /// Gets the enum value.
4628 ///
4629 /// Returns `None` if the enum contains an unknown value deserialized from
4630 /// the string representation of enums.
4631 pub fn value(&self) -> std::option::Option<i32> {
4632 match self {
4633 Self::Unspecified => std::option::Option::Some(0),
4634 Self::UnknownInvalidReason => std::option::Option::Some(1),
4635 Self::Malformed => std::option::Option::Some(2),
4636 Self::Expired => std::option::Option::Some(3),
4637 Self::Dupe => std::option::Option::Some(4),
4638 Self::Missing => std::option::Option::Some(5),
4639 Self::BrowserError => std::option::Option::Some(6),
4640 Self::UnexpectedAction => std::option::Option::Some(7),
4641 Self::UnknownValue(u) => u.0.value(),
4642 }
4643 }
4644
4645 /// Gets the enum value as a string.
4646 ///
4647 /// Returns `None` if the enum contains an unknown value deserialized from
4648 /// the integer representation of enums.
4649 pub fn name(&self) -> std::option::Option<&str> {
4650 match self {
4651 Self::Unspecified => std::option::Option::Some("INVALID_REASON_UNSPECIFIED"),
4652 Self::UnknownInvalidReason => std::option::Option::Some("UNKNOWN_INVALID_REASON"),
4653 Self::Malformed => std::option::Option::Some("MALFORMED"),
4654 Self::Expired => std::option::Option::Some("EXPIRED"),
4655 Self::Dupe => std::option::Option::Some("DUPE"),
4656 Self::Missing => std::option::Option::Some("MISSING"),
4657 Self::BrowserError => std::option::Option::Some("BROWSER_ERROR"),
4658 Self::UnexpectedAction => std::option::Option::Some("UNEXPECTED_ACTION"),
4659 Self::UnknownValue(u) => u.0.name(),
4660 }
4661 }
4662 }
4663
4664 impl std::default::Default for InvalidReason {
4665 fn default() -> Self {
4666 use std::convert::From;
4667 Self::from(0)
4668 }
4669 }
4670
4671 impl std::fmt::Display for InvalidReason {
4672 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4673 wkt::internal::display_enum(f, self.name(), self.value())
4674 }
4675 }
4676
4677 impl std::convert::From<i32> for InvalidReason {
4678 fn from(value: i32) -> Self {
4679 match value {
4680 0 => Self::Unspecified,
4681 1 => Self::UnknownInvalidReason,
4682 2 => Self::Malformed,
4683 3 => Self::Expired,
4684 4 => Self::Dupe,
4685 5 => Self::Missing,
4686 6 => Self::BrowserError,
4687 7 => Self::UnexpectedAction,
4688 _ => Self::UnknownValue(invalid_reason::UnknownValue(
4689 wkt::internal::UnknownEnumValue::Integer(value),
4690 )),
4691 }
4692 }
4693 }
4694
4695 impl std::convert::From<&str> for InvalidReason {
4696 fn from(value: &str) -> Self {
4697 use std::string::ToString;
4698 match value {
4699 "INVALID_REASON_UNSPECIFIED" => Self::Unspecified,
4700 "UNKNOWN_INVALID_REASON" => Self::UnknownInvalidReason,
4701 "MALFORMED" => Self::Malformed,
4702 "EXPIRED" => Self::Expired,
4703 "DUPE" => Self::Dupe,
4704 "MISSING" => Self::Missing,
4705 "BROWSER_ERROR" => Self::BrowserError,
4706 "UNEXPECTED_ACTION" => Self::UnexpectedAction,
4707 _ => Self::UnknownValue(invalid_reason::UnknownValue(
4708 wkt::internal::UnknownEnumValue::String(value.to_string()),
4709 )),
4710 }
4711 }
4712 }
4713
4714 impl serde::ser::Serialize for InvalidReason {
4715 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4716 where
4717 S: serde::Serializer,
4718 {
4719 match self {
4720 Self::Unspecified => serializer.serialize_i32(0),
4721 Self::UnknownInvalidReason => serializer.serialize_i32(1),
4722 Self::Malformed => serializer.serialize_i32(2),
4723 Self::Expired => serializer.serialize_i32(3),
4724 Self::Dupe => serializer.serialize_i32(4),
4725 Self::Missing => serializer.serialize_i32(5),
4726 Self::BrowserError => serializer.serialize_i32(6),
4727 Self::UnexpectedAction => serializer.serialize_i32(7),
4728 Self::UnknownValue(u) => u.0.serialize(serializer),
4729 }
4730 }
4731 }
4732
4733 impl<'de> serde::de::Deserialize<'de> for InvalidReason {
4734 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4735 where
4736 D: serde::Deserializer<'de>,
4737 {
4738 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InvalidReason>::new(
4739 ".google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason",
4740 ))
4741 }
4742 }
4743}
4744
4745/// Assessment for Fraud Prevention.
4746#[derive(Clone, Default, PartialEq)]
4747#[non_exhaustive]
4748pub struct FraudPreventionAssessment {
4749 /// Output only. Probability of this transaction being fraudulent. Summarizes
4750 /// the combined risk of attack vectors below. Values are from 0.0 (lowest)
4751 /// to 1.0 (highest).
4752 pub transaction_risk: f32,
4753
4754 /// Output only. Reasons why the transaction is probably fraudulent and
4755 /// received a high transaction risk score.
4756 pub risk_reasons: std::vec::Vec<crate::model::fraud_prevention_assessment::RiskReason>,
4757
4758 /// Output only. Assessment of this transaction for risk of a stolen
4759 /// instrument.
4760 pub stolen_instrument_verdict:
4761 std::option::Option<crate::model::fraud_prevention_assessment::StolenInstrumentVerdict>,
4762
4763 /// Output only. Assessment of this transaction for risk of being part of a
4764 /// card testing attack.
4765 pub card_testing_verdict:
4766 std::option::Option<crate::model::fraud_prevention_assessment::CardTestingVerdict>,
4767
4768 /// Output only. Assessment of this transaction for behavioral trust.
4769 pub behavioral_trust_verdict:
4770 std::option::Option<crate::model::fraud_prevention_assessment::BehavioralTrustVerdict>,
4771
4772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4773}
4774
4775impl FraudPreventionAssessment {
4776 /// Creates a new default instance.
4777 pub fn new() -> Self {
4778 std::default::Default::default()
4779 }
4780
4781 /// Sets the value of [transaction_risk][crate::model::FraudPreventionAssessment::transaction_risk].
4782 ///
4783 /// # Example
4784 /// ```ignore,no_run
4785 /// # use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
4786 /// let x = FraudPreventionAssessment::new().set_transaction_risk(42.0);
4787 /// ```
4788 pub fn set_transaction_risk<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4789 self.transaction_risk = v.into();
4790 self
4791 }
4792
4793 /// Sets the value of [risk_reasons][crate::model::FraudPreventionAssessment::risk_reasons].
4794 ///
4795 /// # Example
4796 /// ```ignore,no_run
4797 /// # use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
4798 /// use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::RiskReason;
4799 /// let x = FraudPreventionAssessment::new()
4800 /// .set_risk_reasons([
4801 /// RiskReason::default()/* use setters */,
4802 /// RiskReason::default()/* use (different) setters */,
4803 /// ]);
4804 /// ```
4805 pub fn set_risk_reasons<T, V>(mut self, v: T) -> Self
4806 where
4807 T: std::iter::IntoIterator<Item = V>,
4808 V: std::convert::Into<crate::model::fraud_prevention_assessment::RiskReason>,
4809 {
4810 use std::iter::Iterator;
4811 self.risk_reasons = v.into_iter().map(|i| i.into()).collect();
4812 self
4813 }
4814
4815 /// Sets the value of [stolen_instrument_verdict][crate::model::FraudPreventionAssessment::stolen_instrument_verdict].
4816 ///
4817 /// # Example
4818 /// ```ignore,no_run
4819 /// # use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
4820 /// use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::StolenInstrumentVerdict;
4821 /// let x = FraudPreventionAssessment::new().set_stolen_instrument_verdict(StolenInstrumentVerdict::default()/* use setters */);
4822 /// ```
4823 pub fn set_stolen_instrument_verdict<T>(mut self, v: T) -> Self
4824 where
4825 T: std::convert::Into<crate::model::fraud_prevention_assessment::StolenInstrumentVerdict>,
4826 {
4827 self.stolen_instrument_verdict = std::option::Option::Some(v.into());
4828 self
4829 }
4830
4831 /// Sets or clears the value of [stolen_instrument_verdict][crate::model::FraudPreventionAssessment::stolen_instrument_verdict].
4832 ///
4833 /// # Example
4834 /// ```ignore,no_run
4835 /// # use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
4836 /// use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::StolenInstrumentVerdict;
4837 /// let x = FraudPreventionAssessment::new().set_or_clear_stolen_instrument_verdict(Some(StolenInstrumentVerdict::default()/* use setters */));
4838 /// let x = FraudPreventionAssessment::new().set_or_clear_stolen_instrument_verdict(None::<StolenInstrumentVerdict>);
4839 /// ```
4840 pub fn set_or_clear_stolen_instrument_verdict<T>(mut self, v: std::option::Option<T>) -> Self
4841 where
4842 T: std::convert::Into<crate::model::fraud_prevention_assessment::StolenInstrumentVerdict>,
4843 {
4844 self.stolen_instrument_verdict = v.map(|x| x.into());
4845 self
4846 }
4847
4848 /// Sets the value of [card_testing_verdict][crate::model::FraudPreventionAssessment::card_testing_verdict].
4849 ///
4850 /// # Example
4851 /// ```ignore,no_run
4852 /// # use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
4853 /// use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::CardTestingVerdict;
4854 /// let x = FraudPreventionAssessment::new().set_card_testing_verdict(CardTestingVerdict::default()/* use setters */);
4855 /// ```
4856 pub fn set_card_testing_verdict<T>(mut self, v: T) -> Self
4857 where
4858 T: std::convert::Into<crate::model::fraud_prevention_assessment::CardTestingVerdict>,
4859 {
4860 self.card_testing_verdict = std::option::Option::Some(v.into());
4861 self
4862 }
4863
4864 /// Sets or clears the value of [card_testing_verdict][crate::model::FraudPreventionAssessment::card_testing_verdict].
4865 ///
4866 /// # Example
4867 /// ```ignore,no_run
4868 /// # use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
4869 /// use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::CardTestingVerdict;
4870 /// let x = FraudPreventionAssessment::new().set_or_clear_card_testing_verdict(Some(CardTestingVerdict::default()/* use setters */));
4871 /// let x = FraudPreventionAssessment::new().set_or_clear_card_testing_verdict(None::<CardTestingVerdict>);
4872 /// ```
4873 pub fn set_or_clear_card_testing_verdict<T>(mut self, v: std::option::Option<T>) -> Self
4874 where
4875 T: std::convert::Into<crate::model::fraud_prevention_assessment::CardTestingVerdict>,
4876 {
4877 self.card_testing_verdict = v.map(|x| x.into());
4878 self
4879 }
4880
4881 /// Sets the value of [behavioral_trust_verdict][crate::model::FraudPreventionAssessment::behavioral_trust_verdict].
4882 ///
4883 /// # Example
4884 /// ```ignore,no_run
4885 /// # use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
4886 /// use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::BehavioralTrustVerdict;
4887 /// let x = FraudPreventionAssessment::new().set_behavioral_trust_verdict(BehavioralTrustVerdict::default()/* use setters */);
4888 /// ```
4889 pub fn set_behavioral_trust_verdict<T>(mut self, v: T) -> Self
4890 where
4891 T: std::convert::Into<crate::model::fraud_prevention_assessment::BehavioralTrustVerdict>,
4892 {
4893 self.behavioral_trust_verdict = std::option::Option::Some(v.into());
4894 self
4895 }
4896
4897 /// Sets or clears the value of [behavioral_trust_verdict][crate::model::FraudPreventionAssessment::behavioral_trust_verdict].
4898 ///
4899 /// # Example
4900 /// ```ignore,no_run
4901 /// # use google_cloud_recaptchaenterprise_v1::model::FraudPreventionAssessment;
4902 /// use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::BehavioralTrustVerdict;
4903 /// let x = FraudPreventionAssessment::new().set_or_clear_behavioral_trust_verdict(Some(BehavioralTrustVerdict::default()/* use setters */));
4904 /// let x = FraudPreventionAssessment::new().set_or_clear_behavioral_trust_verdict(None::<BehavioralTrustVerdict>);
4905 /// ```
4906 pub fn set_or_clear_behavioral_trust_verdict<T>(mut self, v: std::option::Option<T>) -> Self
4907 where
4908 T: std::convert::Into<crate::model::fraud_prevention_assessment::BehavioralTrustVerdict>,
4909 {
4910 self.behavioral_trust_verdict = v.map(|x| x.into());
4911 self
4912 }
4913}
4914
4915impl wkt::message::Message for FraudPreventionAssessment {
4916 fn typename() -> &'static str {
4917 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FraudPreventionAssessment"
4918 }
4919}
4920
4921/// Defines additional types related to [FraudPreventionAssessment].
4922pub mod fraud_prevention_assessment {
4923 #[allow(unused_imports)]
4924 use super::*;
4925
4926 /// Risk reasons applicable to the Fraud Prevention assessment.
4927 #[derive(Clone, Default, PartialEq)]
4928 #[non_exhaustive]
4929 pub struct RiskReason {
4930 /// Output only. Risk reasons applicable to the Fraud Prevention assessment.
4931 pub reason: crate::model::fraud_prevention_assessment::risk_reason::Reason,
4932
4933 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4934 }
4935
4936 impl RiskReason {
4937 /// Creates a new default instance.
4938 pub fn new() -> Self {
4939 std::default::Default::default()
4940 }
4941
4942 /// Sets the value of [reason][crate::model::fraud_prevention_assessment::RiskReason::reason].
4943 ///
4944 /// # Example
4945 /// ```ignore,no_run
4946 /// # use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::RiskReason;
4947 /// use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::risk_reason::Reason;
4948 /// let x0 = RiskReason::new().set_reason(Reason::HighTransactionVelocity);
4949 /// let x1 = RiskReason::new().set_reason(Reason::ExcessiveEnumerationPattern);
4950 /// let x2 = RiskReason::new().set_reason(Reason::ShortIdentityHistory);
4951 /// ```
4952 pub fn set_reason<
4953 T: std::convert::Into<crate::model::fraud_prevention_assessment::risk_reason::Reason>,
4954 >(
4955 mut self,
4956 v: T,
4957 ) -> Self {
4958 self.reason = v.into();
4959 self
4960 }
4961 }
4962
4963 impl wkt::message::Message for RiskReason {
4964 fn typename() -> &'static str {
4965 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FraudPreventionAssessment.RiskReason"
4966 }
4967 }
4968
4969 /// Defines additional types related to [RiskReason].
4970 pub mod risk_reason {
4971 #[allow(unused_imports)]
4972 use super::*;
4973
4974 /// Risk reasons applicable to the Fraud Prevention assessment. New risk
4975 /// reasons will be added over time.
4976 ///
4977 /// # Working with unknown values
4978 ///
4979 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4980 /// additional enum variants at any time. Adding new variants is not considered
4981 /// a breaking change. Applications should write their code in anticipation of:
4982 ///
4983 /// - New values appearing in future releases of the client library, **and**
4984 /// - New values received dynamically, without application changes.
4985 ///
4986 /// Please consult the [Working with enums] section in the user guide for some
4987 /// guidelines.
4988 ///
4989 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4990 #[derive(Clone, Debug, PartialEq)]
4991 #[non_exhaustive]
4992 pub enum Reason {
4993 /// Default unspecified type.
4994 Unspecified,
4995 /// A suspiciously high number of recent transactions have used identifiers
4996 /// present in this transaction.
4997 HighTransactionVelocity,
4998 /// User is cycling through a suspiciously large number of identifiers,
4999 /// suggesting enumeration or validation attacks within a potential fraud
5000 /// network.
5001 ExcessiveEnumerationPattern,
5002 /// User has a short history or no history in the reCAPTCHA network,
5003 /// suggesting the possibility of synthetic identity generation.
5004 ShortIdentityHistory,
5005 /// Identifiers used in this transaction originate from an unusual or
5006 /// conflicting set of geolocations.
5007 GeolocationDiscrepancy,
5008 /// This transaction is linked to a cluster of known fraudulent activity.
5009 AssociatedWithFraudCluster,
5010 /// If set, the enum was initialized with an unknown value.
5011 ///
5012 /// Applications can examine the value using [Reason::value] or
5013 /// [Reason::name].
5014 UnknownValue(reason::UnknownValue),
5015 }
5016
5017 #[doc(hidden)]
5018 pub mod reason {
5019 #[allow(unused_imports)]
5020 use super::*;
5021 #[derive(Clone, Debug, PartialEq)]
5022 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5023 }
5024
5025 impl Reason {
5026 /// Gets the enum value.
5027 ///
5028 /// Returns `None` if the enum contains an unknown value deserialized from
5029 /// the string representation of enums.
5030 pub fn value(&self) -> std::option::Option<i32> {
5031 match self {
5032 Self::Unspecified => std::option::Option::Some(0),
5033 Self::HighTransactionVelocity => std::option::Option::Some(1),
5034 Self::ExcessiveEnumerationPattern => std::option::Option::Some(2),
5035 Self::ShortIdentityHistory => std::option::Option::Some(3),
5036 Self::GeolocationDiscrepancy => std::option::Option::Some(4),
5037 Self::AssociatedWithFraudCluster => std::option::Option::Some(5),
5038 Self::UnknownValue(u) => u.0.value(),
5039 }
5040 }
5041
5042 /// Gets the enum value as a string.
5043 ///
5044 /// Returns `None` if the enum contains an unknown value deserialized from
5045 /// the integer representation of enums.
5046 pub fn name(&self) -> std::option::Option<&str> {
5047 match self {
5048 Self::Unspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
5049 Self::HighTransactionVelocity => {
5050 std::option::Option::Some("HIGH_TRANSACTION_VELOCITY")
5051 }
5052 Self::ExcessiveEnumerationPattern => {
5053 std::option::Option::Some("EXCESSIVE_ENUMERATION_PATTERN")
5054 }
5055 Self::ShortIdentityHistory => {
5056 std::option::Option::Some("SHORT_IDENTITY_HISTORY")
5057 }
5058 Self::GeolocationDiscrepancy => {
5059 std::option::Option::Some("GEOLOCATION_DISCREPANCY")
5060 }
5061 Self::AssociatedWithFraudCluster => {
5062 std::option::Option::Some("ASSOCIATED_WITH_FRAUD_CLUSTER")
5063 }
5064 Self::UnknownValue(u) => u.0.name(),
5065 }
5066 }
5067 }
5068
5069 impl std::default::Default for Reason {
5070 fn default() -> Self {
5071 use std::convert::From;
5072 Self::from(0)
5073 }
5074 }
5075
5076 impl std::fmt::Display for Reason {
5077 fn fmt(
5078 &self,
5079 f: &mut std::fmt::Formatter<'_>,
5080 ) -> std::result::Result<(), std::fmt::Error> {
5081 wkt::internal::display_enum(f, self.name(), self.value())
5082 }
5083 }
5084
5085 impl std::convert::From<i32> for Reason {
5086 fn from(value: i32) -> Self {
5087 match value {
5088 0 => Self::Unspecified,
5089 1 => Self::HighTransactionVelocity,
5090 2 => Self::ExcessiveEnumerationPattern,
5091 3 => Self::ShortIdentityHistory,
5092 4 => Self::GeolocationDiscrepancy,
5093 5 => Self::AssociatedWithFraudCluster,
5094 _ => Self::UnknownValue(reason::UnknownValue(
5095 wkt::internal::UnknownEnumValue::Integer(value),
5096 )),
5097 }
5098 }
5099 }
5100
5101 impl std::convert::From<&str> for Reason {
5102 fn from(value: &str) -> Self {
5103 use std::string::ToString;
5104 match value {
5105 "REASON_UNSPECIFIED" => Self::Unspecified,
5106 "HIGH_TRANSACTION_VELOCITY" => Self::HighTransactionVelocity,
5107 "EXCESSIVE_ENUMERATION_PATTERN" => Self::ExcessiveEnumerationPattern,
5108 "SHORT_IDENTITY_HISTORY" => Self::ShortIdentityHistory,
5109 "GEOLOCATION_DISCREPANCY" => Self::GeolocationDiscrepancy,
5110 "ASSOCIATED_WITH_FRAUD_CLUSTER" => Self::AssociatedWithFraudCluster,
5111 _ => Self::UnknownValue(reason::UnknownValue(
5112 wkt::internal::UnknownEnumValue::String(value.to_string()),
5113 )),
5114 }
5115 }
5116 }
5117
5118 impl serde::ser::Serialize for Reason {
5119 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5120 where
5121 S: serde::Serializer,
5122 {
5123 match self {
5124 Self::Unspecified => serializer.serialize_i32(0),
5125 Self::HighTransactionVelocity => serializer.serialize_i32(1),
5126 Self::ExcessiveEnumerationPattern => serializer.serialize_i32(2),
5127 Self::ShortIdentityHistory => serializer.serialize_i32(3),
5128 Self::GeolocationDiscrepancy => serializer.serialize_i32(4),
5129 Self::AssociatedWithFraudCluster => serializer.serialize_i32(5),
5130 Self::UnknownValue(u) => u.0.serialize(serializer),
5131 }
5132 }
5133 }
5134
5135 impl<'de> serde::de::Deserialize<'de> for Reason {
5136 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5137 where
5138 D: serde::Deserializer<'de>,
5139 {
5140 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reason>::new(
5141 ".google.cloud.recaptchaenterprise.v1.FraudPreventionAssessment.RiskReason.Reason"))
5142 }
5143 }
5144 }
5145
5146 /// Information about stolen instrument fraud, where the user is not the
5147 /// legitimate owner of the instrument being used for the purchase.
5148 #[derive(Clone, Default, PartialEq)]
5149 #[non_exhaustive]
5150 pub struct StolenInstrumentVerdict {
5151 /// Output only. Probability of this transaction being executed with a stolen
5152 /// instrument. Values are from 0.0 (lowest) to 1.0 (highest).
5153 pub risk: f32,
5154
5155 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5156 }
5157
5158 impl StolenInstrumentVerdict {
5159 /// Creates a new default instance.
5160 pub fn new() -> Self {
5161 std::default::Default::default()
5162 }
5163
5164 /// Sets the value of [risk][crate::model::fraud_prevention_assessment::StolenInstrumentVerdict::risk].
5165 ///
5166 /// # Example
5167 /// ```ignore,no_run
5168 /// # use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::StolenInstrumentVerdict;
5169 /// let x = StolenInstrumentVerdict::new().set_risk(42.0);
5170 /// ```
5171 pub fn set_risk<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5172 self.risk = v.into();
5173 self
5174 }
5175 }
5176
5177 impl wkt::message::Message for StolenInstrumentVerdict {
5178 fn typename() -> &'static str {
5179 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FraudPreventionAssessment.StolenInstrumentVerdict"
5180 }
5181 }
5182
5183 /// Information about card testing fraud, where an adversary is testing
5184 /// fraudulently obtained cards or brute forcing their details.
5185 #[derive(Clone, Default, PartialEq)]
5186 #[non_exhaustive]
5187 pub struct CardTestingVerdict {
5188 /// Output only. Probability of this transaction attempt being part of a card
5189 /// testing attack. Values are from 0.0 (lowest) to 1.0 (highest).
5190 pub risk: f32,
5191
5192 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5193 }
5194
5195 impl CardTestingVerdict {
5196 /// Creates a new default instance.
5197 pub fn new() -> Self {
5198 std::default::Default::default()
5199 }
5200
5201 /// Sets the value of [risk][crate::model::fraud_prevention_assessment::CardTestingVerdict::risk].
5202 ///
5203 /// # Example
5204 /// ```ignore,no_run
5205 /// # use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::CardTestingVerdict;
5206 /// let x = CardTestingVerdict::new().set_risk(42.0);
5207 /// ```
5208 pub fn set_risk<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5209 self.risk = v.into();
5210 self
5211 }
5212 }
5213
5214 impl wkt::message::Message for CardTestingVerdict {
5215 fn typename() -> &'static str {
5216 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FraudPreventionAssessment.CardTestingVerdict"
5217 }
5218 }
5219
5220 /// Information about behavioral trust of the transaction.
5221 #[derive(Clone, Default, PartialEq)]
5222 #[non_exhaustive]
5223 pub struct BehavioralTrustVerdict {
5224 /// Output only. Probability of this transaction attempt being executed in a
5225 /// behaviorally trustworthy way. Values are from 0.0 (lowest) to 1.0
5226 /// (highest).
5227 pub trust: f32,
5228
5229 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5230 }
5231
5232 impl BehavioralTrustVerdict {
5233 /// Creates a new default instance.
5234 pub fn new() -> Self {
5235 std::default::Default::default()
5236 }
5237
5238 /// Sets the value of [trust][crate::model::fraud_prevention_assessment::BehavioralTrustVerdict::trust].
5239 ///
5240 /// # Example
5241 /// ```ignore,no_run
5242 /// # use google_cloud_recaptchaenterprise_v1::model::fraud_prevention_assessment::BehavioralTrustVerdict;
5243 /// let x = BehavioralTrustVerdict::new().set_trust(42.0);
5244 /// ```
5245 pub fn set_trust<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5246 self.trust = v.into();
5247 self
5248 }
5249 }
5250
5251 impl wkt::message::Message for BehavioralTrustVerdict {
5252 fn typename() -> &'static str {
5253 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FraudPreventionAssessment.BehavioralTrustVerdict"
5254 }
5255 }
5256}
5257
5258/// Fraud signals describing users and cards involved in the transaction.
5259#[derive(Clone, Default, PartialEq)]
5260#[non_exhaustive]
5261pub struct FraudSignals {
5262 /// Output only. Signals describing the end user in this transaction.
5263 pub user_signals: std::option::Option<crate::model::fraud_signals::UserSignals>,
5264
5265 /// Output only. Signals describing the payment card or cards used in this
5266 /// transaction.
5267 pub card_signals: std::option::Option<crate::model::fraud_signals::CardSignals>,
5268
5269 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5270}
5271
5272impl FraudSignals {
5273 /// Creates a new default instance.
5274 pub fn new() -> Self {
5275 std::default::Default::default()
5276 }
5277
5278 /// Sets the value of [user_signals][crate::model::FraudSignals::user_signals].
5279 ///
5280 /// # Example
5281 /// ```ignore,no_run
5282 /// # use google_cloud_recaptchaenterprise_v1::model::FraudSignals;
5283 /// use google_cloud_recaptchaenterprise_v1::model::fraud_signals::UserSignals;
5284 /// let x = FraudSignals::new().set_user_signals(UserSignals::default()/* use setters */);
5285 /// ```
5286 pub fn set_user_signals<T>(mut self, v: T) -> Self
5287 where
5288 T: std::convert::Into<crate::model::fraud_signals::UserSignals>,
5289 {
5290 self.user_signals = std::option::Option::Some(v.into());
5291 self
5292 }
5293
5294 /// Sets or clears the value of [user_signals][crate::model::FraudSignals::user_signals].
5295 ///
5296 /// # Example
5297 /// ```ignore,no_run
5298 /// # use google_cloud_recaptchaenterprise_v1::model::FraudSignals;
5299 /// use google_cloud_recaptchaenterprise_v1::model::fraud_signals::UserSignals;
5300 /// let x = FraudSignals::new().set_or_clear_user_signals(Some(UserSignals::default()/* use setters */));
5301 /// let x = FraudSignals::new().set_or_clear_user_signals(None::<UserSignals>);
5302 /// ```
5303 pub fn set_or_clear_user_signals<T>(mut self, v: std::option::Option<T>) -> Self
5304 where
5305 T: std::convert::Into<crate::model::fraud_signals::UserSignals>,
5306 {
5307 self.user_signals = v.map(|x| x.into());
5308 self
5309 }
5310
5311 /// Sets the value of [card_signals][crate::model::FraudSignals::card_signals].
5312 ///
5313 /// # Example
5314 /// ```ignore,no_run
5315 /// # use google_cloud_recaptchaenterprise_v1::model::FraudSignals;
5316 /// use google_cloud_recaptchaenterprise_v1::model::fraud_signals::CardSignals;
5317 /// let x = FraudSignals::new().set_card_signals(CardSignals::default()/* use setters */);
5318 /// ```
5319 pub fn set_card_signals<T>(mut self, v: T) -> Self
5320 where
5321 T: std::convert::Into<crate::model::fraud_signals::CardSignals>,
5322 {
5323 self.card_signals = std::option::Option::Some(v.into());
5324 self
5325 }
5326
5327 /// Sets or clears the value of [card_signals][crate::model::FraudSignals::card_signals].
5328 ///
5329 /// # Example
5330 /// ```ignore,no_run
5331 /// # use google_cloud_recaptchaenterprise_v1::model::FraudSignals;
5332 /// use google_cloud_recaptchaenterprise_v1::model::fraud_signals::CardSignals;
5333 /// let x = FraudSignals::new().set_or_clear_card_signals(Some(CardSignals::default()/* use setters */));
5334 /// let x = FraudSignals::new().set_or_clear_card_signals(None::<CardSignals>);
5335 /// ```
5336 pub fn set_or_clear_card_signals<T>(mut self, v: std::option::Option<T>) -> Self
5337 where
5338 T: std::convert::Into<crate::model::fraud_signals::CardSignals>,
5339 {
5340 self.card_signals = v.map(|x| x.into());
5341 self
5342 }
5343}
5344
5345impl wkt::message::Message for FraudSignals {
5346 fn typename() -> &'static str {
5347 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FraudSignals"
5348 }
5349}
5350
5351/// Defines additional types related to [FraudSignals].
5352pub mod fraud_signals {
5353 #[allow(unused_imports)]
5354 use super::*;
5355
5356 /// Signals describing the user involved in this transaction.
5357 #[derive(Clone, Default, PartialEq)]
5358 #[non_exhaustive]
5359 pub struct UserSignals {
5360 /// Output only. This user (based on email, phone, and other identifiers) has
5361 /// been seen on the internet for at least this number of days.
5362 pub active_days_lower_bound: i32,
5363
5364 /// Output only. Likelihood (from 0.0 to 1.0) this user includes synthetic
5365 /// components in their identity, such as a randomly generated email address,
5366 /// temporary phone number, or fake shipping address.
5367 pub synthetic_risk: f32,
5368
5369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5370 }
5371
5372 impl UserSignals {
5373 /// Creates a new default instance.
5374 pub fn new() -> Self {
5375 std::default::Default::default()
5376 }
5377
5378 /// Sets the value of [active_days_lower_bound][crate::model::fraud_signals::UserSignals::active_days_lower_bound].
5379 ///
5380 /// # Example
5381 /// ```ignore,no_run
5382 /// # use google_cloud_recaptchaenterprise_v1::model::fraud_signals::UserSignals;
5383 /// let x = UserSignals::new().set_active_days_lower_bound(42);
5384 /// ```
5385 pub fn set_active_days_lower_bound<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5386 self.active_days_lower_bound = v.into();
5387 self
5388 }
5389
5390 /// Sets the value of [synthetic_risk][crate::model::fraud_signals::UserSignals::synthetic_risk].
5391 ///
5392 /// # Example
5393 /// ```ignore,no_run
5394 /// # use google_cloud_recaptchaenterprise_v1::model::fraud_signals::UserSignals;
5395 /// let x = UserSignals::new().set_synthetic_risk(42.0);
5396 /// ```
5397 pub fn set_synthetic_risk<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5398 self.synthetic_risk = v.into();
5399 self
5400 }
5401 }
5402
5403 impl wkt::message::Message for UserSignals {
5404 fn typename() -> &'static str {
5405 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FraudSignals.UserSignals"
5406 }
5407 }
5408
5409 /// Signals describing the payment card used in this transaction.
5410 #[derive(Clone, Default, PartialEq)]
5411 #[non_exhaustive]
5412 pub struct CardSignals {
5413 /// Output only. The labels for the payment card in this transaction.
5414 pub card_labels: std::vec::Vec<crate::model::fraud_signals::card_signals::CardLabel>,
5415
5416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5417 }
5418
5419 impl CardSignals {
5420 /// Creates a new default instance.
5421 pub fn new() -> Self {
5422 std::default::Default::default()
5423 }
5424
5425 /// Sets the value of [card_labels][crate::model::fraud_signals::CardSignals::card_labels].
5426 ///
5427 /// # Example
5428 /// ```ignore,no_run
5429 /// # use google_cloud_recaptchaenterprise_v1::model::fraud_signals::CardSignals;
5430 /// use google_cloud_recaptchaenterprise_v1::model::fraud_signals::card_signals::CardLabel;
5431 /// let x = CardSignals::new().set_card_labels([
5432 /// CardLabel::Prepaid,
5433 /// CardLabel::Virtual,
5434 /// CardLabel::UnexpectedLocation,
5435 /// ]);
5436 /// ```
5437 pub fn set_card_labels<T, V>(mut self, v: T) -> Self
5438 where
5439 T: std::iter::IntoIterator<Item = V>,
5440 V: std::convert::Into<crate::model::fraud_signals::card_signals::CardLabel>,
5441 {
5442 use std::iter::Iterator;
5443 self.card_labels = v.into_iter().map(|i| i.into()).collect();
5444 self
5445 }
5446 }
5447
5448 impl wkt::message::Message for CardSignals {
5449 fn typename() -> &'static str {
5450 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FraudSignals.CardSignals"
5451 }
5452 }
5453
5454 /// Defines additional types related to [CardSignals].
5455 pub mod card_signals {
5456 #[allow(unused_imports)]
5457 use super::*;
5458
5459 /// Risk labels describing the card being assessed, such as its funding
5460 /// mechanism.
5461 /// Ensure that applications can handle values not explicitly listed.
5462 ///
5463 /// # Working with unknown values
5464 ///
5465 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5466 /// additional enum variants at any time. Adding new variants is not considered
5467 /// a breaking change. Applications should write their code in anticipation of:
5468 ///
5469 /// - New values appearing in future releases of the client library, **and**
5470 /// - New values received dynamically, without application changes.
5471 ///
5472 /// Please consult the [Working with enums] section in the user guide for some
5473 /// guidelines.
5474 ///
5475 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5476 #[derive(Clone, Debug, PartialEq)]
5477 #[non_exhaustive]
5478 pub enum CardLabel {
5479 /// No label specified.
5480 Unspecified,
5481 /// This card has been detected as prepaid.
5482 Prepaid,
5483 /// This card has been detected as virtual, such as a card number generated
5484 /// for a single transaction or merchant.
5485 Virtual,
5486 /// This card has been detected as being used in an unexpected geographic
5487 /// location.
5488 UnexpectedLocation,
5489 /// If set, the enum was initialized with an unknown value.
5490 ///
5491 /// Applications can examine the value using [CardLabel::value] or
5492 /// [CardLabel::name].
5493 UnknownValue(card_label::UnknownValue),
5494 }
5495
5496 #[doc(hidden)]
5497 pub mod card_label {
5498 #[allow(unused_imports)]
5499 use super::*;
5500 #[derive(Clone, Debug, PartialEq)]
5501 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5502 }
5503
5504 impl CardLabel {
5505 /// Gets the enum value.
5506 ///
5507 /// Returns `None` if the enum contains an unknown value deserialized from
5508 /// the string representation of enums.
5509 pub fn value(&self) -> std::option::Option<i32> {
5510 match self {
5511 Self::Unspecified => std::option::Option::Some(0),
5512 Self::Prepaid => std::option::Option::Some(1),
5513 Self::Virtual => std::option::Option::Some(2),
5514 Self::UnexpectedLocation => std::option::Option::Some(3),
5515 Self::UnknownValue(u) => u.0.value(),
5516 }
5517 }
5518
5519 /// Gets the enum value as a string.
5520 ///
5521 /// Returns `None` if the enum contains an unknown value deserialized from
5522 /// the integer representation of enums.
5523 pub fn name(&self) -> std::option::Option<&str> {
5524 match self {
5525 Self::Unspecified => std::option::Option::Some("CARD_LABEL_UNSPECIFIED"),
5526 Self::Prepaid => std::option::Option::Some("PREPAID"),
5527 Self::Virtual => std::option::Option::Some("VIRTUAL"),
5528 Self::UnexpectedLocation => std::option::Option::Some("UNEXPECTED_LOCATION"),
5529 Self::UnknownValue(u) => u.0.name(),
5530 }
5531 }
5532 }
5533
5534 impl std::default::Default for CardLabel {
5535 fn default() -> Self {
5536 use std::convert::From;
5537 Self::from(0)
5538 }
5539 }
5540
5541 impl std::fmt::Display for CardLabel {
5542 fn fmt(
5543 &self,
5544 f: &mut std::fmt::Formatter<'_>,
5545 ) -> std::result::Result<(), std::fmt::Error> {
5546 wkt::internal::display_enum(f, self.name(), self.value())
5547 }
5548 }
5549
5550 impl std::convert::From<i32> for CardLabel {
5551 fn from(value: i32) -> Self {
5552 match value {
5553 0 => Self::Unspecified,
5554 1 => Self::Prepaid,
5555 2 => Self::Virtual,
5556 3 => Self::UnexpectedLocation,
5557 _ => Self::UnknownValue(card_label::UnknownValue(
5558 wkt::internal::UnknownEnumValue::Integer(value),
5559 )),
5560 }
5561 }
5562 }
5563
5564 impl std::convert::From<&str> for CardLabel {
5565 fn from(value: &str) -> Self {
5566 use std::string::ToString;
5567 match value {
5568 "CARD_LABEL_UNSPECIFIED" => Self::Unspecified,
5569 "PREPAID" => Self::Prepaid,
5570 "VIRTUAL" => Self::Virtual,
5571 "UNEXPECTED_LOCATION" => Self::UnexpectedLocation,
5572 _ => Self::UnknownValue(card_label::UnknownValue(
5573 wkt::internal::UnknownEnumValue::String(value.to_string()),
5574 )),
5575 }
5576 }
5577 }
5578
5579 impl serde::ser::Serialize for CardLabel {
5580 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5581 where
5582 S: serde::Serializer,
5583 {
5584 match self {
5585 Self::Unspecified => serializer.serialize_i32(0),
5586 Self::Prepaid => serializer.serialize_i32(1),
5587 Self::Virtual => serializer.serialize_i32(2),
5588 Self::UnexpectedLocation => serializer.serialize_i32(3),
5589 Self::UnknownValue(u) => u.0.serialize(serializer),
5590 }
5591 }
5592 }
5593
5594 impl<'de> serde::de::Deserialize<'de> for CardLabel {
5595 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5596 where
5597 D: serde::Deserializer<'de>,
5598 {
5599 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CardLabel>::new(
5600 ".google.cloud.recaptchaenterprise.v1.FraudSignals.CardSignals.CardLabel",
5601 ))
5602 }
5603 }
5604 }
5605}
5606
5607/// Information about SMS toll fraud.
5608#[derive(Clone, Default, PartialEq)]
5609#[non_exhaustive]
5610pub struct SmsTollFraudVerdict {
5611 /// Output only. Probability of an SMS event being fraudulent.
5612 /// Values are from 0.0 (lowest) to 1.0 (highest).
5613 pub risk: f32,
5614
5615 /// Output only. Reasons contributing to the SMS toll fraud verdict.
5616 pub reasons: std::vec::Vec<crate::model::sms_toll_fraud_verdict::SmsTollFraudReason>,
5617
5618 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5619}
5620
5621impl SmsTollFraudVerdict {
5622 /// Creates a new default instance.
5623 pub fn new() -> Self {
5624 std::default::Default::default()
5625 }
5626
5627 /// Sets the value of [risk][crate::model::SmsTollFraudVerdict::risk].
5628 ///
5629 /// # Example
5630 /// ```ignore,no_run
5631 /// # use google_cloud_recaptchaenterprise_v1::model::SmsTollFraudVerdict;
5632 /// let x = SmsTollFraudVerdict::new().set_risk(42.0);
5633 /// ```
5634 pub fn set_risk<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5635 self.risk = v.into();
5636 self
5637 }
5638
5639 /// Sets the value of [reasons][crate::model::SmsTollFraudVerdict::reasons].
5640 ///
5641 /// # Example
5642 /// ```ignore,no_run
5643 /// # use google_cloud_recaptchaenterprise_v1::model::SmsTollFraudVerdict;
5644 /// use google_cloud_recaptchaenterprise_v1::model::sms_toll_fraud_verdict::SmsTollFraudReason;
5645 /// let x = SmsTollFraudVerdict::new().set_reasons([
5646 /// SmsTollFraudReason::InvalidPhoneNumber,
5647 /// ]);
5648 /// ```
5649 pub fn set_reasons<T, V>(mut self, v: T) -> Self
5650 where
5651 T: std::iter::IntoIterator<Item = V>,
5652 V: std::convert::Into<crate::model::sms_toll_fraud_verdict::SmsTollFraudReason>,
5653 {
5654 use std::iter::Iterator;
5655 self.reasons = v.into_iter().map(|i| i.into()).collect();
5656 self
5657 }
5658}
5659
5660impl wkt::message::Message for SmsTollFraudVerdict {
5661 fn typename() -> &'static str {
5662 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict"
5663 }
5664}
5665
5666/// Defines additional types related to [SmsTollFraudVerdict].
5667pub mod sms_toll_fraud_verdict {
5668 #[allow(unused_imports)]
5669 use super::*;
5670
5671 /// Reasons contributing to the SMS toll fraud verdict.
5672 /// Ensure that applications can handle values not explicitly listed.
5673 ///
5674 /// # Working with unknown values
5675 ///
5676 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5677 /// additional enum variants at any time. Adding new variants is not considered
5678 /// a breaking change. Applications should write their code in anticipation of:
5679 ///
5680 /// - New values appearing in future releases of the client library, **and**
5681 /// - New values received dynamically, without application changes.
5682 ///
5683 /// Please consult the [Working with enums] section in the user guide for some
5684 /// guidelines.
5685 ///
5686 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5687 #[derive(Clone, Debug, PartialEq)]
5688 #[non_exhaustive]
5689 pub enum SmsTollFraudReason {
5690 /// Default unspecified reason
5691 Unspecified,
5692 /// The provided phone number was invalid
5693 InvalidPhoneNumber,
5694 /// If set, the enum was initialized with an unknown value.
5695 ///
5696 /// Applications can examine the value using [SmsTollFraudReason::value] or
5697 /// [SmsTollFraudReason::name].
5698 UnknownValue(sms_toll_fraud_reason::UnknownValue),
5699 }
5700
5701 #[doc(hidden)]
5702 pub mod sms_toll_fraud_reason {
5703 #[allow(unused_imports)]
5704 use super::*;
5705 #[derive(Clone, Debug, PartialEq)]
5706 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5707 }
5708
5709 impl SmsTollFraudReason {
5710 /// Gets the enum value.
5711 ///
5712 /// Returns `None` if the enum contains an unknown value deserialized from
5713 /// the string representation of enums.
5714 pub fn value(&self) -> std::option::Option<i32> {
5715 match self {
5716 Self::Unspecified => std::option::Option::Some(0),
5717 Self::InvalidPhoneNumber => std::option::Option::Some(1),
5718 Self::UnknownValue(u) => u.0.value(),
5719 }
5720 }
5721
5722 /// Gets the enum value as a string.
5723 ///
5724 /// Returns `None` if the enum contains an unknown value deserialized from
5725 /// the integer representation of enums.
5726 pub fn name(&self) -> std::option::Option<&str> {
5727 match self {
5728 Self::Unspecified => std::option::Option::Some("SMS_TOLL_FRAUD_REASON_UNSPECIFIED"),
5729 Self::InvalidPhoneNumber => std::option::Option::Some("INVALID_PHONE_NUMBER"),
5730 Self::UnknownValue(u) => u.0.name(),
5731 }
5732 }
5733 }
5734
5735 impl std::default::Default for SmsTollFraudReason {
5736 fn default() -> Self {
5737 use std::convert::From;
5738 Self::from(0)
5739 }
5740 }
5741
5742 impl std::fmt::Display for SmsTollFraudReason {
5743 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5744 wkt::internal::display_enum(f, self.name(), self.value())
5745 }
5746 }
5747
5748 impl std::convert::From<i32> for SmsTollFraudReason {
5749 fn from(value: i32) -> Self {
5750 match value {
5751 0 => Self::Unspecified,
5752 1 => Self::InvalidPhoneNumber,
5753 _ => Self::UnknownValue(sms_toll_fraud_reason::UnknownValue(
5754 wkt::internal::UnknownEnumValue::Integer(value),
5755 )),
5756 }
5757 }
5758 }
5759
5760 impl std::convert::From<&str> for SmsTollFraudReason {
5761 fn from(value: &str) -> Self {
5762 use std::string::ToString;
5763 match value {
5764 "SMS_TOLL_FRAUD_REASON_UNSPECIFIED" => Self::Unspecified,
5765 "INVALID_PHONE_NUMBER" => Self::InvalidPhoneNumber,
5766 _ => Self::UnknownValue(sms_toll_fraud_reason::UnknownValue(
5767 wkt::internal::UnknownEnumValue::String(value.to_string()),
5768 )),
5769 }
5770 }
5771 }
5772
5773 impl serde::ser::Serialize for SmsTollFraudReason {
5774 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5775 where
5776 S: serde::Serializer,
5777 {
5778 match self {
5779 Self::Unspecified => serializer.serialize_i32(0),
5780 Self::InvalidPhoneNumber => serializer.serialize_i32(1),
5781 Self::UnknownValue(u) => u.0.serialize(serializer),
5782 }
5783 }
5784 }
5785
5786 impl<'de> serde::de::Deserialize<'de> for SmsTollFraudReason {
5787 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5788 where
5789 D: serde::Deserializer<'de>,
5790 {
5791 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SmsTollFraudReason>::new(
5792 ".google.cloud.recaptchaenterprise.v1.SmsTollFraudVerdict.SmsTollFraudReason",
5793 ))
5794 }
5795 }
5796}
5797
5798/// Assessment for Phone Fraud
5799#[derive(Clone, Default, PartialEq)]
5800#[non_exhaustive]
5801pub struct PhoneFraudAssessment {
5802 /// Output only. Assessment of this phone event for risk of SMS toll fraud.
5803 pub sms_toll_fraud_verdict: std::option::Option<crate::model::SmsTollFraudVerdict>,
5804
5805 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5806}
5807
5808impl PhoneFraudAssessment {
5809 /// Creates a new default instance.
5810 pub fn new() -> Self {
5811 std::default::Default::default()
5812 }
5813
5814 /// Sets the value of [sms_toll_fraud_verdict][crate::model::PhoneFraudAssessment::sms_toll_fraud_verdict].
5815 ///
5816 /// # Example
5817 /// ```ignore,no_run
5818 /// # use google_cloud_recaptchaenterprise_v1::model::PhoneFraudAssessment;
5819 /// use google_cloud_recaptchaenterprise_v1::model::SmsTollFraudVerdict;
5820 /// let x = PhoneFraudAssessment::new().set_sms_toll_fraud_verdict(SmsTollFraudVerdict::default()/* use setters */);
5821 /// ```
5822 pub fn set_sms_toll_fraud_verdict<T>(mut self, v: T) -> Self
5823 where
5824 T: std::convert::Into<crate::model::SmsTollFraudVerdict>,
5825 {
5826 self.sms_toll_fraud_verdict = std::option::Option::Some(v.into());
5827 self
5828 }
5829
5830 /// Sets or clears the value of [sms_toll_fraud_verdict][crate::model::PhoneFraudAssessment::sms_toll_fraud_verdict].
5831 ///
5832 /// # Example
5833 /// ```ignore,no_run
5834 /// # use google_cloud_recaptchaenterprise_v1::model::PhoneFraudAssessment;
5835 /// use google_cloud_recaptchaenterprise_v1::model::SmsTollFraudVerdict;
5836 /// let x = PhoneFraudAssessment::new().set_or_clear_sms_toll_fraud_verdict(Some(SmsTollFraudVerdict::default()/* use setters */));
5837 /// let x = PhoneFraudAssessment::new().set_or_clear_sms_toll_fraud_verdict(None::<SmsTollFraudVerdict>);
5838 /// ```
5839 pub fn set_or_clear_sms_toll_fraud_verdict<T>(mut self, v: std::option::Option<T>) -> Self
5840 where
5841 T: std::convert::Into<crate::model::SmsTollFraudVerdict>,
5842 {
5843 self.sms_toll_fraud_verdict = v.map(|x| x.into());
5844 self
5845 }
5846}
5847
5848impl wkt::message::Message for PhoneFraudAssessment {
5849 fn typename() -> &'static str {
5850 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.PhoneFraudAssessment"
5851 }
5852}
5853
5854/// Account defender risk assessment.
5855#[derive(Clone, Default, PartialEq)]
5856#[non_exhaustive]
5857pub struct AccountDefenderAssessment {
5858 /// Output only. Labels for this request.
5859 pub labels: std::vec::Vec<crate::model::account_defender_assessment::AccountDefenderLabel>,
5860
5861 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5862}
5863
5864impl AccountDefenderAssessment {
5865 /// Creates a new default instance.
5866 pub fn new() -> Self {
5867 std::default::Default::default()
5868 }
5869
5870 /// Sets the value of [labels][crate::model::AccountDefenderAssessment::labels].
5871 ///
5872 /// # Example
5873 /// ```ignore,no_run
5874 /// # use google_cloud_recaptchaenterprise_v1::model::AccountDefenderAssessment;
5875 /// use google_cloud_recaptchaenterprise_v1::model::account_defender_assessment::AccountDefenderLabel;
5876 /// let x = AccountDefenderAssessment::new().set_labels([
5877 /// AccountDefenderLabel::ProfileMatch,
5878 /// AccountDefenderLabel::SuspiciousLoginActivity,
5879 /// AccountDefenderLabel::SuspiciousAccountCreation,
5880 /// ]);
5881 /// ```
5882 pub fn set_labels<T, V>(mut self, v: T) -> Self
5883 where
5884 T: std::iter::IntoIterator<Item = V>,
5885 V: std::convert::Into<crate::model::account_defender_assessment::AccountDefenderLabel>,
5886 {
5887 use std::iter::Iterator;
5888 self.labels = v.into_iter().map(|i| i.into()).collect();
5889 self
5890 }
5891}
5892
5893impl wkt::message::Message for AccountDefenderAssessment {
5894 fn typename() -> &'static str {
5895 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment"
5896 }
5897}
5898
5899/// Defines additional types related to [AccountDefenderAssessment].
5900pub mod account_defender_assessment {
5901 #[allow(unused_imports)]
5902 use super::*;
5903
5904 /// Labels returned by account defender for this request.
5905 /// Ensure that applications can handle values not explicitly listed.
5906 ///
5907 /// # Working with unknown values
5908 ///
5909 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5910 /// additional enum variants at any time. Adding new variants is not considered
5911 /// a breaking change. Applications should write their code in anticipation of:
5912 ///
5913 /// - New values appearing in future releases of the client library, **and**
5914 /// - New values received dynamically, without application changes.
5915 ///
5916 /// Please consult the [Working with enums] section in the user guide for some
5917 /// guidelines.
5918 ///
5919 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5920 #[derive(Clone, Debug, PartialEq)]
5921 #[non_exhaustive]
5922 pub enum AccountDefenderLabel {
5923 /// Default unspecified type.
5924 Unspecified,
5925 /// The request matches a known good profile for the user.
5926 ProfileMatch,
5927 /// The request is potentially a suspicious login event and must be further
5928 /// verified either through multi-factor authentication or another system.
5929 SuspiciousLoginActivity,
5930 /// The request matched a profile that previously had suspicious account
5931 /// creation behavior. This can mean that this is a fake account.
5932 SuspiciousAccountCreation,
5933 /// The account in the request has a high number of related accounts. It does
5934 /// not necessarily imply that the account is bad but can require further
5935 /// investigation.
5936 RelatedAccountsNumberHigh,
5937 /// If set, the enum was initialized with an unknown value.
5938 ///
5939 /// Applications can examine the value using [AccountDefenderLabel::value] or
5940 /// [AccountDefenderLabel::name].
5941 UnknownValue(account_defender_label::UnknownValue),
5942 }
5943
5944 #[doc(hidden)]
5945 pub mod account_defender_label {
5946 #[allow(unused_imports)]
5947 use super::*;
5948 #[derive(Clone, Debug, PartialEq)]
5949 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5950 }
5951
5952 impl AccountDefenderLabel {
5953 /// Gets the enum value.
5954 ///
5955 /// Returns `None` if the enum contains an unknown value deserialized from
5956 /// the string representation of enums.
5957 pub fn value(&self) -> std::option::Option<i32> {
5958 match self {
5959 Self::Unspecified => std::option::Option::Some(0),
5960 Self::ProfileMatch => std::option::Option::Some(1),
5961 Self::SuspiciousLoginActivity => std::option::Option::Some(2),
5962 Self::SuspiciousAccountCreation => std::option::Option::Some(3),
5963 Self::RelatedAccountsNumberHigh => std::option::Option::Some(4),
5964 Self::UnknownValue(u) => u.0.value(),
5965 }
5966 }
5967
5968 /// Gets the enum value as a string.
5969 ///
5970 /// Returns `None` if the enum contains an unknown value deserialized from
5971 /// the integer representation of enums.
5972 pub fn name(&self) -> std::option::Option<&str> {
5973 match self {
5974 Self::Unspecified => {
5975 std::option::Option::Some("ACCOUNT_DEFENDER_LABEL_UNSPECIFIED")
5976 }
5977 Self::ProfileMatch => std::option::Option::Some("PROFILE_MATCH"),
5978 Self::SuspiciousLoginActivity => {
5979 std::option::Option::Some("SUSPICIOUS_LOGIN_ACTIVITY")
5980 }
5981 Self::SuspiciousAccountCreation => {
5982 std::option::Option::Some("SUSPICIOUS_ACCOUNT_CREATION")
5983 }
5984 Self::RelatedAccountsNumberHigh => {
5985 std::option::Option::Some("RELATED_ACCOUNTS_NUMBER_HIGH")
5986 }
5987 Self::UnknownValue(u) => u.0.name(),
5988 }
5989 }
5990 }
5991
5992 impl std::default::Default for AccountDefenderLabel {
5993 fn default() -> Self {
5994 use std::convert::From;
5995 Self::from(0)
5996 }
5997 }
5998
5999 impl std::fmt::Display for AccountDefenderLabel {
6000 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6001 wkt::internal::display_enum(f, self.name(), self.value())
6002 }
6003 }
6004
6005 impl std::convert::From<i32> for AccountDefenderLabel {
6006 fn from(value: i32) -> Self {
6007 match value {
6008 0 => Self::Unspecified,
6009 1 => Self::ProfileMatch,
6010 2 => Self::SuspiciousLoginActivity,
6011 3 => Self::SuspiciousAccountCreation,
6012 4 => Self::RelatedAccountsNumberHigh,
6013 _ => Self::UnknownValue(account_defender_label::UnknownValue(
6014 wkt::internal::UnknownEnumValue::Integer(value),
6015 )),
6016 }
6017 }
6018 }
6019
6020 impl std::convert::From<&str> for AccountDefenderLabel {
6021 fn from(value: &str) -> Self {
6022 use std::string::ToString;
6023 match value {
6024 "ACCOUNT_DEFENDER_LABEL_UNSPECIFIED" => Self::Unspecified,
6025 "PROFILE_MATCH" => Self::ProfileMatch,
6026 "SUSPICIOUS_LOGIN_ACTIVITY" => Self::SuspiciousLoginActivity,
6027 "SUSPICIOUS_ACCOUNT_CREATION" => Self::SuspiciousAccountCreation,
6028 "RELATED_ACCOUNTS_NUMBER_HIGH" => Self::RelatedAccountsNumberHigh,
6029 _ => Self::UnknownValue(account_defender_label::UnknownValue(
6030 wkt::internal::UnknownEnumValue::String(value.to_string()),
6031 )),
6032 }
6033 }
6034 }
6035
6036 impl serde::ser::Serialize for AccountDefenderLabel {
6037 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6038 where
6039 S: serde::Serializer,
6040 {
6041 match self {
6042 Self::Unspecified => serializer.serialize_i32(0),
6043 Self::ProfileMatch => serializer.serialize_i32(1),
6044 Self::SuspiciousLoginActivity => serializer.serialize_i32(2),
6045 Self::SuspiciousAccountCreation => serializer.serialize_i32(3),
6046 Self::RelatedAccountsNumberHigh => serializer.serialize_i32(4),
6047 Self::UnknownValue(u) => u.0.serialize(serializer),
6048 }
6049 }
6050 }
6051
6052 impl<'de> serde::de::Deserialize<'de> for AccountDefenderLabel {
6053 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6054 where
6055 D: serde::Deserializer<'de>,
6056 {
6057 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccountDefenderLabel>::new(
6058 ".google.cloud.recaptchaenterprise.v1.AccountDefenderAssessment.AccountDefenderLabel"))
6059 }
6060 }
6061}
6062
6063/// The create key request message.
6064#[derive(Clone, Default, PartialEq)]
6065#[non_exhaustive]
6066pub struct CreateKeyRequest {
6067 /// Required. The name of the project in which the key is created, in the
6068 /// format `projects/{project}`.
6069 pub parent: std::string::String,
6070
6071 /// Required. Information to create a reCAPTCHA Enterprise key.
6072 pub key: std::option::Option<crate::model::Key>,
6073
6074 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6075}
6076
6077impl CreateKeyRequest {
6078 /// Creates a new default instance.
6079 pub fn new() -> Self {
6080 std::default::Default::default()
6081 }
6082
6083 /// Sets the value of [parent][crate::model::CreateKeyRequest::parent].
6084 ///
6085 /// # Example
6086 /// ```ignore,no_run
6087 /// # use google_cloud_recaptchaenterprise_v1::model::CreateKeyRequest;
6088 /// let x = CreateKeyRequest::new().set_parent("example");
6089 /// ```
6090 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6091 self.parent = v.into();
6092 self
6093 }
6094
6095 /// Sets the value of [key][crate::model::CreateKeyRequest::key].
6096 ///
6097 /// # Example
6098 /// ```ignore,no_run
6099 /// # use google_cloud_recaptchaenterprise_v1::model::CreateKeyRequest;
6100 /// use google_cloud_recaptchaenterprise_v1::model::Key;
6101 /// let x = CreateKeyRequest::new().set_key(Key::default()/* use setters */);
6102 /// ```
6103 pub fn set_key<T>(mut self, v: T) -> Self
6104 where
6105 T: std::convert::Into<crate::model::Key>,
6106 {
6107 self.key = std::option::Option::Some(v.into());
6108 self
6109 }
6110
6111 /// Sets or clears the value of [key][crate::model::CreateKeyRequest::key].
6112 ///
6113 /// # Example
6114 /// ```ignore,no_run
6115 /// # use google_cloud_recaptchaenterprise_v1::model::CreateKeyRequest;
6116 /// use google_cloud_recaptchaenterprise_v1::model::Key;
6117 /// let x = CreateKeyRequest::new().set_or_clear_key(Some(Key::default()/* use setters */));
6118 /// let x = CreateKeyRequest::new().set_or_clear_key(None::<Key>);
6119 /// ```
6120 pub fn set_or_clear_key<T>(mut self, v: std::option::Option<T>) -> Self
6121 where
6122 T: std::convert::Into<crate::model::Key>,
6123 {
6124 self.key = v.map(|x| x.into());
6125 self
6126 }
6127}
6128
6129impl wkt::message::Message for CreateKeyRequest {
6130 fn typename() -> &'static str {
6131 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.CreateKeyRequest"
6132 }
6133}
6134
6135/// The list keys request message.
6136#[derive(Clone, Default, PartialEq)]
6137#[non_exhaustive]
6138pub struct ListKeysRequest {
6139 /// Required. The name of the project that contains the keys that is
6140 /// listed, in the format `projects/{project}`.
6141 pub parent: std::string::String,
6142
6143 /// Optional. The maximum number of keys to return. Default is 10. Max limit is
6144 /// 1000.
6145 pub page_size: i32,
6146
6147 /// Optional. The next_page_token value returned from a previous.
6148 /// ListKeysRequest, if any.
6149 pub page_token: std::string::String,
6150
6151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6152}
6153
6154impl ListKeysRequest {
6155 /// Creates a new default instance.
6156 pub fn new() -> Self {
6157 std::default::Default::default()
6158 }
6159
6160 /// Sets the value of [parent][crate::model::ListKeysRequest::parent].
6161 ///
6162 /// # Example
6163 /// ```ignore,no_run
6164 /// # use google_cloud_recaptchaenterprise_v1::model::ListKeysRequest;
6165 /// let x = ListKeysRequest::new().set_parent("example");
6166 /// ```
6167 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6168 self.parent = v.into();
6169 self
6170 }
6171
6172 /// Sets the value of [page_size][crate::model::ListKeysRequest::page_size].
6173 ///
6174 /// # Example
6175 /// ```ignore,no_run
6176 /// # use google_cloud_recaptchaenterprise_v1::model::ListKeysRequest;
6177 /// let x = ListKeysRequest::new().set_page_size(42);
6178 /// ```
6179 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6180 self.page_size = v.into();
6181 self
6182 }
6183
6184 /// Sets the value of [page_token][crate::model::ListKeysRequest::page_token].
6185 ///
6186 /// # Example
6187 /// ```ignore,no_run
6188 /// # use google_cloud_recaptchaenterprise_v1::model::ListKeysRequest;
6189 /// let x = ListKeysRequest::new().set_page_token("example");
6190 /// ```
6191 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6192 self.page_token = v.into();
6193 self
6194 }
6195}
6196
6197impl wkt::message::Message for ListKeysRequest {
6198 fn typename() -> &'static str {
6199 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListKeysRequest"
6200 }
6201}
6202
6203/// Response to request to list keys in a project.
6204#[derive(Clone, Default, PartialEq)]
6205#[non_exhaustive]
6206pub struct ListKeysResponse {
6207 /// Key details.
6208 pub keys: std::vec::Vec<crate::model::Key>,
6209
6210 /// Token to retrieve the next page of results. It is set to empty if no keys
6211 /// remain in results.
6212 pub next_page_token: std::string::String,
6213
6214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6215}
6216
6217impl ListKeysResponse {
6218 /// Creates a new default instance.
6219 pub fn new() -> Self {
6220 std::default::Default::default()
6221 }
6222
6223 /// Sets the value of [keys][crate::model::ListKeysResponse::keys].
6224 ///
6225 /// # Example
6226 /// ```ignore,no_run
6227 /// # use google_cloud_recaptchaenterprise_v1::model::ListKeysResponse;
6228 /// use google_cloud_recaptchaenterprise_v1::model::Key;
6229 /// let x = ListKeysResponse::new()
6230 /// .set_keys([
6231 /// Key::default()/* use setters */,
6232 /// Key::default()/* use (different) setters */,
6233 /// ]);
6234 /// ```
6235 pub fn set_keys<T, V>(mut self, v: T) -> Self
6236 where
6237 T: std::iter::IntoIterator<Item = V>,
6238 V: std::convert::Into<crate::model::Key>,
6239 {
6240 use std::iter::Iterator;
6241 self.keys = v.into_iter().map(|i| i.into()).collect();
6242 self
6243 }
6244
6245 /// Sets the value of [next_page_token][crate::model::ListKeysResponse::next_page_token].
6246 ///
6247 /// # Example
6248 /// ```ignore,no_run
6249 /// # use google_cloud_recaptchaenterprise_v1::model::ListKeysResponse;
6250 /// let x = ListKeysResponse::new().set_next_page_token("example");
6251 /// ```
6252 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6253 self.next_page_token = v.into();
6254 self
6255 }
6256}
6257
6258impl wkt::message::Message for ListKeysResponse {
6259 fn typename() -> &'static str {
6260 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListKeysResponse"
6261 }
6262}
6263
6264#[doc(hidden)]
6265impl google_cloud_gax::paginator::internal::PageableResponse for ListKeysResponse {
6266 type PageItem = crate::model::Key;
6267
6268 fn items(self) -> std::vec::Vec<Self::PageItem> {
6269 self.keys
6270 }
6271
6272 fn next_page_token(&self) -> std::string::String {
6273 use std::clone::Clone;
6274 self.next_page_token.clone()
6275 }
6276}
6277
6278/// The retrieve legacy secret key request message.
6279#[derive(Clone, Default, PartialEq)]
6280#[non_exhaustive]
6281pub struct RetrieveLegacySecretKeyRequest {
6282 /// Required. The public key name linked to the requested secret key in the
6283 /// format `projects/{project}/keys/{key}`.
6284 pub key: std::string::String,
6285
6286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6287}
6288
6289impl RetrieveLegacySecretKeyRequest {
6290 /// Creates a new default instance.
6291 pub fn new() -> Self {
6292 std::default::Default::default()
6293 }
6294
6295 /// Sets the value of [key][crate::model::RetrieveLegacySecretKeyRequest::key].
6296 ///
6297 /// # Example
6298 /// ```ignore,no_run
6299 /// # use google_cloud_recaptchaenterprise_v1::model::RetrieveLegacySecretKeyRequest;
6300 /// # let project_id = "project_id";
6301 /// # let key_id = "key_id";
6302 /// let x = RetrieveLegacySecretKeyRequest::new().set_key(format!("projects/{project_id}/keys/{key_id}"));
6303 /// ```
6304 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6305 self.key = v.into();
6306 self
6307 }
6308}
6309
6310impl wkt::message::Message for RetrieveLegacySecretKeyRequest {
6311 fn typename() -> &'static str {
6312 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyRequest"
6313 }
6314}
6315
6316/// The get key request message.
6317#[derive(Clone, Default, PartialEq)]
6318#[non_exhaustive]
6319pub struct GetKeyRequest {
6320 /// Required. The name of the requested key, in the format
6321 /// `projects/{project}/keys/{key}`.
6322 pub name: std::string::String,
6323
6324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6325}
6326
6327impl GetKeyRequest {
6328 /// Creates a new default instance.
6329 pub fn new() -> Self {
6330 std::default::Default::default()
6331 }
6332
6333 /// Sets the value of [name][crate::model::GetKeyRequest::name].
6334 ///
6335 /// # Example
6336 /// ```ignore,no_run
6337 /// # use google_cloud_recaptchaenterprise_v1::model::GetKeyRequest;
6338 /// # let project_id = "project_id";
6339 /// # let key_id = "key_id";
6340 /// let x = GetKeyRequest::new().set_name(format!("projects/{project_id}/keys/{key_id}"));
6341 /// ```
6342 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6343 self.name = v.into();
6344 self
6345 }
6346}
6347
6348impl wkt::message::Message for GetKeyRequest {
6349 fn typename() -> &'static str {
6350 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.GetKeyRequest"
6351 }
6352}
6353
6354/// The update key request message.
6355#[derive(Clone, Default, PartialEq)]
6356#[non_exhaustive]
6357pub struct UpdateKeyRequest {
6358 /// Required. The key to update.
6359 pub key: std::option::Option<crate::model::Key>,
6360
6361 /// Optional. The mask to control which fields of the key get updated. If the
6362 /// mask is not present, all fields are updated.
6363 pub update_mask: std::option::Option<wkt::FieldMask>,
6364
6365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6366}
6367
6368impl UpdateKeyRequest {
6369 /// Creates a new default instance.
6370 pub fn new() -> Self {
6371 std::default::Default::default()
6372 }
6373
6374 /// Sets the value of [key][crate::model::UpdateKeyRequest::key].
6375 ///
6376 /// # Example
6377 /// ```ignore,no_run
6378 /// # use google_cloud_recaptchaenterprise_v1::model::UpdateKeyRequest;
6379 /// use google_cloud_recaptchaenterprise_v1::model::Key;
6380 /// let x = UpdateKeyRequest::new().set_key(Key::default()/* use setters */);
6381 /// ```
6382 pub fn set_key<T>(mut self, v: T) -> Self
6383 where
6384 T: std::convert::Into<crate::model::Key>,
6385 {
6386 self.key = std::option::Option::Some(v.into());
6387 self
6388 }
6389
6390 /// Sets or clears the value of [key][crate::model::UpdateKeyRequest::key].
6391 ///
6392 /// # Example
6393 /// ```ignore,no_run
6394 /// # use google_cloud_recaptchaenterprise_v1::model::UpdateKeyRequest;
6395 /// use google_cloud_recaptchaenterprise_v1::model::Key;
6396 /// let x = UpdateKeyRequest::new().set_or_clear_key(Some(Key::default()/* use setters */));
6397 /// let x = UpdateKeyRequest::new().set_or_clear_key(None::<Key>);
6398 /// ```
6399 pub fn set_or_clear_key<T>(mut self, v: std::option::Option<T>) -> Self
6400 where
6401 T: std::convert::Into<crate::model::Key>,
6402 {
6403 self.key = v.map(|x| x.into());
6404 self
6405 }
6406
6407 /// Sets the value of [update_mask][crate::model::UpdateKeyRequest::update_mask].
6408 ///
6409 /// # Example
6410 /// ```ignore,no_run
6411 /// # use google_cloud_recaptchaenterprise_v1::model::UpdateKeyRequest;
6412 /// use wkt::FieldMask;
6413 /// let x = UpdateKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6414 /// ```
6415 pub fn set_update_mask<T>(mut self, v: T) -> Self
6416 where
6417 T: std::convert::Into<wkt::FieldMask>,
6418 {
6419 self.update_mask = std::option::Option::Some(v.into());
6420 self
6421 }
6422
6423 /// Sets or clears the value of [update_mask][crate::model::UpdateKeyRequest::update_mask].
6424 ///
6425 /// # Example
6426 /// ```ignore,no_run
6427 /// # use google_cloud_recaptchaenterprise_v1::model::UpdateKeyRequest;
6428 /// use wkt::FieldMask;
6429 /// let x = UpdateKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6430 /// let x = UpdateKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6431 /// ```
6432 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6433 where
6434 T: std::convert::Into<wkt::FieldMask>,
6435 {
6436 self.update_mask = v.map(|x| x.into());
6437 self
6438 }
6439}
6440
6441impl wkt::message::Message for UpdateKeyRequest {
6442 fn typename() -> &'static str {
6443 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.UpdateKeyRequest"
6444 }
6445}
6446
6447/// The delete key request message.
6448#[derive(Clone, Default, PartialEq)]
6449#[non_exhaustive]
6450pub struct DeleteKeyRequest {
6451 /// Required. The name of the key to be deleted, in the format
6452 /// `projects/{project}/keys/{key}`.
6453 pub name: std::string::String,
6454
6455 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6456}
6457
6458impl DeleteKeyRequest {
6459 /// Creates a new default instance.
6460 pub fn new() -> Self {
6461 std::default::Default::default()
6462 }
6463
6464 /// Sets the value of [name][crate::model::DeleteKeyRequest::name].
6465 ///
6466 /// # Example
6467 /// ```ignore,no_run
6468 /// # use google_cloud_recaptchaenterprise_v1::model::DeleteKeyRequest;
6469 /// # let project_id = "project_id";
6470 /// # let key_id = "key_id";
6471 /// let x = DeleteKeyRequest::new().set_name(format!("projects/{project_id}/keys/{key_id}"));
6472 /// ```
6473 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6474 self.name = v.into();
6475 self
6476 }
6477}
6478
6479impl wkt::message::Message for DeleteKeyRequest {
6480 fn typename() -> &'static str {
6481 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.DeleteKeyRequest"
6482 }
6483}
6484
6485/// The create firewall policy request message.
6486#[derive(Clone, Default, PartialEq)]
6487#[non_exhaustive]
6488pub struct CreateFirewallPolicyRequest {
6489 /// Required. The name of the project this policy applies to, in the format
6490 /// `projects/{project}`.
6491 pub parent: std::string::String,
6492
6493 /// Required. Information to create the policy.
6494 pub firewall_policy: std::option::Option<crate::model::FirewallPolicy>,
6495
6496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6497}
6498
6499impl CreateFirewallPolicyRequest {
6500 /// Creates a new default instance.
6501 pub fn new() -> Self {
6502 std::default::Default::default()
6503 }
6504
6505 /// Sets the value of [parent][crate::model::CreateFirewallPolicyRequest::parent].
6506 ///
6507 /// # Example
6508 /// ```ignore,no_run
6509 /// # use google_cloud_recaptchaenterprise_v1::model::CreateFirewallPolicyRequest;
6510 /// let x = CreateFirewallPolicyRequest::new().set_parent("example");
6511 /// ```
6512 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6513 self.parent = v.into();
6514 self
6515 }
6516
6517 /// Sets the value of [firewall_policy][crate::model::CreateFirewallPolicyRequest::firewall_policy].
6518 ///
6519 /// # Example
6520 /// ```ignore,no_run
6521 /// # use google_cloud_recaptchaenterprise_v1::model::CreateFirewallPolicyRequest;
6522 /// use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
6523 /// let x = CreateFirewallPolicyRequest::new().set_firewall_policy(FirewallPolicy::default()/* use setters */);
6524 /// ```
6525 pub fn set_firewall_policy<T>(mut self, v: T) -> Self
6526 where
6527 T: std::convert::Into<crate::model::FirewallPolicy>,
6528 {
6529 self.firewall_policy = std::option::Option::Some(v.into());
6530 self
6531 }
6532
6533 /// Sets or clears the value of [firewall_policy][crate::model::CreateFirewallPolicyRequest::firewall_policy].
6534 ///
6535 /// # Example
6536 /// ```ignore,no_run
6537 /// # use google_cloud_recaptchaenterprise_v1::model::CreateFirewallPolicyRequest;
6538 /// use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
6539 /// let x = CreateFirewallPolicyRequest::new().set_or_clear_firewall_policy(Some(FirewallPolicy::default()/* use setters */));
6540 /// let x = CreateFirewallPolicyRequest::new().set_or_clear_firewall_policy(None::<FirewallPolicy>);
6541 /// ```
6542 pub fn set_or_clear_firewall_policy<T>(mut self, v: std::option::Option<T>) -> Self
6543 where
6544 T: std::convert::Into<crate::model::FirewallPolicy>,
6545 {
6546 self.firewall_policy = v.map(|x| x.into());
6547 self
6548 }
6549}
6550
6551impl wkt::message::Message for CreateFirewallPolicyRequest {
6552 fn typename() -> &'static str {
6553 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.CreateFirewallPolicyRequest"
6554 }
6555}
6556
6557/// The list firewall policies request message.
6558#[derive(Clone, Default, PartialEq)]
6559#[non_exhaustive]
6560pub struct ListFirewallPoliciesRequest {
6561 /// Required. The name of the project to list the policies for, in the format
6562 /// `projects/{project}`.
6563 pub parent: std::string::String,
6564
6565 /// Optional. The maximum number of policies to return. Default is 10. Max
6566 /// limit is 1000.
6567 pub page_size: i32,
6568
6569 /// Optional. The next_page_token value returned from a previous.
6570 /// ListFirewallPoliciesRequest, if any.
6571 pub page_token: std::string::String,
6572
6573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6574}
6575
6576impl ListFirewallPoliciesRequest {
6577 /// Creates a new default instance.
6578 pub fn new() -> Self {
6579 std::default::Default::default()
6580 }
6581
6582 /// Sets the value of [parent][crate::model::ListFirewallPoliciesRequest::parent].
6583 ///
6584 /// # Example
6585 /// ```ignore,no_run
6586 /// # use google_cloud_recaptchaenterprise_v1::model::ListFirewallPoliciesRequest;
6587 /// let x = ListFirewallPoliciesRequest::new().set_parent("example");
6588 /// ```
6589 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6590 self.parent = v.into();
6591 self
6592 }
6593
6594 /// Sets the value of [page_size][crate::model::ListFirewallPoliciesRequest::page_size].
6595 ///
6596 /// # Example
6597 /// ```ignore,no_run
6598 /// # use google_cloud_recaptchaenterprise_v1::model::ListFirewallPoliciesRequest;
6599 /// let x = ListFirewallPoliciesRequest::new().set_page_size(42);
6600 /// ```
6601 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6602 self.page_size = v.into();
6603 self
6604 }
6605
6606 /// Sets the value of [page_token][crate::model::ListFirewallPoliciesRequest::page_token].
6607 ///
6608 /// # Example
6609 /// ```ignore,no_run
6610 /// # use google_cloud_recaptchaenterprise_v1::model::ListFirewallPoliciesRequest;
6611 /// let x = ListFirewallPoliciesRequest::new().set_page_token("example");
6612 /// ```
6613 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6614 self.page_token = v.into();
6615 self
6616 }
6617}
6618
6619impl wkt::message::Message for ListFirewallPoliciesRequest {
6620 fn typename() -> &'static str {
6621 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListFirewallPoliciesRequest"
6622 }
6623}
6624
6625/// Response to request to list firewall policies belonging to a project.
6626#[derive(Clone, Default, PartialEq)]
6627#[non_exhaustive]
6628pub struct ListFirewallPoliciesResponse {
6629 /// Policy details.
6630 pub firewall_policies: std::vec::Vec<crate::model::FirewallPolicy>,
6631
6632 /// Token to retrieve the next page of results. It is set to empty if no
6633 /// policies remain in results.
6634 pub next_page_token: std::string::String,
6635
6636 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6637}
6638
6639impl ListFirewallPoliciesResponse {
6640 /// Creates a new default instance.
6641 pub fn new() -> Self {
6642 std::default::Default::default()
6643 }
6644
6645 /// Sets the value of [firewall_policies][crate::model::ListFirewallPoliciesResponse::firewall_policies].
6646 ///
6647 /// # Example
6648 /// ```ignore,no_run
6649 /// # use google_cloud_recaptchaenterprise_v1::model::ListFirewallPoliciesResponse;
6650 /// use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
6651 /// let x = ListFirewallPoliciesResponse::new()
6652 /// .set_firewall_policies([
6653 /// FirewallPolicy::default()/* use setters */,
6654 /// FirewallPolicy::default()/* use (different) setters */,
6655 /// ]);
6656 /// ```
6657 pub fn set_firewall_policies<T, V>(mut self, v: T) -> Self
6658 where
6659 T: std::iter::IntoIterator<Item = V>,
6660 V: std::convert::Into<crate::model::FirewallPolicy>,
6661 {
6662 use std::iter::Iterator;
6663 self.firewall_policies = v.into_iter().map(|i| i.into()).collect();
6664 self
6665 }
6666
6667 /// Sets the value of [next_page_token][crate::model::ListFirewallPoliciesResponse::next_page_token].
6668 ///
6669 /// # Example
6670 /// ```ignore,no_run
6671 /// # use google_cloud_recaptchaenterprise_v1::model::ListFirewallPoliciesResponse;
6672 /// let x = ListFirewallPoliciesResponse::new().set_next_page_token("example");
6673 /// ```
6674 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6675 self.next_page_token = v.into();
6676 self
6677 }
6678}
6679
6680impl wkt::message::Message for ListFirewallPoliciesResponse {
6681 fn typename() -> &'static str {
6682 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListFirewallPoliciesResponse"
6683 }
6684}
6685
6686#[doc(hidden)]
6687impl google_cloud_gax::paginator::internal::PageableResponse for ListFirewallPoliciesResponse {
6688 type PageItem = crate::model::FirewallPolicy;
6689
6690 fn items(self) -> std::vec::Vec<Self::PageItem> {
6691 self.firewall_policies
6692 }
6693
6694 fn next_page_token(&self) -> std::string::String {
6695 use std::clone::Clone;
6696 self.next_page_token.clone()
6697 }
6698}
6699
6700/// The get firewall policy request message.
6701#[derive(Clone, Default, PartialEq)]
6702#[non_exhaustive]
6703pub struct GetFirewallPolicyRequest {
6704 /// Required. The name of the requested policy, in the format
6705 /// `projects/{project}/firewallpolicies/{firewallpolicy}`.
6706 pub name: std::string::String,
6707
6708 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6709}
6710
6711impl GetFirewallPolicyRequest {
6712 /// Creates a new default instance.
6713 pub fn new() -> Self {
6714 std::default::Default::default()
6715 }
6716
6717 /// Sets the value of [name][crate::model::GetFirewallPolicyRequest::name].
6718 ///
6719 /// # Example
6720 /// ```ignore,no_run
6721 /// # use google_cloud_recaptchaenterprise_v1::model::GetFirewallPolicyRequest;
6722 /// # let project_id = "project_id";
6723 /// # let firewallpolicy_id = "firewallpolicy_id";
6724 /// let x = GetFirewallPolicyRequest::new().set_name(format!("projects/{project_id}/firewallpolicies/{firewallpolicy_id}"));
6725 /// ```
6726 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6727 self.name = v.into();
6728 self
6729 }
6730}
6731
6732impl wkt::message::Message for GetFirewallPolicyRequest {
6733 fn typename() -> &'static str {
6734 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.GetFirewallPolicyRequest"
6735 }
6736}
6737
6738/// The update firewall policy request message.
6739#[derive(Clone, Default, PartialEq)]
6740#[non_exhaustive]
6741pub struct UpdateFirewallPolicyRequest {
6742 /// Required. The policy to update.
6743 pub firewall_policy: std::option::Option<crate::model::FirewallPolicy>,
6744
6745 /// Optional. The mask to control which fields of the policy get updated. If
6746 /// the mask is not present, all fields are updated.
6747 pub update_mask: std::option::Option<wkt::FieldMask>,
6748
6749 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6750}
6751
6752impl UpdateFirewallPolicyRequest {
6753 /// Creates a new default instance.
6754 pub fn new() -> Self {
6755 std::default::Default::default()
6756 }
6757
6758 /// Sets the value of [firewall_policy][crate::model::UpdateFirewallPolicyRequest::firewall_policy].
6759 ///
6760 /// # Example
6761 /// ```ignore,no_run
6762 /// # use google_cloud_recaptchaenterprise_v1::model::UpdateFirewallPolicyRequest;
6763 /// use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
6764 /// let x = UpdateFirewallPolicyRequest::new().set_firewall_policy(FirewallPolicy::default()/* use setters */);
6765 /// ```
6766 pub fn set_firewall_policy<T>(mut self, v: T) -> Self
6767 where
6768 T: std::convert::Into<crate::model::FirewallPolicy>,
6769 {
6770 self.firewall_policy = std::option::Option::Some(v.into());
6771 self
6772 }
6773
6774 /// Sets or clears the value of [firewall_policy][crate::model::UpdateFirewallPolicyRequest::firewall_policy].
6775 ///
6776 /// # Example
6777 /// ```ignore,no_run
6778 /// # use google_cloud_recaptchaenterprise_v1::model::UpdateFirewallPolicyRequest;
6779 /// use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
6780 /// let x = UpdateFirewallPolicyRequest::new().set_or_clear_firewall_policy(Some(FirewallPolicy::default()/* use setters */));
6781 /// let x = UpdateFirewallPolicyRequest::new().set_or_clear_firewall_policy(None::<FirewallPolicy>);
6782 /// ```
6783 pub fn set_or_clear_firewall_policy<T>(mut self, v: std::option::Option<T>) -> Self
6784 where
6785 T: std::convert::Into<crate::model::FirewallPolicy>,
6786 {
6787 self.firewall_policy = v.map(|x| x.into());
6788 self
6789 }
6790
6791 /// Sets the value of [update_mask][crate::model::UpdateFirewallPolicyRequest::update_mask].
6792 ///
6793 /// # Example
6794 /// ```ignore,no_run
6795 /// # use google_cloud_recaptchaenterprise_v1::model::UpdateFirewallPolicyRequest;
6796 /// use wkt::FieldMask;
6797 /// let x = UpdateFirewallPolicyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6798 /// ```
6799 pub fn set_update_mask<T>(mut self, v: T) -> Self
6800 where
6801 T: std::convert::Into<wkt::FieldMask>,
6802 {
6803 self.update_mask = std::option::Option::Some(v.into());
6804 self
6805 }
6806
6807 /// Sets or clears the value of [update_mask][crate::model::UpdateFirewallPolicyRequest::update_mask].
6808 ///
6809 /// # Example
6810 /// ```ignore,no_run
6811 /// # use google_cloud_recaptchaenterprise_v1::model::UpdateFirewallPolicyRequest;
6812 /// use wkt::FieldMask;
6813 /// let x = UpdateFirewallPolicyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6814 /// let x = UpdateFirewallPolicyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6815 /// ```
6816 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6817 where
6818 T: std::convert::Into<wkt::FieldMask>,
6819 {
6820 self.update_mask = v.map(|x| x.into());
6821 self
6822 }
6823}
6824
6825impl wkt::message::Message for UpdateFirewallPolicyRequest {
6826 fn typename() -> &'static str {
6827 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.UpdateFirewallPolicyRequest"
6828 }
6829}
6830
6831/// The delete firewall policy request message.
6832#[derive(Clone, Default, PartialEq)]
6833#[non_exhaustive]
6834pub struct DeleteFirewallPolicyRequest {
6835 /// Required. The name of the policy to be deleted, in the format
6836 /// `projects/{project}/firewallpolicies/{firewallpolicy}`.
6837 pub name: std::string::String,
6838
6839 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6840}
6841
6842impl DeleteFirewallPolicyRequest {
6843 /// Creates a new default instance.
6844 pub fn new() -> Self {
6845 std::default::Default::default()
6846 }
6847
6848 /// Sets the value of [name][crate::model::DeleteFirewallPolicyRequest::name].
6849 ///
6850 /// # Example
6851 /// ```ignore,no_run
6852 /// # use google_cloud_recaptchaenterprise_v1::model::DeleteFirewallPolicyRequest;
6853 /// # let project_id = "project_id";
6854 /// # let firewallpolicy_id = "firewallpolicy_id";
6855 /// let x = DeleteFirewallPolicyRequest::new().set_name(format!("projects/{project_id}/firewallpolicies/{firewallpolicy_id}"));
6856 /// ```
6857 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6858 self.name = v.into();
6859 self
6860 }
6861}
6862
6863impl wkt::message::Message for DeleteFirewallPolicyRequest {
6864 fn typename() -> &'static str {
6865 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.DeleteFirewallPolicyRequest"
6866 }
6867}
6868
6869/// The reorder firewall policies request message.
6870#[derive(Clone, Default, PartialEq)]
6871#[non_exhaustive]
6872pub struct ReorderFirewallPoliciesRequest {
6873 /// Required. The name of the project to list the policies for, in the format
6874 /// `projects/{project}`.
6875 pub parent: std::string::String,
6876
6877 /// Required. A list containing all policy names, in the new order. Each name
6878 /// is in the format `projects/{project}/firewallpolicies/{firewallpolicy}`.
6879 pub names: std::vec::Vec<std::string::String>,
6880
6881 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6882}
6883
6884impl ReorderFirewallPoliciesRequest {
6885 /// Creates a new default instance.
6886 pub fn new() -> Self {
6887 std::default::Default::default()
6888 }
6889
6890 /// Sets the value of [parent][crate::model::ReorderFirewallPoliciesRequest::parent].
6891 ///
6892 /// # Example
6893 /// ```ignore,no_run
6894 /// # use google_cloud_recaptchaenterprise_v1::model::ReorderFirewallPoliciesRequest;
6895 /// let x = ReorderFirewallPoliciesRequest::new().set_parent("example");
6896 /// ```
6897 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6898 self.parent = v.into();
6899 self
6900 }
6901
6902 /// Sets the value of [names][crate::model::ReorderFirewallPoliciesRequest::names].
6903 ///
6904 /// # Example
6905 /// ```ignore,no_run
6906 /// # use google_cloud_recaptchaenterprise_v1::model::ReorderFirewallPoliciesRequest;
6907 /// let x = ReorderFirewallPoliciesRequest::new().set_names(["a", "b", "c"]);
6908 /// ```
6909 pub fn set_names<T, V>(mut self, v: T) -> Self
6910 where
6911 T: std::iter::IntoIterator<Item = V>,
6912 V: std::convert::Into<std::string::String>,
6913 {
6914 use std::iter::Iterator;
6915 self.names = v.into_iter().map(|i| i.into()).collect();
6916 self
6917 }
6918}
6919
6920impl wkt::message::Message for ReorderFirewallPoliciesRequest {
6921 fn typename() -> &'static str {
6922 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ReorderFirewallPoliciesRequest"
6923 }
6924}
6925
6926/// The reorder firewall policies response message.
6927#[derive(Clone, Default, PartialEq)]
6928#[non_exhaustive]
6929pub struct ReorderFirewallPoliciesResponse {
6930 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6931}
6932
6933impl ReorderFirewallPoliciesResponse {
6934 /// Creates a new default instance.
6935 pub fn new() -> Self {
6936 std::default::Default::default()
6937 }
6938}
6939
6940impl wkt::message::Message for ReorderFirewallPoliciesResponse {
6941 fn typename() -> &'static str {
6942 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ReorderFirewallPoliciesResponse"
6943 }
6944}
6945
6946/// The migrate key request message.
6947#[derive(Clone, Default, PartialEq)]
6948#[non_exhaustive]
6949pub struct MigrateKeyRequest {
6950 /// Required. The name of the key to be migrated, in the format
6951 /// `projects/{project}/keys/{key}`.
6952 pub name: std::string::String,
6953
6954 /// Optional. If true, skips the billing check.
6955 /// A reCAPTCHA Enterprise key or migrated key behaves differently than a
6956 /// reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see
6957 /// <https://docs.cloud.google.com/recaptcha/quotas#quota_limit>). To avoid
6958 /// any disruption of your usage, we check that a billing account is present.
6959 /// If your usage of reCAPTCHA is under the free quota, you can safely skip the
6960 /// billing check and proceed with the migration. See
6961 /// <https://cloud.google.com/recaptcha/docs/billing-information>.
6962 pub skip_billing_check: bool,
6963
6964 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6965}
6966
6967impl MigrateKeyRequest {
6968 /// Creates a new default instance.
6969 pub fn new() -> Self {
6970 std::default::Default::default()
6971 }
6972
6973 /// Sets the value of [name][crate::model::MigrateKeyRequest::name].
6974 ///
6975 /// # Example
6976 /// ```ignore,no_run
6977 /// # use google_cloud_recaptchaenterprise_v1::model::MigrateKeyRequest;
6978 /// # let project_id = "project_id";
6979 /// # let key_id = "key_id";
6980 /// let x = MigrateKeyRequest::new().set_name(format!("projects/{project_id}/keys/{key_id}"));
6981 /// ```
6982 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6983 self.name = v.into();
6984 self
6985 }
6986
6987 /// Sets the value of [skip_billing_check][crate::model::MigrateKeyRequest::skip_billing_check].
6988 ///
6989 /// # Example
6990 /// ```ignore,no_run
6991 /// # use google_cloud_recaptchaenterprise_v1::model::MigrateKeyRequest;
6992 /// let x = MigrateKeyRequest::new().set_skip_billing_check(true);
6993 /// ```
6994 pub fn set_skip_billing_check<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6995 self.skip_billing_check = v.into();
6996 self
6997 }
6998}
6999
7000impl wkt::message::Message for MigrateKeyRequest {
7001 fn typename() -> &'static str {
7002 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.MigrateKeyRequest"
7003 }
7004}
7005
7006/// The get metrics request message.
7007#[derive(Clone, Default, PartialEq)]
7008#[non_exhaustive]
7009pub struct GetMetricsRequest {
7010 /// Required. The name of the requested metrics, in the format
7011 /// `projects/{project}/keys/{key}/metrics`.
7012 pub name: std::string::String,
7013
7014 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7015}
7016
7017impl GetMetricsRequest {
7018 /// Creates a new default instance.
7019 pub fn new() -> Self {
7020 std::default::Default::default()
7021 }
7022
7023 /// Sets the value of [name][crate::model::GetMetricsRequest::name].
7024 ///
7025 /// # Example
7026 /// ```ignore,no_run
7027 /// # use google_cloud_recaptchaenterprise_v1::model::GetMetricsRequest;
7028 /// # let project_id = "project_id";
7029 /// # let key_id = "key_id";
7030 /// let x = GetMetricsRequest::new().set_name(format!("projects/{project_id}/keys/{key_id}/metrics"));
7031 /// ```
7032 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7033 self.name = v.into();
7034 self
7035 }
7036}
7037
7038impl wkt::message::Message for GetMetricsRequest {
7039 fn typename() -> &'static str {
7040 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.GetMetricsRequest"
7041 }
7042}
7043
7044/// Metrics for a single Key.
7045#[derive(Clone, Default, PartialEq)]
7046#[non_exhaustive]
7047pub struct Metrics {
7048 /// Output only. Identifier. The name of the metrics, in the format
7049 /// `projects/{project}/keys/{key}/metrics`.
7050 pub name: std::string::String,
7051
7052 /// Inclusive start time aligned to a day in the America/Los_Angeles (Pacific)
7053 /// timezone.
7054 pub start_time: std::option::Option<wkt::Timestamp>,
7055
7056 /// Metrics are continuous and in order by dates, and in the granularity
7057 /// of day. All Key types should have score-based data.
7058 pub score_metrics: std::vec::Vec<crate::model::ScoreMetrics>,
7059
7060 /// Metrics are continuous and in order by dates, and in the granularity
7061 /// of day. Only challenge-based keys (CHECKBOX, INVISIBLE) have
7062 /// challenge-based data.
7063 pub challenge_metrics: std::vec::Vec<crate::model::ChallengeMetrics>,
7064
7065 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7066}
7067
7068impl Metrics {
7069 /// Creates a new default instance.
7070 pub fn new() -> Self {
7071 std::default::Default::default()
7072 }
7073
7074 /// Sets the value of [name][crate::model::Metrics::name].
7075 ///
7076 /// # Example
7077 /// ```ignore,no_run
7078 /// # use google_cloud_recaptchaenterprise_v1::model::Metrics;
7079 /// # let project_id = "project_id";
7080 /// # let key_id = "key_id";
7081 /// let x = Metrics::new().set_name(format!("projects/{project_id}/keys/{key_id}/metrics"));
7082 /// ```
7083 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7084 self.name = v.into();
7085 self
7086 }
7087
7088 /// Sets the value of [start_time][crate::model::Metrics::start_time].
7089 ///
7090 /// # Example
7091 /// ```ignore,no_run
7092 /// # use google_cloud_recaptchaenterprise_v1::model::Metrics;
7093 /// use wkt::Timestamp;
7094 /// let x = Metrics::new().set_start_time(Timestamp::default()/* use setters */);
7095 /// ```
7096 pub fn set_start_time<T>(mut self, v: T) -> Self
7097 where
7098 T: std::convert::Into<wkt::Timestamp>,
7099 {
7100 self.start_time = std::option::Option::Some(v.into());
7101 self
7102 }
7103
7104 /// Sets or clears the value of [start_time][crate::model::Metrics::start_time].
7105 ///
7106 /// # Example
7107 /// ```ignore,no_run
7108 /// # use google_cloud_recaptchaenterprise_v1::model::Metrics;
7109 /// use wkt::Timestamp;
7110 /// let x = Metrics::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
7111 /// let x = Metrics::new().set_or_clear_start_time(None::<Timestamp>);
7112 /// ```
7113 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7114 where
7115 T: std::convert::Into<wkt::Timestamp>,
7116 {
7117 self.start_time = v.map(|x| x.into());
7118 self
7119 }
7120
7121 /// Sets the value of [score_metrics][crate::model::Metrics::score_metrics].
7122 ///
7123 /// # Example
7124 /// ```ignore,no_run
7125 /// # use google_cloud_recaptchaenterprise_v1::model::Metrics;
7126 /// use google_cloud_recaptchaenterprise_v1::model::ScoreMetrics;
7127 /// let x = Metrics::new()
7128 /// .set_score_metrics([
7129 /// ScoreMetrics::default()/* use setters */,
7130 /// ScoreMetrics::default()/* use (different) setters */,
7131 /// ]);
7132 /// ```
7133 pub fn set_score_metrics<T, V>(mut self, v: T) -> Self
7134 where
7135 T: std::iter::IntoIterator<Item = V>,
7136 V: std::convert::Into<crate::model::ScoreMetrics>,
7137 {
7138 use std::iter::Iterator;
7139 self.score_metrics = v.into_iter().map(|i| i.into()).collect();
7140 self
7141 }
7142
7143 /// Sets the value of [challenge_metrics][crate::model::Metrics::challenge_metrics].
7144 ///
7145 /// # Example
7146 /// ```ignore,no_run
7147 /// # use google_cloud_recaptchaenterprise_v1::model::Metrics;
7148 /// use google_cloud_recaptchaenterprise_v1::model::ChallengeMetrics;
7149 /// let x = Metrics::new()
7150 /// .set_challenge_metrics([
7151 /// ChallengeMetrics::default()/* use setters */,
7152 /// ChallengeMetrics::default()/* use (different) setters */,
7153 /// ]);
7154 /// ```
7155 pub fn set_challenge_metrics<T, V>(mut self, v: T) -> Self
7156 where
7157 T: std::iter::IntoIterator<Item = V>,
7158 V: std::convert::Into<crate::model::ChallengeMetrics>,
7159 {
7160 use std::iter::Iterator;
7161 self.challenge_metrics = v.into_iter().map(|i| i.into()).collect();
7162 self
7163 }
7164}
7165
7166impl wkt::message::Message for Metrics {
7167 fn typename() -> &'static str {
7168 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.Metrics"
7169 }
7170}
7171
7172/// Secret key is used only in legacy reCAPTCHA. It must be used in a 3rd party
7173/// integration with legacy reCAPTCHA.
7174#[derive(Clone, Default, PartialEq)]
7175#[non_exhaustive]
7176pub struct RetrieveLegacySecretKeyResponse {
7177 /// The secret key (also known as shared secret) authorizes communication
7178 /// between your application backend and the reCAPTCHA Enterprise server to
7179 /// create an assessment.
7180 /// The secret key needs to be kept safe for security purposes.
7181 pub legacy_secret_key: std::string::String,
7182
7183 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7184}
7185
7186impl RetrieveLegacySecretKeyResponse {
7187 /// Creates a new default instance.
7188 pub fn new() -> Self {
7189 std::default::Default::default()
7190 }
7191
7192 /// Sets the value of [legacy_secret_key][crate::model::RetrieveLegacySecretKeyResponse::legacy_secret_key].
7193 ///
7194 /// # Example
7195 /// ```ignore,no_run
7196 /// # use google_cloud_recaptchaenterprise_v1::model::RetrieveLegacySecretKeyResponse;
7197 /// let x = RetrieveLegacySecretKeyResponse::new().set_legacy_secret_key("example");
7198 /// ```
7199 pub fn set_legacy_secret_key<T: std::convert::Into<std::string::String>>(
7200 mut self,
7201 v: T,
7202 ) -> Self {
7203 self.legacy_secret_key = v.into();
7204 self
7205 }
7206}
7207
7208impl wkt::message::Message for RetrieveLegacySecretKeyResponse {
7209 fn typename() -> &'static str {
7210 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.RetrieveLegacySecretKeyResponse"
7211 }
7212}
7213
7214/// A key used to identify and configure applications (web and/or mobile) that
7215/// use reCAPTCHA Enterprise.
7216#[derive(Clone, Default, PartialEq)]
7217#[non_exhaustive]
7218pub struct Key {
7219 /// Identifier. The resource name for the Key in the format
7220 /// `projects/{project}/keys/{key}`.
7221 pub name: std::string::String,
7222
7223 /// Required. Human-readable display name of this key. Modifiable by user.
7224 pub display_name: std::string::String,
7225
7226 /// Optional. See [Creating and managing labels]
7227 /// (<https://cloud.google.com/recaptcha/docs/labels>).
7228 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7229
7230 /// Output only. The timestamp corresponding to the creation of this key.
7231 pub create_time: std::option::Option<wkt::Timestamp>,
7232
7233 /// Optional. Options for user acceptance testing.
7234 pub testing_options: std::option::Option<crate::model::TestingOptions>,
7235
7236 /// Optional. Settings for Web Application Firewall (WAF).
7237 pub waf_settings: std::option::Option<crate::model::WafSettings>,
7238
7239 /// Platform-specific settings for this key. The key can only be used on a
7240 /// platform for which the settings are enabled.
7241 pub platform_settings: std::option::Option<crate::model::key::PlatformSettings>,
7242
7243 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7244}
7245
7246impl Key {
7247 /// Creates a new default instance.
7248 pub fn new() -> Self {
7249 std::default::Default::default()
7250 }
7251
7252 /// Sets the value of [name][crate::model::Key::name].
7253 ///
7254 /// # Example
7255 /// ```ignore,no_run
7256 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7257 /// # let project_id = "project_id";
7258 /// # let key_id = "key_id";
7259 /// let x = Key::new().set_name(format!("projects/{project_id}/keys/{key_id}"));
7260 /// ```
7261 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7262 self.name = v.into();
7263 self
7264 }
7265
7266 /// Sets the value of [display_name][crate::model::Key::display_name].
7267 ///
7268 /// # Example
7269 /// ```ignore,no_run
7270 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7271 /// let x = Key::new().set_display_name("example");
7272 /// ```
7273 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7274 self.display_name = v.into();
7275 self
7276 }
7277
7278 /// Sets the value of [labels][crate::model::Key::labels].
7279 ///
7280 /// # Example
7281 /// ```ignore,no_run
7282 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7283 /// let x = Key::new().set_labels([
7284 /// ("key0", "abc"),
7285 /// ("key1", "xyz"),
7286 /// ]);
7287 /// ```
7288 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7289 where
7290 T: std::iter::IntoIterator<Item = (K, V)>,
7291 K: std::convert::Into<std::string::String>,
7292 V: std::convert::Into<std::string::String>,
7293 {
7294 use std::iter::Iterator;
7295 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7296 self
7297 }
7298
7299 /// Sets the value of [create_time][crate::model::Key::create_time].
7300 ///
7301 /// # Example
7302 /// ```ignore,no_run
7303 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7304 /// use wkt::Timestamp;
7305 /// let x = Key::new().set_create_time(Timestamp::default()/* use setters */);
7306 /// ```
7307 pub fn set_create_time<T>(mut self, v: T) -> Self
7308 where
7309 T: std::convert::Into<wkt::Timestamp>,
7310 {
7311 self.create_time = std::option::Option::Some(v.into());
7312 self
7313 }
7314
7315 /// Sets or clears the value of [create_time][crate::model::Key::create_time].
7316 ///
7317 /// # Example
7318 /// ```ignore,no_run
7319 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7320 /// use wkt::Timestamp;
7321 /// let x = Key::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7322 /// let x = Key::new().set_or_clear_create_time(None::<Timestamp>);
7323 /// ```
7324 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7325 where
7326 T: std::convert::Into<wkt::Timestamp>,
7327 {
7328 self.create_time = v.map(|x| x.into());
7329 self
7330 }
7331
7332 /// Sets the value of [testing_options][crate::model::Key::testing_options].
7333 ///
7334 /// # Example
7335 /// ```ignore,no_run
7336 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7337 /// use google_cloud_recaptchaenterprise_v1::model::TestingOptions;
7338 /// let x = Key::new().set_testing_options(TestingOptions::default()/* use setters */);
7339 /// ```
7340 pub fn set_testing_options<T>(mut self, v: T) -> Self
7341 where
7342 T: std::convert::Into<crate::model::TestingOptions>,
7343 {
7344 self.testing_options = std::option::Option::Some(v.into());
7345 self
7346 }
7347
7348 /// Sets or clears the value of [testing_options][crate::model::Key::testing_options].
7349 ///
7350 /// # Example
7351 /// ```ignore,no_run
7352 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7353 /// use google_cloud_recaptchaenterprise_v1::model::TestingOptions;
7354 /// let x = Key::new().set_or_clear_testing_options(Some(TestingOptions::default()/* use setters */));
7355 /// let x = Key::new().set_or_clear_testing_options(None::<TestingOptions>);
7356 /// ```
7357 pub fn set_or_clear_testing_options<T>(mut self, v: std::option::Option<T>) -> Self
7358 where
7359 T: std::convert::Into<crate::model::TestingOptions>,
7360 {
7361 self.testing_options = v.map(|x| x.into());
7362 self
7363 }
7364
7365 /// Sets the value of [waf_settings][crate::model::Key::waf_settings].
7366 ///
7367 /// # Example
7368 /// ```ignore,no_run
7369 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7370 /// use google_cloud_recaptchaenterprise_v1::model::WafSettings;
7371 /// let x = Key::new().set_waf_settings(WafSettings::default()/* use setters */);
7372 /// ```
7373 pub fn set_waf_settings<T>(mut self, v: T) -> Self
7374 where
7375 T: std::convert::Into<crate::model::WafSettings>,
7376 {
7377 self.waf_settings = std::option::Option::Some(v.into());
7378 self
7379 }
7380
7381 /// Sets or clears the value of [waf_settings][crate::model::Key::waf_settings].
7382 ///
7383 /// # Example
7384 /// ```ignore,no_run
7385 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7386 /// use google_cloud_recaptchaenterprise_v1::model::WafSettings;
7387 /// let x = Key::new().set_or_clear_waf_settings(Some(WafSettings::default()/* use setters */));
7388 /// let x = Key::new().set_or_clear_waf_settings(None::<WafSettings>);
7389 /// ```
7390 pub fn set_or_clear_waf_settings<T>(mut self, v: std::option::Option<T>) -> Self
7391 where
7392 T: std::convert::Into<crate::model::WafSettings>,
7393 {
7394 self.waf_settings = v.map(|x| x.into());
7395 self
7396 }
7397
7398 /// Sets the value of [platform_settings][crate::model::Key::platform_settings].
7399 ///
7400 /// Note that all the setters affecting `platform_settings` are mutually
7401 /// exclusive.
7402 ///
7403 /// # Example
7404 /// ```ignore,no_run
7405 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7406 /// use google_cloud_recaptchaenterprise_v1::model::WebKeySettings;
7407 /// let x = Key::new().set_platform_settings(Some(
7408 /// google_cloud_recaptchaenterprise_v1::model::key::PlatformSettings::WebSettings(WebKeySettings::default().into())));
7409 /// ```
7410 pub fn set_platform_settings<
7411 T: std::convert::Into<std::option::Option<crate::model::key::PlatformSettings>>,
7412 >(
7413 mut self,
7414 v: T,
7415 ) -> Self {
7416 self.platform_settings = v.into();
7417 self
7418 }
7419
7420 /// The value of [platform_settings][crate::model::Key::platform_settings]
7421 /// if it holds a `WebSettings`, `None` if the field is not set or
7422 /// holds a different branch.
7423 pub fn web_settings(
7424 &self,
7425 ) -> std::option::Option<&std::boxed::Box<crate::model::WebKeySettings>> {
7426 #[allow(unreachable_patterns)]
7427 self.platform_settings.as_ref().and_then(|v| match v {
7428 crate::model::key::PlatformSettings::WebSettings(v) => std::option::Option::Some(v),
7429 _ => std::option::Option::None,
7430 })
7431 }
7432
7433 /// Sets the value of [platform_settings][crate::model::Key::platform_settings]
7434 /// to hold a `WebSettings`.
7435 ///
7436 /// Note that all the setters affecting `platform_settings` are
7437 /// mutually exclusive.
7438 ///
7439 /// # Example
7440 /// ```ignore,no_run
7441 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7442 /// use google_cloud_recaptchaenterprise_v1::model::WebKeySettings;
7443 /// let x = Key::new().set_web_settings(WebKeySettings::default()/* use setters */);
7444 /// assert!(x.web_settings().is_some());
7445 /// assert!(x.android_settings().is_none());
7446 /// assert!(x.ios_settings().is_none());
7447 /// assert!(x.express_settings().is_none());
7448 /// ```
7449 pub fn set_web_settings<
7450 T: std::convert::Into<std::boxed::Box<crate::model::WebKeySettings>>,
7451 >(
7452 mut self,
7453 v: T,
7454 ) -> Self {
7455 self.platform_settings =
7456 std::option::Option::Some(crate::model::key::PlatformSettings::WebSettings(v.into()));
7457 self
7458 }
7459
7460 /// The value of [platform_settings][crate::model::Key::platform_settings]
7461 /// if it holds a `AndroidSettings`, `None` if the field is not set or
7462 /// holds a different branch.
7463 pub fn android_settings(
7464 &self,
7465 ) -> std::option::Option<&std::boxed::Box<crate::model::AndroidKeySettings>> {
7466 #[allow(unreachable_patterns)]
7467 self.platform_settings.as_ref().and_then(|v| match v {
7468 crate::model::key::PlatformSettings::AndroidSettings(v) => std::option::Option::Some(v),
7469 _ => std::option::Option::None,
7470 })
7471 }
7472
7473 /// Sets the value of [platform_settings][crate::model::Key::platform_settings]
7474 /// to hold a `AndroidSettings`.
7475 ///
7476 /// Note that all the setters affecting `platform_settings` are
7477 /// mutually exclusive.
7478 ///
7479 /// # Example
7480 /// ```ignore,no_run
7481 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7482 /// use google_cloud_recaptchaenterprise_v1::model::AndroidKeySettings;
7483 /// let x = Key::new().set_android_settings(AndroidKeySettings::default()/* use setters */);
7484 /// assert!(x.android_settings().is_some());
7485 /// assert!(x.web_settings().is_none());
7486 /// assert!(x.ios_settings().is_none());
7487 /// assert!(x.express_settings().is_none());
7488 /// ```
7489 pub fn set_android_settings<
7490 T: std::convert::Into<std::boxed::Box<crate::model::AndroidKeySettings>>,
7491 >(
7492 mut self,
7493 v: T,
7494 ) -> Self {
7495 self.platform_settings = std::option::Option::Some(
7496 crate::model::key::PlatformSettings::AndroidSettings(v.into()),
7497 );
7498 self
7499 }
7500
7501 /// The value of [platform_settings][crate::model::Key::platform_settings]
7502 /// if it holds a `IosSettings`, `None` if the field is not set or
7503 /// holds a different branch.
7504 pub fn ios_settings(
7505 &self,
7506 ) -> std::option::Option<&std::boxed::Box<crate::model::IOSKeySettings>> {
7507 #[allow(unreachable_patterns)]
7508 self.platform_settings.as_ref().and_then(|v| match v {
7509 crate::model::key::PlatformSettings::IosSettings(v) => std::option::Option::Some(v),
7510 _ => std::option::Option::None,
7511 })
7512 }
7513
7514 /// Sets the value of [platform_settings][crate::model::Key::platform_settings]
7515 /// to hold a `IosSettings`.
7516 ///
7517 /// Note that all the setters affecting `platform_settings` are
7518 /// mutually exclusive.
7519 ///
7520 /// # Example
7521 /// ```ignore,no_run
7522 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7523 /// use google_cloud_recaptchaenterprise_v1::model::IOSKeySettings;
7524 /// let x = Key::new().set_ios_settings(IOSKeySettings::default()/* use setters */);
7525 /// assert!(x.ios_settings().is_some());
7526 /// assert!(x.web_settings().is_none());
7527 /// assert!(x.android_settings().is_none());
7528 /// assert!(x.express_settings().is_none());
7529 /// ```
7530 pub fn set_ios_settings<
7531 T: std::convert::Into<std::boxed::Box<crate::model::IOSKeySettings>>,
7532 >(
7533 mut self,
7534 v: T,
7535 ) -> Self {
7536 self.platform_settings =
7537 std::option::Option::Some(crate::model::key::PlatformSettings::IosSettings(v.into()));
7538 self
7539 }
7540
7541 /// The value of [platform_settings][crate::model::Key::platform_settings]
7542 /// if it holds a `ExpressSettings`, `None` if the field is not set or
7543 /// holds a different branch.
7544 pub fn express_settings(
7545 &self,
7546 ) -> std::option::Option<&std::boxed::Box<crate::model::ExpressKeySettings>> {
7547 #[allow(unreachable_patterns)]
7548 self.platform_settings.as_ref().and_then(|v| match v {
7549 crate::model::key::PlatformSettings::ExpressSettings(v) => std::option::Option::Some(v),
7550 _ => std::option::Option::None,
7551 })
7552 }
7553
7554 /// Sets the value of [platform_settings][crate::model::Key::platform_settings]
7555 /// to hold a `ExpressSettings`.
7556 ///
7557 /// Note that all the setters affecting `platform_settings` are
7558 /// mutually exclusive.
7559 ///
7560 /// # Example
7561 /// ```ignore,no_run
7562 /// # use google_cloud_recaptchaenterprise_v1::model::Key;
7563 /// use google_cloud_recaptchaenterprise_v1::model::ExpressKeySettings;
7564 /// let x = Key::new().set_express_settings(ExpressKeySettings::default()/* use setters */);
7565 /// assert!(x.express_settings().is_some());
7566 /// assert!(x.web_settings().is_none());
7567 /// assert!(x.android_settings().is_none());
7568 /// assert!(x.ios_settings().is_none());
7569 /// ```
7570 pub fn set_express_settings<
7571 T: std::convert::Into<std::boxed::Box<crate::model::ExpressKeySettings>>,
7572 >(
7573 mut self,
7574 v: T,
7575 ) -> Self {
7576 self.platform_settings = std::option::Option::Some(
7577 crate::model::key::PlatformSettings::ExpressSettings(v.into()),
7578 );
7579 self
7580 }
7581}
7582
7583impl wkt::message::Message for Key {
7584 fn typename() -> &'static str {
7585 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.Key"
7586 }
7587}
7588
7589/// Defines additional types related to [Key].
7590pub mod key {
7591 #[allow(unused_imports)]
7592 use super::*;
7593
7594 /// Platform-specific settings for this key. The key can only be used on a
7595 /// platform for which the settings are enabled.
7596 #[derive(Clone, Debug, PartialEq)]
7597 #[non_exhaustive]
7598 pub enum PlatformSettings {
7599 /// Settings for keys that can be used by websites.
7600 WebSettings(std::boxed::Box<crate::model::WebKeySettings>),
7601 /// Settings for keys that can be used by Android apps.
7602 AndroidSettings(std::boxed::Box<crate::model::AndroidKeySettings>),
7603 /// Settings for keys that can be used by iOS apps.
7604 IosSettings(std::boxed::Box<crate::model::IOSKeySettings>),
7605 /// Settings for keys that can be used by reCAPTCHA Express.
7606 ExpressSettings(std::boxed::Box<crate::model::ExpressKeySettings>),
7607 }
7608}
7609
7610/// Options for user acceptance testing.
7611#[derive(Clone, Default, PartialEq)]
7612#[non_exhaustive]
7613pub struct TestingOptions {
7614 /// Optional. All assessments for this Key return this score. Must be between 0
7615 /// (likely not legitimate) and 1 (likely legitimate) inclusive.
7616 pub testing_score: f32,
7617
7618 /// Optional. For challenge-based keys only (CHECKBOX, INVISIBLE), all
7619 /// challenge requests for this site return nocaptcha if NOCAPTCHA, or an
7620 /// unsolvable challenge if CHALLENGE.
7621 pub testing_challenge: crate::model::testing_options::TestingChallenge,
7622
7623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7624}
7625
7626impl TestingOptions {
7627 /// Creates a new default instance.
7628 pub fn new() -> Self {
7629 std::default::Default::default()
7630 }
7631
7632 /// Sets the value of [testing_score][crate::model::TestingOptions::testing_score].
7633 ///
7634 /// # Example
7635 /// ```ignore,no_run
7636 /// # use google_cloud_recaptchaenterprise_v1::model::TestingOptions;
7637 /// let x = TestingOptions::new().set_testing_score(42.0);
7638 /// ```
7639 pub fn set_testing_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
7640 self.testing_score = v.into();
7641 self
7642 }
7643
7644 /// Sets the value of [testing_challenge][crate::model::TestingOptions::testing_challenge].
7645 ///
7646 /// # Example
7647 /// ```ignore,no_run
7648 /// # use google_cloud_recaptchaenterprise_v1::model::TestingOptions;
7649 /// use google_cloud_recaptchaenterprise_v1::model::testing_options::TestingChallenge;
7650 /// let x0 = TestingOptions::new().set_testing_challenge(TestingChallenge::Nocaptcha);
7651 /// let x1 = TestingOptions::new().set_testing_challenge(TestingChallenge::UnsolvableChallenge);
7652 /// ```
7653 pub fn set_testing_challenge<
7654 T: std::convert::Into<crate::model::testing_options::TestingChallenge>,
7655 >(
7656 mut self,
7657 v: T,
7658 ) -> Self {
7659 self.testing_challenge = v.into();
7660 self
7661 }
7662}
7663
7664impl wkt::message::Message for TestingOptions {
7665 fn typename() -> &'static str {
7666 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.TestingOptions"
7667 }
7668}
7669
7670/// Defines additional types related to [TestingOptions].
7671pub mod testing_options {
7672 #[allow(unused_imports)]
7673 use super::*;
7674
7675 /// Enum that represents the challenge option for challenge-based (for example,
7676 /// CHECKBOX and INVISIBLE) testing keys.
7677 /// Ensure that applications can handle values not explicitly listed.
7678 ///
7679 /// # Working with unknown values
7680 ///
7681 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7682 /// additional enum variants at any time. Adding new variants is not considered
7683 /// a breaking change. Applications should write their code in anticipation of:
7684 ///
7685 /// - New values appearing in future releases of the client library, **and**
7686 /// - New values received dynamically, without application changes.
7687 ///
7688 /// Please consult the [Working with enums] section in the user guide for some
7689 /// guidelines.
7690 ///
7691 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7692 #[derive(Clone, Debug, PartialEq)]
7693 #[non_exhaustive]
7694 pub enum TestingChallenge {
7695 /// Perform the normal risk analysis and return either nocaptcha or a
7696 /// challenge depending on risk and trust factors.
7697 Unspecified,
7698 /// Challenge requests for this key always return a nocaptcha, which
7699 /// does not require a solution.
7700 Nocaptcha,
7701 /// Challenge requests for this key always return an unsolvable
7702 /// challenge.
7703 UnsolvableChallenge,
7704 /// If set, the enum was initialized with an unknown value.
7705 ///
7706 /// Applications can examine the value using [TestingChallenge::value] or
7707 /// [TestingChallenge::name].
7708 UnknownValue(testing_challenge::UnknownValue),
7709 }
7710
7711 #[doc(hidden)]
7712 pub mod testing_challenge {
7713 #[allow(unused_imports)]
7714 use super::*;
7715 #[derive(Clone, Debug, PartialEq)]
7716 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7717 }
7718
7719 impl TestingChallenge {
7720 /// Gets the enum value.
7721 ///
7722 /// Returns `None` if the enum contains an unknown value deserialized from
7723 /// the string representation of enums.
7724 pub fn value(&self) -> std::option::Option<i32> {
7725 match self {
7726 Self::Unspecified => std::option::Option::Some(0),
7727 Self::Nocaptcha => std::option::Option::Some(1),
7728 Self::UnsolvableChallenge => std::option::Option::Some(2),
7729 Self::UnknownValue(u) => u.0.value(),
7730 }
7731 }
7732
7733 /// Gets the enum value as a string.
7734 ///
7735 /// Returns `None` if the enum contains an unknown value deserialized from
7736 /// the integer representation of enums.
7737 pub fn name(&self) -> std::option::Option<&str> {
7738 match self {
7739 Self::Unspecified => std::option::Option::Some("TESTING_CHALLENGE_UNSPECIFIED"),
7740 Self::Nocaptcha => std::option::Option::Some("NOCAPTCHA"),
7741 Self::UnsolvableChallenge => std::option::Option::Some("UNSOLVABLE_CHALLENGE"),
7742 Self::UnknownValue(u) => u.0.name(),
7743 }
7744 }
7745 }
7746
7747 impl std::default::Default for TestingChallenge {
7748 fn default() -> Self {
7749 use std::convert::From;
7750 Self::from(0)
7751 }
7752 }
7753
7754 impl std::fmt::Display for TestingChallenge {
7755 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7756 wkt::internal::display_enum(f, self.name(), self.value())
7757 }
7758 }
7759
7760 impl std::convert::From<i32> for TestingChallenge {
7761 fn from(value: i32) -> Self {
7762 match value {
7763 0 => Self::Unspecified,
7764 1 => Self::Nocaptcha,
7765 2 => Self::UnsolvableChallenge,
7766 _ => Self::UnknownValue(testing_challenge::UnknownValue(
7767 wkt::internal::UnknownEnumValue::Integer(value),
7768 )),
7769 }
7770 }
7771 }
7772
7773 impl std::convert::From<&str> for TestingChallenge {
7774 fn from(value: &str) -> Self {
7775 use std::string::ToString;
7776 match value {
7777 "TESTING_CHALLENGE_UNSPECIFIED" => Self::Unspecified,
7778 "NOCAPTCHA" => Self::Nocaptcha,
7779 "UNSOLVABLE_CHALLENGE" => Self::UnsolvableChallenge,
7780 _ => Self::UnknownValue(testing_challenge::UnknownValue(
7781 wkt::internal::UnknownEnumValue::String(value.to_string()),
7782 )),
7783 }
7784 }
7785 }
7786
7787 impl serde::ser::Serialize for TestingChallenge {
7788 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7789 where
7790 S: serde::Serializer,
7791 {
7792 match self {
7793 Self::Unspecified => serializer.serialize_i32(0),
7794 Self::Nocaptcha => serializer.serialize_i32(1),
7795 Self::UnsolvableChallenge => serializer.serialize_i32(2),
7796 Self::UnknownValue(u) => u.0.serialize(serializer),
7797 }
7798 }
7799 }
7800
7801 impl<'de> serde::de::Deserialize<'de> for TestingChallenge {
7802 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7803 where
7804 D: serde::Deserializer<'de>,
7805 {
7806 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TestingChallenge>::new(
7807 ".google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge",
7808 ))
7809 }
7810 }
7811}
7812
7813/// Settings specific to keys that can be used by websites.
7814#[derive(Clone, Default, PartialEq)]
7815#[non_exhaustive]
7816pub struct WebKeySettings {
7817 /// Optional. If set to true, it means allowed_domains are not enforced.
7818 pub allow_all_domains: bool,
7819
7820 /// Optional. Domains or subdomains of websites allowed to use the key. All
7821 /// subdomains of an allowed domain are automatically allowed. A valid domain
7822 /// requires a host and must not include any path, port, query or fragment.
7823 /// Examples: 'example.com' or 'subdomain.example.com'
7824 /// Each key supports a maximum of 250 domains. To use a key on more domains,
7825 /// set `allow_all_domains` to true. When this is set, you are responsible for
7826 /// validating the hostname by checking the `token_properties.hostname` field
7827 /// in each assessment response against your list of allowed domains.
7828 pub allowed_domains: std::vec::Vec<std::string::String>,
7829
7830 /// Optional. If set to true, the key can be used on AMP (Accelerated Mobile
7831 /// Pages) websites. This is supported only for the SCORE integration type.
7832 pub allow_amp_traffic: bool,
7833
7834 /// Required. Describes how this key is integrated with the website.
7835 pub integration_type: crate::model::web_key_settings::IntegrationType,
7836
7837 /// Optional. Settings for the frequency and difficulty at which this key
7838 /// triggers captcha challenges. This should only be specified for
7839 /// `IntegrationType` CHECKBOX, INVISIBLE or POLICY_BASED_CHALLENGE.
7840 pub challenge_security_preference: crate::model::web_key_settings::ChallengeSecurityPreference,
7841
7842 /// Optional. Challenge settings.
7843 pub challenge_settings: std::option::Option<crate::model::web_key_settings::ChallengeSettings>,
7844
7845 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7846}
7847
7848impl WebKeySettings {
7849 /// Creates a new default instance.
7850 pub fn new() -> Self {
7851 std::default::Default::default()
7852 }
7853
7854 /// Sets the value of [allow_all_domains][crate::model::WebKeySettings::allow_all_domains].
7855 ///
7856 /// # Example
7857 /// ```ignore,no_run
7858 /// # use google_cloud_recaptchaenterprise_v1::model::WebKeySettings;
7859 /// let x = WebKeySettings::new().set_allow_all_domains(true);
7860 /// ```
7861 pub fn set_allow_all_domains<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7862 self.allow_all_domains = v.into();
7863 self
7864 }
7865
7866 /// Sets the value of [allowed_domains][crate::model::WebKeySettings::allowed_domains].
7867 ///
7868 /// # Example
7869 /// ```ignore,no_run
7870 /// # use google_cloud_recaptchaenterprise_v1::model::WebKeySettings;
7871 /// let x = WebKeySettings::new().set_allowed_domains(["a", "b", "c"]);
7872 /// ```
7873 pub fn set_allowed_domains<T, V>(mut self, v: T) -> Self
7874 where
7875 T: std::iter::IntoIterator<Item = V>,
7876 V: std::convert::Into<std::string::String>,
7877 {
7878 use std::iter::Iterator;
7879 self.allowed_domains = v.into_iter().map(|i| i.into()).collect();
7880 self
7881 }
7882
7883 /// Sets the value of [allow_amp_traffic][crate::model::WebKeySettings::allow_amp_traffic].
7884 ///
7885 /// # Example
7886 /// ```ignore,no_run
7887 /// # use google_cloud_recaptchaenterprise_v1::model::WebKeySettings;
7888 /// let x = WebKeySettings::new().set_allow_amp_traffic(true);
7889 /// ```
7890 pub fn set_allow_amp_traffic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7891 self.allow_amp_traffic = v.into();
7892 self
7893 }
7894
7895 /// Sets the value of [integration_type][crate::model::WebKeySettings::integration_type].
7896 ///
7897 /// # Example
7898 /// ```ignore,no_run
7899 /// # use google_cloud_recaptchaenterprise_v1::model::WebKeySettings;
7900 /// use google_cloud_recaptchaenterprise_v1::model::web_key_settings::IntegrationType;
7901 /// let x0 = WebKeySettings::new().set_integration_type(IntegrationType::Score);
7902 /// let x1 = WebKeySettings::new().set_integration_type(IntegrationType::Checkbox);
7903 /// let x2 = WebKeySettings::new().set_integration_type(IntegrationType::Invisible);
7904 /// ```
7905 pub fn set_integration_type<
7906 T: std::convert::Into<crate::model::web_key_settings::IntegrationType>,
7907 >(
7908 mut self,
7909 v: T,
7910 ) -> Self {
7911 self.integration_type = v.into();
7912 self
7913 }
7914
7915 /// Sets the value of [challenge_security_preference][crate::model::WebKeySettings::challenge_security_preference].
7916 ///
7917 /// # Example
7918 /// ```ignore,no_run
7919 /// # use google_cloud_recaptchaenterprise_v1::model::WebKeySettings;
7920 /// use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ChallengeSecurityPreference;
7921 /// let x0 = WebKeySettings::new().set_challenge_security_preference(ChallengeSecurityPreference::Usability);
7922 /// let x1 = WebKeySettings::new().set_challenge_security_preference(ChallengeSecurityPreference::Balance);
7923 /// let x2 = WebKeySettings::new().set_challenge_security_preference(ChallengeSecurityPreference::Security);
7924 /// ```
7925 pub fn set_challenge_security_preference<
7926 T: std::convert::Into<crate::model::web_key_settings::ChallengeSecurityPreference>,
7927 >(
7928 mut self,
7929 v: T,
7930 ) -> Self {
7931 self.challenge_security_preference = v.into();
7932 self
7933 }
7934
7935 /// Sets the value of [challenge_settings][crate::model::WebKeySettings::challenge_settings].
7936 ///
7937 /// # Example
7938 /// ```ignore,no_run
7939 /// # use google_cloud_recaptchaenterprise_v1::model::WebKeySettings;
7940 /// use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ChallengeSettings;
7941 /// let x = WebKeySettings::new().set_challenge_settings(ChallengeSettings::default()/* use setters */);
7942 /// ```
7943 pub fn set_challenge_settings<T>(mut self, v: T) -> Self
7944 where
7945 T: std::convert::Into<crate::model::web_key_settings::ChallengeSettings>,
7946 {
7947 self.challenge_settings = std::option::Option::Some(v.into());
7948 self
7949 }
7950
7951 /// Sets or clears the value of [challenge_settings][crate::model::WebKeySettings::challenge_settings].
7952 ///
7953 /// # Example
7954 /// ```ignore,no_run
7955 /// # use google_cloud_recaptchaenterprise_v1::model::WebKeySettings;
7956 /// use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ChallengeSettings;
7957 /// let x = WebKeySettings::new().set_or_clear_challenge_settings(Some(ChallengeSettings::default()/* use setters */));
7958 /// let x = WebKeySettings::new().set_or_clear_challenge_settings(None::<ChallengeSettings>);
7959 /// ```
7960 pub fn set_or_clear_challenge_settings<T>(mut self, v: std::option::Option<T>) -> Self
7961 where
7962 T: std::convert::Into<crate::model::web_key_settings::ChallengeSettings>,
7963 {
7964 self.challenge_settings = v.map(|x| x.into());
7965 self
7966 }
7967}
7968
7969impl wkt::message::Message for WebKeySettings {
7970 fn typename() -> &'static str {
7971 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.WebKeySettings"
7972 }
7973}
7974
7975/// Defines additional types related to [WebKeySettings].
7976pub mod web_key_settings {
7977 #[allow(unused_imports)]
7978 use super::*;
7979
7980 /// Per-action challenge settings.
7981 #[derive(Clone, Default, PartialEq)]
7982 #[non_exhaustive]
7983 pub struct ActionSettings {
7984 /// Required. A challenge is triggered if the end-user score is below that
7985 /// threshold. Value must be between 0 and 1 (inclusive).
7986 pub score_threshold: f32,
7987
7988 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7989 }
7990
7991 impl ActionSettings {
7992 /// Creates a new default instance.
7993 pub fn new() -> Self {
7994 std::default::Default::default()
7995 }
7996
7997 /// Sets the value of [score_threshold][crate::model::web_key_settings::ActionSettings::score_threshold].
7998 ///
7999 /// # Example
8000 /// ```ignore,no_run
8001 /// # use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ActionSettings;
8002 /// let x = ActionSettings::new().set_score_threshold(42.0);
8003 /// ```
8004 pub fn set_score_threshold<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
8005 self.score_threshold = v.into();
8006 self
8007 }
8008 }
8009
8010 impl wkt::message::Message for ActionSettings {
8011 fn typename() -> &'static str {
8012 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.WebKeySettings.ActionSettings"
8013 }
8014 }
8015
8016 /// Settings for POLICY_BASED_CHALLENGE keys to control when a challenge is
8017 /// triggered.
8018 #[derive(Clone, Default, PartialEq)]
8019 #[non_exhaustive]
8020 pub struct ChallengeSettings {
8021 /// Required. Defines when a challenge is triggered (unless the default
8022 /// threshold is overridden for the given action, see `action_settings`).
8023 pub default_settings: std::option::Option<crate::model::web_key_settings::ActionSettings>,
8024
8025 /// Optional. The action to score threshold map.
8026 /// The action name should be the same as the action name passed in the
8027 /// `data-action` attribute
8028 /// (see <https://cloud.google.com/recaptcha/docs/actions-website>).
8029 /// Action names are case-insensitive.
8030 /// There is a maximum of 100 action settings.
8031 /// An action name has a maximum length of 100.
8032 pub action_settings: std::collections::HashMap<
8033 std::string::String,
8034 crate::model::web_key_settings::ActionSettings,
8035 >,
8036
8037 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8038 }
8039
8040 impl ChallengeSettings {
8041 /// Creates a new default instance.
8042 pub fn new() -> Self {
8043 std::default::Default::default()
8044 }
8045
8046 /// Sets the value of [default_settings][crate::model::web_key_settings::ChallengeSettings::default_settings].
8047 ///
8048 /// # Example
8049 /// ```ignore,no_run
8050 /// # use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ChallengeSettings;
8051 /// use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ActionSettings;
8052 /// let x = ChallengeSettings::new().set_default_settings(ActionSettings::default()/* use setters */);
8053 /// ```
8054 pub fn set_default_settings<T>(mut self, v: T) -> Self
8055 where
8056 T: std::convert::Into<crate::model::web_key_settings::ActionSettings>,
8057 {
8058 self.default_settings = std::option::Option::Some(v.into());
8059 self
8060 }
8061
8062 /// Sets or clears the value of [default_settings][crate::model::web_key_settings::ChallengeSettings::default_settings].
8063 ///
8064 /// # Example
8065 /// ```ignore,no_run
8066 /// # use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ChallengeSettings;
8067 /// use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ActionSettings;
8068 /// let x = ChallengeSettings::new().set_or_clear_default_settings(Some(ActionSettings::default()/* use setters */));
8069 /// let x = ChallengeSettings::new().set_or_clear_default_settings(None::<ActionSettings>);
8070 /// ```
8071 pub fn set_or_clear_default_settings<T>(mut self, v: std::option::Option<T>) -> Self
8072 where
8073 T: std::convert::Into<crate::model::web_key_settings::ActionSettings>,
8074 {
8075 self.default_settings = v.map(|x| x.into());
8076 self
8077 }
8078
8079 /// Sets the value of [action_settings][crate::model::web_key_settings::ChallengeSettings::action_settings].
8080 ///
8081 /// # Example
8082 /// ```ignore,no_run
8083 /// # use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ChallengeSettings;
8084 /// use google_cloud_recaptchaenterprise_v1::model::web_key_settings::ActionSettings;
8085 /// let x = ChallengeSettings::new().set_action_settings([
8086 /// ("key0", ActionSettings::default()/* use setters */),
8087 /// ("key1", ActionSettings::default()/* use (different) setters */),
8088 /// ]);
8089 /// ```
8090 pub fn set_action_settings<T, K, V>(mut self, v: T) -> Self
8091 where
8092 T: std::iter::IntoIterator<Item = (K, V)>,
8093 K: std::convert::Into<std::string::String>,
8094 V: std::convert::Into<crate::model::web_key_settings::ActionSettings>,
8095 {
8096 use std::iter::Iterator;
8097 self.action_settings = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8098 self
8099 }
8100 }
8101
8102 impl wkt::message::Message for ChallengeSettings {
8103 fn typename() -> &'static str {
8104 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSettings"
8105 }
8106 }
8107
8108 /// Enum that represents the integration types for web keys.
8109 /// Ensure that applications can handle values not explicitly listed.
8110 ///
8111 /// # Working with unknown values
8112 ///
8113 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8114 /// additional enum variants at any time. Adding new variants is not considered
8115 /// a breaking change. Applications should write their code in anticipation of:
8116 ///
8117 /// - New values appearing in future releases of the client library, **and**
8118 /// - New values received dynamically, without application changes.
8119 ///
8120 /// Please consult the [Working with enums] section in the user guide for some
8121 /// guidelines.
8122 ///
8123 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8124 #[derive(Clone, Debug, PartialEq)]
8125 #[non_exhaustive]
8126 pub enum IntegrationType {
8127 /// Default type that indicates this enum hasn't been specified. This is not
8128 /// a valid IntegrationType, one of the other types must be specified
8129 /// instead.
8130 Unspecified,
8131 /// Only used to produce scores. It doesn't display the "I'm not a robot"
8132 /// checkbox and never shows captcha challenges.
8133 Score,
8134 /// Displays the "I'm not a robot" checkbox and may show captcha challenges
8135 /// after it is checked.
8136 Checkbox,
8137 /// Doesn't display the "I'm not a robot" checkbox, but may show captcha
8138 /// challenges after risk analysis.
8139 Invisible,
8140 /// Displays a visual challenge or not depending on the user risk analysis
8141 /// score.
8142 PolicyBasedChallenge,
8143 /// If set, the enum was initialized with an unknown value.
8144 ///
8145 /// Applications can examine the value using [IntegrationType::value] or
8146 /// [IntegrationType::name].
8147 UnknownValue(integration_type::UnknownValue),
8148 }
8149
8150 #[doc(hidden)]
8151 pub mod integration_type {
8152 #[allow(unused_imports)]
8153 use super::*;
8154 #[derive(Clone, Debug, PartialEq)]
8155 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8156 }
8157
8158 impl IntegrationType {
8159 /// Gets the enum value.
8160 ///
8161 /// Returns `None` if the enum contains an unknown value deserialized from
8162 /// the string representation of enums.
8163 pub fn value(&self) -> std::option::Option<i32> {
8164 match self {
8165 Self::Unspecified => std::option::Option::Some(0),
8166 Self::Score => std::option::Option::Some(1),
8167 Self::Checkbox => std::option::Option::Some(2),
8168 Self::Invisible => std::option::Option::Some(3),
8169 Self::PolicyBasedChallenge => std::option::Option::Some(5),
8170 Self::UnknownValue(u) => u.0.value(),
8171 }
8172 }
8173
8174 /// Gets the enum value as a string.
8175 ///
8176 /// Returns `None` if the enum contains an unknown value deserialized from
8177 /// the integer representation of enums.
8178 pub fn name(&self) -> std::option::Option<&str> {
8179 match self {
8180 Self::Unspecified => std::option::Option::Some("INTEGRATION_TYPE_UNSPECIFIED"),
8181 Self::Score => std::option::Option::Some("SCORE"),
8182 Self::Checkbox => std::option::Option::Some("CHECKBOX"),
8183 Self::Invisible => std::option::Option::Some("INVISIBLE"),
8184 Self::PolicyBasedChallenge => std::option::Option::Some("POLICY_BASED_CHALLENGE"),
8185 Self::UnknownValue(u) => u.0.name(),
8186 }
8187 }
8188 }
8189
8190 impl std::default::Default for IntegrationType {
8191 fn default() -> Self {
8192 use std::convert::From;
8193 Self::from(0)
8194 }
8195 }
8196
8197 impl std::fmt::Display for IntegrationType {
8198 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8199 wkt::internal::display_enum(f, self.name(), self.value())
8200 }
8201 }
8202
8203 impl std::convert::From<i32> for IntegrationType {
8204 fn from(value: i32) -> Self {
8205 match value {
8206 0 => Self::Unspecified,
8207 1 => Self::Score,
8208 2 => Self::Checkbox,
8209 3 => Self::Invisible,
8210 5 => Self::PolicyBasedChallenge,
8211 _ => Self::UnknownValue(integration_type::UnknownValue(
8212 wkt::internal::UnknownEnumValue::Integer(value),
8213 )),
8214 }
8215 }
8216 }
8217
8218 impl std::convert::From<&str> for IntegrationType {
8219 fn from(value: &str) -> Self {
8220 use std::string::ToString;
8221 match value {
8222 "INTEGRATION_TYPE_UNSPECIFIED" => Self::Unspecified,
8223 "SCORE" => Self::Score,
8224 "CHECKBOX" => Self::Checkbox,
8225 "INVISIBLE" => Self::Invisible,
8226 "POLICY_BASED_CHALLENGE" => Self::PolicyBasedChallenge,
8227 _ => Self::UnknownValue(integration_type::UnknownValue(
8228 wkt::internal::UnknownEnumValue::String(value.to_string()),
8229 )),
8230 }
8231 }
8232 }
8233
8234 impl serde::ser::Serialize for IntegrationType {
8235 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8236 where
8237 S: serde::Serializer,
8238 {
8239 match self {
8240 Self::Unspecified => serializer.serialize_i32(0),
8241 Self::Score => serializer.serialize_i32(1),
8242 Self::Checkbox => serializer.serialize_i32(2),
8243 Self::Invisible => serializer.serialize_i32(3),
8244 Self::PolicyBasedChallenge => serializer.serialize_i32(5),
8245 Self::UnknownValue(u) => u.0.serialize(serializer),
8246 }
8247 }
8248 }
8249
8250 impl<'de> serde::de::Deserialize<'de> for IntegrationType {
8251 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8252 where
8253 D: serde::Deserializer<'de>,
8254 {
8255 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IntegrationType>::new(
8256 ".google.cloud.recaptchaenterprise.v1.WebKeySettings.IntegrationType",
8257 ))
8258 }
8259 }
8260
8261 /// Enum that represents the possible challenge frequency and difficulty
8262 /// configurations for a web key.
8263 /// Ensure that applications can handle values not explicitly listed.
8264 ///
8265 /// # Working with unknown values
8266 ///
8267 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8268 /// additional enum variants at any time. Adding new variants is not considered
8269 /// a breaking change. Applications should write their code in anticipation of:
8270 ///
8271 /// - New values appearing in future releases of the client library, **and**
8272 /// - New values received dynamically, without application changes.
8273 ///
8274 /// Please consult the [Working with enums] section in the user guide for some
8275 /// guidelines.
8276 ///
8277 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8278 #[derive(Clone, Debug, PartialEq)]
8279 #[non_exhaustive]
8280 pub enum ChallengeSecurityPreference {
8281 /// Default type that indicates this enum hasn't been specified.
8282 Unspecified,
8283 /// Key tends to show fewer and easier challenges.
8284 Usability,
8285 /// Key tends to show balanced (in amount and difficulty) challenges.
8286 Balance,
8287 /// Key tends to show more and harder challenges.
8288 Security,
8289 /// If set, the enum was initialized with an unknown value.
8290 ///
8291 /// Applications can examine the value using [ChallengeSecurityPreference::value] or
8292 /// [ChallengeSecurityPreference::name].
8293 UnknownValue(challenge_security_preference::UnknownValue),
8294 }
8295
8296 #[doc(hidden)]
8297 pub mod challenge_security_preference {
8298 #[allow(unused_imports)]
8299 use super::*;
8300 #[derive(Clone, Debug, PartialEq)]
8301 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8302 }
8303
8304 impl ChallengeSecurityPreference {
8305 /// Gets the enum value.
8306 ///
8307 /// Returns `None` if the enum contains an unknown value deserialized from
8308 /// the string representation of enums.
8309 pub fn value(&self) -> std::option::Option<i32> {
8310 match self {
8311 Self::Unspecified => std::option::Option::Some(0),
8312 Self::Usability => std::option::Option::Some(1),
8313 Self::Balance => std::option::Option::Some(2),
8314 Self::Security => std::option::Option::Some(3),
8315 Self::UnknownValue(u) => u.0.value(),
8316 }
8317 }
8318
8319 /// Gets the enum value as a string.
8320 ///
8321 /// Returns `None` if the enum contains an unknown value deserialized from
8322 /// the integer representation of enums.
8323 pub fn name(&self) -> std::option::Option<&str> {
8324 match self {
8325 Self::Unspecified => {
8326 std::option::Option::Some("CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED")
8327 }
8328 Self::Usability => std::option::Option::Some("USABILITY"),
8329 Self::Balance => std::option::Option::Some("BALANCE"),
8330 Self::Security => std::option::Option::Some("SECURITY"),
8331 Self::UnknownValue(u) => u.0.name(),
8332 }
8333 }
8334 }
8335
8336 impl std::default::Default for ChallengeSecurityPreference {
8337 fn default() -> Self {
8338 use std::convert::From;
8339 Self::from(0)
8340 }
8341 }
8342
8343 impl std::fmt::Display for ChallengeSecurityPreference {
8344 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8345 wkt::internal::display_enum(f, self.name(), self.value())
8346 }
8347 }
8348
8349 impl std::convert::From<i32> for ChallengeSecurityPreference {
8350 fn from(value: i32) -> Self {
8351 match value {
8352 0 => Self::Unspecified,
8353 1 => Self::Usability,
8354 2 => Self::Balance,
8355 3 => Self::Security,
8356 _ => Self::UnknownValue(challenge_security_preference::UnknownValue(
8357 wkt::internal::UnknownEnumValue::Integer(value),
8358 )),
8359 }
8360 }
8361 }
8362
8363 impl std::convert::From<&str> for ChallengeSecurityPreference {
8364 fn from(value: &str) -> Self {
8365 use std::string::ToString;
8366 match value {
8367 "CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED" => Self::Unspecified,
8368 "USABILITY" => Self::Usability,
8369 "BALANCE" => Self::Balance,
8370 "SECURITY" => Self::Security,
8371 _ => Self::UnknownValue(challenge_security_preference::UnknownValue(
8372 wkt::internal::UnknownEnumValue::String(value.to_string()),
8373 )),
8374 }
8375 }
8376 }
8377
8378 impl serde::ser::Serialize for ChallengeSecurityPreference {
8379 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8380 where
8381 S: serde::Serializer,
8382 {
8383 match self {
8384 Self::Unspecified => serializer.serialize_i32(0),
8385 Self::Usability => serializer.serialize_i32(1),
8386 Self::Balance => serializer.serialize_i32(2),
8387 Self::Security => serializer.serialize_i32(3),
8388 Self::UnknownValue(u) => u.0.serialize(serializer),
8389 }
8390 }
8391 }
8392
8393 impl<'de> serde::de::Deserialize<'de> for ChallengeSecurityPreference {
8394 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8395 where
8396 D: serde::Deserializer<'de>,
8397 {
8398 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ChallengeSecurityPreference>::new(
8399 ".google.cloud.recaptchaenterprise.v1.WebKeySettings.ChallengeSecurityPreference"))
8400 }
8401 }
8402}
8403
8404/// Settings specific to keys that can be used by Android apps.
8405#[derive(Clone, Default, PartialEq)]
8406#[non_exhaustive]
8407pub struct AndroidKeySettings {
8408 /// Optional. If set to true, allowed_package_names are not enforced.
8409 pub allow_all_package_names: bool,
8410
8411 /// Optional. Android package names of apps allowed to use the key.
8412 /// Example: 'com.companyname.appname'
8413 /// Each key supports a maximum of 250 package names. To use a key on more
8414 /// apps, set `allow_all_package_names` to true. When this is set, you
8415 /// are responsible for validating the package name by checking the
8416 /// `token_properties.android_package_name` field in each assessment response
8417 /// against your list of allowed package names.
8418 pub allowed_package_names: std::vec::Vec<std::string::String>,
8419
8420 /// Optional. Set to true for keys that are used in an Android application that
8421 /// is available for download in app stores in addition to the Google Play
8422 /// Store.
8423 pub support_non_google_app_store_distribution: bool,
8424
8425 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8426}
8427
8428impl AndroidKeySettings {
8429 /// Creates a new default instance.
8430 pub fn new() -> Self {
8431 std::default::Default::default()
8432 }
8433
8434 /// Sets the value of [allow_all_package_names][crate::model::AndroidKeySettings::allow_all_package_names].
8435 ///
8436 /// # Example
8437 /// ```ignore,no_run
8438 /// # use google_cloud_recaptchaenterprise_v1::model::AndroidKeySettings;
8439 /// let x = AndroidKeySettings::new().set_allow_all_package_names(true);
8440 /// ```
8441 pub fn set_allow_all_package_names<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8442 self.allow_all_package_names = v.into();
8443 self
8444 }
8445
8446 /// Sets the value of [allowed_package_names][crate::model::AndroidKeySettings::allowed_package_names].
8447 ///
8448 /// # Example
8449 /// ```ignore,no_run
8450 /// # use google_cloud_recaptchaenterprise_v1::model::AndroidKeySettings;
8451 /// let x = AndroidKeySettings::new().set_allowed_package_names(["a", "b", "c"]);
8452 /// ```
8453 pub fn set_allowed_package_names<T, V>(mut self, v: T) -> Self
8454 where
8455 T: std::iter::IntoIterator<Item = V>,
8456 V: std::convert::Into<std::string::String>,
8457 {
8458 use std::iter::Iterator;
8459 self.allowed_package_names = v.into_iter().map(|i| i.into()).collect();
8460 self
8461 }
8462
8463 /// Sets the value of [support_non_google_app_store_distribution][crate::model::AndroidKeySettings::support_non_google_app_store_distribution].
8464 ///
8465 /// # Example
8466 /// ```ignore,no_run
8467 /// # use google_cloud_recaptchaenterprise_v1::model::AndroidKeySettings;
8468 /// let x = AndroidKeySettings::new().set_support_non_google_app_store_distribution(true);
8469 /// ```
8470 pub fn set_support_non_google_app_store_distribution<T: std::convert::Into<bool>>(
8471 mut self,
8472 v: T,
8473 ) -> Self {
8474 self.support_non_google_app_store_distribution = v.into();
8475 self
8476 }
8477}
8478
8479impl wkt::message::Message for AndroidKeySettings {
8480 fn typename() -> &'static str {
8481 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.AndroidKeySettings"
8482 }
8483}
8484
8485/// Settings specific to keys that can be used by iOS apps.
8486#[derive(Clone, Default, PartialEq)]
8487#[non_exhaustive]
8488pub struct IOSKeySettings {
8489 /// Optional. If set to true, allowed_bundle_ids are not enforced.
8490 pub allow_all_bundle_ids: bool,
8491
8492 /// Optional. iOS bundle IDs of apps allowed to use the key.
8493 /// Example: 'com.companyname.productname.appname'
8494 /// Each key supports a maximum of 250 bundle IDs. To use a key on more
8495 /// apps, set `allow_all_bundle_ids` to true. When this is set, you
8496 /// are responsible for validating the bundle id by checking the
8497 /// `token_properties.ios_bundle_id` field in each assessment response
8498 /// against your list of allowed bundle IDs.
8499 pub allowed_bundle_ids: std::vec::Vec<std::string::String>,
8500
8501 /// Optional. Apple Developer account details for the app that is protected by
8502 /// the reCAPTCHA Key. reCAPTCHA leverages platform-specific checks like Apple
8503 /// App Attest and Apple DeviceCheck to protect your app from abuse. Providing
8504 /// these fields allows reCAPTCHA to get a better assessment of the integrity
8505 /// of your app.
8506 pub apple_developer_id: std::option::Option<crate::model::AppleDeveloperId>,
8507
8508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8509}
8510
8511impl IOSKeySettings {
8512 /// Creates a new default instance.
8513 pub fn new() -> Self {
8514 std::default::Default::default()
8515 }
8516
8517 /// Sets the value of [allow_all_bundle_ids][crate::model::IOSKeySettings::allow_all_bundle_ids].
8518 ///
8519 /// # Example
8520 /// ```ignore,no_run
8521 /// # use google_cloud_recaptchaenterprise_v1::model::IOSKeySettings;
8522 /// let x = IOSKeySettings::new().set_allow_all_bundle_ids(true);
8523 /// ```
8524 pub fn set_allow_all_bundle_ids<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8525 self.allow_all_bundle_ids = v.into();
8526 self
8527 }
8528
8529 /// Sets the value of [allowed_bundle_ids][crate::model::IOSKeySettings::allowed_bundle_ids].
8530 ///
8531 /// # Example
8532 /// ```ignore,no_run
8533 /// # use google_cloud_recaptchaenterprise_v1::model::IOSKeySettings;
8534 /// let x = IOSKeySettings::new().set_allowed_bundle_ids(["a", "b", "c"]);
8535 /// ```
8536 pub fn set_allowed_bundle_ids<T, V>(mut self, v: T) -> Self
8537 where
8538 T: std::iter::IntoIterator<Item = V>,
8539 V: std::convert::Into<std::string::String>,
8540 {
8541 use std::iter::Iterator;
8542 self.allowed_bundle_ids = v.into_iter().map(|i| i.into()).collect();
8543 self
8544 }
8545
8546 /// Sets the value of [apple_developer_id][crate::model::IOSKeySettings::apple_developer_id].
8547 ///
8548 /// # Example
8549 /// ```ignore,no_run
8550 /// # use google_cloud_recaptchaenterprise_v1::model::IOSKeySettings;
8551 /// use google_cloud_recaptchaenterprise_v1::model::AppleDeveloperId;
8552 /// let x = IOSKeySettings::new().set_apple_developer_id(AppleDeveloperId::default()/* use setters */);
8553 /// ```
8554 pub fn set_apple_developer_id<T>(mut self, v: T) -> Self
8555 where
8556 T: std::convert::Into<crate::model::AppleDeveloperId>,
8557 {
8558 self.apple_developer_id = std::option::Option::Some(v.into());
8559 self
8560 }
8561
8562 /// Sets or clears the value of [apple_developer_id][crate::model::IOSKeySettings::apple_developer_id].
8563 ///
8564 /// # Example
8565 /// ```ignore,no_run
8566 /// # use google_cloud_recaptchaenterprise_v1::model::IOSKeySettings;
8567 /// use google_cloud_recaptchaenterprise_v1::model::AppleDeveloperId;
8568 /// let x = IOSKeySettings::new().set_or_clear_apple_developer_id(Some(AppleDeveloperId::default()/* use setters */));
8569 /// let x = IOSKeySettings::new().set_or_clear_apple_developer_id(None::<AppleDeveloperId>);
8570 /// ```
8571 pub fn set_or_clear_apple_developer_id<T>(mut self, v: std::option::Option<T>) -> Self
8572 where
8573 T: std::convert::Into<crate::model::AppleDeveloperId>,
8574 {
8575 self.apple_developer_id = v.map(|x| x.into());
8576 self
8577 }
8578}
8579
8580impl wkt::message::Message for IOSKeySettings {
8581 fn typename() -> &'static str {
8582 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.IOSKeySettings"
8583 }
8584}
8585
8586/// Settings specific to keys that can be used for reCAPTCHA Express.
8587#[derive(Clone, Default, PartialEq)]
8588#[non_exhaustive]
8589pub struct ExpressKeySettings {
8590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8591}
8592
8593impl ExpressKeySettings {
8594 /// Creates a new default instance.
8595 pub fn new() -> Self {
8596 std::default::Default::default()
8597 }
8598}
8599
8600impl wkt::message::Message for ExpressKeySettings {
8601 fn typename() -> &'static str {
8602 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ExpressKeySettings"
8603 }
8604}
8605
8606/// Contains fields that are required to perform Apple-specific integrity checks.
8607#[derive(Clone, Default, PartialEq)]
8608#[non_exhaustive]
8609pub struct AppleDeveloperId {
8610 /// Required. Input only. A private key (downloaded as a text file with a .p8
8611 /// file extension) generated for your Apple Developer account. Ensure that
8612 /// Apple DeviceCheck is enabled for the private key.
8613 pub private_key: std::string::String,
8614
8615 /// Required. The Apple developer key ID (10-character string).
8616 pub key_id: std::string::String,
8617
8618 /// Required. The Apple team ID (10-character string) owning the provisioning
8619 /// profile used to build your application.
8620 pub team_id: std::string::String,
8621
8622 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8623}
8624
8625impl AppleDeveloperId {
8626 /// Creates a new default instance.
8627 pub fn new() -> Self {
8628 std::default::Default::default()
8629 }
8630
8631 /// Sets the value of [private_key][crate::model::AppleDeveloperId::private_key].
8632 ///
8633 /// # Example
8634 /// ```ignore,no_run
8635 /// # use google_cloud_recaptchaenterprise_v1::model::AppleDeveloperId;
8636 /// let x = AppleDeveloperId::new().set_private_key("example");
8637 /// ```
8638 pub fn set_private_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8639 self.private_key = v.into();
8640 self
8641 }
8642
8643 /// Sets the value of [key_id][crate::model::AppleDeveloperId::key_id].
8644 ///
8645 /// # Example
8646 /// ```ignore,no_run
8647 /// # use google_cloud_recaptchaenterprise_v1::model::AppleDeveloperId;
8648 /// let x = AppleDeveloperId::new().set_key_id("example");
8649 /// ```
8650 pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8651 self.key_id = v.into();
8652 self
8653 }
8654
8655 /// Sets the value of [team_id][crate::model::AppleDeveloperId::team_id].
8656 ///
8657 /// # Example
8658 /// ```ignore,no_run
8659 /// # use google_cloud_recaptchaenterprise_v1::model::AppleDeveloperId;
8660 /// let x = AppleDeveloperId::new().set_team_id("example");
8661 /// ```
8662 pub fn set_team_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8663 self.team_id = v.into();
8664 self
8665 }
8666}
8667
8668impl wkt::message::Message for AppleDeveloperId {
8669 fn typename() -> &'static str {
8670 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.AppleDeveloperId"
8671 }
8672}
8673
8674/// Score distribution.
8675#[derive(Clone, Default, PartialEq)]
8676#[non_exhaustive]
8677pub struct ScoreDistribution {
8678 /// Map key is score value multiplied by 100. The scores are discrete values
8679 /// between [0, 1]. The maximum number of buckets is on order of a few dozen,
8680 /// but typically much lower (ie. 10).
8681 pub score_buckets: std::collections::HashMap<i32, i64>,
8682
8683 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8684}
8685
8686impl ScoreDistribution {
8687 /// Creates a new default instance.
8688 pub fn new() -> Self {
8689 std::default::Default::default()
8690 }
8691
8692 /// Sets the value of [score_buckets][crate::model::ScoreDistribution::score_buckets].
8693 ///
8694 /// # Example
8695 /// ```ignore,no_run
8696 /// # use google_cloud_recaptchaenterprise_v1::model::ScoreDistribution;
8697 /// let x = ScoreDistribution::new().set_score_buckets([
8698 /// (0, 123),
8699 /// (1, 456),
8700 /// ]);
8701 /// ```
8702 pub fn set_score_buckets<T, K, V>(mut self, v: T) -> Self
8703 where
8704 T: std::iter::IntoIterator<Item = (K, V)>,
8705 K: std::convert::Into<i32>,
8706 V: std::convert::Into<i64>,
8707 {
8708 use std::iter::Iterator;
8709 self.score_buckets = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8710 self
8711 }
8712}
8713
8714impl wkt::message::Message for ScoreDistribution {
8715 fn typename() -> &'static str {
8716 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ScoreDistribution"
8717 }
8718}
8719
8720/// Metrics related to scoring.
8721#[derive(Clone, Default, PartialEq)]
8722#[non_exhaustive]
8723pub struct ScoreMetrics {
8724 /// Aggregated score metrics for all traffic.
8725 pub overall_metrics: std::option::Option<crate::model::ScoreDistribution>,
8726
8727 /// Action-based metrics. The map key is the action name which specified by the
8728 /// site owners at time of the "execute" client-side call.
8729 pub action_metrics:
8730 std::collections::HashMap<std::string::String, crate::model::ScoreDistribution>,
8731
8732 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8733}
8734
8735impl ScoreMetrics {
8736 /// Creates a new default instance.
8737 pub fn new() -> Self {
8738 std::default::Default::default()
8739 }
8740
8741 /// Sets the value of [overall_metrics][crate::model::ScoreMetrics::overall_metrics].
8742 ///
8743 /// # Example
8744 /// ```ignore,no_run
8745 /// # use google_cloud_recaptchaenterprise_v1::model::ScoreMetrics;
8746 /// use google_cloud_recaptchaenterprise_v1::model::ScoreDistribution;
8747 /// let x = ScoreMetrics::new().set_overall_metrics(ScoreDistribution::default()/* use setters */);
8748 /// ```
8749 pub fn set_overall_metrics<T>(mut self, v: T) -> Self
8750 where
8751 T: std::convert::Into<crate::model::ScoreDistribution>,
8752 {
8753 self.overall_metrics = std::option::Option::Some(v.into());
8754 self
8755 }
8756
8757 /// Sets or clears the value of [overall_metrics][crate::model::ScoreMetrics::overall_metrics].
8758 ///
8759 /// # Example
8760 /// ```ignore,no_run
8761 /// # use google_cloud_recaptchaenterprise_v1::model::ScoreMetrics;
8762 /// use google_cloud_recaptchaenterprise_v1::model::ScoreDistribution;
8763 /// let x = ScoreMetrics::new().set_or_clear_overall_metrics(Some(ScoreDistribution::default()/* use setters */));
8764 /// let x = ScoreMetrics::new().set_or_clear_overall_metrics(None::<ScoreDistribution>);
8765 /// ```
8766 pub fn set_or_clear_overall_metrics<T>(mut self, v: std::option::Option<T>) -> Self
8767 where
8768 T: std::convert::Into<crate::model::ScoreDistribution>,
8769 {
8770 self.overall_metrics = v.map(|x| x.into());
8771 self
8772 }
8773
8774 /// Sets the value of [action_metrics][crate::model::ScoreMetrics::action_metrics].
8775 ///
8776 /// # Example
8777 /// ```ignore,no_run
8778 /// # use google_cloud_recaptchaenterprise_v1::model::ScoreMetrics;
8779 /// use google_cloud_recaptchaenterprise_v1::model::ScoreDistribution;
8780 /// let x = ScoreMetrics::new().set_action_metrics([
8781 /// ("key0", ScoreDistribution::default()/* use setters */),
8782 /// ("key1", ScoreDistribution::default()/* use (different) setters */),
8783 /// ]);
8784 /// ```
8785 pub fn set_action_metrics<T, K, V>(mut self, v: T) -> Self
8786 where
8787 T: std::iter::IntoIterator<Item = (K, V)>,
8788 K: std::convert::Into<std::string::String>,
8789 V: std::convert::Into<crate::model::ScoreDistribution>,
8790 {
8791 use std::iter::Iterator;
8792 self.action_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8793 self
8794 }
8795}
8796
8797impl wkt::message::Message for ScoreMetrics {
8798 fn typename() -> &'static str {
8799 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ScoreMetrics"
8800 }
8801}
8802
8803/// Metrics related to challenges.
8804#[derive(Clone, Default, PartialEq)]
8805#[non_exhaustive]
8806pub struct ChallengeMetrics {
8807 /// Count of reCAPTCHA checkboxes or badges rendered. This is mostly equivalent
8808 /// to a count of pageloads for pages that include reCAPTCHA.
8809 pub pageload_count: i64,
8810
8811 /// Count of nocaptchas (successful verification without a challenge) issued.
8812 pub nocaptcha_count: i64,
8813
8814 /// Count of submitted challenge solutions that were incorrect or otherwise
8815 /// deemed suspicious such that a subsequent challenge was triggered.
8816 pub failed_count: i64,
8817
8818 /// Count of nocaptchas (successful verification without a challenge) plus
8819 /// submitted challenge solutions that were correct and resulted in
8820 /// verification.
8821 pub passed_count: i64,
8822
8823 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8824}
8825
8826impl ChallengeMetrics {
8827 /// Creates a new default instance.
8828 pub fn new() -> Self {
8829 std::default::Default::default()
8830 }
8831
8832 /// Sets the value of [pageload_count][crate::model::ChallengeMetrics::pageload_count].
8833 ///
8834 /// # Example
8835 /// ```ignore,no_run
8836 /// # use google_cloud_recaptchaenterprise_v1::model::ChallengeMetrics;
8837 /// let x = ChallengeMetrics::new().set_pageload_count(42);
8838 /// ```
8839 pub fn set_pageload_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8840 self.pageload_count = v.into();
8841 self
8842 }
8843
8844 /// Sets the value of [nocaptcha_count][crate::model::ChallengeMetrics::nocaptcha_count].
8845 ///
8846 /// # Example
8847 /// ```ignore,no_run
8848 /// # use google_cloud_recaptchaenterprise_v1::model::ChallengeMetrics;
8849 /// let x = ChallengeMetrics::new().set_nocaptcha_count(42);
8850 /// ```
8851 pub fn set_nocaptcha_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8852 self.nocaptcha_count = v.into();
8853 self
8854 }
8855
8856 /// Sets the value of [failed_count][crate::model::ChallengeMetrics::failed_count].
8857 ///
8858 /// # Example
8859 /// ```ignore,no_run
8860 /// # use google_cloud_recaptchaenterprise_v1::model::ChallengeMetrics;
8861 /// let x = ChallengeMetrics::new().set_failed_count(42);
8862 /// ```
8863 pub fn set_failed_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8864 self.failed_count = v.into();
8865 self
8866 }
8867
8868 /// Sets the value of [passed_count][crate::model::ChallengeMetrics::passed_count].
8869 ///
8870 /// # Example
8871 /// ```ignore,no_run
8872 /// # use google_cloud_recaptchaenterprise_v1::model::ChallengeMetrics;
8873 /// let x = ChallengeMetrics::new().set_passed_count(42);
8874 /// ```
8875 pub fn set_passed_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
8876 self.passed_count = v.into();
8877 self
8878 }
8879}
8880
8881impl wkt::message::Message for ChallengeMetrics {
8882 fn typename() -> &'static str {
8883 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ChallengeMetrics"
8884 }
8885}
8886
8887/// Policy config assessment.
8888#[derive(Clone, Default, PartialEq)]
8889#[non_exhaustive]
8890pub struct FirewallPolicyAssessment {
8891 /// Output only. If the processing of a policy config fails, an error is
8892 /// populated and the firewall_policy is left empty.
8893 pub error: std::option::Option<google_cloud_rpc::model::Status>,
8894
8895 /// Output only. The policy that matched the request. If more than one policy
8896 /// may match, this is the first match. If no policy matches the incoming
8897 /// request, the policy field is left empty.
8898 pub firewall_policy: std::option::Option<crate::model::FirewallPolicy>,
8899
8900 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8901}
8902
8903impl FirewallPolicyAssessment {
8904 /// Creates a new default instance.
8905 pub fn new() -> Self {
8906 std::default::Default::default()
8907 }
8908
8909 /// Sets the value of [error][crate::model::FirewallPolicyAssessment::error].
8910 ///
8911 /// # Example
8912 /// ```ignore,no_run
8913 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallPolicyAssessment;
8914 /// use google_cloud_rpc::model::Status;
8915 /// let x = FirewallPolicyAssessment::new().set_error(Status::default()/* use setters */);
8916 /// ```
8917 pub fn set_error<T>(mut self, v: T) -> Self
8918 where
8919 T: std::convert::Into<google_cloud_rpc::model::Status>,
8920 {
8921 self.error = std::option::Option::Some(v.into());
8922 self
8923 }
8924
8925 /// Sets or clears the value of [error][crate::model::FirewallPolicyAssessment::error].
8926 ///
8927 /// # Example
8928 /// ```ignore,no_run
8929 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallPolicyAssessment;
8930 /// use google_cloud_rpc::model::Status;
8931 /// let x = FirewallPolicyAssessment::new().set_or_clear_error(Some(Status::default()/* use setters */));
8932 /// let x = FirewallPolicyAssessment::new().set_or_clear_error(None::<Status>);
8933 /// ```
8934 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
8935 where
8936 T: std::convert::Into<google_cloud_rpc::model::Status>,
8937 {
8938 self.error = v.map(|x| x.into());
8939 self
8940 }
8941
8942 /// Sets the value of [firewall_policy][crate::model::FirewallPolicyAssessment::firewall_policy].
8943 ///
8944 /// # Example
8945 /// ```ignore,no_run
8946 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallPolicyAssessment;
8947 /// use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
8948 /// let x = FirewallPolicyAssessment::new().set_firewall_policy(FirewallPolicy::default()/* use setters */);
8949 /// ```
8950 pub fn set_firewall_policy<T>(mut self, v: T) -> Self
8951 where
8952 T: std::convert::Into<crate::model::FirewallPolicy>,
8953 {
8954 self.firewall_policy = std::option::Option::Some(v.into());
8955 self
8956 }
8957
8958 /// Sets or clears the value of [firewall_policy][crate::model::FirewallPolicyAssessment::firewall_policy].
8959 ///
8960 /// # Example
8961 /// ```ignore,no_run
8962 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallPolicyAssessment;
8963 /// use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
8964 /// let x = FirewallPolicyAssessment::new().set_or_clear_firewall_policy(Some(FirewallPolicy::default()/* use setters */));
8965 /// let x = FirewallPolicyAssessment::new().set_or_clear_firewall_policy(None::<FirewallPolicy>);
8966 /// ```
8967 pub fn set_or_clear_firewall_policy<T>(mut self, v: std::option::Option<T>) -> Self
8968 where
8969 T: std::convert::Into<crate::model::FirewallPolicy>,
8970 {
8971 self.firewall_policy = v.map(|x| x.into());
8972 self
8973 }
8974}
8975
8976impl wkt::message::Message for FirewallPolicyAssessment {
8977 fn typename() -> &'static str {
8978 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FirewallPolicyAssessment"
8979 }
8980}
8981
8982/// An individual action. Each action represents what to do if a policy
8983/// matches.
8984#[derive(Clone, Default, PartialEq)]
8985#[non_exhaustive]
8986pub struct FirewallAction {
8987 #[allow(missing_docs)]
8988 pub firewall_action_oneof:
8989 std::option::Option<crate::model::firewall_action::FirewallActionOneof>,
8990
8991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8992}
8993
8994impl FirewallAction {
8995 /// Creates a new default instance.
8996 pub fn new() -> Self {
8997 std::default::Default::default()
8998 }
8999
9000 /// Sets the value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof].
9001 ///
9002 /// Note that all the setters affecting `firewall_action_oneof` are mutually
9003 /// exclusive.
9004 ///
9005 /// # Example
9006 /// ```ignore,no_run
9007 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallAction;
9008 /// use google_cloud_recaptchaenterprise_v1::model::firewall_action::AllowAction;
9009 /// let x = FirewallAction::new().set_firewall_action_oneof(Some(
9010 /// google_cloud_recaptchaenterprise_v1::model::firewall_action::FirewallActionOneof::Allow(AllowAction::default().into())));
9011 /// ```
9012 pub fn set_firewall_action_oneof<
9013 T: std::convert::Into<std::option::Option<crate::model::firewall_action::FirewallActionOneof>>,
9014 >(
9015 mut self,
9016 v: T,
9017 ) -> Self {
9018 self.firewall_action_oneof = v.into();
9019 self
9020 }
9021
9022 /// The value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9023 /// if it holds a `Allow`, `None` if the field is not set or
9024 /// holds a different branch.
9025 pub fn allow(
9026 &self,
9027 ) -> std::option::Option<&std::boxed::Box<crate::model::firewall_action::AllowAction>> {
9028 #[allow(unreachable_patterns)]
9029 self.firewall_action_oneof.as_ref().and_then(|v| match v {
9030 crate::model::firewall_action::FirewallActionOneof::Allow(v) => {
9031 std::option::Option::Some(v)
9032 }
9033 _ => std::option::Option::None,
9034 })
9035 }
9036
9037 /// Sets the value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9038 /// to hold a `Allow`.
9039 ///
9040 /// Note that all the setters affecting `firewall_action_oneof` are
9041 /// mutually exclusive.
9042 ///
9043 /// # Example
9044 /// ```ignore,no_run
9045 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallAction;
9046 /// use google_cloud_recaptchaenterprise_v1::model::firewall_action::AllowAction;
9047 /// let x = FirewallAction::new().set_allow(AllowAction::default()/* use setters */);
9048 /// assert!(x.allow().is_some());
9049 /// assert!(x.block().is_none());
9050 /// assert!(x.include_recaptcha_script().is_none());
9051 /// assert!(x.redirect().is_none());
9052 /// assert!(x.substitute().is_none());
9053 /// assert!(x.set_header().is_none());
9054 /// ```
9055 pub fn set_allow<
9056 T: std::convert::Into<std::boxed::Box<crate::model::firewall_action::AllowAction>>,
9057 >(
9058 mut self,
9059 v: T,
9060 ) -> Self {
9061 self.firewall_action_oneof = std::option::Option::Some(
9062 crate::model::firewall_action::FirewallActionOneof::Allow(v.into()),
9063 );
9064 self
9065 }
9066
9067 /// The value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9068 /// if it holds a `Block`, `None` if the field is not set or
9069 /// holds a different branch.
9070 pub fn block(
9071 &self,
9072 ) -> std::option::Option<&std::boxed::Box<crate::model::firewall_action::BlockAction>> {
9073 #[allow(unreachable_patterns)]
9074 self.firewall_action_oneof.as_ref().and_then(|v| match v {
9075 crate::model::firewall_action::FirewallActionOneof::Block(v) => {
9076 std::option::Option::Some(v)
9077 }
9078 _ => std::option::Option::None,
9079 })
9080 }
9081
9082 /// Sets the value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9083 /// to hold a `Block`.
9084 ///
9085 /// Note that all the setters affecting `firewall_action_oneof` are
9086 /// mutually exclusive.
9087 ///
9088 /// # Example
9089 /// ```ignore,no_run
9090 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallAction;
9091 /// use google_cloud_recaptchaenterprise_v1::model::firewall_action::BlockAction;
9092 /// let x = FirewallAction::new().set_block(BlockAction::default()/* use setters */);
9093 /// assert!(x.block().is_some());
9094 /// assert!(x.allow().is_none());
9095 /// assert!(x.include_recaptcha_script().is_none());
9096 /// assert!(x.redirect().is_none());
9097 /// assert!(x.substitute().is_none());
9098 /// assert!(x.set_header().is_none());
9099 /// ```
9100 pub fn set_block<
9101 T: std::convert::Into<std::boxed::Box<crate::model::firewall_action::BlockAction>>,
9102 >(
9103 mut self,
9104 v: T,
9105 ) -> Self {
9106 self.firewall_action_oneof = std::option::Option::Some(
9107 crate::model::firewall_action::FirewallActionOneof::Block(v.into()),
9108 );
9109 self
9110 }
9111
9112 /// The value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9113 /// if it holds a `IncludeRecaptchaScript`, `None` if the field is not set or
9114 /// holds a different branch.
9115 pub fn include_recaptcha_script(
9116 &self,
9117 ) -> std::option::Option<
9118 &std::boxed::Box<crate::model::firewall_action::IncludeRecaptchaScriptAction>,
9119 > {
9120 #[allow(unreachable_patterns)]
9121 self.firewall_action_oneof.as_ref().and_then(|v| match v {
9122 crate::model::firewall_action::FirewallActionOneof::IncludeRecaptchaScript(v) => {
9123 std::option::Option::Some(v)
9124 }
9125 _ => std::option::Option::None,
9126 })
9127 }
9128
9129 /// Sets the value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9130 /// to hold a `IncludeRecaptchaScript`.
9131 ///
9132 /// Note that all the setters affecting `firewall_action_oneof` are
9133 /// mutually exclusive.
9134 ///
9135 /// # Example
9136 /// ```ignore,no_run
9137 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallAction;
9138 /// use google_cloud_recaptchaenterprise_v1::model::firewall_action::IncludeRecaptchaScriptAction;
9139 /// let x = FirewallAction::new().set_include_recaptcha_script(IncludeRecaptchaScriptAction::default()/* use setters */);
9140 /// assert!(x.include_recaptcha_script().is_some());
9141 /// assert!(x.allow().is_none());
9142 /// assert!(x.block().is_none());
9143 /// assert!(x.redirect().is_none());
9144 /// assert!(x.substitute().is_none());
9145 /// assert!(x.set_header().is_none());
9146 /// ```
9147 pub fn set_include_recaptcha_script<
9148 T: std::convert::Into<
9149 std::boxed::Box<crate::model::firewall_action::IncludeRecaptchaScriptAction>,
9150 >,
9151 >(
9152 mut self,
9153 v: T,
9154 ) -> Self {
9155 self.firewall_action_oneof = std::option::Option::Some(
9156 crate::model::firewall_action::FirewallActionOneof::IncludeRecaptchaScript(v.into()),
9157 );
9158 self
9159 }
9160
9161 /// The value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9162 /// if it holds a `Redirect`, `None` if the field is not set or
9163 /// holds a different branch.
9164 pub fn redirect(
9165 &self,
9166 ) -> std::option::Option<&std::boxed::Box<crate::model::firewall_action::RedirectAction>> {
9167 #[allow(unreachable_patterns)]
9168 self.firewall_action_oneof.as_ref().and_then(|v| match v {
9169 crate::model::firewall_action::FirewallActionOneof::Redirect(v) => {
9170 std::option::Option::Some(v)
9171 }
9172 _ => std::option::Option::None,
9173 })
9174 }
9175
9176 /// Sets the value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9177 /// to hold a `Redirect`.
9178 ///
9179 /// Note that all the setters affecting `firewall_action_oneof` are
9180 /// mutually exclusive.
9181 ///
9182 /// # Example
9183 /// ```ignore,no_run
9184 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallAction;
9185 /// use google_cloud_recaptchaenterprise_v1::model::firewall_action::RedirectAction;
9186 /// let x = FirewallAction::new().set_redirect(RedirectAction::default()/* use setters */);
9187 /// assert!(x.redirect().is_some());
9188 /// assert!(x.allow().is_none());
9189 /// assert!(x.block().is_none());
9190 /// assert!(x.include_recaptcha_script().is_none());
9191 /// assert!(x.substitute().is_none());
9192 /// assert!(x.set_header().is_none());
9193 /// ```
9194 pub fn set_redirect<
9195 T: std::convert::Into<std::boxed::Box<crate::model::firewall_action::RedirectAction>>,
9196 >(
9197 mut self,
9198 v: T,
9199 ) -> Self {
9200 self.firewall_action_oneof = std::option::Option::Some(
9201 crate::model::firewall_action::FirewallActionOneof::Redirect(v.into()),
9202 );
9203 self
9204 }
9205
9206 /// The value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9207 /// if it holds a `Substitute`, `None` if the field is not set or
9208 /// holds a different branch.
9209 pub fn substitute(
9210 &self,
9211 ) -> std::option::Option<&std::boxed::Box<crate::model::firewall_action::SubstituteAction>>
9212 {
9213 #[allow(unreachable_patterns)]
9214 self.firewall_action_oneof.as_ref().and_then(|v| match v {
9215 crate::model::firewall_action::FirewallActionOneof::Substitute(v) => {
9216 std::option::Option::Some(v)
9217 }
9218 _ => std::option::Option::None,
9219 })
9220 }
9221
9222 /// Sets the value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9223 /// to hold a `Substitute`.
9224 ///
9225 /// Note that all the setters affecting `firewall_action_oneof` are
9226 /// mutually exclusive.
9227 ///
9228 /// # Example
9229 /// ```ignore,no_run
9230 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallAction;
9231 /// use google_cloud_recaptchaenterprise_v1::model::firewall_action::SubstituteAction;
9232 /// let x = FirewallAction::new().set_substitute(SubstituteAction::default()/* use setters */);
9233 /// assert!(x.substitute().is_some());
9234 /// assert!(x.allow().is_none());
9235 /// assert!(x.block().is_none());
9236 /// assert!(x.include_recaptcha_script().is_none());
9237 /// assert!(x.redirect().is_none());
9238 /// assert!(x.set_header().is_none());
9239 /// ```
9240 pub fn set_substitute<
9241 T: std::convert::Into<std::boxed::Box<crate::model::firewall_action::SubstituteAction>>,
9242 >(
9243 mut self,
9244 v: T,
9245 ) -> Self {
9246 self.firewall_action_oneof = std::option::Option::Some(
9247 crate::model::firewall_action::FirewallActionOneof::Substitute(v.into()),
9248 );
9249 self
9250 }
9251
9252 /// The value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9253 /// if it holds a `SetHeader`, `None` if the field is not set or
9254 /// holds a different branch.
9255 pub fn set_header(
9256 &self,
9257 ) -> std::option::Option<&std::boxed::Box<crate::model::firewall_action::SetHeaderAction>> {
9258 #[allow(unreachable_patterns)]
9259 self.firewall_action_oneof.as_ref().and_then(|v| match v {
9260 crate::model::firewall_action::FirewallActionOneof::SetHeader(v) => {
9261 std::option::Option::Some(v)
9262 }
9263 _ => std::option::Option::None,
9264 })
9265 }
9266
9267 /// Sets the value of [firewall_action_oneof][crate::model::FirewallAction::firewall_action_oneof]
9268 /// to hold a `SetHeader`.
9269 ///
9270 /// Note that all the setters affecting `firewall_action_oneof` are
9271 /// mutually exclusive.
9272 ///
9273 /// # Example
9274 /// ```ignore,no_run
9275 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallAction;
9276 /// use google_cloud_recaptchaenterprise_v1::model::firewall_action::SetHeaderAction;
9277 /// let x = FirewallAction::new().set_set_header(SetHeaderAction::default()/* use setters */);
9278 /// assert!(x.set_header().is_some());
9279 /// assert!(x.allow().is_none());
9280 /// assert!(x.block().is_none());
9281 /// assert!(x.include_recaptcha_script().is_none());
9282 /// assert!(x.redirect().is_none());
9283 /// assert!(x.substitute().is_none());
9284 /// ```
9285 pub fn set_set_header<
9286 T: std::convert::Into<std::boxed::Box<crate::model::firewall_action::SetHeaderAction>>,
9287 >(
9288 mut self,
9289 v: T,
9290 ) -> Self {
9291 self.firewall_action_oneof = std::option::Option::Some(
9292 crate::model::firewall_action::FirewallActionOneof::SetHeader(v.into()),
9293 );
9294 self
9295 }
9296}
9297
9298impl wkt::message::Message for FirewallAction {
9299 fn typename() -> &'static str {
9300 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FirewallAction"
9301 }
9302}
9303
9304/// Defines additional types related to [FirewallAction].
9305pub mod firewall_action {
9306 #[allow(unused_imports)]
9307 use super::*;
9308
9309 /// An allow action continues processing a request unimpeded.
9310 #[derive(Clone, Default, PartialEq)]
9311 #[non_exhaustive]
9312 pub struct AllowAction {
9313 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9314 }
9315
9316 impl AllowAction {
9317 /// Creates a new default instance.
9318 pub fn new() -> Self {
9319 std::default::Default::default()
9320 }
9321 }
9322
9323 impl wkt::message::Message for AllowAction {
9324 fn typename() -> &'static str {
9325 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FirewallAction.AllowAction"
9326 }
9327 }
9328
9329 /// A block action serves an HTTP error code a prevents the request from
9330 /// hitting the backend.
9331 #[derive(Clone, Default, PartialEq)]
9332 #[non_exhaustive]
9333 pub struct BlockAction {
9334 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9335 }
9336
9337 impl BlockAction {
9338 /// Creates a new default instance.
9339 pub fn new() -> Self {
9340 std::default::Default::default()
9341 }
9342 }
9343
9344 impl wkt::message::Message for BlockAction {
9345 fn typename() -> &'static str {
9346 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FirewallAction.BlockAction"
9347 }
9348 }
9349
9350 /// An include reCAPTCHA script action involves injecting reCAPTCHA JavaScript
9351 /// code into the HTML returned by the site backend. This reCAPTCHA
9352 /// script is tasked with collecting user signals on the requested web page,
9353 /// issuing tokens as a cookie within the site domain, and enabling their
9354 /// utilization in subsequent page requests.
9355 #[derive(Clone, Default, PartialEq)]
9356 #[non_exhaustive]
9357 pub struct IncludeRecaptchaScriptAction {
9358 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9359 }
9360
9361 impl IncludeRecaptchaScriptAction {
9362 /// Creates a new default instance.
9363 pub fn new() -> Self {
9364 std::default::Default::default()
9365 }
9366 }
9367
9368 impl wkt::message::Message for IncludeRecaptchaScriptAction {
9369 fn typename() -> &'static str {
9370 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FirewallAction.IncludeRecaptchaScriptAction"
9371 }
9372 }
9373
9374 /// A redirect action returns a 307 (temporary redirect) response, pointing
9375 /// the user to a reCAPTCHA interstitial page to attach a token.
9376 #[derive(Clone, Default, PartialEq)]
9377 #[non_exhaustive]
9378 pub struct RedirectAction {
9379 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9380 }
9381
9382 impl RedirectAction {
9383 /// Creates a new default instance.
9384 pub fn new() -> Self {
9385 std::default::Default::default()
9386 }
9387 }
9388
9389 impl wkt::message::Message for RedirectAction {
9390 fn typename() -> &'static str {
9391 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FirewallAction.RedirectAction"
9392 }
9393 }
9394
9395 /// A substitute action transparently serves a different page than the one
9396 /// requested.
9397 #[derive(Clone, Default, PartialEq)]
9398 #[non_exhaustive]
9399 pub struct SubstituteAction {
9400 /// Optional. The address to redirect to. The target is a relative path in
9401 /// the current host. Example: "/blog/404.html".
9402 pub path: std::string::String,
9403
9404 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9405 }
9406
9407 impl SubstituteAction {
9408 /// Creates a new default instance.
9409 pub fn new() -> Self {
9410 std::default::Default::default()
9411 }
9412
9413 /// Sets the value of [path][crate::model::firewall_action::SubstituteAction::path].
9414 ///
9415 /// # Example
9416 /// ```ignore,no_run
9417 /// # use google_cloud_recaptchaenterprise_v1::model::firewall_action::SubstituteAction;
9418 /// let x = SubstituteAction::new().set_path("example");
9419 /// ```
9420 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9421 self.path = v.into();
9422 self
9423 }
9424 }
9425
9426 impl wkt::message::Message for SubstituteAction {
9427 fn typename() -> &'static str {
9428 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FirewallAction.SubstituteAction"
9429 }
9430 }
9431
9432 /// A set header action sets a header and forwards the request to the
9433 /// backend. This can be used to trigger custom protection implemented on the
9434 /// backend.
9435 #[derive(Clone, Default, PartialEq)]
9436 #[non_exhaustive]
9437 pub struct SetHeaderAction {
9438 /// Optional. The header key to set in the request to the backend server.
9439 pub key: std::string::String,
9440
9441 /// Optional. The header value to set in the request to the backend server.
9442 pub value: std::string::String,
9443
9444 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9445 }
9446
9447 impl SetHeaderAction {
9448 /// Creates a new default instance.
9449 pub fn new() -> Self {
9450 std::default::Default::default()
9451 }
9452
9453 /// Sets the value of [key][crate::model::firewall_action::SetHeaderAction::key].
9454 ///
9455 /// # Example
9456 /// ```ignore,no_run
9457 /// # use google_cloud_recaptchaenterprise_v1::model::firewall_action::SetHeaderAction;
9458 /// let x = SetHeaderAction::new().set_key("example");
9459 /// ```
9460 pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9461 self.key = v.into();
9462 self
9463 }
9464
9465 /// Sets the value of [value][crate::model::firewall_action::SetHeaderAction::value].
9466 ///
9467 /// # Example
9468 /// ```ignore,no_run
9469 /// # use google_cloud_recaptchaenterprise_v1::model::firewall_action::SetHeaderAction;
9470 /// let x = SetHeaderAction::new().set_value("example");
9471 /// ```
9472 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9473 self.value = v.into();
9474 self
9475 }
9476 }
9477
9478 impl wkt::message::Message for SetHeaderAction {
9479 fn typename() -> &'static str {
9480 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FirewallAction.SetHeaderAction"
9481 }
9482 }
9483
9484 #[allow(missing_docs)]
9485 #[derive(Clone, Debug, PartialEq)]
9486 #[non_exhaustive]
9487 pub enum FirewallActionOneof {
9488 /// The user request did not match any policy and should be allowed
9489 /// access to the requested resource.
9490 Allow(std::boxed::Box<crate::model::firewall_action::AllowAction>),
9491 /// This action denies access to a given page. The user gets an HTTP
9492 /// error code.
9493 Block(std::boxed::Box<crate::model::firewall_action::BlockAction>),
9494 /// This action injects reCAPTCHA JavaScript code into the HTML page
9495 /// returned by the site backend.
9496 IncludeRecaptchaScript(
9497 std::boxed::Box<crate::model::firewall_action::IncludeRecaptchaScriptAction>,
9498 ),
9499 /// This action redirects the request to a reCAPTCHA interstitial to
9500 /// attach a token.
9501 Redirect(std::boxed::Box<crate::model::firewall_action::RedirectAction>),
9502 /// This action transparently serves a different page to an offending
9503 /// user.
9504 Substitute(std::boxed::Box<crate::model::firewall_action::SubstituteAction>),
9505 /// This action sets a custom header but allow the request to continue
9506 /// to the customer backend.
9507 SetHeader(std::boxed::Box<crate::model::firewall_action::SetHeaderAction>),
9508 }
9509}
9510
9511/// A FirewallPolicy represents a single matching pattern and resulting actions
9512/// to take.
9513#[derive(Clone, Default, PartialEq)]
9514#[non_exhaustive]
9515pub struct FirewallPolicy {
9516 /// Identifier. The resource name for the FirewallPolicy in the format
9517 /// `projects/{project}/firewallpolicies/{firewallpolicy}`.
9518 pub name: std::string::String,
9519
9520 /// Optional. A description of what this policy aims to achieve, for
9521 /// convenience purposes. The description can at most include 256 UTF-8
9522 /// characters.
9523 pub description: std::string::String,
9524
9525 /// Optional. The path for which this policy applies, specified as a glob
9526 /// pattern. For more information on glob, see the [manual
9527 /// page](https://man7.org/linux/man-pages/man7/glob.7.html).
9528 /// A path has a max length of 200 characters.
9529 pub path: std::string::String,
9530
9531 /// Optional. A CEL (Common Expression Language) conditional expression that
9532 /// specifies if this policy applies to an incoming user request. If this
9533 /// condition evaluates to true and the requested path matched the path
9534 /// pattern, the associated actions should be executed by the caller. The
9535 /// condition string is checked for CEL syntax correctness on creation. For
9536 /// more information, see the [CEL spec](https://github.com/google/cel-spec)
9537 /// and its [language
9538 /// definition](https://github.com/google/cel-spec/blob/master/doc/langdef.md).
9539 /// A condition has a max length of 500 characters.
9540 pub condition: std::string::String,
9541
9542 /// Optional. The actions that the caller should take regarding user access.
9543 /// There should be at most one terminal action. A terminal action is any
9544 /// action that forces a response, such as `AllowAction`,
9545 /// `BlockAction` or `SubstituteAction`.
9546 /// Zero or more non-terminal actions such as `SetHeader` might be
9547 /// specified. A single policy can contain up to 16 actions.
9548 pub actions: std::vec::Vec<crate::model::FirewallAction>,
9549
9550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9551}
9552
9553impl FirewallPolicy {
9554 /// Creates a new default instance.
9555 pub fn new() -> Self {
9556 std::default::Default::default()
9557 }
9558
9559 /// Sets the value of [name][crate::model::FirewallPolicy::name].
9560 ///
9561 /// # Example
9562 /// ```ignore,no_run
9563 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
9564 /// # let project_id = "project_id";
9565 /// # let firewallpolicy_id = "firewallpolicy_id";
9566 /// let x = FirewallPolicy::new().set_name(format!("projects/{project_id}/firewallpolicies/{firewallpolicy_id}"));
9567 /// ```
9568 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9569 self.name = v.into();
9570 self
9571 }
9572
9573 /// Sets the value of [description][crate::model::FirewallPolicy::description].
9574 ///
9575 /// # Example
9576 /// ```ignore,no_run
9577 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
9578 /// let x = FirewallPolicy::new().set_description("example");
9579 /// ```
9580 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9581 self.description = v.into();
9582 self
9583 }
9584
9585 /// Sets the value of [path][crate::model::FirewallPolicy::path].
9586 ///
9587 /// # Example
9588 /// ```ignore,no_run
9589 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
9590 /// let x = FirewallPolicy::new().set_path("example");
9591 /// ```
9592 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9593 self.path = v.into();
9594 self
9595 }
9596
9597 /// Sets the value of [condition][crate::model::FirewallPolicy::condition].
9598 ///
9599 /// # Example
9600 /// ```ignore,no_run
9601 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
9602 /// let x = FirewallPolicy::new().set_condition("example");
9603 /// ```
9604 pub fn set_condition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9605 self.condition = v.into();
9606 self
9607 }
9608
9609 /// Sets the value of [actions][crate::model::FirewallPolicy::actions].
9610 ///
9611 /// # Example
9612 /// ```ignore,no_run
9613 /// # use google_cloud_recaptchaenterprise_v1::model::FirewallPolicy;
9614 /// use google_cloud_recaptchaenterprise_v1::model::FirewallAction;
9615 /// let x = FirewallPolicy::new()
9616 /// .set_actions([
9617 /// FirewallAction::default()/* use setters */,
9618 /// FirewallAction::default()/* use (different) setters */,
9619 /// ]);
9620 /// ```
9621 pub fn set_actions<T, V>(mut self, v: T) -> Self
9622 where
9623 T: std::iter::IntoIterator<Item = V>,
9624 V: std::convert::Into<crate::model::FirewallAction>,
9625 {
9626 use std::iter::Iterator;
9627 self.actions = v.into_iter().map(|i| i.into()).collect();
9628 self
9629 }
9630}
9631
9632impl wkt::message::Message for FirewallPolicy {
9633 fn typename() -> &'static str {
9634 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.FirewallPolicy"
9635 }
9636}
9637
9638/// The request message to list memberships in a related account group.
9639#[derive(Clone, Default, PartialEq)]
9640#[non_exhaustive]
9641pub struct ListRelatedAccountGroupMembershipsRequest {
9642 /// Required. The resource name for the related account group in the format
9643 /// `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`.
9644 pub parent: std::string::String,
9645
9646 /// Optional. The maximum number of accounts to return. The service might
9647 /// return fewer than this value. If unspecified, at most 50 accounts are
9648 /// returned. The maximum value is 1000; values above 1000 are coerced to 1000.
9649 pub page_size: i32,
9650
9651 /// Optional. A page token, received from a previous
9652 /// `ListRelatedAccountGroupMemberships` call.
9653 ///
9654 /// When paginating, all other parameters provided to
9655 /// `ListRelatedAccountGroupMemberships` must match the call that provided the
9656 /// page token.
9657 pub page_token: std::string::String,
9658
9659 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9660}
9661
9662impl ListRelatedAccountGroupMembershipsRequest {
9663 /// Creates a new default instance.
9664 pub fn new() -> Self {
9665 std::default::Default::default()
9666 }
9667
9668 /// Sets the value of [parent][crate::model::ListRelatedAccountGroupMembershipsRequest::parent].
9669 ///
9670 /// # Example
9671 /// ```ignore,no_run
9672 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupMembershipsRequest;
9673 /// # let project_id = "project_id";
9674 /// # let relatedaccountgroup_id = "relatedaccountgroup_id";
9675 /// let x = ListRelatedAccountGroupMembershipsRequest::new().set_parent(format!("projects/{project_id}/relatedaccountgroups/{relatedaccountgroup_id}"));
9676 /// ```
9677 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9678 self.parent = v.into();
9679 self
9680 }
9681
9682 /// Sets the value of [page_size][crate::model::ListRelatedAccountGroupMembershipsRequest::page_size].
9683 ///
9684 /// # Example
9685 /// ```ignore,no_run
9686 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupMembershipsRequest;
9687 /// let x = ListRelatedAccountGroupMembershipsRequest::new().set_page_size(42);
9688 /// ```
9689 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9690 self.page_size = v.into();
9691 self
9692 }
9693
9694 /// Sets the value of [page_token][crate::model::ListRelatedAccountGroupMembershipsRequest::page_token].
9695 ///
9696 /// # Example
9697 /// ```ignore,no_run
9698 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupMembershipsRequest;
9699 /// let x = ListRelatedAccountGroupMembershipsRequest::new().set_page_token("example");
9700 /// ```
9701 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9702 self.page_token = v.into();
9703 self
9704 }
9705}
9706
9707impl wkt::message::Message for ListRelatedAccountGroupMembershipsRequest {
9708 fn typename() -> &'static str {
9709 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest"
9710 }
9711}
9712
9713/// The response to a `ListRelatedAccountGroupMemberships` call.
9714#[derive(Clone, Default, PartialEq)]
9715#[non_exhaustive]
9716pub struct ListRelatedAccountGroupMembershipsResponse {
9717 /// The memberships listed by the query.
9718 pub related_account_group_memberships:
9719 std::vec::Vec<crate::model::RelatedAccountGroupMembership>,
9720
9721 /// A token, which can be sent as `page_token` to retrieve the next page.
9722 /// If this field is omitted, there are no subsequent pages.
9723 pub next_page_token: std::string::String,
9724
9725 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9726}
9727
9728impl ListRelatedAccountGroupMembershipsResponse {
9729 /// Creates a new default instance.
9730 pub fn new() -> Self {
9731 std::default::Default::default()
9732 }
9733
9734 /// Sets the value of [related_account_group_memberships][crate::model::ListRelatedAccountGroupMembershipsResponse::related_account_group_memberships].
9735 ///
9736 /// # Example
9737 /// ```ignore,no_run
9738 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupMembershipsResponse;
9739 /// use google_cloud_recaptchaenterprise_v1::model::RelatedAccountGroupMembership;
9740 /// let x = ListRelatedAccountGroupMembershipsResponse::new()
9741 /// .set_related_account_group_memberships([
9742 /// RelatedAccountGroupMembership::default()/* use setters */,
9743 /// RelatedAccountGroupMembership::default()/* use (different) setters */,
9744 /// ]);
9745 /// ```
9746 pub fn set_related_account_group_memberships<T, V>(mut self, v: T) -> Self
9747 where
9748 T: std::iter::IntoIterator<Item = V>,
9749 V: std::convert::Into<crate::model::RelatedAccountGroupMembership>,
9750 {
9751 use std::iter::Iterator;
9752 self.related_account_group_memberships = v.into_iter().map(|i| i.into()).collect();
9753 self
9754 }
9755
9756 /// Sets the value of [next_page_token][crate::model::ListRelatedAccountGroupMembershipsResponse::next_page_token].
9757 ///
9758 /// # Example
9759 /// ```ignore,no_run
9760 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupMembershipsResponse;
9761 /// let x = ListRelatedAccountGroupMembershipsResponse::new().set_next_page_token("example");
9762 /// ```
9763 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9764 self.next_page_token = v.into();
9765 self
9766 }
9767}
9768
9769impl wkt::message::Message for ListRelatedAccountGroupMembershipsResponse {
9770 fn typename() -> &'static str {
9771 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse"
9772 }
9773}
9774
9775#[doc(hidden)]
9776impl google_cloud_gax::paginator::internal::PageableResponse
9777 for ListRelatedAccountGroupMembershipsResponse
9778{
9779 type PageItem = crate::model::RelatedAccountGroupMembership;
9780
9781 fn items(self) -> std::vec::Vec<Self::PageItem> {
9782 self.related_account_group_memberships
9783 }
9784
9785 fn next_page_token(&self) -> std::string::String {
9786 use std::clone::Clone;
9787 self.next_page_token.clone()
9788 }
9789}
9790
9791/// The request message to list related account groups.
9792#[derive(Clone, Default, PartialEq)]
9793#[non_exhaustive]
9794pub struct ListRelatedAccountGroupsRequest {
9795 /// Required. The name of the project to list related account groups from, in
9796 /// the format `projects/{project}`.
9797 pub parent: std::string::String,
9798
9799 /// Optional. The maximum number of groups to return. The service might return
9800 /// fewer than this value. If unspecified, at most 50 groups are returned. The
9801 /// maximum value is 1000; values above 1000 are coerced to 1000.
9802 pub page_size: i32,
9803
9804 /// Optional. A page token, received from a previous `ListRelatedAccountGroups`
9805 /// call. Provide this to retrieve the subsequent page.
9806 ///
9807 /// When paginating, all other parameters provided to
9808 /// `ListRelatedAccountGroups` must match the call that provided the page
9809 /// token.
9810 pub page_token: std::string::String,
9811
9812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9813}
9814
9815impl ListRelatedAccountGroupsRequest {
9816 /// Creates a new default instance.
9817 pub fn new() -> Self {
9818 std::default::Default::default()
9819 }
9820
9821 /// Sets the value of [parent][crate::model::ListRelatedAccountGroupsRequest::parent].
9822 ///
9823 /// # Example
9824 /// ```ignore,no_run
9825 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupsRequest;
9826 /// # let project_id = "project_id";
9827 /// let x = ListRelatedAccountGroupsRequest::new().set_parent(format!("projects/{project_id}"));
9828 /// ```
9829 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9830 self.parent = v.into();
9831 self
9832 }
9833
9834 /// Sets the value of [page_size][crate::model::ListRelatedAccountGroupsRequest::page_size].
9835 ///
9836 /// # Example
9837 /// ```ignore,no_run
9838 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupsRequest;
9839 /// let x = ListRelatedAccountGroupsRequest::new().set_page_size(42);
9840 /// ```
9841 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9842 self.page_size = v.into();
9843 self
9844 }
9845
9846 /// Sets the value of [page_token][crate::model::ListRelatedAccountGroupsRequest::page_token].
9847 ///
9848 /// # Example
9849 /// ```ignore,no_run
9850 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupsRequest;
9851 /// let x = ListRelatedAccountGroupsRequest::new().set_page_token("example");
9852 /// ```
9853 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9854 self.page_token = v.into();
9855 self
9856 }
9857}
9858
9859impl wkt::message::Message for ListRelatedAccountGroupsRequest {
9860 fn typename() -> &'static str {
9861 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest"
9862 }
9863}
9864
9865/// The response to a `ListRelatedAccountGroups` call.
9866#[derive(Clone, Default, PartialEq)]
9867#[non_exhaustive]
9868pub struct ListRelatedAccountGroupsResponse {
9869 /// The groups of related accounts listed by the query.
9870 pub related_account_groups: std::vec::Vec<crate::model::RelatedAccountGroup>,
9871
9872 /// A token, which can be sent as `page_token` to retrieve the next page.
9873 /// If this field is omitted, there are no subsequent pages.
9874 pub next_page_token: std::string::String,
9875
9876 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9877}
9878
9879impl ListRelatedAccountGroupsResponse {
9880 /// Creates a new default instance.
9881 pub fn new() -> Self {
9882 std::default::Default::default()
9883 }
9884
9885 /// Sets the value of [related_account_groups][crate::model::ListRelatedAccountGroupsResponse::related_account_groups].
9886 ///
9887 /// # Example
9888 /// ```ignore,no_run
9889 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupsResponse;
9890 /// use google_cloud_recaptchaenterprise_v1::model::RelatedAccountGroup;
9891 /// let x = ListRelatedAccountGroupsResponse::new()
9892 /// .set_related_account_groups([
9893 /// RelatedAccountGroup::default()/* use setters */,
9894 /// RelatedAccountGroup::default()/* use (different) setters */,
9895 /// ]);
9896 /// ```
9897 pub fn set_related_account_groups<T, V>(mut self, v: T) -> Self
9898 where
9899 T: std::iter::IntoIterator<Item = V>,
9900 V: std::convert::Into<crate::model::RelatedAccountGroup>,
9901 {
9902 use std::iter::Iterator;
9903 self.related_account_groups = v.into_iter().map(|i| i.into()).collect();
9904 self
9905 }
9906
9907 /// Sets the value of [next_page_token][crate::model::ListRelatedAccountGroupsResponse::next_page_token].
9908 ///
9909 /// # Example
9910 /// ```ignore,no_run
9911 /// # use google_cloud_recaptchaenterprise_v1::model::ListRelatedAccountGroupsResponse;
9912 /// let x = ListRelatedAccountGroupsResponse::new().set_next_page_token("example");
9913 /// ```
9914 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9915 self.next_page_token = v.into();
9916 self
9917 }
9918}
9919
9920impl wkt::message::Message for ListRelatedAccountGroupsResponse {
9921 fn typename() -> &'static str {
9922 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse"
9923 }
9924}
9925
9926#[doc(hidden)]
9927impl google_cloud_gax::paginator::internal::PageableResponse for ListRelatedAccountGroupsResponse {
9928 type PageItem = crate::model::RelatedAccountGroup;
9929
9930 fn items(self) -> std::vec::Vec<Self::PageItem> {
9931 self.related_account_groups
9932 }
9933
9934 fn next_page_token(&self) -> std::string::String {
9935 use std::clone::Clone;
9936 self.next_page_token.clone()
9937 }
9938}
9939
9940/// The request message to search related account group memberships.
9941#[derive(Clone, Default, PartialEq)]
9942#[non_exhaustive]
9943pub struct SearchRelatedAccountGroupMembershipsRequest {
9944 /// Required. The name of the project to search related account group
9945 /// memberships from. Specify the project name in the following format:
9946 /// `projects/{project}`.
9947 pub project: std::string::String,
9948
9949 /// Optional. The unique stable account identifier used to search connections.
9950 /// The identifier should correspond to an `account_id` provided in a previous
9951 /// `CreateAssessment` or `AnnotateAssessment` call. Either hashed_account_id
9952 /// or account_id must be set, but not both.
9953 pub account_id: std::string::String,
9954
9955 /// Optional. Deprecated: use `account_id` instead.
9956 /// The unique stable hashed account identifier used to search connections. The
9957 /// identifier should correspond to a `hashed_account_id` provided in a
9958 /// previous `CreateAssessment` or `AnnotateAssessment` call. Either
9959 /// hashed_account_id or account_id must be set, but not both.
9960 #[deprecated]
9961 pub hashed_account_id: ::bytes::Bytes,
9962
9963 /// Optional. The maximum number of groups to return. The service might return
9964 /// fewer than this value. If unspecified, at most 50 groups are returned. The
9965 /// maximum value is 1000; values above 1000 are coerced to 1000.
9966 pub page_size: i32,
9967
9968 /// Optional. A page token, received from a previous
9969 /// `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the
9970 /// subsequent page.
9971 ///
9972 /// When paginating, all other parameters provided to
9973 /// `SearchRelatedAccountGroupMemberships` must match the call that provided
9974 /// the page token.
9975 pub page_token: std::string::String,
9976
9977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9978}
9979
9980impl SearchRelatedAccountGroupMembershipsRequest {
9981 /// Creates a new default instance.
9982 pub fn new() -> Self {
9983 std::default::Default::default()
9984 }
9985
9986 /// Sets the value of [project][crate::model::SearchRelatedAccountGroupMembershipsRequest::project].
9987 ///
9988 /// # Example
9989 /// ```ignore,no_run
9990 /// # use google_cloud_recaptchaenterprise_v1::model::SearchRelatedAccountGroupMembershipsRequest;
9991 /// let x = SearchRelatedAccountGroupMembershipsRequest::new().set_project("example");
9992 /// ```
9993 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9994 self.project = v.into();
9995 self
9996 }
9997
9998 /// Sets the value of [account_id][crate::model::SearchRelatedAccountGroupMembershipsRequest::account_id].
9999 ///
10000 /// # Example
10001 /// ```ignore,no_run
10002 /// # use google_cloud_recaptchaenterprise_v1::model::SearchRelatedAccountGroupMembershipsRequest;
10003 /// let x = SearchRelatedAccountGroupMembershipsRequest::new().set_account_id("example");
10004 /// ```
10005 pub fn set_account_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10006 self.account_id = v.into();
10007 self
10008 }
10009
10010 /// Sets the value of [hashed_account_id][crate::model::SearchRelatedAccountGroupMembershipsRequest::hashed_account_id].
10011 ///
10012 /// # Example
10013 /// ```ignore,no_run
10014 /// # use google_cloud_recaptchaenterprise_v1::model::SearchRelatedAccountGroupMembershipsRequest;
10015 /// let x = SearchRelatedAccountGroupMembershipsRequest::new().set_hashed_account_id(bytes::Bytes::from_static(b"example"));
10016 /// ```
10017 #[deprecated]
10018 pub fn set_hashed_account_id<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10019 self.hashed_account_id = v.into();
10020 self
10021 }
10022
10023 /// Sets the value of [page_size][crate::model::SearchRelatedAccountGroupMembershipsRequest::page_size].
10024 ///
10025 /// # Example
10026 /// ```ignore,no_run
10027 /// # use google_cloud_recaptchaenterprise_v1::model::SearchRelatedAccountGroupMembershipsRequest;
10028 /// let x = SearchRelatedAccountGroupMembershipsRequest::new().set_page_size(42);
10029 /// ```
10030 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10031 self.page_size = v.into();
10032 self
10033 }
10034
10035 /// Sets the value of [page_token][crate::model::SearchRelatedAccountGroupMembershipsRequest::page_token].
10036 ///
10037 /// # Example
10038 /// ```ignore,no_run
10039 /// # use google_cloud_recaptchaenterprise_v1::model::SearchRelatedAccountGroupMembershipsRequest;
10040 /// let x = SearchRelatedAccountGroupMembershipsRequest::new().set_page_token("example");
10041 /// ```
10042 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10043 self.page_token = v.into();
10044 self
10045 }
10046}
10047
10048impl wkt::message::Message for SearchRelatedAccountGroupMembershipsRequest {
10049 fn typename() -> &'static str {
10050 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest"
10051 }
10052}
10053
10054/// The response to a `SearchRelatedAccountGroupMemberships` call.
10055#[derive(Clone, Default, PartialEq)]
10056#[non_exhaustive]
10057pub struct SearchRelatedAccountGroupMembershipsResponse {
10058 /// The queried memberships.
10059 pub related_account_group_memberships:
10060 std::vec::Vec<crate::model::RelatedAccountGroupMembership>,
10061
10062 /// A token, which can be sent as `page_token` to retrieve the next page.
10063 /// If this field is omitted, there are no subsequent pages.
10064 pub next_page_token: std::string::String,
10065
10066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10067}
10068
10069impl SearchRelatedAccountGroupMembershipsResponse {
10070 /// Creates a new default instance.
10071 pub fn new() -> Self {
10072 std::default::Default::default()
10073 }
10074
10075 /// Sets the value of [related_account_group_memberships][crate::model::SearchRelatedAccountGroupMembershipsResponse::related_account_group_memberships].
10076 ///
10077 /// # Example
10078 /// ```ignore,no_run
10079 /// # use google_cloud_recaptchaenterprise_v1::model::SearchRelatedAccountGroupMembershipsResponse;
10080 /// use google_cloud_recaptchaenterprise_v1::model::RelatedAccountGroupMembership;
10081 /// let x = SearchRelatedAccountGroupMembershipsResponse::new()
10082 /// .set_related_account_group_memberships([
10083 /// RelatedAccountGroupMembership::default()/* use setters */,
10084 /// RelatedAccountGroupMembership::default()/* use (different) setters */,
10085 /// ]);
10086 /// ```
10087 pub fn set_related_account_group_memberships<T, V>(mut self, v: T) -> Self
10088 where
10089 T: std::iter::IntoIterator<Item = V>,
10090 V: std::convert::Into<crate::model::RelatedAccountGroupMembership>,
10091 {
10092 use std::iter::Iterator;
10093 self.related_account_group_memberships = v.into_iter().map(|i| i.into()).collect();
10094 self
10095 }
10096
10097 /// Sets the value of [next_page_token][crate::model::SearchRelatedAccountGroupMembershipsResponse::next_page_token].
10098 ///
10099 /// # Example
10100 /// ```ignore,no_run
10101 /// # use google_cloud_recaptchaenterprise_v1::model::SearchRelatedAccountGroupMembershipsResponse;
10102 /// let x = SearchRelatedAccountGroupMembershipsResponse::new().set_next_page_token("example");
10103 /// ```
10104 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10105 self.next_page_token = v.into();
10106 self
10107 }
10108}
10109
10110impl wkt::message::Message for SearchRelatedAccountGroupMembershipsResponse {
10111 fn typename() -> &'static str {
10112 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse"
10113 }
10114}
10115
10116#[doc(hidden)]
10117impl google_cloud_gax::paginator::internal::PageableResponse
10118 for SearchRelatedAccountGroupMembershipsResponse
10119{
10120 type PageItem = crate::model::RelatedAccountGroupMembership;
10121
10122 fn items(self) -> std::vec::Vec<Self::PageItem> {
10123 self.related_account_group_memberships
10124 }
10125
10126 fn next_page_token(&self) -> std::string::String {
10127 use std::clone::Clone;
10128 self.next_page_token.clone()
10129 }
10130}
10131
10132/// The AddIpOverride request message.
10133#[derive(Clone, Default, PartialEq)]
10134#[non_exhaustive]
10135pub struct AddIpOverrideRequest {
10136 /// Required. The name of the key to which the IP override is added, in the
10137 /// format `projects/{project}/keys/{key}`.
10138 pub name: std::string::String,
10139
10140 /// Required. IP override added to the key.
10141 pub ip_override_data: std::option::Option<crate::model::IpOverrideData>,
10142
10143 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10144}
10145
10146impl AddIpOverrideRequest {
10147 /// Creates a new default instance.
10148 pub fn new() -> Self {
10149 std::default::Default::default()
10150 }
10151
10152 /// Sets the value of [name][crate::model::AddIpOverrideRequest::name].
10153 ///
10154 /// # Example
10155 /// ```ignore,no_run
10156 /// # use google_cloud_recaptchaenterprise_v1::model::AddIpOverrideRequest;
10157 /// # let project_id = "project_id";
10158 /// # let key_id = "key_id";
10159 /// let x = AddIpOverrideRequest::new().set_name(format!("projects/{project_id}/keys/{key_id}"));
10160 /// ```
10161 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10162 self.name = v.into();
10163 self
10164 }
10165
10166 /// Sets the value of [ip_override_data][crate::model::AddIpOverrideRequest::ip_override_data].
10167 ///
10168 /// # Example
10169 /// ```ignore,no_run
10170 /// # use google_cloud_recaptchaenterprise_v1::model::AddIpOverrideRequest;
10171 /// use google_cloud_recaptchaenterprise_v1::model::IpOverrideData;
10172 /// let x = AddIpOverrideRequest::new().set_ip_override_data(IpOverrideData::default()/* use setters */);
10173 /// ```
10174 pub fn set_ip_override_data<T>(mut self, v: T) -> Self
10175 where
10176 T: std::convert::Into<crate::model::IpOverrideData>,
10177 {
10178 self.ip_override_data = std::option::Option::Some(v.into());
10179 self
10180 }
10181
10182 /// Sets or clears the value of [ip_override_data][crate::model::AddIpOverrideRequest::ip_override_data].
10183 ///
10184 /// # Example
10185 /// ```ignore,no_run
10186 /// # use google_cloud_recaptchaenterprise_v1::model::AddIpOverrideRequest;
10187 /// use google_cloud_recaptchaenterprise_v1::model::IpOverrideData;
10188 /// let x = AddIpOverrideRequest::new().set_or_clear_ip_override_data(Some(IpOverrideData::default()/* use setters */));
10189 /// let x = AddIpOverrideRequest::new().set_or_clear_ip_override_data(None::<IpOverrideData>);
10190 /// ```
10191 pub fn set_or_clear_ip_override_data<T>(mut self, v: std::option::Option<T>) -> Self
10192 where
10193 T: std::convert::Into<crate::model::IpOverrideData>,
10194 {
10195 self.ip_override_data = v.map(|x| x.into());
10196 self
10197 }
10198}
10199
10200impl wkt::message::Message for AddIpOverrideRequest {
10201 fn typename() -> &'static str {
10202 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.AddIpOverrideRequest"
10203 }
10204}
10205
10206/// Response for AddIpOverride.
10207#[derive(Clone, Default, PartialEq)]
10208#[non_exhaustive]
10209pub struct AddIpOverrideResponse {
10210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10211}
10212
10213impl AddIpOverrideResponse {
10214 /// Creates a new default instance.
10215 pub fn new() -> Self {
10216 std::default::Default::default()
10217 }
10218}
10219
10220impl wkt::message::Message for AddIpOverrideResponse {
10221 fn typename() -> &'static str {
10222 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.AddIpOverrideResponse"
10223 }
10224}
10225
10226/// The RemoveIpOverride request message.
10227#[derive(Clone, Default, PartialEq)]
10228#[non_exhaustive]
10229pub struct RemoveIpOverrideRequest {
10230 /// Required. The name of the key from which the IP override is removed, in the
10231 /// format `projects/{project}/keys/{key}`.
10232 pub name: std::string::String,
10233
10234 /// Required. IP override to be removed from the key.
10235 pub ip_override_data: std::option::Option<crate::model::IpOverrideData>,
10236
10237 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10238}
10239
10240impl RemoveIpOverrideRequest {
10241 /// Creates a new default instance.
10242 pub fn new() -> Self {
10243 std::default::Default::default()
10244 }
10245
10246 /// Sets the value of [name][crate::model::RemoveIpOverrideRequest::name].
10247 ///
10248 /// # Example
10249 /// ```ignore,no_run
10250 /// # use google_cloud_recaptchaenterprise_v1::model::RemoveIpOverrideRequest;
10251 /// # let project_id = "project_id";
10252 /// # let key_id = "key_id";
10253 /// let x = RemoveIpOverrideRequest::new().set_name(format!("projects/{project_id}/keys/{key_id}"));
10254 /// ```
10255 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10256 self.name = v.into();
10257 self
10258 }
10259
10260 /// Sets the value of [ip_override_data][crate::model::RemoveIpOverrideRequest::ip_override_data].
10261 ///
10262 /// # Example
10263 /// ```ignore,no_run
10264 /// # use google_cloud_recaptchaenterprise_v1::model::RemoveIpOverrideRequest;
10265 /// use google_cloud_recaptchaenterprise_v1::model::IpOverrideData;
10266 /// let x = RemoveIpOverrideRequest::new().set_ip_override_data(IpOverrideData::default()/* use setters */);
10267 /// ```
10268 pub fn set_ip_override_data<T>(mut self, v: T) -> Self
10269 where
10270 T: std::convert::Into<crate::model::IpOverrideData>,
10271 {
10272 self.ip_override_data = std::option::Option::Some(v.into());
10273 self
10274 }
10275
10276 /// Sets or clears the value of [ip_override_data][crate::model::RemoveIpOverrideRequest::ip_override_data].
10277 ///
10278 /// # Example
10279 /// ```ignore,no_run
10280 /// # use google_cloud_recaptchaenterprise_v1::model::RemoveIpOverrideRequest;
10281 /// use google_cloud_recaptchaenterprise_v1::model::IpOverrideData;
10282 /// let x = RemoveIpOverrideRequest::new().set_or_clear_ip_override_data(Some(IpOverrideData::default()/* use setters */));
10283 /// let x = RemoveIpOverrideRequest::new().set_or_clear_ip_override_data(None::<IpOverrideData>);
10284 /// ```
10285 pub fn set_or_clear_ip_override_data<T>(mut self, v: std::option::Option<T>) -> Self
10286 where
10287 T: std::convert::Into<crate::model::IpOverrideData>,
10288 {
10289 self.ip_override_data = v.map(|x| x.into());
10290 self
10291 }
10292}
10293
10294impl wkt::message::Message for RemoveIpOverrideRequest {
10295 fn typename() -> &'static str {
10296 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.RemoveIpOverrideRequest"
10297 }
10298}
10299
10300/// Response for RemoveIpOverride.
10301#[derive(Clone, Default, PartialEq)]
10302#[non_exhaustive]
10303pub struct RemoveIpOverrideResponse {
10304 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10305}
10306
10307impl RemoveIpOverrideResponse {
10308 /// Creates a new default instance.
10309 pub fn new() -> Self {
10310 std::default::Default::default()
10311 }
10312}
10313
10314impl wkt::message::Message for RemoveIpOverrideResponse {
10315 fn typename() -> &'static str {
10316 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.RemoveIpOverrideResponse"
10317 }
10318}
10319
10320/// The ListIpOverrides request message.
10321#[derive(Clone, Default, PartialEq)]
10322#[non_exhaustive]
10323pub struct ListIpOverridesRequest {
10324 /// Required. The parent key for which the IP overrides are listed, in the
10325 /// format `projects/{project}/keys/{key}`.
10326 pub parent: std::string::String,
10327
10328 /// Optional. The maximum number of overrides to return. Default is 10. Max
10329 /// limit is 100. If the number of overrides is less than the page_size, all
10330 /// overrides are returned. If the page size is more than 100, it is coerced to
10331 /// 100.
10332 pub page_size: i32,
10333
10334 /// Optional. The next_page_token value returned from a previous
10335 /// ListIpOverridesRequest, if any.
10336 pub page_token: std::string::String,
10337
10338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10339}
10340
10341impl ListIpOverridesRequest {
10342 /// Creates a new default instance.
10343 pub fn new() -> Self {
10344 std::default::Default::default()
10345 }
10346
10347 /// Sets the value of [parent][crate::model::ListIpOverridesRequest::parent].
10348 ///
10349 /// # Example
10350 /// ```ignore,no_run
10351 /// # use google_cloud_recaptchaenterprise_v1::model::ListIpOverridesRequest;
10352 /// # let project_id = "project_id";
10353 /// # let key_id = "key_id";
10354 /// let x = ListIpOverridesRequest::new().set_parent(format!("projects/{project_id}/keys/{key_id}"));
10355 /// ```
10356 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10357 self.parent = v.into();
10358 self
10359 }
10360
10361 /// Sets the value of [page_size][crate::model::ListIpOverridesRequest::page_size].
10362 ///
10363 /// # Example
10364 /// ```ignore,no_run
10365 /// # use google_cloud_recaptchaenterprise_v1::model::ListIpOverridesRequest;
10366 /// let x = ListIpOverridesRequest::new().set_page_size(42);
10367 /// ```
10368 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10369 self.page_size = v.into();
10370 self
10371 }
10372
10373 /// Sets the value of [page_token][crate::model::ListIpOverridesRequest::page_token].
10374 ///
10375 /// # Example
10376 /// ```ignore,no_run
10377 /// # use google_cloud_recaptchaenterprise_v1::model::ListIpOverridesRequest;
10378 /// let x = ListIpOverridesRequest::new().set_page_token("example");
10379 /// ```
10380 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10381 self.page_token = v.into();
10382 self
10383 }
10384}
10385
10386impl wkt::message::Message for ListIpOverridesRequest {
10387 fn typename() -> &'static str {
10388 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListIpOverridesRequest"
10389 }
10390}
10391
10392/// Response for ListIpOverrides.
10393#[derive(Clone, Default, PartialEq)]
10394#[non_exhaustive]
10395pub struct ListIpOverridesResponse {
10396 /// IP Overrides details.
10397 pub ip_overrides: std::vec::Vec<crate::model::IpOverrideData>,
10398
10399 /// Token to retrieve the next page of results. If this field is empty, no keys
10400 /// remain in the results.
10401 pub next_page_token: std::string::String,
10402
10403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10404}
10405
10406impl ListIpOverridesResponse {
10407 /// Creates a new default instance.
10408 pub fn new() -> Self {
10409 std::default::Default::default()
10410 }
10411
10412 /// Sets the value of [ip_overrides][crate::model::ListIpOverridesResponse::ip_overrides].
10413 ///
10414 /// # Example
10415 /// ```ignore,no_run
10416 /// # use google_cloud_recaptchaenterprise_v1::model::ListIpOverridesResponse;
10417 /// use google_cloud_recaptchaenterprise_v1::model::IpOverrideData;
10418 /// let x = ListIpOverridesResponse::new()
10419 /// .set_ip_overrides([
10420 /// IpOverrideData::default()/* use setters */,
10421 /// IpOverrideData::default()/* use (different) setters */,
10422 /// ]);
10423 /// ```
10424 pub fn set_ip_overrides<T, V>(mut self, v: T) -> Self
10425 where
10426 T: std::iter::IntoIterator<Item = V>,
10427 V: std::convert::Into<crate::model::IpOverrideData>,
10428 {
10429 use std::iter::Iterator;
10430 self.ip_overrides = v.into_iter().map(|i| i.into()).collect();
10431 self
10432 }
10433
10434 /// Sets the value of [next_page_token][crate::model::ListIpOverridesResponse::next_page_token].
10435 ///
10436 /// # Example
10437 /// ```ignore,no_run
10438 /// # use google_cloud_recaptchaenterprise_v1::model::ListIpOverridesResponse;
10439 /// let x = ListIpOverridesResponse::new().set_next_page_token("example");
10440 /// ```
10441 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10442 self.next_page_token = v.into();
10443 self
10444 }
10445}
10446
10447impl wkt::message::Message for ListIpOverridesResponse {
10448 fn typename() -> &'static str {
10449 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.ListIpOverridesResponse"
10450 }
10451}
10452
10453#[doc(hidden)]
10454impl google_cloud_gax::paginator::internal::PageableResponse for ListIpOverridesResponse {
10455 type PageItem = crate::model::IpOverrideData;
10456
10457 fn items(self) -> std::vec::Vec<Self::PageItem> {
10458 self.ip_overrides
10459 }
10460
10461 fn next_page_token(&self) -> std::string::String {
10462 use std::clone::Clone;
10463 self.next_page_token.clone()
10464 }
10465}
10466
10467/// A membership in a group of related accounts.
10468#[derive(Clone, Default, PartialEq)]
10469#[non_exhaustive]
10470pub struct RelatedAccountGroupMembership {
10471 /// Required. Identifier. The resource name for this membership in the format
10472 /// `projects/{project}/relatedaccountgroups/{relatedaccountgroup}/memberships/{membership}`.
10473 pub name: std::string::String,
10474
10475 /// The unique stable account identifier of the member. The identifier
10476 /// corresponds to an `account_id` provided in a previous `CreateAssessment` or
10477 /// `AnnotateAssessment` call.
10478 pub account_id: std::string::String,
10479
10480 /// Deprecated: use `account_id` instead.
10481 /// The unique stable hashed account identifier of the member. The identifier
10482 /// corresponds to a `hashed_account_id` provided in a previous
10483 /// `CreateAssessment` or `AnnotateAssessment` call.
10484 #[deprecated]
10485 pub hashed_account_id: ::bytes::Bytes,
10486
10487 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10488}
10489
10490impl RelatedAccountGroupMembership {
10491 /// Creates a new default instance.
10492 pub fn new() -> Self {
10493 std::default::Default::default()
10494 }
10495
10496 /// Sets the value of [name][crate::model::RelatedAccountGroupMembership::name].
10497 ///
10498 /// # Example
10499 /// ```ignore,no_run
10500 /// # use google_cloud_recaptchaenterprise_v1::model::RelatedAccountGroupMembership;
10501 /// # let project_id = "project_id";
10502 /// # let relatedaccountgroup_id = "relatedaccountgroup_id";
10503 /// # let membership_id = "membership_id";
10504 /// let x = RelatedAccountGroupMembership::new().set_name(format!("projects/{project_id}/relatedaccountgroups/{relatedaccountgroup_id}/memberships/{membership_id}"));
10505 /// ```
10506 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10507 self.name = v.into();
10508 self
10509 }
10510
10511 /// Sets the value of [account_id][crate::model::RelatedAccountGroupMembership::account_id].
10512 ///
10513 /// # Example
10514 /// ```ignore,no_run
10515 /// # use google_cloud_recaptchaenterprise_v1::model::RelatedAccountGroupMembership;
10516 /// let x = RelatedAccountGroupMembership::new().set_account_id("example");
10517 /// ```
10518 pub fn set_account_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10519 self.account_id = v.into();
10520 self
10521 }
10522
10523 /// Sets the value of [hashed_account_id][crate::model::RelatedAccountGroupMembership::hashed_account_id].
10524 ///
10525 /// # Example
10526 /// ```ignore,no_run
10527 /// # use google_cloud_recaptchaenterprise_v1::model::RelatedAccountGroupMembership;
10528 /// let x = RelatedAccountGroupMembership::new().set_hashed_account_id(bytes::Bytes::from_static(b"example"));
10529 /// ```
10530 #[deprecated]
10531 pub fn set_hashed_account_id<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10532 self.hashed_account_id = v.into();
10533 self
10534 }
10535}
10536
10537impl wkt::message::Message for RelatedAccountGroupMembership {
10538 fn typename() -> &'static str {
10539 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.RelatedAccountGroupMembership"
10540 }
10541}
10542
10543/// A group of related accounts.
10544#[derive(Clone, Default, PartialEq)]
10545#[non_exhaustive]
10546pub struct RelatedAccountGroup {
10547 /// Required. Identifier. The resource name for the related account group in
10548 /// the format
10549 /// `projects/{project}/relatedaccountgroups/{related_account_group}`.
10550 pub name: std::string::String,
10551
10552 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10553}
10554
10555impl RelatedAccountGroup {
10556 /// Creates a new default instance.
10557 pub fn new() -> Self {
10558 std::default::Default::default()
10559 }
10560
10561 /// Sets the value of [name][crate::model::RelatedAccountGroup::name].
10562 ///
10563 /// # Example
10564 /// ```ignore,no_run
10565 /// # use google_cloud_recaptchaenterprise_v1::model::RelatedAccountGroup;
10566 /// # let project_id = "project_id";
10567 /// # let relatedaccountgroup_id = "relatedaccountgroup_id";
10568 /// let x = RelatedAccountGroup::new().set_name(format!("projects/{project_id}/relatedaccountgroups/{relatedaccountgroup_id}"));
10569 /// ```
10570 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10571 self.name = v.into();
10572 self
10573 }
10574}
10575
10576impl wkt::message::Message for RelatedAccountGroup {
10577 fn typename() -> &'static str {
10578 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.RelatedAccountGroup"
10579 }
10580}
10581
10582/// Settings specific to keys that can be used for WAF (Web Application
10583/// Firewall).
10584#[derive(Clone, Default, PartialEq)]
10585#[non_exhaustive]
10586pub struct WafSettings {
10587 /// Required. The Web Application Firewall (WAF) service that uses this key.
10588 pub waf_service: crate::model::waf_settings::WafService,
10589
10590 /// Required. The Web Application Firewall (WAF) feature for which this key is
10591 /// enabled.
10592 pub waf_feature: crate::model::waf_settings::WafFeature,
10593
10594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10595}
10596
10597impl WafSettings {
10598 /// Creates a new default instance.
10599 pub fn new() -> Self {
10600 std::default::Default::default()
10601 }
10602
10603 /// Sets the value of [waf_service][crate::model::WafSettings::waf_service].
10604 ///
10605 /// # Example
10606 /// ```ignore,no_run
10607 /// # use google_cloud_recaptchaenterprise_v1::model::WafSettings;
10608 /// use google_cloud_recaptchaenterprise_v1::model::waf_settings::WafService;
10609 /// let x0 = WafSettings::new().set_waf_service(WafService::Ca);
10610 /// let x1 = WafSettings::new().set_waf_service(WafService::Fastly);
10611 /// let x2 = WafSettings::new().set_waf_service(WafService::Cloudflare);
10612 /// ```
10613 pub fn set_waf_service<T: std::convert::Into<crate::model::waf_settings::WafService>>(
10614 mut self,
10615 v: T,
10616 ) -> Self {
10617 self.waf_service = v.into();
10618 self
10619 }
10620
10621 /// Sets the value of [waf_feature][crate::model::WafSettings::waf_feature].
10622 ///
10623 /// # Example
10624 /// ```ignore,no_run
10625 /// # use google_cloud_recaptchaenterprise_v1::model::WafSettings;
10626 /// use google_cloud_recaptchaenterprise_v1::model::waf_settings::WafFeature;
10627 /// let x0 = WafSettings::new().set_waf_feature(WafFeature::ChallengePage);
10628 /// let x1 = WafSettings::new().set_waf_feature(WafFeature::SessionToken);
10629 /// let x2 = WafSettings::new().set_waf_feature(WafFeature::ActionToken);
10630 /// ```
10631 pub fn set_waf_feature<T: std::convert::Into<crate::model::waf_settings::WafFeature>>(
10632 mut self,
10633 v: T,
10634 ) -> Self {
10635 self.waf_feature = v.into();
10636 self
10637 }
10638}
10639
10640impl wkt::message::Message for WafSettings {
10641 fn typename() -> &'static str {
10642 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.WafSettings"
10643 }
10644}
10645
10646/// Defines additional types related to [WafSettings].
10647pub mod waf_settings {
10648 #[allow(unused_imports)]
10649 use super::*;
10650
10651 /// Supported WAF features. For more information, see
10652 /// <https://cloud.google.com/recaptcha/docs/usecase#comparison_of_features>.
10653 /// Ensure that applications can handle values not explicitly listed.
10654 ///
10655 /// # Working with unknown values
10656 ///
10657 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10658 /// additional enum variants at any time. Adding new variants is not considered
10659 /// a breaking change. Applications should write their code in anticipation of:
10660 ///
10661 /// - New values appearing in future releases of the client library, **and**
10662 /// - New values received dynamically, without application changes.
10663 ///
10664 /// Please consult the [Working with enums] section in the user guide for some
10665 /// guidelines.
10666 ///
10667 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10668 #[derive(Clone, Debug, PartialEq)]
10669 #[non_exhaustive]
10670 pub enum WafFeature {
10671 /// Undefined feature.
10672 Unspecified,
10673 /// Redirects suspicious traffic to reCAPTCHA.
10674 ChallengePage,
10675 /// Use reCAPTCHA session-tokens to protect the whole user session on the
10676 /// site's domain.
10677 SessionToken,
10678 /// Use reCAPTCHA action-tokens to protect user actions.
10679 ActionToken,
10680 /// Deprecated: Use `express_settings` instead.
10681 #[deprecated]
10682 Express,
10683 /// If set, the enum was initialized with an unknown value.
10684 ///
10685 /// Applications can examine the value using [WafFeature::value] or
10686 /// [WafFeature::name].
10687 UnknownValue(waf_feature::UnknownValue),
10688 }
10689
10690 #[doc(hidden)]
10691 pub mod waf_feature {
10692 #[allow(unused_imports)]
10693 use super::*;
10694 #[derive(Clone, Debug, PartialEq)]
10695 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10696 }
10697
10698 impl WafFeature {
10699 /// Gets the enum value.
10700 ///
10701 /// Returns `None` if the enum contains an unknown value deserialized from
10702 /// the string representation of enums.
10703 pub fn value(&self) -> std::option::Option<i32> {
10704 match self {
10705 Self::Unspecified => std::option::Option::Some(0),
10706 Self::ChallengePage => std::option::Option::Some(1),
10707 Self::SessionToken => std::option::Option::Some(2),
10708 Self::ActionToken => std::option::Option::Some(3),
10709 Self::Express => std::option::Option::Some(5),
10710 Self::UnknownValue(u) => u.0.value(),
10711 }
10712 }
10713
10714 /// Gets the enum value as a string.
10715 ///
10716 /// Returns `None` if the enum contains an unknown value deserialized from
10717 /// the integer representation of enums.
10718 pub fn name(&self) -> std::option::Option<&str> {
10719 match self {
10720 Self::Unspecified => std::option::Option::Some("WAF_FEATURE_UNSPECIFIED"),
10721 Self::ChallengePage => std::option::Option::Some("CHALLENGE_PAGE"),
10722 Self::SessionToken => std::option::Option::Some("SESSION_TOKEN"),
10723 Self::ActionToken => std::option::Option::Some("ACTION_TOKEN"),
10724 Self::Express => std::option::Option::Some("EXPRESS"),
10725 Self::UnknownValue(u) => u.0.name(),
10726 }
10727 }
10728 }
10729
10730 impl std::default::Default for WafFeature {
10731 fn default() -> Self {
10732 use std::convert::From;
10733 Self::from(0)
10734 }
10735 }
10736
10737 impl std::fmt::Display for WafFeature {
10738 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10739 wkt::internal::display_enum(f, self.name(), self.value())
10740 }
10741 }
10742
10743 impl std::convert::From<i32> for WafFeature {
10744 fn from(value: i32) -> Self {
10745 match value {
10746 0 => Self::Unspecified,
10747 1 => Self::ChallengePage,
10748 2 => Self::SessionToken,
10749 3 => Self::ActionToken,
10750 5 => Self::Express,
10751 _ => Self::UnknownValue(waf_feature::UnknownValue(
10752 wkt::internal::UnknownEnumValue::Integer(value),
10753 )),
10754 }
10755 }
10756 }
10757
10758 impl std::convert::From<&str> for WafFeature {
10759 fn from(value: &str) -> Self {
10760 use std::string::ToString;
10761 match value {
10762 "WAF_FEATURE_UNSPECIFIED" => Self::Unspecified,
10763 "CHALLENGE_PAGE" => Self::ChallengePage,
10764 "SESSION_TOKEN" => Self::SessionToken,
10765 "ACTION_TOKEN" => Self::ActionToken,
10766 "EXPRESS" => Self::Express,
10767 _ => Self::UnknownValue(waf_feature::UnknownValue(
10768 wkt::internal::UnknownEnumValue::String(value.to_string()),
10769 )),
10770 }
10771 }
10772 }
10773
10774 impl serde::ser::Serialize for WafFeature {
10775 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10776 where
10777 S: serde::Serializer,
10778 {
10779 match self {
10780 Self::Unspecified => serializer.serialize_i32(0),
10781 Self::ChallengePage => serializer.serialize_i32(1),
10782 Self::SessionToken => serializer.serialize_i32(2),
10783 Self::ActionToken => serializer.serialize_i32(3),
10784 Self::Express => serializer.serialize_i32(5),
10785 Self::UnknownValue(u) => u.0.serialize(serializer),
10786 }
10787 }
10788 }
10789
10790 impl<'de> serde::de::Deserialize<'de> for WafFeature {
10791 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10792 where
10793 D: serde::Deserializer<'de>,
10794 {
10795 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WafFeature>::new(
10796 ".google.cloud.recaptchaenterprise.v1.WafSettings.WafFeature",
10797 ))
10798 }
10799 }
10800
10801 /// Web Application Firewalls that reCAPTCHA supports.
10802 /// Ensure that applications can handle values not explicitly listed.
10803 ///
10804 /// # Working with unknown values
10805 ///
10806 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10807 /// additional enum variants at any time. Adding new variants is not considered
10808 /// a breaking change. Applications should write their code in anticipation of:
10809 ///
10810 /// - New values appearing in future releases of the client library, **and**
10811 /// - New values received dynamically, without application changes.
10812 ///
10813 /// Please consult the [Working with enums] section in the user guide for some
10814 /// guidelines.
10815 ///
10816 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10817 #[derive(Clone, Debug, PartialEq)]
10818 #[non_exhaustive]
10819 pub enum WafService {
10820 /// Undefined WAF
10821 Unspecified,
10822 /// Cloud Armor
10823 Ca,
10824 /// Fastly
10825 Fastly,
10826 /// Cloudflare
10827 Cloudflare,
10828 /// Akamai
10829 Akamai,
10830 /// If set, the enum was initialized with an unknown value.
10831 ///
10832 /// Applications can examine the value using [WafService::value] or
10833 /// [WafService::name].
10834 UnknownValue(waf_service::UnknownValue),
10835 }
10836
10837 #[doc(hidden)]
10838 pub mod waf_service {
10839 #[allow(unused_imports)]
10840 use super::*;
10841 #[derive(Clone, Debug, PartialEq)]
10842 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10843 }
10844
10845 impl WafService {
10846 /// Gets the enum value.
10847 ///
10848 /// Returns `None` if the enum contains an unknown value deserialized from
10849 /// the string representation of enums.
10850 pub fn value(&self) -> std::option::Option<i32> {
10851 match self {
10852 Self::Unspecified => std::option::Option::Some(0),
10853 Self::Ca => std::option::Option::Some(1),
10854 Self::Fastly => std::option::Option::Some(3),
10855 Self::Cloudflare => std::option::Option::Some(4),
10856 Self::Akamai => std::option::Option::Some(5),
10857 Self::UnknownValue(u) => u.0.value(),
10858 }
10859 }
10860
10861 /// Gets the enum value as a string.
10862 ///
10863 /// Returns `None` if the enum contains an unknown value deserialized from
10864 /// the integer representation of enums.
10865 pub fn name(&self) -> std::option::Option<&str> {
10866 match self {
10867 Self::Unspecified => std::option::Option::Some("WAF_SERVICE_UNSPECIFIED"),
10868 Self::Ca => std::option::Option::Some("CA"),
10869 Self::Fastly => std::option::Option::Some("FASTLY"),
10870 Self::Cloudflare => std::option::Option::Some("CLOUDFLARE"),
10871 Self::Akamai => std::option::Option::Some("AKAMAI"),
10872 Self::UnknownValue(u) => u.0.name(),
10873 }
10874 }
10875 }
10876
10877 impl std::default::Default for WafService {
10878 fn default() -> Self {
10879 use std::convert::From;
10880 Self::from(0)
10881 }
10882 }
10883
10884 impl std::fmt::Display for WafService {
10885 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10886 wkt::internal::display_enum(f, self.name(), self.value())
10887 }
10888 }
10889
10890 impl std::convert::From<i32> for WafService {
10891 fn from(value: i32) -> Self {
10892 match value {
10893 0 => Self::Unspecified,
10894 1 => Self::Ca,
10895 3 => Self::Fastly,
10896 4 => Self::Cloudflare,
10897 5 => Self::Akamai,
10898 _ => Self::UnknownValue(waf_service::UnknownValue(
10899 wkt::internal::UnknownEnumValue::Integer(value),
10900 )),
10901 }
10902 }
10903 }
10904
10905 impl std::convert::From<&str> for WafService {
10906 fn from(value: &str) -> Self {
10907 use std::string::ToString;
10908 match value {
10909 "WAF_SERVICE_UNSPECIFIED" => Self::Unspecified,
10910 "CA" => Self::Ca,
10911 "FASTLY" => Self::Fastly,
10912 "CLOUDFLARE" => Self::Cloudflare,
10913 "AKAMAI" => Self::Akamai,
10914 _ => Self::UnknownValue(waf_service::UnknownValue(
10915 wkt::internal::UnknownEnumValue::String(value.to_string()),
10916 )),
10917 }
10918 }
10919 }
10920
10921 impl serde::ser::Serialize for WafService {
10922 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10923 where
10924 S: serde::Serializer,
10925 {
10926 match self {
10927 Self::Unspecified => serializer.serialize_i32(0),
10928 Self::Ca => serializer.serialize_i32(1),
10929 Self::Fastly => serializer.serialize_i32(3),
10930 Self::Cloudflare => serializer.serialize_i32(4),
10931 Self::Akamai => serializer.serialize_i32(5),
10932 Self::UnknownValue(u) => u.0.serialize(serializer),
10933 }
10934 }
10935 }
10936
10937 impl<'de> serde::de::Deserialize<'de> for WafService {
10938 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10939 where
10940 D: serde::Deserializer<'de>,
10941 {
10942 deserializer.deserialize_any(wkt::internal::EnumVisitor::<WafService>::new(
10943 ".google.cloud.recaptchaenterprise.v1.WafSettings.WafService",
10944 ))
10945 }
10946 }
10947}
10948
10949/// The environment creating the assessment. This describes your environment
10950/// (the system invoking CreateAssessment), NOT the environment of your user.
10951#[derive(Clone, Default, PartialEq)]
10952#[non_exhaustive]
10953pub struct AssessmentEnvironment {
10954 /// Optional. Identifies the client module initiating the CreateAssessment
10955 /// request. This can be the link to the client module's project. Examples
10956 /// include:
10957 ///
10958 /// - "github.com/GoogleCloudPlatform/recaptcha-enterprise-google-tag-manager"
10959 /// - "wordpress.org/plugins/recaptcha-something"
10960 pub client: std::string::String,
10961
10962 /// Optional. The version of the client module. For example, "1.0.0".
10963 pub version: std::string::String,
10964
10965 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10966}
10967
10968impl AssessmentEnvironment {
10969 /// Creates a new default instance.
10970 pub fn new() -> Self {
10971 std::default::Default::default()
10972 }
10973
10974 /// Sets the value of [client][crate::model::AssessmentEnvironment::client].
10975 ///
10976 /// # Example
10977 /// ```ignore,no_run
10978 /// # use google_cloud_recaptchaenterprise_v1::model::AssessmentEnvironment;
10979 /// let x = AssessmentEnvironment::new().set_client("example");
10980 /// ```
10981 pub fn set_client<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10982 self.client = v.into();
10983 self
10984 }
10985
10986 /// Sets the value of [version][crate::model::AssessmentEnvironment::version].
10987 ///
10988 /// # Example
10989 /// ```ignore,no_run
10990 /// # use google_cloud_recaptchaenterprise_v1::model::AssessmentEnvironment;
10991 /// let x = AssessmentEnvironment::new().set_version("example");
10992 /// ```
10993 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10994 self.version = v.into();
10995 self
10996 }
10997}
10998
10999impl wkt::message::Message for AssessmentEnvironment {
11000 fn typename() -> &'static str {
11001 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.AssessmentEnvironment"
11002 }
11003}
11004
11005/// Information about the IP or IP range override.
11006#[derive(Clone, Default, PartialEq)]
11007#[non_exhaustive]
11008pub struct IpOverrideData {
11009 /// Required. The IP address to override (can be IPv4, IPv6 or CIDR).
11010 /// The IP override must be a valid IPv4 or IPv6 address, or a CIDR range.
11011 /// The IP override must be a public IP address.
11012 /// Example of IPv4: 168.192.5.6
11013 /// Example of IPv6: 2001:0000:130F:0000:0000:09C0:876A:130B
11014 /// Example of IPv4 with CIDR: 168.192.5.0/24
11015 /// Example of IPv6 with CIDR: 2001:0DB8:1234::/48
11016 pub ip: std::string::String,
11017
11018 /// Required. Describes the type of IP override.
11019 pub override_type: crate::model::ip_override_data::OverrideType,
11020
11021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11022}
11023
11024impl IpOverrideData {
11025 /// Creates a new default instance.
11026 pub fn new() -> Self {
11027 std::default::Default::default()
11028 }
11029
11030 /// Sets the value of [ip][crate::model::IpOverrideData::ip].
11031 ///
11032 /// # Example
11033 /// ```ignore,no_run
11034 /// # use google_cloud_recaptchaenterprise_v1::model::IpOverrideData;
11035 /// let x = IpOverrideData::new().set_ip("example");
11036 /// ```
11037 pub fn set_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11038 self.ip = v.into();
11039 self
11040 }
11041
11042 /// Sets the value of [override_type][crate::model::IpOverrideData::override_type].
11043 ///
11044 /// # Example
11045 /// ```ignore,no_run
11046 /// # use google_cloud_recaptchaenterprise_v1::model::IpOverrideData;
11047 /// use google_cloud_recaptchaenterprise_v1::model::ip_override_data::OverrideType;
11048 /// let x0 = IpOverrideData::new().set_override_type(OverrideType::Allow);
11049 /// ```
11050 pub fn set_override_type<
11051 T: std::convert::Into<crate::model::ip_override_data::OverrideType>,
11052 >(
11053 mut self,
11054 v: T,
11055 ) -> Self {
11056 self.override_type = v.into();
11057 self
11058 }
11059}
11060
11061impl wkt::message::Message for IpOverrideData {
11062 fn typename() -> &'static str {
11063 "type.googleapis.com/google.cloud.recaptchaenterprise.v1.IpOverrideData"
11064 }
11065}
11066
11067/// Defines additional types related to [IpOverrideData].
11068pub mod ip_override_data {
11069 #[allow(unused_imports)]
11070 use super::*;
11071
11072 /// Enum that represents the type of IP override.
11073 /// Ensure that applications can handle values not explicitly listed.
11074 ///
11075 /// # Working with unknown values
11076 ///
11077 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11078 /// additional enum variants at any time. Adding new variants is not considered
11079 /// a breaking change. Applications should write their code in anticipation of:
11080 ///
11081 /// - New values appearing in future releases of the client library, **and**
11082 /// - New values received dynamically, without application changes.
11083 ///
11084 /// Please consult the [Working with enums] section in the user guide for some
11085 /// guidelines.
11086 ///
11087 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11088 #[derive(Clone, Debug, PartialEq)]
11089 #[non_exhaustive]
11090 pub enum OverrideType {
11091 /// Default override type that indicates this enum hasn't been specified.
11092 Unspecified,
11093 /// Allowlist the IP address; i.e. give a `risk_analysis.score` of 0.9 for
11094 /// all valid assessments.
11095 Allow,
11096 /// If set, the enum was initialized with an unknown value.
11097 ///
11098 /// Applications can examine the value using [OverrideType::value] or
11099 /// [OverrideType::name].
11100 UnknownValue(override_type::UnknownValue),
11101 }
11102
11103 #[doc(hidden)]
11104 pub mod override_type {
11105 #[allow(unused_imports)]
11106 use super::*;
11107 #[derive(Clone, Debug, PartialEq)]
11108 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11109 }
11110
11111 impl OverrideType {
11112 /// Gets the enum value.
11113 ///
11114 /// Returns `None` if the enum contains an unknown value deserialized from
11115 /// the string representation of enums.
11116 pub fn value(&self) -> std::option::Option<i32> {
11117 match self {
11118 Self::Unspecified => std::option::Option::Some(0),
11119 Self::Allow => std::option::Option::Some(1),
11120 Self::UnknownValue(u) => u.0.value(),
11121 }
11122 }
11123
11124 /// Gets the enum value as a string.
11125 ///
11126 /// Returns `None` if the enum contains an unknown value deserialized from
11127 /// the integer representation of enums.
11128 pub fn name(&self) -> std::option::Option<&str> {
11129 match self {
11130 Self::Unspecified => std::option::Option::Some("OVERRIDE_TYPE_UNSPECIFIED"),
11131 Self::Allow => std::option::Option::Some("ALLOW"),
11132 Self::UnknownValue(u) => u.0.name(),
11133 }
11134 }
11135 }
11136
11137 impl std::default::Default for OverrideType {
11138 fn default() -> Self {
11139 use std::convert::From;
11140 Self::from(0)
11141 }
11142 }
11143
11144 impl std::fmt::Display for OverrideType {
11145 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11146 wkt::internal::display_enum(f, self.name(), self.value())
11147 }
11148 }
11149
11150 impl std::convert::From<i32> for OverrideType {
11151 fn from(value: i32) -> Self {
11152 match value {
11153 0 => Self::Unspecified,
11154 1 => Self::Allow,
11155 _ => Self::UnknownValue(override_type::UnknownValue(
11156 wkt::internal::UnknownEnumValue::Integer(value),
11157 )),
11158 }
11159 }
11160 }
11161
11162 impl std::convert::From<&str> for OverrideType {
11163 fn from(value: &str) -> Self {
11164 use std::string::ToString;
11165 match value {
11166 "OVERRIDE_TYPE_UNSPECIFIED" => Self::Unspecified,
11167 "ALLOW" => Self::Allow,
11168 _ => Self::UnknownValue(override_type::UnknownValue(
11169 wkt::internal::UnknownEnumValue::String(value.to_string()),
11170 )),
11171 }
11172 }
11173 }
11174
11175 impl serde::ser::Serialize for OverrideType {
11176 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11177 where
11178 S: serde::Serializer,
11179 {
11180 match self {
11181 Self::Unspecified => serializer.serialize_i32(0),
11182 Self::Allow => serializer.serialize_i32(1),
11183 Self::UnknownValue(u) => u.0.serialize(serializer),
11184 }
11185 }
11186 }
11187
11188 impl<'de> serde::de::Deserialize<'de> for OverrideType {
11189 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11190 where
11191 D: serde::Deserializer<'de>,
11192 {
11193 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OverrideType>::new(
11194 ".google.cloud.recaptchaenterprise.v1.IpOverrideData.OverrideType",
11195 ))
11196 }
11197 }
11198}