google_cloud_chronicle_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::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_longrunning;
25extern crate google_cloud_lro;
26extern crate google_cloud_type;
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/// Request message for CreateDataAccessLabel.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct CreateDataAccessLabelRequest {
42 /// Required. The parent resource where this Data Access Label will be created.
43 /// Format: `projects/{project}/locations/{location}/instances/{instance}`
44 pub parent: std::string::String,
45
46 /// Required. Data access label to create.
47 pub data_access_label: std::option::Option<crate::model::DataAccessLabel>,
48
49 /// Required. The ID to use for the data access label, which will become the
50 /// label's display name and the final component of the label's resource name.
51 /// The maximum number of characters should be 63. Regex pattern is as per AIP:
52 /// <https://google.aip.dev/122#resource-id-segments>
53 pub data_access_label_id: std::string::String,
54
55 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
56}
57
58impl CreateDataAccessLabelRequest {
59 pub fn new() -> Self {
60 std::default::Default::default()
61 }
62
63 /// Sets the value of [parent][crate::model::CreateDataAccessLabelRequest::parent].
64 ///
65 /// # Example
66 /// ```ignore,no_run
67 /// # use google_cloud_chronicle_v1::model::CreateDataAccessLabelRequest;
68 /// let x = CreateDataAccessLabelRequest::new().set_parent("example");
69 /// ```
70 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
71 self.parent = v.into();
72 self
73 }
74
75 /// Sets the value of [data_access_label][crate::model::CreateDataAccessLabelRequest::data_access_label].
76 ///
77 /// # Example
78 /// ```ignore,no_run
79 /// # use google_cloud_chronicle_v1::model::CreateDataAccessLabelRequest;
80 /// use google_cloud_chronicle_v1::model::DataAccessLabel;
81 /// let x = CreateDataAccessLabelRequest::new().set_data_access_label(DataAccessLabel::default()/* use setters */);
82 /// ```
83 pub fn set_data_access_label<T>(mut self, v: T) -> Self
84 where
85 T: std::convert::Into<crate::model::DataAccessLabel>,
86 {
87 self.data_access_label = std::option::Option::Some(v.into());
88 self
89 }
90
91 /// Sets or clears the value of [data_access_label][crate::model::CreateDataAccessLabelRequest::data_access_label].
92 ///
93 /// # Example
94 /// ```ignore,no_run
95 /// # use google_cloud_chronicle_v1::model::CreateDataAccessLabelRequest;
96 /// use google_cloud_chronicle_v1::model::DataAccessLabel;
97 /// let x = CreateDataAccessLabelRequest::new().set_or_clear_data_access_label(Some(DataAccessLabel::default()/* use setters */));
98 /// let x = CreateDataAccessLabelRequest::new().set_or_clear_data_access_label(None::<DataAccessLabel>);
99 /// ```
100 pub fn set_or_clear_data_access_label<T>(mut self, v: std::option::Option<T>) -> Self
101 where
102 T: std::convert::Into<crate::model::DataAccessLabel>,
103 {
104 self.data_access_label = v.map(|x| x.into());
105 self
106 }
107
108 /// Sets the value of [data_access_label_id][crate::model::CreateDataAccessLabelRequest::data_access_label_id].
109 ///
110 /// # Example
111 /// ```ignore,no_run
112 /// # use google_cloud_chronicle_v1::model::CreateDataAccessLabelRequest;
113 /// let x = CreateDataAccessLabelRequest::new().set_data_access_label_id("example");
114 /// ```
115 pub fn set_data_access_label_id<T: std::convert::Into<std::string::String>>(
116 mut self,
117 v: T,
118 ) -> Self {
119 self.data_access_label_id = v.into();
120 self
121 }
122}
123
124impl wkt::message::Message for CreateDataAccessLabelRequest {
125 fn typename() -> &'static str {
126 "type.googleapis.com/google.cloud.chronicle.v1.CreateDataAccessLabelRequest"
127 }
128}
129
130/// Request message to retrieve a data access label.
131#[derive(Clone, Default, PartialEq)]
132#[non_exhaustive]
133pub struct GetDataAccessLabelRequest {
134 /// Required. The ID of the data access label to retrieve.
135 /// Format:
136 /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessLabels/{data_access_label}`
137 pub name: std::string::String,
138
139 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
140}
141
142impl GetDataAccessLabelRequest {
143 pub fn new() -> Self {
144 std::default::Default::default()
145 }
146
147 /// Sets the value of [name][crate::model::GetDataAccessLabelRequest::name].
148 ///
149 /// # Example
150 /// ```ignore,no_run
151 /// # use google_cloud_chronicle_v1::model::GetDataAccessLabelRequest;
152 /// let x = GetDataAccessLabelRequest::new().set_name("example");
153 /// ```
154 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
155 self.name = v.into();
156 self
157 }
158}
159
160impl wkt::message::Message for GetDataAccessLabelRequest {
161 fn typename() -> &'static str {
162 "type.googleapis.com/google.cloud.chronicle.v1.GetDataAccessLabelRequest"
163 }
164}
165
166/// Request message for ListDataAccessLabels.
167#[derive(Clone, Default, PartialEq)]
168#[non_exhaustive]
169pub struct ListDataAccessLabelsRequest {
170 /// Required. The parent resource where this data access label will be created.
171 /// Format: `projects/{project}/locations/{location}/instances/{instance}`
172 pub parent: std::string::String,
173
174 /// The maximum number of data access labels to return. The service may return
175 /// fewer than this value. If unspecified, at most 100 data access labels will
176 /// be returned. The maximum value is 1000; values above 1000 will be coerced
177 /// to 1000.
178 pub page_size: i32,
179
180 /// A page token, received from a previous `ListDataAccessLabelsRequest` call.
181 /// Provide this to retrieve the subsequent page.
182 pub page_token: std::string::String,
183
184 /// Optional. A filter which should follow the guidelines of AIP-160.
185 /// Supports filtering on all fieds of DataAccessLabel and all operations as
186 /// mentioned in <https://google.aip.dev/160>.
187 /// example filter: "create_time greater than \"2023-04-21T11:30:00-04:00\" OR
188 /// display_name:\"-21-1\"".
189 pub filter: std::string::String,
190
191 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
192}
193
194impl ListDataAccessLabelsRequest {
195 pub fn new() -> Self {
196 std::default::Default::default()
197 }
198
199 /// Sets the value of [parent][crate::model::ListDataAccessLabelsRequest::parent].
200 ///
201 /// # Example
202 /// ```ignore,no_run
203 /// # use google_cloud_chronicle_v1::model::ListDataAccessLabelsRequest;
204 /// let x = ListDataAccessLabelsRequest::new().set_parent("example");
205 /// ```
206 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
207 self.parent = v.into();
208 self
209 }
210
211 /// Sets the value of [page_size][crate::model::ListDataAccessLabelsRequest::page_size].
212 ///
213 /// # Example
214 /// ```ignore,no_run
215 /// # use google_cloud_chronicle_v1::model::ListDataAccessLabelsRequest;
216 /// let x = ListDataAccessLabelsRequest::new().set_page_size(42);
217 /// ```
218 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
219 self.page_size = v.into();
220 self
221 }
222
223 /// Sets the value of [page_token][crate::model::ListDataAccessLabelsRequest::page_token].
224 ///
225 /// # Example
226 /// ```ignore,no_run
227 /// # use google_cloud_chronicle_v1::model::ListDataAccessLabelsRequest;
228 /// let x = ListDataAccessLabelsRequest::new().set_page_token("example");
229 /// ```
230 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
231 self.page_token = v.into();
232 self
233 }
234
235 /// Sets the value of [filter][crate::model::ListDataAccessLabelsRequest::filter].
236 ///
237 /// # Example
238 /// ```ignore,no_run
239 /// # use google_cloud_chronicle_v1::model::ListDataAccessLabelsRequest;
240 /// let x = ListDataAccessLabelsRequest::new().set_filter("example");
241 /// ```
242 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
243 self.filter = v.into();
244 self
245 }
246}
247
248impl wkt::message::Message for ListDataAccessLabelsRequest {
249 fn typename() -> &'static str {
250 "type.googleapis.com/google.cloud.chronicle.v1.ListDataAccessLabelsRequest"
251 }
252}
253
254/// Response message for ListDataAccessLabels.
255#[derive(Clone, Default, PartialEq)]
256#[non_exhaustive]
257pub struct ListDataAccessLabelsResponse {
258 /// List of data access labels.
259 pub data_access_labels: std::vec::Vec<crate::model::DataAccessLabel>,
260
261 /// A token, which can be sent as `page_token` to retrieve the next page.
262 /// If this field is omitted, there are no subsequent pages.
263 pub next_page_token: std::string::String,
264
265 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
266}
267
268impl ListDataAccessLabelsResponse {
269 pub fn new() -> Self {
270 std::default::Default::default()
271 }
272
273 /// Sets the value of [data_access_labels][crate::model::ListDataAccessLabelsResponse::data_access_labels].
274 ///
275 /// # Example
276 /// ```ignore,no_run
277 /// # use google_cloud_chronicle_v1::model::ListDataAccessLabelsResponse;
278 /// use google_cloud_chronicle_v1::model::DataAccessLabel;
279 /// let x = ListDataAccessLabelsResponse::new()
280 /// .set_data_access_labels([
281 /// DataAccessLabel::default()/* use setters */,
282 /// DataAccessLabel::default()/* use (different) setters */,
283 /// ]);
284 /// ```
285 pub fn set_data_access_labels<T, V>(mut self, v: T) -> Self
286 where
287 T: std::iter::IntoIterator<Item = V>,
288 V: std::convert::Into<crate::model::DataAccessLabel>,
289 {
290 use std::iter::Iterator;
291 self.data_access_labels = v.into_iter().map(|i| i.into()).collect();
292 self
293 }
294
295 /// Sets the value of [next_page_token][crate::model::ListDataAccessLabelsResponse::next_page_token].
296 ///
297 /// # Example
298 /// ```ignore,no_run
299 /// # use google_cloud_chronicle_v1::model::ListDataAccessLabelsResponse;
300 /// let x = ListDataAccessLabelsResponse::new().set_next_page_token("example");
301 /// ```
302 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
303 self.next_page_token = v.into();
304 self
305 }
306}
307
308impl wkt::message::Message for ListDataAccessLabelsResponse {
309 fn typename() -> &'static str {
310 "type.googleapis.com/google.cloud.chronicle.v1.ListDataAccessLabelsResponse"
311 }
312}
313
314#[doc(hidden)]
315impl google_cloud_gax::paginator::internal::PageableResponse for ListDataAccessLabelsResponse {
316 type PageItem = crate::model::DataAccessLabel;
317
318 fn items(self) -> std::vec::Vec<Self::PageItem> {
319 self.data_access_labels
320 }
321
322 fn next_page_token(&self) -> std::string::String {
323 use std::clone::Clone;
324 self.next_page_token.clone()
325 }
326}
327
328/// Request message for UpdateDataAccessLabel method.
329#[derive(Clone, Default, PartialEq)]
330#[non_exhaustive]
331pub struct UpdateDataAccessLabelRequest {
332 /// Required. The data access label to update.
333 ///
334 /// The label's `name` field is used to identify the label to update.
335 /// Format:
336 /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessLabels/{data_access_label}`
337 pub data_access_label: std::option::Option<crate::model::DataAccessLabel>,
338
339 /// The list of fields to update. If not included, all fields with a non-empty
340 /// value will be overwritten. Currently, only the description and definition
341 /// fields are supported for update; an update call that attempts to update any
342 /// other fields will return INVALID_ARGUMENT.
343 pub update_mask: std::option::Option<wkt::FieldMask>,
344
345 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
346}
347
348impl UpdateDataAccessLabelRequest {
349 pub fn new() -> Self {
350 std::default::Default::default()
351 }
352
353 /// Sets the value of [data_access_label][crate::model::UpdateDataAccessLabelRequest::data_access_label].
354 ///
355 /// # Example
356 /// ```ignore,no_run
357 /// # use google_cloud_chronicle_v1::model::UpdateDataAccessLabelRequest;
358 /// use google_cloud_chronicle_v1::model::DataAccessLabel;
359 /// let x = UpdateDataAccessLabelRequest::new().set_data_access_label(DataAccessLabel::default()/* use setters */);
360 /// ```
361 pub fn set_data_access_label<T>(mut self, v: T) -> Self
362 where
363 T: std::convert::Into<crate::model::DataAccessLabel>,
364 {
365 self.data_access_label = std::option::Option::Some(v.into());
366 self
367 }
368
369 /// Sets or clears the value of [data_access_label][crate::model::UpdateDataAccessLabelRequest::data_access_label].
370 ///
371 /// # Example
372 /// ```ignore,no_run
373 /// # use google_cloud_chronicle_v1::model::UpdateDataAccessLabelRequest;
374 /// use google_cloud_chronicle_v1::model::DataAccessLabel;
375 /// let x = UpdateDataAccessLabelRequest::new().set_or_clear_data_access_label(Some(DataAccessLabel::default()/* use setters */));
376 /// let x = UpdateDataAccessLabelRequest::new().set_or_clear_data_access_label(None::<DataAccessLabel>);
377 /// ```
378 pub fn set_or_clear_data_access_label<T>(mut self, v: std::option::Option<T>) -> Self
379 where
380 T: std::convert::Into<crate::model::DataAccessLabel>,
381 {
382 self.data_access_label = v.map(|x| x.into());
383 self
384 }
385
386 /// Sets the value of [update_mask][crate::model::UpdateDataAccessLabelRequest::update_mask].
387 ///
388 /// # Example
389 /// ```ignore,no_run
390 /// # use google_cloud_chronicle_v1::model::UpdateDataAccessLabelRequest;
391 /// use wkt::FieldMask;
392 /// let x = UpdateDataAccessLabelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
393 /// ```
394 pub fn set_update_mask<T>(mut self, v: T) -> Self
395 where
396 T: std::convert::Into<wkt::FieldMask>,
397 {
398 self.update_mask = std::option::Option::Some(v.into());
399 self
400 }
401
402 /// Sets or clears the value of [update_mask][crate::model::UpdateDataAccessLabelRequest::update_mask].
403 ///
404 /// # Example
405 /// ```ignore,no_run
406 /// # use google_cloud_chronicle_v1::model::UpdateDataAccessLabelRequest;
407 /// use wkt::FieldMask;
408 /// let x = UpdateDataAccessLabelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
409 /// let x = UpdateDataAccessLabelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
410 /// ```
411 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
412 where
413 T: std::convert::Into<wkt::FieldMask>,
414 {
415 self.update_mask = v.map(|x| x.into());
416 self
417 }
418}
419
420impl wkt::message::Message for UpdateDataAccessLabelRequest {
421 fn typename() -> &'static str {
422 "type.googleapis.com/google.cloud.chronicle.v1.UpdateDataAccessLabelRequest"
423 }
424}
425
426/// Request message to delete a data access label.
427#[derive(Clone, Default, PartialEq)]
428#[non_exhaustive]
429pub struct DeleteDataAccessLabelRequest {
430 /// Required. The ID of the data access label to delete.
431 /// Format:
432 /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessLabels/{data_access_label}`
433 pub name: std::string::String,
434
435 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
436}
437
438impl DeleteDataAccessLabelRequest {
439 pub fn new() -> Self {
440 std::default::Default::default()
441 }
442
443 /// Sets the value of [name][crate::model::DeleteDataAccessLabelRequest::name].
444 ///
445 /// # Example
446 /// ```ignore,no_run
447 /// # use google_cloud_chronicle_v1::model::DeleteDataAccessLabelRequest;
448 /// let x = DeleteDataAccessLabelRequest::new().set_name("example");
449 /// ```
450 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
451 self.name = v.into();
452 self
453 }
454}
455
456impl wkt::message::Message for DeleteDataAccessLabelRequest {
457 fn typename() -> &'static str {
458 "type.googleapis.com/google.cloud.chronicle.v1.DeleteDataAccessLabelRequest"
459 }
460}
461
462/// Request message for CreateDataAccessScope.
463#[derive(Clone, Default, PartialEq)]
464#[non_exhaustive]
465pub struct CreateDataAccessScopeRequest {
466 /// Required. The parent resource where this Data Access Scope will be created.
467 /// Format: `projects/{project}/locations/{location}/instances/{instance}`
468 pub parent: std::string::String,
469
470 /// Required. Data access scope to create.
471 pub data_access_scope: std::option::Option<crate::model::DataAccessScope>,
472
473 /// Required. The user provided scope id which will become the last part of the
474 /// name of the scope resource. Needs to be compliant with
475 /// <https://google.aip.dev/122>
476 pub data_access_scope_id: std::string::String,
477
478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
479}
480
481impl CreateDataAccessScopeRequest {
482 pub fn new() -> Self {
483 std::default::Default::default()
484 }
485
486 /// Sets the value of [parent][crate::model::CreateDataAccessScopeRequest::parent].
487 ///
488 /// # Example
489 /// ```ignore,no_run
490 /// # use google_cloud_chronicle_v1::model::CreateDataAccessScopeRequest;
491 /// let x = CreateDataAccessScopeRequest::new().set_parent("example");
492 /// ```
493 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
494 self.parent = v.into();
495 self
496 }
497
498 /// Sets the value of [data_access_scope][crate::model::CreateDataAccessScopeRequest::data_access_scope].
499 ///
500 /// # Example
501 /// ```ignore,no_run
502 /// # use google_cloud_chronicle_v1::model::CreateDataAccessScopeRequest;
503 /// use google_cloud_chronicle_v1::model::DataAccessScope;
504 /// let x = CreateDataAccessScopeRequest::new().set_data_access_scope(DataAccessScope::default()/* use setters */);
505 /// ```
506 pub fn set_data_access_scope<T>(mut self, v: T) -> Self
507 where
508 T: std::convert::Into<crate::model::DataAccessScope>,
509 {
510 self.data_access_scope = std::option::Option::Some(v.into());
511 self
512 }
513
514 /// Sets or clears the value of [data_access_scope][crate::model::CreateDataAccessScopeRequest::data_access_scope].
515 ///
516 /// # Example
517 /// ```ignore,no_run
518 /// # use google_cloud_chronicle_v1::model::CreateDataAccessScopeRequest;
519 /// use google_cloud_chronicle_v1::model::DataAccessScope;
520 /// let x = CreateDataAccessScopeRequest::new().set_or_clear_data_access_scope(Some(DataAccessScope::default()/* use setters */));
521 /// let x = CreateDataAccessScopeRequest::new().set_or_clear_data_access_scope(None::<DataAccessScope>);
522 /// ```
523 pub fn set_or_clear_data_access_scope<T>(mut self, v: std::option::Option<T>) -> Self
524 where
525 T: std::convert::Into<crate::model::DataAccessScope>,
526 {
527 self.data_access_scope = v.map(|x| x.into());
528 self
529 }
530
531 /// Sets the value of [data_access_scope_id][crate::model::CreateDataAccessScopeRequest::data_access_scope_id].
532 ///
533 /// # Example
534 /// ```ignore,no_run
535 /// # use google_cloud_chronicle_v1::model::CreateDataAccessScopeRequest;
536 /// let x = CreateDataAccessScopeRequest::new().set_data_access_scope_id("example");
537 /// ```
538 pub fn set_data_access_scope_id<T: std::convert::Into<std::string::String>>(
539 mut self,
540 v: T,
541 ) -> Self {
542 self.data_access_scope_id = v.into();
543 self
544 }
545}
546
547impl wkt::message::Message for CreateDataAccessScopeRequest {
548 fn typename() -> &'static str {
549 "type.googleapis.com/google.cloud.chronicle.v1.CreateDataAccessScopeRequest"
550 }
551}
552
553/// Request message to retrieve a data access scope.
554#[derive(Clone, Default, PartialEq)]
555#[non_exhaustive]
556pub struct GetDataAccessScopeRequest {
557 /// Required. The ID of the data access scope to retrieve.
558 /// Format:
559 /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope}`
560 pub name: std::string::String,
561
562 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
563}
564
565impl GetDataAccessScopeRequest {
566 pub fn new() -> Self {
567 std::default::Default::default()
568 }
569
570 /// Sets the value of [name][crate::model::GetDataAccessScopeRequest::name].
571 ///
572 /// # Example
573 /// ```ignore,no_run
574 /// # use google_cloud_chronicle_v1::model::GetDataAccessScopeRequest;
575 /// let x = GetDataAccessScopeRequest::new().set_name("example");
576 /// ```
577 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
578 self.name = v.into();
579 self
580 }
581}
582
583impl wkt::message::Message for GetDataAccessScopeRequest {
584 fn typename() -> &'static str {
585 "type.googleapis.com/google.cloud.chronicle.v1.GetDataAccessScopeRequest"
586 }
587}
588
589/// Request message for ListDataAccessScopes.
590#[derive(Clone, Default, PartialEq)]
591#[non_exhaustive]
592pub struct ListDataAccessScopesRequest {
593 /// Required. The parent resource where this data access scope will be created.
594 /// Format: `projects/{project}/locations/{location}/instances/{instance}`
595 pub parent: std::string::String,
596
597 /// The maximum number of data access scopes to return. The service may return
598 /// fewer than this value. If unspecified, at most 100 data access scopes will
599 /// be returned. The maximum value is 1000; values above 1000 will be coerced
600 /// to 1000.
601 pub page_size: i32,
602
603 /// A page token, received from a previous `ListDataAccessScopesRequest` call.
604 /// Provide this to retrieve the subsequent page.
605 pub page_token: std::string::String,
606
607 /// Optional. A filter which should follow the guidelines of AIP-160.
608 /// Supports filtering on all fieds of DataAccessScope and all operations as
609 /// mentioned in <https://google.aip.dev/160>.
610 /// example filter: "create_time greater than \"2023-04-21T11:30:00-04:00\" OR
611 /// display_name:\"-21-1\"".
612 pub filter: std::string::String,
613
614 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
615}
616
617impl ListDataAccessScopesRequest {
618 pub fn new() -> Self {
619 std::default::Default::default()
620 }
621
622 /// Sets the value of [parent][crate::model::ListDataAccessScopesRequest::parent].
623 ///
624 /// # Example
625 /// ```ignore,no_run
626 /// # use google_cloud_chronicle_v1::model::ListDataAccessScopesRequest;
627 /// let x = ListDataAccessScopesRequest::new().set_parent("example");
628 /// ```
629 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
630 self.parent = v.into();
631 self
632 }
633
634 /// Sets the value of [page_size][crate::model::ListDataAccessScopesRequest::page_size].
635 ///
636 /// # Example
637 /// ```ignore,no_run
638 /// # use google_cloud_chronicle_v1::model::ListDataAccessScopesRequest;
639 /// let x = ListDataAccessScopesRequest::new().set_page_size(42);
640 /// ```
641 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
642 self.page_size = v.into();
643 self
644 }
645
646 /// Sets the value of [page_token][crate::model::ListDataAccessScopesRequest::page_token].
647 ///
648 /// # Example
649 /// ```ignore,no_run
650 /// # use google_cloud_chronicle_v1::model::ListDataAccessScopesRequest;
651 /// let x = ListDataAccessScopesRequest::new().set_page_token("example");
652 /// ```
653 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
654 self.page_token = v.into();
655 self
656 }
657
658 /// Sets the value of [filter][crate::model::ListDataAccessScopesRequest::filter].
659 ///
660 /// # Example
661 /// ```ignore,no_run
662 /// # use google_cloud_chronicle_v1::model::ListDataAccessScopesRequest;
663 /// let x = ListDataAccessScopesRequest::new().set_filter("example");
664 /// ```
665 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
666 self.filter = v.into();
667 self
668 }
669}
670
671impl wkt::message::Message for ListDataAccessScopesRequest {
672 fn typename() -> &'static str {
673 "type.googleapis.com/google.cloud.chronicle.v1.ListDataAccessScopesRequest"
674 }
675}
676
677/// Response message for ListDataAccessScopes.
678#[derive(Clone, Default, PartialEq)]
679#[non_exhaustive]
680pub struct ListDataAccessScopesResponse {
681 /// List of data access scopes.
682 pub data_access_scopes: std::vec::Vec<crate::model::DataAccessScope>,
683
684 /// Whether or not global scope is granted to the user.
685 pub global_data_access_scope_granted: std::option::Option<bool>,
686
687 /// A token, which can be sent as `page_token` to retrieve the next page.
688 /// If this field is omitted, there are no subsequent pages.
689 pub next_page_token: std::string::String,
690
691 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
692}
693
694impl ListDataAccessScopesResponse {
695 pub fn new() -> Self {
696 std::default::Default::default()
697 }
698
699 /// Sets the value of [data_access_scopes][crate::model::ListDataAccessScopesResponse::data_access_scopes].
700 ///
701 /// # Example
702 /// ```ignore,no_run
703 /// # use google_cloud_chronicle_v1::model::ListDataAccessScopesResponse;
704 /// use google_cloud_chronicle_v1::model::DataAccessScope;
705 /// let x = ListDataAccessScopesResponse::new()
706 /// .set_data_access_scopes([
707 /// DataAccessScope::default()/* use setters */,
708 /// DataAccessScope::default()/* use (different) setters */,
709 /// ]);
710 /// ```
711 pub fn set_data_access_scopes<T, V>(mut self, v: T) -> Self
712 where
713 T: std::iter::IntoIterator<Item = V>,
714 V: std::convert::Into<crate::model::DataAccessScope>,
715 {
716 use std::iter::Iterator;
717 self.data_access_scopes = v.into_iter().map(|i| i.into()).collect();
718 self
719 }
720
721 /// Sets the value of [global_data_access_scope_granted][crate::model::ListDataAccessScopesResponse::global_data_access_scope_granted].
722 ///
723 /// # Example
724 /// ```ignore,no_run
725 /// # use google_cloud_chronicle_v1::model::ListDataAccessScopesResponse;
726 /// let x = ListDataAccessScopesResponse::new().set_global_data_access_scope_granted(true);
727 /// ```
728 pub fn set_global_data_access_scope_granted<T>(mut self, v: T) -> Self
729 where
730 T: std::convert::Into<bool>,
731 {
732 self.global_data_access_scope_granted = std::option::Option::Some(v.into());
733 self
734 }
735
736 /// Sets or clears the value of [global_data_access_scope_granted][crate::model::ListDataAccessScopesResponse::global_data_access_scope_granted].
737 ///
738 /// # Example
739 /// ```ignore,no_run
740 /// # use google_cloud_chronicle_v1::model::ListDataAccessScopesResponse;
741 /// let x = ListDataAccessScopesResponse::new().set_or_clear_global_data_access_scope_granted(Some(false));
742 /// let x = ListDataAccessScopesResponse::new().set_or_clear_global_data_access_scope_granted(None::<bool>);
743 /// ```
744 pub fn set_or_clear_global_data_access_scope_granted<T>(
745 mut self,
746 v: std::option::Option<T>,
747 ) -> Self
748 where
749 T: std::convert::Into<bool>,
750 {
751 self.global_data_access_scope_granted = v.map(|x| x.into());
752 self
753 }
754
755 /// Sets the value of [next_page_token][crate::model::ListDataAccessScopesResponse::next_page_token].
756 ///
757 /// # Example
758 /// ```ignore,no_run
759 /// # use google_cloud_chronicle_v1::model::ListDataAccessScopesResponse;
760 /// let x = ListDataAccessScopesResponse::new().set_next_page_token("example");
761 /// ```
762 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
763 self.next_page_token = v.into();
764 self
765 }
766}
767
768impl wkt::message::Message for ListDataAccessScopesResponse {
769 fn typename() -> &'static str {
770 "type.googleapis.com/google.cloud.chronicle.v1.ListDataAccessScopesResponse"
771 }
772}
773
774#[doc(hidden)]
775impl google_cloud_gax::paginator::internal::PageableResponse for ListDataAccessScopesResponse {
776 type PageItem = crate::model::DataAccessScope;
777
778 fn items(self) -> std::vec::Vec<Self::PageItem> {
779 self.data_access_scopes
780 }
781
782 fn next_page_token(&self) -> std::string::String {
783 use std::clone::Clone;
784 self.next_page_token.clone()
785 }
786}
787
788/// Request message for UpdateDataAccessScope method.
789#[derive(Clone, Default, PartialEq)]
790#[non_exhaustive]
791pub struct UpdateDataAccessScopeRequest {
792 /// Required. The data access scope to update.
793 ///
794 /// The scope's `name` field is used to identify the scope to update.
795 /// Format:
796 /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope}`
797 pub data_access_scope: std::option::Option<crate::model::DataAccessScope>,
798
799 /// The list of fields to update. If not included, all fields with a non-empty
800 /// value will be overwritten. Currently, only the description, the allowed
801 /// and denied labels list fields are supported for update;
802 /// an update call that attempts to update any
803 /// other fields will return INVALID_ARGUMENT.
804 pub update_mask: std::option::Option<wkt::FieldMask>,
805
806 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
807}
808
809impl UpdateDataAccessScopeRequest {
810 pub fn new() -> Self {
811 std::default::Default::default()
812 }
813
814 /// Sets the value of [data_access_scope][crate::model::UpdateDataAccessScopeRequest::data_access_scope].
815 ///
816 /// # Example
817 /// ```ignore,no_run
818 /// # use google_cloud_chronicle_v1::model::UpdateDataAccessScopeRequest;
819 /// use google_cloud_chronicle_v1::model::DataAccessScope;
820 /// let x = UpdateDataAccessScopeRequest::new().set_data_access_scope(DataAccessScope::default()/* use setters */);
821 /// ```
822 pub fn set_data_access_scope<T>(mut self, v: T) -> Self
823 where
824 T: std::convert::Into<crate::model::DataAccessScope>,
825 {
826 self.data_access_scope = std::option::Option::Some(v.into());
827 self
828 }
829
830 /// Sets or clears the value of [data_access_scope][crate::model::UpdateDataAccessScopeRequest::data_access_scope].
831 ///
832 /// # Example
833 /// ```ignore,no_run
834 /// # use google_cloud_chronicle_v1::model::UpdateDataAccessScopeRequest;
835 /// use google_cloud_chronicle_v1::model::DataAccessScope;
836 /// let x = UpdateDataAccessScopeRequest::new().set_or_clear_data_access_scope(Some(DataAccessScope::default()/* use setters */));
837 /// let x = UpdateDataAccessScopeRequest::new().set_or_clear_data_access_scope(None::<DataAccessScope>);
838 /// ```
839 pub fn set_or_clear_data_access_scope<T>(mut self, v: std::option::Option<T>) -> Self
840 where
841 T: std::convert::Into<crate::model::DataAccessScope>,
842 {
843 self.data_access_scope = v.map(|x| x.into());
844 self
845 }
846
847 /// Sets the value of [update_mask][crate::model::UpdateDataAccessScopeRequest::update_mask].
848 ///
849 /// # Example
850 /// ```ignore,no_run
851 /// # use google_cloud_chronicle_v1::model::UpdateDataAccessScopeRequest;
852 /// use wkt::FieldMask;
853 /// let x = UpdateDataAccessScopeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
854 /// ```
855 pub fn set_update_mask<T>(mut self, v: T) -> Self
856 where
857 T: std::convert::Into<wkt::FieldMask>,
858 {
859 self.update_mask = std::option::Option::Some(v.into());
860 self
861 }
862
863 /// Sets or clears the value of [update_mask][crate::model::UpdateDataAccessScopeRequest::update_mask].
864 ///
865 /// # Example
866 /// ```ignore,no_run
867 /// # use google_cloud_chronicle_v1::model::UpdateDataAccessScopeRequest;
868 /// use wkt::FieldMask;
869 /// let x = UpdateDataAccessScopeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
870 /// let x = UpdateDataAccessScopeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
871 /// ```
872 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
873 where
874 T: std::convert::Into<wkt::FieldMask>,
875 {
876 self.update_mask = v.map(|x| x.into());
877 self
878 }
879}
880
881impl wkt::message::Message for UpdateDataAccessScopeRequest {
882 fn typename() -> &'static str {
883 "type.googleapis.com/google.cloud.chronicle.v1.UpdateDataAccessScopeRequest"
884 }
885}
886
887/// Request message to delete a data access scope.
888#[derive(Clone, Default, PartialEq)]
889#[non_exhaustive]
890pub struct DeleteDataAccessScopeRequest {
891 /// Required. The ID of the data access scope to delete.
892 /// Format:
893 /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope}`
894 pub name: std::string::String,
895
896 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
897}
898
899impl DeleteDataAccessScopeRequest {
900 pub fn new() -> Self {
901 std::default::Default::default()
902 }
903
904 /// Sets the value of [name][crate::model::DeleteDataAccessScopeRequest::name].
905 ///
906 /// # Example
907 /// ```ignore,no_run
908 /// # use google_cloud_chronicle_v1::model::DeleteDataAccessScopeRequest;
909 /// let x = DeleteDataAccessScopeRequest::new().set_name("example");
910 /// ```
911 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
912 self.name = v.into();
913 self
914 }
915}
916
917impl wkt::message::Message for DeleteDataAccessScopeRequest {
918 fn typename() -> &'static str {
919 "type.googleapis.com/google.cloud.chronicle.v1.DeleteDataAccessScopeRequest"
920 }
921}
922
923/// A DataAccessLabel is a label on events to define user access to data.
924#[derive(Clone, Default, PartialEq)]
925#[non_exhaustive]
926pub struct DataAccessLabel {
927 /// The unique resource name of the data access label.
928 pub name: std::string::String,
929
930 /// Output only. The short name displayed for the label as it appears on event
931 /// data.
932 pub display_name: std::string::String,
933
934 /// Output only. The time at which the data access label was created.
935 pub create_time: std::option::Option<wkt::Timestamp>,
936
937 /// Output only. The time at which the data access label was last updated.
938 pub update_time: std::option::Option<wkt::Timestamp>,
939
940 /// Output only. The user who created the data access label.
941 pub author: std::string::String,
942
943 /// Output only. The user who last updated the data access label.
944 pub last_editor: std::string::String,
945
946 /// Optional. A description of the data access label for a human reader.
947 pub description: std::string::String,
948
949 /// Required.
950 /// The definition of the data access label that determines which
951 /// data gets tagged with this label.
952 pub definition: std::option::Option<crate::model::data_access_label::Definition>,
953
954 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
955}
956
957impl DataAccessLabel {
958 pub fn new() -> Self {
959 std::default::Default::default()
960 }
961
962 /// Sets the value of [name][crate::model::DataAccessLabel::name].
963 ///
964 /// # Example
965 /// ```ignore,no_run
966 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
967 /// let x = DataAccessLabel::new().set_name("example");
968 /// ```
969 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
970 self.name = v.into();
971 self
972 }
973
974 /// Sets the value of [display_name][crate::model::DataAccessLabel::display_name].
975 ///
976 /// # Example
977 /// ```ignore,no_run
978 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
979 /// let x = DataAccessLabel::new().set_display_name("example");
980 /// ```
981 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
982 self.display_name = v.into();
983 self
984 }
985
986 /// Sets the value of [create_time][crate::model::DataAccessLabel::create_time].
987 ///
988 /// # Example
989 /// ```ignore,no_run
990 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
991 /// use wkt::Timestamp;
992 /// let x = DataAccessLabel::new().set_create_time(Timestamp::default()/* use setters */);
993 /// ```
994 pub fn set_create_time<T>(mut self, v: T) -> Self
995 where
996 T: std::convert::Into<wkt::Timestamp>,
997 {
998 self.create_time = std::option::Option::Some(v.into());
999 self
1000 }
1001
1002 /// Sets or clears the value of [create_time][crate::model::DataAccessLabel::create_time].
1003 ///
1004 /// # Example
1005 /// ```ignore,no_run
1006 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
1007 /// use wkt::Timestamp;
1008 /// let x = DataAccessLabel::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1009 /// let x = DataAccessLabel::new().set_or_clear_create_time(None::<Timestamp>);
1010 /// ```
1011 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1012 where
1013 T: std::convert::Into<wkt::Timestamp>,
1014 {
1015 self.create_time = v.map(|x| x.into());
1016 self
1017 }
1018
1019 /// Sets the value of [update_time][crate::model::DataAccessLabel::update_time].
1020 ///
1021 /// # Example
1022 /// ```ignore,no_run
1023 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
1024 /// use wkt::Timestamp;
1025 /// let x = DataAccessLabel::new().set_update_time(Timestamp::default()/* use setters */);
1026 /// ```
1027 pub fn set_update_time<T>(mut self, v: T) -> Self
1028 where
1029 T: std::convert::Into<wkt::Timestamp>,
1030 {
1031 self.update_time = std::option::Option::Some(v.into());
1032 self
1033 }
1034
1035 /// Sets or clears the value of [update_time][crate::model::DataAccessLabel::update_time].
1036 ///
1037 /// # Example
1038 /// ```ignore,no_run
1039 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
1040 /// use wkt::Timestamp;
1041 /// let x = DataAccessLabel::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1042 /// let x = DataAccessLabel::new().set_or_clear_update_time(None::<Timestamp>);
1043 /// ```
1044 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1045 where
1046 T: std::convert::Into<wkt::Timestamp>,
1047 {
1048 self.update_time = v.map(|x| x.into());
1049 self
1050 }
1051
1052 /// Sets the value of [author][crate::model::DataAccessLabel::author].
1053 ///
1054 /// # Example
1055 /// ```ignore,no_run
1056 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
1057 /// let x = DataAccessLabel::new().set_author("example");
1058 /// ```
1059 pub fn set_author<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1060 self.author = v.into();
1061 self
1062 }
1063
1064 /// Sets the value of [last_editor][crate::model::DataAccessLabel::last_editor].
1065 ///
1066 /// # Example
1067 /// ```ignore,no_run
1068 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
1069 /// let x = DataAccessLabel::new().set_last_editor("example");
1070 /// ```
1071 pub fn set_last_editor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1072 self.last_editor = v.into();
1073 self
1074 }
1075
1076 /// Sets the value of [description][crate::model::DataAccessLabel::description].
1077 ///
1078 /// # Example
1079 /// ```ignore,no_run
1080 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
1081 /// let x = DataAccessLabel::new().set_description("example");
1082 /// ```
1083 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1084 self.description = v.into();
1085 self
1086 }
1087
1088 /// Sets the value of [definition][crate::model::DataAccessLabel::definition].
1089 ///
1090 /// Note that all the setters affecting `definition` are mutually
1091 /// exclusive.
1092 ///
1093 /// # Example
1094 /// ```ignore,no_run
1095 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
1096 /// use google_cloud_chronicle_v1::model::data_access_label::Definition;
1097 /// let x = DataAccessLabel::new().set_definition(Some(Definition::UdmQuery("example".to_string())));
1098 /// ```
1099 pub fn set_definition<
1100 T: std::convert::Into<std::option::Option<crate::model::data_access_label::Definition>>,
1101 >(
1102 mut self,
1103 v: T,
1104 ) -> Self {
1105 self.definition = v.into();
1106 self
1107 }
1108
1109 /// The value of [definition][crate::model::DataAccessLabel::definition]
1110 /// if it holds a `UdmQuery`, `None` if the field is not set or
1111 /// holds a different branch.
1112 pub fn udm_query(&self) -> std::option::Option<&std::string::String> {
1113 #[allow(unreachable_patterns)]
1114 self.definition.as_ref().and_then(|v| match v {
1115 crate::model::data_access_label::Definition::UdmQuery(v) => {
1116 std::option::Option::Some(v)
1117 }
1118 _ => std::option::Option::None,
1119 })
1120 }
1121
1122 /// Sets the value of [definition][crate::model::DataAccessLabel::definition]
1123 /// to hold a `UdmQuery`.
1124 ///
1125 /// Note that all the setters affecting `definition` are
1126 /// mutually exclusive.
1127 ///
1128 /// # Example
1129 /// ```ignore,no_run
1130 /// # use google_cloud_chronicle_v1::model::DataAccessLabel;
1131 /// let x = DataAccessLabel::new().set_udm_query("example");
1132 /// assert!(x.udm_query().is_some());
1133 /// ```
1134 pub fn set_udm_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1135 self.definition = std::option::Option::Some(
1136 crate::model::data_access_label::Definition::UdmQuery(v.into()),
1137 );
1138 self
1139 }
1140}
1141
1142impl wkt::message::Message for DataAccessLabel {
1143 fn typename() -> &'static str {
1144 "type.googleapis.com/google.cloud.chronicle.v1.DataAccessLabel"
1145 }
1146}
1147
1148/// Defines additional types related to [DataAccessLabel].
1149pub mod data_access_label {
1150 #[allow(unused_imports)]
1151 use super::*;
1152
1153 /// Required.
1154 /// The definition of the data access label that determines which
1155 /// data gets tagged with this label.
1156 #[derive(Clone, Debug, PartialEq)]
1157 #[non_exhaustive]
1158 pub enum Definition {
1159 /// A UDM query over event data.
1160 UdmQuery(std::string::String),
1161 }
1162}
1163
1164/// A DataAccessScope is a boolean expression of data access labels used
1165/// to restrict access to data for users.
1166#[derive(Clone, Default, PartialEq)]
1167#[non_exhaustive]
1168pub struct DataAccessScope {
1169 /// Required. The unique full name of the data access scope.
1170 /// The name should comply with <https://google.aip.dev/122> standards.
1171 pub name: std::string::String,
1172
1173 /// Optional. The allowed labels for the scope.
1174 /// Either allow_all or allowed_data_access_labels needs to be provided.
1175 /// When provided, there has to be at least one label allowed for the scope to
1176 /// be valid.
1177 /// The logical operator for evaluation of the allowed labels is OR.
1178 /// E.g.: A customer with scope with allowed labels A and B will be able
1179 /// to see data with labeled with A or B or (A and B).
1180 pub allowed_data_access_labels: std::vec::Vec<crate::model::DataAccessLabelReference>,
1181
1182 /// Optional. The denied labels for the scope.
1183 /// The logical operator for evaluation of the denied labels is AND.
1184 /// E.g.: A customer with scope with denied labels A and B won't be able
1185 /// to see data labeled with A and data labeled with B
1186 /// and data with labels A and B.
1187 pub denied_data_access_labels: std::vec::Vec<crate::model::DataAccessLabelReference>,
1188
1189 /// Output only. The name to be used for display to customers of the data
1190 /// access scope.
1191 pub display_name: std::string::String,
1192
1193 /// Output only. The time at which the data access scope was created.
1194 pub create_time: std::option::Option<wkt::Timestamp>,
1195
1196 /// Output only. The time at which the data access scope was last updated.
1197 pub update_time: std::option::Option<wkt::Timestamp>,
1198
1199 /// Output only. The user who created the data access scope.
1200 pub author: std::string::String,
1201
1202 /// Output only. The user who last updated the data access scope.
1203 pub last_editor: std::string::String,
1204
1205 /// Optional. A description of the data access scope for a human reader.
1206 pub description: std::string::String,
1207
1208 /// Optional. Whether or not the scope allows all labels, allow_all and
1209 /// allowed_data_access_labels are mutually exclusive and one of them must be
1210 /// present. denied_data_access_labels can still be used along with allow_all.
1211 /// When combined with denied_data_access_labels, access will be granted to all
1212 /// data that doesn't have labels mentioned in denied_data_access_labels. E.g.:
1213 /// A customer with scope with denied labels A and B and allow_all will be able
1214 /// to see all data except data labeled with A and data labeled with B and data
1215 /// with labels A and B.
1216 pub allow_all: bool,
1217
1218 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1219}
1220
1221impl DataAccessScope {
1222 pub fn new() -> Self {
1223 std::default::Default::default()
1224 }
1225
1226 /// Sets the value of [name][crate::model::DataAccessScope::name].
1227 ///
1228 /// # Example
1229 /// ```ignore,no_run
1230 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1231 /// let x = DataAccessScope::new().set_name("example");
1232 /// ```
1233 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1234 self.name = v.into();
1235 self
1236 }
1237
1238 /// Sets the value of [allowed_data_access_labels][crate::model::DataAccessScope::allowed_data_access_labels].
1239 ///
1240 /// # Example
1241 /// ```ignore,no_run
1242 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1243 /// use google_cloud_chronicle_v1::model::DataAccessLabelReference;
1244 /// let x = DataAccessScope::new()
1245 /// .set_allowed_data_access_labels([
1246 /// DataAccessLabelReference::default()/* use setters */,
1247 /// DataAccessLabelReference::default()/* use (different) setters */,
1248 /// ]);
1249 /// ```
1250 pub fn set_allowed_data_access_labels<T, V>(mut self, v: T) -> Self
1251 where
1252 T: std::iter::IntoIterator<Item = V>,
1253 V: std::convert::Into<crate::model::DataAccessLabelReference>,
1254 {
1255 use std::iter::Iterator;
1256 self.allowed_data_access_labels = v.into_iter().map(|i| i.into()).collect();
1257 self
1258 }
1259
1260 /// Sets the value of [denied_data_access_labels][crate::model::DataAccessScope::denied_data_access_labels].
1261 ///
1262 /// # Example
1263 /// ```ignore,no_run
1264 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1265 /// use google_cloud_chronicle_v1::model::DataAccessLabelReference;
1266 /// let x = DataAccessScope::new()
1267 /// .set_denied_data_access_labels([
1268 /// DataAccessLabelReference::default()/* use setters */,
1269 /// DataAccessLabelReference::default()/* use (different) setters */,
1270 /// ]);
1271 /// ```
1272 pub fn set_denied_data_access_labels<T, V>(mut self, v: T) -> Self
1273 where
1274 T: std::iter::IntoIterator<Item = V>,
1275 V: std::convert::Into<crate::model::DataAccessLabelReference>,
1276 {
1277 use std::iter::Iterator;
1278 self.denied_data_access_labels = v.into_iter().map(|i| i.into()).collect();
1279 self
1280 }
1281
1282 /// Sets the value of [display_name][crate::model::DataAccessScope::display_name].
1283 ///
1284 /// # Example
1285 /// ```ignore,no_run
1286 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1287 /// let x = DataAccessScope::new().set_display_name("example");
1288 /// ```
1289 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1290 self.display_name = v.into();
1291 self
1292 }
1293
1294 /// Sets the value of [create_time][crate::model::DataAccessScope::create_time].
1295 ///
1296 /// # Example
1297 /// ```ignore,no_run
1298 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1299 /// use wkt::Timestamp;
1300 /// let x = DataAccessScope::new().set_create_time(Timestamp::default()/* use setters */);
1301 /// ```
1302 pub fn set_create_time<T>(mut self, v: T) -> Self
1303 where
1304 T: std::convert::Into<wkt::Timestamp>,
1305 {
1306 self.create_time = std::option::Option::Some(v.into());
1307 self
1308 }
1309
1310 /// Sets or clears the value of [create_time][crate::model::DataAccessScope::create_time].
1311 ///
1312 /// # Example
1313 /// ```ignore,no_run
1314 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1315 /// use wkt::Timestamp;
1316 /// let x = DataAccessScope::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1317 /// let x = DataAccessScope::new().set_or_clear_create_time(None::<Timestamp>);
1318 /// ```
1319 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1320 where
1321 T: std::convert::Into<wkt::Timestamp>,
1322 {
1323 self.create_time = v.map(|x| x.into());
1324 self
1325 }
1326
1327 /// Sets the value of [update_time][crate::model::DataAccessScope::update_time].
1328 ///
1329 /// # Example
1330 /// ```ignore,no_run
1331 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1332 /// use wkt::Timestamp;
1333 /// let x = DataAccessScope::new().set_update_time(Timestamp::default()/* use setters */);
1334 /// ```
1335 pub fn set_update_time<T>(mut self, v: T) -> Self
1336 where
1337 T: std::convert::Into<wkt::Timestamp>,
1338 {
1339 self.update_time = std::option::Option::Some(v.into());
1340 self
1341 }
1342
1343 /// Sets or clears the value of [update_time][crate::model::DataAccessScope::update_time].
1344 ///
1345 /// # Example
1346 /// ```ignore,no_run
1347 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1348 /// use wkt::Timestamp;
1349 /// let x = DataAccessScope::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1350 /// let x = DataAccessScope::new().set_or_clear_update_time(None::<Timestamp>);
1351 /// ```
1352 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1353 where
1354 T: std::convert::Into<wkt::Timestamp>,
1355 {
1356 self.update_time = v.map(|x| x.into());
1357 self
1358 }
1359
1360 /// Sets the value of [author][crate::model::DataAccessScope::author].
1361 ///
1362 /// # Example
1363 /// ```ignore,no_run
1364 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1365 /// let x = DataAccessScope::new().set_author("example");
1366 /// ```
1367 pub fn set_author<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1368 self.author = v.into();
1369 self
1370 }
1371
1372 /// Sets the value of [last_editor][crate::model::DataAccessScope::last_editor].
1373 ///
1374 /// # Example
1375 /// ```ignore,no_run
1376 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1377 /// let x = DataAccessScope::new().set_last_editor("example");
1378 /// ```
1379 pub fn set_last_editor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1380 self.last_editor = v.into();
1381 self
1382 }
1383
1384 /// Sets the value of [description][crate::model::DataAccessScope::description].
1385 ///
1386 /// # Example
1387 /// ```ignore,no_run
1388 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1389 /// let x = DataAccessScope::new().set_description("example");
1390 /// ```
1391 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1392 self.description = v.into();
1393 self
1394 }
1395
1396 /// Sets the value of [allow_all][crate::model::DataAccessScope::allow_all].
1397 ///
1398 /// # Example
1399 /// ```ignore,no_run
1400 /// # use google_cloud_chronicle_v1::model::DataAccessScope;
1401 /// let x = DataAccessScope::new().set_allow_all(true);
1402 /// ```
1403 pub fn set_allow_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1404 self.allow_all = v.into();
1405 self
1406 }
1407}
1408
1409impl wkt::message::Message for DataAccessScope {
1410 fn typename() -> &'static str {
1411 "type.googleapis.com/google.cloud.chronicle.v1.DataAccessScope"
1412 }
1413}
1414
1415/// Reference object to a data access label.
1416#[derive(Clone, Default, PartialEq)]
1417#[non_exhaustive]
1418pub struct DataAccessLabelReference {
1419 /// Output only. The display name of the label.
1420 /// Data access label and log types's name
1421 /// will match the display name of the resource.
1422 /// The asset namespace will match the namespace itself.
1423 /// The ingestion key value pair will match the key of the tuple.
1424 pub display_name: std::string::String,
1425
1426 /// The unique identifier for the label.
1427 pub label: std::option::Option<crate::model::data_access_label_reference::Label>,
1428
1429 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1430}
1431
1432impl DataAccessLabelReference {
1433 pub fn new() -> Self {
1434 std::default::Default::default()
1435 }
1436
1437 /// Sets the value of [display_name][crate::model::DataAccessLabelReference::display_name].
1438 ///
1439 /// # Example
1440 /// ```ignore,no_run
1441 /// # use google_cloud_chronicle_v1::model::DataAccessLabelReference;
1442 /// let x = DataAccessLabelReference::new().set_display_name("example");
1443 /// ```
1444 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1445 self.display_name = v.into();
1446 self
1447 }
1448
1449 /// Sets the value of [label][crate::model::DataAccessLabelReference::label].
1450 ///
1451 /// Note that all the setters affecting `label` are mutually
1452 /// exclusive.
1453 ///
1454 /// # Example
1455 /// ```ignore,no_run
1456 /// # use google_cloud_chronicle_v1::model::DataAccessLabelReference;
1457 /// use google_cloud_chronicle_v1::model::data_access_label_reference::Label;
1458 /// let x = DataAccessLabelReference::new().set_label(Some(Label::DataAccessLabel("example".to_string())));
1459 /// ```
1460 pub fn set_label<
1461 T: std::convert::Into<std::option::Option<crate::model::data_access_label_reference::Label>>,
1462 >(
1463 mut self,
1464 v: T,
1465 ) -> Self {
1466 self.label = v.into();
1467 self
1468 }
1469
1470 /// The value of [label][crate::model::DataAccessLabelReference::label]
1471 /// if it holds a `DataAccessLabel`, `None` if the field is not set or
1472 /// holds a different branch.
1473 pub fn data_access_label(&self) -> std::option::Option<&std::string::String> {
1474 #[allow(unreachable_patterns)]
1475 self.label.as_ref().and_then(|v| match v {
1476 crate::model::data_access_label_reference::Label::DataAccessLabel(v) => {
1477 std::option::Option::Some(v)
1478 }
1479 _ => std::option::Option::None,
1480 })
1481 }
1482
1483 /// Sets the value of [label][crate::model::DataAccessLabelReference::label]
1484 /// to hold a `DataAccessLabel`.
1485 ///
1486 /// Note that all the setters affecting `label` are
1487 /// mutually exclusive.
1488 ///
1489 /// # Example
1490 /// ```ignore,no_run
1491 /// # use google_cloud_chronicle_v1::model::DataAccessLabelReference;
1492 /// let x = DataAccessLabelReference::new().set_data_access_label("example");
1493 /// assert!(x.data_access_label().is_some());
1494 /// assert!(x.log_type().is_none());
1495 /// assert!(x.asset_namespace().is_none());
1496 /// assert!(x.ingestion_label().is_none());
1497 /// ```
1498 pub fn set_data_access_label<T: std::convert::Into<std::string::String>>(
1499 mut self,
1500 v: T,
1501 ) -> Self {
1502 self.label = std::option::Option::Some(
1503 crate::model::data_access_label_reference::Label::DataAccessLabel(v.into()),
1504 );
1505 self
1506 }
1507
1508 /// The value of [label][crate::model::DataAccessLabelReference::label]
1509 /// if it holds a `LogType`, `None` if the field is not set or
1510 /// holds a different branch.
1511 pub fn log_type(&self) -> std::option::Option<&std::string::String> {
1512 #[allow(unreachable_patterns)]
1513 self.label.as_ref().and_then(|v| match v {
1514 crate::model::data_access_label_reference::Label::LogType(v) => {
1515 std::option::Option::Some(v)
1516 }
1517 _ => std::option::Option::None,
1518 })
1519 }
1520
1521 /// Sets the value of [label][crate::model::DataAccessLabelReference::label]
1522 /// to hold a `LogType`.
1523 ///
1524 /// Note that all the setters affecting `label` are
1525 /// mutually exclusive.
1526 ///
1527 /// # Example
1528 /// ```ignore,no_run
1529 /// # use google_cloud_chronicle_v1::model::DataAccessLabelReference;
1530 /// let x = DataAccessLabelReference::new().set_log_type("example");
1531 /// assert!(x.log_type().is_some());
1532 /// assert!(x.data_access_label().is_none());
1533 /// assert!(x.asset_namespace().is_none());
1534 /// assert!(x.ingestion_label().is_none());
1535 /// ```
1536 pub fn set_log_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1537 self.label = std::option::Option::Some(
1538 crate::model::data_access_label_reference::Label::LogType(v.into()),
1539 );
1540 self
1541 }
1542
1543 /// The value of [label][crate::model::DataAccessLabelReference::label]
1544 /// if it holds a `AssetNamespace`, `None` if the field is not set or
1545 /// holds a different branch.
1546 pub fn asset_namespace(&self) -> std::option::Option<&std::string::String> {
1547 #[allow(unreachable_patterns)]
1548 self.label.as_ref().and_then(|v| match v {
1549 crate::model::data_access_label_reference::Label::AssetNamespace(v) => {
1550 std::option::Option::Some(v)
1551 }
1552 _ => std::option::Option::None,
1553 })
1554 }
1555
1556 /// Sets the value of [label][crate::model::DataAccessLabelReference::label]
1557 /// to hold a `AssetNamespace`.
1558 ///
1559 /// Note that all the setters affecting `label` are
1560 /// mutually exclusive.
1561 ///
1562 /// # Example
1563 /// ```ignore,no_run
1564 /// # use google_cloud_chronicle_v1::model::DataAccessLabelReference;
1565 /// let x = DataAccessLabelReference::new().set_asset_namespace("example");
1566 /// assert!(x.asset_namespace().is_some());
1567 /// assert!(x.data_access_label().is_none());
1568 /// assert!(x.log_type().is_none());
1569 /// assert!(x.ingestion_label().is_none());
1570 /// ```
1571 pub fn set_asset_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1572 self.label = std::option::Option::Some(
1573 crate::model::data_access_label_reference::Label::AssetNamespace(v.into()),
1574 );
1575 self
1576 }
1577
1578 /// The value of [label][crate::model::DataAccessLabelReference::label]
1579 /// if it holds a `IngestionLabel`, `None` if the field is not set or
1580 /// holds a different branch.
1581 pub fn ingestion_label(
1582 &self,
1583 ) -> std::option::Option<&std::boxed::Box<crate::model::IngestionLabel>> {
1584 #[allow(unreachable_patterns)]
1585 self.label.as_ref().and_then(|v| match v {
1586 crate::model::data_access_label_reference::Label::IngestionLabel(v) => {
1587 std::option::Option::Some(v)
1588 }
1589 _ => std::option::Option::None,
1590 })
1591 }
1592
1593 /// Sets the value of [label][crate::model::DataAccessLabelReference::label]
1594 /// to hold a `IngestionLabel`.
1595 ///
1596 /// Note that all the setters affecting `label` are
1597 /// mutually exclusive.
1598 ///
1599 /// # Example
1600 /// ```ignore,no_run
1601 /// # use google_cloud_chronicle_v1::model::DataAccessLabelReference;
1602 /// use google_cloud_chronicle_v1::model::IngestionLabel;
1603 /// let x = DataAccessLabelReference::new().set_ingestion_label(IngestionLabel::default()/* use setters */);
1604 /// assert!(x.ingestion_label().is_some());
1605 /// assert!(x.data_access_label().is_none());
1606 /// assert!(x.log_type().is_none());
1607 /// assert!(x.asset_namespace().is_none());
1608 /// ```
1609 pub fn set_ingestion_label<
1610 T: std::convert::Into<std::boxed::Box<crate::model::IngestionLabel>>,
1611 >(
1612 mut self,
1613 v: T,
1614 ) -> Self {
1615 self.label = std::option::Option::Some(
1616 crate::model::data_access_label_reference::Label::IngestionLabel(v.into()),
1617 );
1618 self
1619 }
1620}
1621
1622impl wkt::message::Message for DataAccessLabelReference {
1623 fn typename() -> &'static str {
1624 "type.googleapis.com/google.cloud.chronicle.v1.DataAccessLabelReference"
1625 }
1626}
1627
1628/// Defines additional types related to [DataAccessLabelReference].
1629pub mod data_access_label_reference {
1630 #[allow(unused_imports)]
1631 use super::*;
1632
1633 /// The unique identifier for the label.
1634 #[derive(Clone, Debug, PartialEq)]
1635 #[non_exhaustive]
1636 pub enum Label {
1637 /// The name of the data access label.
1638 DataAccessLabel(std::string::String),
1639 /// The name of the log type.
1640 LogType(std::string::String),
1641 /// The asset namespace configured in the forwarder
1642 /// of the customer's events.
1643 AssetNamespace(std::string::String),
1644 /// The ingestion label configured in the forwarder of the customer's events.
1645 IngestionLabel(std::boxed::Box<crate::model::IngestionLabel>),
1646 }
1647}
1648
1649/// Representation of an ingestion label type.
1650#[derive(Clone, Default, PartialEq)]
1651#[non_exhaustive]
1652pub struct IngestionLabel {
1653 /// Required. The key of the ingestion label. Always required.
1654 pub ingestion_label_key: std::string::String,
1655
1656 /// Optional. The value of the ingestion label. Optional. An object
1657 /// with no provided value and some key provided would match
1658 /// against the given key and ANY value.
1659 pub ingestion_label_value: std::string::String,
1660
1661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1662}
1663
1664impl IngestionLabel {
1665 pub fn new() -> Self {
1666 std::default::Default::default()
1667 }
1668
1669 /// Sets the value of [ingestion_label_key][crate::model::IngestionLabel::ingestion_label_key].
1670 ///
1671 /// # Example
1672 /// ```ignore,no_run
1673 /// # use google_cloud_chronicle_v1::model::IngestionLabel;
1674 /// let x = IngestionLabel::new().set_ingestion_label_key("example");
1675 /// ```
1676 pub fn set_ingestion_label_key<T: std::convert::Into<std::string::String>>(
1677 mut self,
1678 v: T,
1679 ) -> Self {
1680 self.ingestion_label_key = v.into();
1681 self
1682 }
1683
1684 /// Sets the value of [ingestion_label_value][crate::model::IngestionLabel::ingestion_label_value].
1685 ///
1686 /// # Example
1687 /// ```ignore,no_run
1688 /// # use google_cloud_chronicle_v1::model::IngestionLabel;
1689 /// let x = IngestionLabel::new().set_ingestion_label_value("example");
1690 /// ```
1691 pub fn set_ingestion_label_value<T: std::convert::Into<std::string::String>>(
1692 mut self,
1693 v: T,
1694 ) -> Self {
1695 self.ingestion_label_value = v.into();
1696 self
1697 }
1698}
1699
1700impl wkt::message::Message for IngestionLabel {
1701 fn typename() -> &'static str {
1702 "type.googleapis.com/google.cloud.chronicle.v1.IngestionLabel"
1703 }
1704}
1705
1706/// A watchlist is a list of entities that allows for bulk operations over the
1707/// included entities.
1708#[derive(Clone, Default, PartialEq)]
1709#[non_exhaustive]
1710pub struct Watchlist {
1711 /// Identifier. Resource name of the watchlist.
1712 /// Format:
1713 /// `projects/{project}/locations/{location}/instances/{instance}/watchlists/{watchlist}`
1714 pub name: std::string::String,
1715
1716 /// Required. Display name of the watchlist.
1717 /// Note that it must be at least one character and less than 63 characters
1718 /// (<https://google.aip.dev/148>).
1719 pub display_name: std::string::String,
1720
1721 /// Optional. Description of the watchlist.
1722 pub description: std::string::String,
1723
1724 /// Optional. Weight applied to the risk score for entities
1725 /// in this watchlist.
1726 /// The default is 1.0 if it is not specified.
1727 pub multiplying_factor: f32,
1728
1729 /// Required. Mechanism to populate entities in the watchlist.
1730 pub entity_population_mechanism:
1731 std::option::Option<crate::model::watchlist::EntityPopulationMechanism>,
1732
1733 /// Output only. Entity count in the watchlist.
1734 pub entity_count: std::option::Option<crate::model::watchlist::EntityCount>,
1735
1736 /// Output only. Time the watchlist was created.
1737 pub create_time: std::option::Option<wkt::Timestamp>,
1738
1739 /// Output only. Time the watchlist was last updated.
1740 pub update_time: std::option::Option<wkt::Timestamp>,
1741
1742 /// Optional. User preferences for watchlist configuration.
1743 pub watchlist_user_preferences: std::option::Option<crate::model::WatchlistUserPreferences>,
1744
1745 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1746}
1747
1748impl Watchlist {
1749 pub fn new() -> Self {
1750 std::default::Default::default()
1751 }
1752
1753 /// Sets the value of [name][crate::model::Watchlist::name].
1754 ///
1755 /// # Example
1756 /// ```ignore,no_run
1757 /// # use google_cloud_chronicle_v1::model::Watchlist;
1758 /// let x = Watchlist::new().set_name("example");
1759 /// ```
1760 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1761 self.name = v.into();
1762 self
1763 }
1764
1765 /// Sets the value of [display_name][crate::model::Watchlist::display_name].
1766 ///
1767 /// # Example
1768 /// ```ignore,no_run
1769 /// # use google_cloud_chronicle_v1::model::Watchlist;
1770 /// let x = Watchlist::new().set_display_name("example");
1771 /// ```
1772 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1773 self.display_name = v.into();
1774 self
1775 }
1776
1777 /// Sets the value of [description][crate::model::Watchlist::description].
1778 ///
1779 /// # Example
1780 /// ```ignore,no_run
1781 /// # use google_cloud_chronicle_v1::model::Watchlist;
1782 /// let x = Watchlist::new().set_description("example");
1783 /// ```
1784 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1785 self.description = v.into();
1786 self
1787 }
1788
1789 /// Sets the value of [multiplying_factor][crate::model::Watchlist::multiplying_factor].
1790 ///
1791 /// # Example
1792 /// ```ignore,no_run
1793 /// # use google_cloud_chronicle_v1::model::Watchlist;
1794 /// let x = Watchlist::new().set_multiplying_factor(42.0);
1795 /// ```
1796 pub fn set_multiplying_factor<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1797 self.multiplying_factor = v.into();
1798 self
1799 }
1800
1801 /// Sets the value of [entity_population_mechanism][crate::model::Watchlist::entity_population_mechanism].
1802 ///
1803 /// # Example
1804 /// ```ignore,no_run
1805 /// # use google_cloud_chronicle_v1::model::Watchlist;
1806 /// use google_cloud_chronicle_v1::model::watchlist::EntityPopulationMechanism;
1807 /// let x = Watchlist::new().set_entity_population_mechanism(EntityPopulationMechanism::default()/* use setters */);
1808 /// ```
1809 pub fn set_entity_population_mechanism<T>(mut self, v: T) -> Self
1810 where
1811 T: std::convert::Into<crate::model::watchlist::EntityPopulationMechanism>,
1812 {
1813 self.entity_population_mechanism = std::option::Option::Some(v.into());
1814 self
1815 }
1816
1817 /// Sets or clears the value of [entity_population_mechanism][crate::model::Watchlist::entity_population_mechanism].
1818 ///
1819 /// # Example
1820 /// ```ignore,no_run
1821 /// # use google_cloud_chronicle_v1::model::Watchlist;
1822 /// use google_cloud_chronicle_v1::model::watchlist::EntityPopulationMechanism;
1823 /// let x = Watchlist::new().set_or_clear_entity_population_mechanism(Some(EntityPopulationMechanism::default()/* use setters */));
1824 /// let x = Watchlist::new().set_or_clear_entity_population_mechanism(None::<EntityPopulationMechanism>);
1825 /// ```
1826 pub fn set_or_clear_entity_population_mechanism<T>(mut self, v: std::option::Option<T>) -> Self
1827 where
1828 T: std::convert::Into<crate::model::watchlist::EntityPopulationMechanism>,
1829 {
1830 self.entity_population_mechanism = v.map(|x| x.into());
1831 self
1832 }
1833
1834 /// Sets the value of [entity_count][crate::model::Watchlist::entity_count].
1835 ///
1836 /// # Example
1837 /// ```ignore,no_run
1838 /// # use google_cloud_chronicle_v1::model::Watchlist;
1839 /// use google_cloud_chronicle_v1::model::watchlist::EntityCount;
1840 /// let x = Watchlist::new().set_entity_count(EntityCount::default()/* use setters */);
1841 /// ```
1842 pub fn set_entity_count<T>(mut self, v: T) -> Self
1843 where
1844 T: std::convert::Into<crate::model::watchlist::EntityCount>,
1845 {
1846 self.entity_count = std::option::Option::Some(v.into());
1847 self
1848 }
1849
1850 /// Sets or clears the value of [entity_count][crate::model::Watchlist::entity_count].
1851 ///
1852 /// # Example
1853 /// ```ignore,no_run
1854 /// # use google_cloud_chronicle_v1::model::Watchlist;
1855 /// use google_cloud_chronicle_v1::model::watchlist::EntityCount;
1856 /// let x = Watchlist::new().set_or_clear_entity_count(Some(EntityCount::default()/* use setters */));
1857 /// let x = Watchlist::new().set_or_clear_entity_count(None::<EntityCount>);
1858 /// ```
1859 pub fn set_or_clear_entity_count<T>(mut self, v: std::option::Option<T>) -> Self
1860 where
1861 T: std::convert::Into<crate::model::watchlist::EntityCount>,
1862 {
1863 self.entity_count = v.map(|x| x.into());
1864 self
1865 }
1866
1867 /// Sets the value of [create_time][crate::model::Watchlist::create_time].
1868 ///
1869 /// # Example
1870 /// ```ignore,no_run
1871 /// # use google_cloud_chronicle_v1::model::Watchlist;
1872 /// use wkt::Timestamp;
1873 /// let x = Watchlist::new().set_create_time(Timestamp::default()/* use setters */);
1874 /// ```
1875 pub fn set_create_time<T>(mut self, v: T) -> Self
1876 where
1877 T: std::convert::Into<wkt::Timestamp>,
1878 {
1879 self.create_time = std::option::Option::Some(v.into());
1880 self
1881 }
1882
1883 /// Sets or clears the value of [create_time][crate::model::Watchlist::create_time].
1884 ///
1885 /// # Example
1886 /// ```ignore,no_run
1887 /// # use google_cloud_chronicle_v1::model::Watchlist;
1888 /// use wkt::Timestamp;
1889 /// let x = Watchlist::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1890 /// let x = Watchlist::new().set_or_clear_create_time(None::<Timestamp>);
1891 /// ```
1892 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1893 where
1894 T: std::convert::Into<wkt::Timestamp>,
1895 {
1896 self.create_time = v.map(|x| x.into());
1897 self
1898 }
1899
1900 /// Sets the value of [update_time][crate::model::Watchlist::update_time].
1901 ///
1902 /// # Example
1903 /// ```ignore,no_run
1904 /// # use google_cloud_chronicle_v1::model::Watchlist;
1905 /// use wkt::Timestamp;
1906 /// let x = Watchlist::new().set_update_time(Timestamp::default()/* use setters */);
1907 /// ```
1908 pub fn set_update_time<T>(mut self, v: T) -> Self
1909 where
1910 T: std::convert::Into<wkt::Timestamp>,
1911 {
1912 self.update_time = std::option::Option::Some(v.into());
1913 self
1914 }
1915
1916 /// Sets or clears the value of [update_time][crate::model::Watchlist::update_time].
1917 ///
1918 /// # Example
1919 /// ```ignore,no_run
1920 /// # use google_cloud_chronicle_v1::model::Watchlist;
1921 /// use wkt::Timestamp;
1922 /// let x = Watchlist::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1923 /// let x = Watchlist::new().set_or_clear_update_time(None::<Timestamp>);
1924 /// ```
1925 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1926 where
1927 T: std::convert::Into<wkt::Timestamp>,
1928 {
1929 self.update_time = v.map(|x| x.into());
1930 self
1931 }
1932
1933 /// Sets the value of [watchlist_user_preferences][crate::model::Watchlist::watchlist_user_preferences].
1934 ///
1935 /// # Example
1936 /// ```ignore,no_run
1937 /// # use google_cloud_chronicle_v1::model::Watchlist;
1938 /// use google_cloud_chronicle_v1::model::WatchlistUserPreferences;
1939 /// let x = Watchlist::new().set_watchlist_user_preferences(WatchlistUserPreferences::default()/* use setters */);
1940 /// ```
1941 pub fn set_watchlist_user_preferences<T>(mut self, v: T) -> Self
1942 where
1943 T: std::convert::Into<crate::model::WatchlistUserPreferences>,
1944 {
1945 self.watchlist_user_preferences = std::option::Option::Some(v.into());
1946 self
1947 }
1948
1949 /// Sets or clears the value of [watchlist_user_preferences][crate::model::Watchlist::watchlist_user_preferences].
1950 ///
1951 /// # Example
1952 /// ```ignore,no_run
1953 /// # use google_cloud_chronicle_v1::model::Watchlist;
1954 /// use google_cloud_chronicle_v1::model::WatchlistUserPreferences;
1955 /// let x = Watchlist::new().set_or_clear_watchlist_user_preferences(Some(WatchlistUserPreferences::default()/* use setters */));
1956 /// let x = Watchlist::new().set_or_clear_watchlist_user_preferences(None::<WatchlistUserPreferences>);
1957 /// ```
1958 pub fn set_or_clear_watchlist_user_preferences<T>(mut self, v: std::option::Option<T>) -> Self
1959 where
1960 T: std::convert::Into<crate::model::WatchlistUserPreferences>,
1961 {
1962 self.watchlist_user_preferences = v.map(|x| x.into());
1963 self
1964 }
1965}
1966
1967impl wkt::message::Message for Watchlist {
1968 fn typename() -> &'static str {
1969 "type.googleapis.com/google.cloud.chronicle.v1.Watchlist"
1970 }
1971}
1972
1973/// Defines additional types related to [Watchlist].
1974pub mod watchlist {
1975 #[allow(unused_imports)]
1976 use super::*;
1977
1978 /// Mechanism to populate entities in the watchlist.
1979 #[derive(Clone, Default, PartialEq)]
1980 #[non_exhaustive]
1981 pub struct EntityPopulationMechanism {
1982 /// Ways to populate entities in watchlist.
1983 /// Currently, only manual is supported.
1984 pub mechanism:
1985 std::option::Option<crate::model::watchlist::entity_population_mechanism::Mechanism>,
1986
1987 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1988 }
1989
1990 impl EntityPopulationMechanism {
1991 pub fn new() -> Self {
1992 std::default::Default::default()
1993 }
1994
1995 /// Sets the value of [mechanism][crate::model::watchlist::EntityPopulationMechanism::mechanism].
1996 ///
1997 /// Note that all the setters affecting `mechanism` are mutually
1998 /// exclusive.
1999 ///
2000 /// # Example
2001 /// ```ignore,no_run
2002 /// # use google_cloud_chronicle_v1::model::watchlist::EntityPopulationMechanism;
2003 /// use google_cloud_chronicle_v1::model::watchlist::entity_population_mechanism::Manual;
2004 /// let x = EntityPopulationMechanism::new().set_mechanism(Some(
2005 /// google_cloud_chronicle_v1::model::watchlist::entity_population_mechanism::Mechanism::Manual(Manual::default().into())));
2006 /// ```
2007 pub fn set_mechanism<
2008 T: std::convert::Into<
2009 std::option::Option<
2010 crate::model::watchlist::entity_population_mechanism::Mechanism,
2011 >,
2012 >,
2013 >(
2014 mut self,
2015 v: T,
2016 ) -> Self {
2017 self.mechanism = v.into();
2018 self
2019 }
2020
2021 /// The value of [mechanism][crate::model::watchlist::EntityPopulationMechanism::mechanism]
2022 /// if it holds a `Manual`, `None` if the field is not set or
2023 /// holds a different branch.
2024 pub fn manual(
2025 &self,
2026 ) -> std::option::Option<
2027 &std::boxed::Box<crate::model::watchlist::entity_population_mechanism::Manual>,
2028 > {
2029 #[allow(unreachable_patterns)]
2030 self.mechanism.as_ref().and_then(|v| match v {
2031 crate::model::watchlist::entity_population_mechanism::Mechanism::Manual(v) => {
2032 std::option::Option::Some(v)
2033 }
2034 _ => std::option::Option::None,
2035 })
2036 }
2037
2038 /// Sets the value of [mechanism][crate::model::watchlist::EntityPopulationMechanism::mechanism]
2039 /// to hold a `Manual`.
2040 ///
2041 /// Note that all the setters affecting `mechanism` are
2042 /// mutually exclusive.
2043 ///
2044 /// # Example
2045 /// ```ignore,no_run
2046 /// # use google_cloud_chronicle_v1::model::watchlist::EntityPopulationMechanism;
2047 /// use google_cloud_chronicle_v1::model::watchlist::entity_population_mechanism::Manual;
2048 /// let x = EntityPopulationMechanism::new().set_manual(Manual::default()/* use setters */);
2049 /// assert!(x.manual().is_some());
2050 /// ```
2051 pub fn set_manual<
2052 T: std::convert::Into<
2053 std::boxed::Box<crate::model::watchlist::entity_population_mechanism::Manual>,
2054 >,
2055 >(
2056 mut self,
2057 v: T,
2058 ) -> Self {
2059 self.mechanism = std::option::Option::Some(
2060 crate::model::watchlist::entity_population_mechanism::Mechanism::Manual(v.into()),
2061 );
2062 self
2063 }
2064 }
2065
2066 impl wkt::message::Message for EntityPopulationMechanism {
2067 fn typename() -> &'static str {
2068 "type.googleapis.com/google.cloud.chronicle.v1.Watchlist.EntityPopulationMechanism"
2069 }
2070 }
2071
2072 /// Defines additional types related to [EntityPopulationMechanism].
2073 pub mod entity_population_mechanism {
2074 #[allow(unused_imports)]
2075 use super::*;
2076
2077 /// Entities are added manually.
2078 #[derive(Clone, Default, PartialEq)]
2079 #[non_exhaustive]
2080 pub struct Manual {
2081 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2082 }
2083
2084 impl Manual {
2085 pub fn new() -> Self {
2086 std::default::Default::default()
2087 }
2088 }
2089
2090 impl wkt::message::Message for Manual {
2091 fn typename() -> &'static str {
2092 "type.googleapis.com/google.cloud.chronicle.v1.Watchlist.EntityPopulationMechanism.Manual"
2093 }
2094 }
2095
2096 /// Ways to populate entities in watchlist.
2097 /// Currently, only manual is supported.
2098 #[derive(Clone, Debug, PartialEq)]
2099 #[non_exhaustive]
2100 pub enum Mechanism {
2101 /// Optional. Entities are added manually.
2102 Manual(std::boxed::Box<crate::model::watchlist::entity_population_mechanism::Manual>),
2103 }
2104 }
2105
2106 /// Count of different types of entities in the watchlist.
2107 #[derive(Clone, Default, PartialEq)]
2108 #[non_exhaustive]
2109 pub struct EntityCount {
2110 /// Output only. Count of user type entities in the watchlist.
2111 pub user: i32,
2112
2113 /// Output only. Count of asset type entities in the watchlist.
2114 pub asset: i32,
2115
2116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2117 }
2118
2119 impl EntityCount {
2120 pub fn new() -> Self {
2121 std::default::Default::default()
2122 }
2123
2124 /// Sets the value of [user][crate::model::watchlist::EntityCount::user].
2125 ///
2126 /// # Example
2127 /// ```ignore,no_run
2128 /// # use google_cloud_chronicle_v1::model::watchlist::EntityCount;
2129 /// let x = EntityCount::new().set_user(42);
2130 /// ```
2131 pub fn set_user<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2132 self.user = v.into();
2133 self
2134 }
2135
2136 /// Sets the value of [asset][crate::model::watchlist::EntityCount::asset].
2137 ///
2138 /// # Example
2139 /// ```ignore,no_run
2140 /// # use google_cloud_chronicle_v1::model::watchlist::EntityCount;
2141 /// let x = EntityCount::new().set_asset(42);
2142 /// ```
2143 pub fn set_asset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2144 self.asset = v.into();
2145 self
2146 }
2147 }
2148
2149 impl wkt::message::Message for EntityCount {
2150 fn typename() -> &'static str {
2151 "type.googleapis.com/google.cloud.chronicle.v1.Watchlist.EntityCount"
2152 }
2153 }
2154}
2155
2156/// A collection of user preferences for watchlist UI configuration.
2157#[derive(Clone, Default, PartialEq)]
2158#[non_exhaustive]
2159pub struct WatchlistUserPreferences {
2160 /// Optional. Whether the watchlist is pinned on the dashboard.
2161 pub pinned: bool,
2162
2163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2164}
2165
2166impl WatchlistUserPreferences {
2167 pub fn new() -> Self {
2168 std::default::Default::default()
2169 }
2170
2171 /// Sets the value of [pinned][crate::model::WatchlistUserPreferences::pinned].
2172 ///
2173 /// # Example
2174 /// ```ignore,no_run
2175 /// # use google_cloud_chronicle_v1::model::WatchlistUserPreferences;
2176 /// let x = WatchlistUserPreferences::new().set_pinned(true);
2177 /// ```
2178 pub fn set_pinned<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2179 self.pinned = v.into();
2180 self
2181 }
2182}
2183
2184impl wkt::message::Message for WatchlistUserPreferences {
2185 fn typename() -> &'static str {
2186 "type.googleapis.com/google.cloud.chronicle.v1.WatchlistUserPreferences"
2187 }
2188}
2189
2190/// Request message for getting a watchlist.
2191#[derive(Clone, Default, PartialEq)]
2192#[non_exhaustive]
2193pub struct GetWatchlistRequest {
2194 /// Required. The parent, which owns this collection of watchlists.
2195 /// The name of the watchlist to retrieve.
2196 /// Format:
2197 /// `projects/{project}/locations/{location}/instances/{instance}/watchlists/{watchlist}`
2198 pub name: std::string::String,
2199
2200 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2201}
2202
2203impl GetWatchlistRequest {
2204 pub fn new() -> Self {
2205 std::default::Default::default()
2206 }
2207
2208 /// Sets the value of [name][crate::model::GetWatchlistRequest::name].
2209 ///
2210 /// # Example
2211 /// ```ignore,no_run
2212 /// # use google_cloud_chronicle_v1::model::GetWatchlistRequest;
2213 /// let x = GetWatchlistRequest::new().set_name("example");
2214 /// ```
2215 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2216 self.name = v.into();
2217 self
2218 }
2219}
2220
2221impl wkt::message::Message for GetWatchlistRequest {
2222 fn typename() -> &'static str {
2223 "type.googleapis.com/google.cloud.chronicle.v1.GetWatchlistRequest"
2224 }
2225}
2226
2227/// Request message for listing watchlists.
2228#[derive(Clone, Default, PartialEq)]
2229#[non_exhaustive]
2230pub struct ListWatchlistsRequest {
2231 /// Required. The parent, which owns this collection of watchlists.
2232 /// Format: `projects/{project}/locations/{location}/instances/{instance}`
2233 pub parent: std::string::String,
2234
2235 /// Optional. The maximum number of watchlists to return.
2236 /// The service may return fewer than this value.
2237 /// If unspecified, at most 200 watchlists will be returned.
2238 /// The maximum value is 200; values above 200 will be coerced to 200.
2239 pub page_size: i32,
2240
2241 /// Optional. A page token, received from a previous `ListWatchlists` call.
2242 /// Provide this to retrieve the subsequent page.
2243 ///
2244 /// When paginating, all other parameters provided to
2245 /// `ListWatchlists` must match the call that provided the page
2246 /// token.
2247 pub page_token: std::string::String,
2248
2249 /// Optional. Which watchlist to return in aip.dev/160 form.
2250 /// Currently, only the following filters are supported:
2251 ///
2252 /// - `watchlist_user_preferences.pinned=true`
2253 /// - `has_entity([ENTITY_INDICATOR],[ENTITY_TYPE])`
2254 /// - `has_entity([ENTITY_INDICATOR],[ENTITY_TYPE],[NAMESPACE])`
2255 pub filter: std::string::String,
2256
2257 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2258}
2259
2260impl ListWatchlistsRequest {
2261 pub fn new() -> Self {
2262 std::default::Default::default()
2263 }
2264
2265 /// Sets the value of [parent][crate::model::ListWatchlistsRequest::parent].
2266 ///
2267 /// # Example
2268 /// ```ignore,no_run
2269 /// # use google_cloud_chronicle_v1::model::ListWatchlistsRequest;
2270 /// let x = ListWatchlistsRequest::new().set_parent("example");
2271 /// ```
2272 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2273 self.parent = v.into();
2274 self
2275 }
2276
2277 /// Sets the value of [page_size][crate::model::ListWatchlistsRequest::page_size].
2278 ///
2279 /// # Example
2280 /// ```ignore,no_run
2281 /// # use google_cloud_chronicle_v1::model::ListWatchlistsRequest;
2282 /// let x = ListWatchlistsRequest::new().set_page_size(42);
2283 /// ```
2284 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2285 self.page_size = v.into();
2286 self
2287 }
2288
2289 /// Sets the value of [page_token][crate::model::ListWatchlistsRequest::page_token].
2290 ///
2291 /// # Example
2292 /// ```ignore,no_run
2293 /// # use google_cloud_chronicle_v1::model::ListWatchlistsRequest;
2294 /// let x = ListWatchlistsRequest::new().set_page_token("example");
2295 /// ```
2296 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2297 self.page_token = v.into();
2298 self
2299 }
2300
2301 /// Sets the value of [filter][crate::model::ListWatchlistsRequest::filter].
2302 ///
2303 /// # Example
2304 /// ```ignore,no_run
2305 /// # use google_cloud_chronicle_v1::model::ListWatchlistsRequest;
2306 /// let x = ListWatchlistsRequest::new().set_filter("example");
2307 /// ```
2308 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2309 self.filter = v.into();
2310 self
2311 }
2312}
2313
2314impl wkt::message::Message for ListWatchlistsRequest {
2315 fn typename() -> &'static str {
2316 "type.googleapis.com/google.cloud.chronicle.v1.ListWatchlistsRequest"
2317 }
2318}
2319
2320/// Response message for listing watchlists.
2321#[derive(Clone, Default, PartialEq)]
2322#[non_exhaustive]
2323pub struct ListWatchlistsResponse {
2324 /// Optional. The watchlists from the specified instance.
2325 pub watchlists: std::vec::Vec<crate::model::Watchlist>,
2326
2327 /// Optional. A token, which can be sent as `page_token` to retrieve the next
2328 /// page. If this field is omitted, there are no subsequent pages.
2329 pub next_page_token: std::string::String,
2330
2331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2332}
2333
2334impl ListWatchlistsResponse {
2335 pub fn new() -> Self {
2336 std::default::Default::default()
2337 }
2338
2339 /// Sets the value of [watchlists][crate::model::ListWatchlistsResponse::watchlists].
2340 ///
2341 /// # Example
2342 /// ```ignore,no_run
2343 /// # use google_cloud_chronicle_v1::model::ListWatchlistsResponse;
2344 /// use google_cloud_chronicle_v1::model::Watchlist;
2345 /// let x = ListWatchlistsResponse::new()
2346 /// .set_watchlists([
2347 /// Watchlist::default()/* use setters */,
2348 /// Watchlist::default()/* use (different) setters */,
2349 /// ]);
2350 /// ```
2351 pub fn set_watchlists<T, V>(mut self, v: T) -> Self
2352 where
2353 T: std::iter::IntoIterator<Item = V>,
2354 V: std::convert::Into<crate::model::Watchlist>,
2355 {
2356 use std::iter::Iterator;
2357 self.watchlists = v.into_iter().map(|i| i.into()).collect();
2358 self
2359 }
2360
2361 /// Sets the value of [next_page_token][crate::model::ListWatchlistsResponse::next_page_token].
2362 ///
2363 /// # Example
2364 /// ```ignore,no_run
2365 /// # use google_cloud_chronicle_v1::model::ListWatchlistsResponse;
2366 /// let x = ListWatchlistsResponse::new().set_next_page_token("example");
2367 /// ```
2368 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2369 self.next_page_token = v.into();
2370 self
2371 }
2372}
2373
2374impl wkt::message::Message for ListWatchlistsResponse {
2375 fn typename() -> &'static str {
2376 "type.googleapis.com/google.cloud.chronicle.v1.ListWatchlistsResponse"
2377 }
2378}
2379
2380#[doc(hidden)]
2381impl google_cloud_gax::paginator::internal::PageableResponse for ListWatchlistsResponse {
2382 type PageItem = crate::model::Watchlist;
2383
2384 fn items(self) -> std::vec::Vec<Self::PageItem> {
2385 self.watchlists
2386 }
2387
2388 fn next_page_token(&self) -> std::string::String {
2389 use std::clone::Clone;
2390 self.next_page_token.clone()
2391 }
2392}
2393
2394/// Request message for creating watchlist.
2395#[derive(Clone, Default, PartialEq)]
2396#[non_exhaustive]
2397pub struct CreateWatchlistRequest {
2398 /// Required. The parent resource where this watchlist will be created.
2399 /// Format: `projects/{project}/locations/{location}/instances/{instance}`
2400 pub parent: std::string::String,
2401
2402 /// Optional. The ID to use for the watchlist,
2403 /// which will become the final component of the watchlist's resource name.
2404 ///
2405 /// This value should be 4-63 characters, and valid characters
2406 /// are /[a-z][0-9]-/.
2407 pub watchlist_id: std::string::String,
2408
2409 /// Required. The watchlist to create.
2410 pub watchlist: std::option::Option<crate::model::Watchlist>,
2411
2412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2413}
2414
2415impl CreateWatchlistRequest {
2416 pub fn new() -> Self {
2417 std::default::Default::default()
2418 }
2419
2420 /// Sets the value of [parent][crate::model::CreateWatchlistRequest::parent].
2421 ///
2422 /// # Example
2423 /// ```ignore,no_run
2424 /// # use google_cloud_chronicle_v1::model::CreateWatchlistRequest;
2425 /// let x = CreateWatchlistRequest::new().set_parent("example");
2426 /// ```
2427 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2428 self.parent = v.into();
2429 self
2430 }
2431
2432 /// Sets the value of [watchlist_id][crate::model::CreateWatchlistRequest::watchlist_id].
2433 ///
2434 /// # Example
2435 /// ```ignore,no_run
2436 /// # use google_cloud_chronicle_v1::model::CreateWatchlistRequest;
2437 /// let x = CreateWatchlistRequest::new().set_watchlist_id("example");
2438 /// ```
2439 pub fn set_watchlist_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2440 self.watchlist_id = v.into();
2441 self
2442 }
2443
2444 /// Sets the value of [watchlist][crate::model::CreateWatchlistRequest::watchlist].
2445 ///
2446 /// # Example
2447 /// ```ignore,no_run
2448 /// # use google_cloud_chronicle_v1::model::CreateWatchlistRequest;
2449 /// use google_cloud_chronicle_v1::model::Watchlist;
2450 /// let x = CreateWatchlistRequest::new().set_watchlist(Watchlist::default()/* use setters */);
2451 /// ```
2452 pub fn set_watchlist<T>(mut self, v: T) -> Self
2453 where
2454 T: std::convert::Into<crate::model::Watchlist>,
2455 {
2456 self.watchlist = std::option::Option::Some(v.into());
2457 self
2458 }
2459
2460 /// Sets or clears the value of [watchlist][crate::model::CreateWatchlistRequest::watchlist].
2461 ///
2462 /// # Example
2463 /// ```ignore,no_run
2464 /// # use google_cloud_chronicle_v1::model::CreateWatchlistRequest;
2465 /// use google_cloud_chronicle_v1::model::Watchlist;
2466 /// let x = CreateWatchlistRequest::new().set_or_clear_watchlist(Some(Watchlist::default()/* use setters */));
2467 /// let x = CreateWatchlistRequest::new().set_or_clear_watchlist(None::<Watchlist>);
2468 /// ```
2469 pub fn set_or_clear_watchlist<T>(mut self, v: std::option::Option<T>) -> Self
2470 where
2471 T: std::convert::Into<crate::model::Watchlist>,
2472 {
2473 self.watchlist = v.map(|x| x.into());
2474 self
2475 }
2476}
2477
2478impl wkt::message::Message for CreateWatchlistRequest {
2479 fn typename() -> &'static str {
2480 "type.googleapis.com/google.cloud.chronicle.v1.CreateWatchlistRequest"
2481 }
2482}
2483
2484/// Request message for updating watchlist.
2485#[derive(Clone, Default, PartialEq)]
2486#[non_exhaustive]
2487pub struct UpdateWatchlistRequest {
2488 /// Required. The watchlist to update.
2489 ///
2490 /// The watchlist's `name` field is used to identify the watchlist to update.
2491 /// Format:
2492 /// `projects/{project}/locations/{location}/instances/{instance}/watchlists/{watchlist}`
2493 pub watchlist: std::option::Option<crate::model::Watchlist>,
2494
2495 /// Optional. The list of fields to update.
2496 pub update_mask: std::option::Option<wkt::FieldMask>,
2497
2498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2499}
2500
2501impl UpdateWatchlistRequest {
2502 pub fn new() -> Self {
2503 std::default::Default::default()
2504 }
2505
2506 /// Sets the value of [watchlist][crate::model::UpdateWatchlistRequest::watchlist].
2507 ///
2508 /// # Example
2509 /// ```ignore,no_run
2510 /// # use google_cloud_chronicle_v1::model::UpdateWatchlistRequest;
2511 /// use google_cloud_chronicle_v1::model::Watchlist;
2512 /// let x = UpdateWatchlistRequest::new().set_watchlist(Watchlist::default()/* use setters */);
2513 /// ```
2514 pub fn set_watchlist<T>(mut self, v: T) -> Self
2515 where
2516 T: std::convert::Into<crate::model::Watchlist>,
2517 {
2518 self.watchlist = std::option::Option::Some(v.into());
2519 self
2520 }
2521
2522 /// Sets or clears the value of [watchlist][crate::model::UpdateWatchlistRequest::watchlist].
2523 ///
2524 /// # Example
2525 /// ```ignore,no_run
2526 /// # use google_cloud_chronicle_v1::model::UpdateWatchlistRequest;
2527 /// use google_cloud_chronicle_v1::model::Watchlist;
2528 /// let x = UpdateWatchlistRequest::new().set_or_clear_watchlist(Some(Watchlist::default()/* use setters */));
2529 /// let x = UpdateWatchlistRequest::new().set_or_clear_watchlist(None::<Watchlist>);
2530 /// ```
2531 pub fn set_or_clear_watchlist<T>(mut self, v: std::option::Option<T>) -> Self
2532 where
2533 T: std::convert::Into<crate::model::Watchlist>,
2534 {
2535 self.watchlist = v.map(|x| x.into());
2536 self
2537 }
2538
2539 /// Sets the value of [update_mask][crate::model::UpdateWatchlistRequest::update_mask].
2540 ///
2541 /// # Example
2542 /// ```ignore,no_run
2543 /// # use google_cloud_chronicle_v1::model::UpdateWatchlistRequest;
2544 /// use wkt::FieldMask;
2545 /// let x = UpdateWatchlistRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2546 /// ```
2547 pub fn set_update_mask<T>(mut self, v: T) -> Self
2548 where
2549 T: std::convert::Into<wkt::FieldMask>,
2550 {
2551 self.update_mask = std::option::Option::Some(v.into());
2552 self
2553 }
2554
2555 /// Sets or clears the value of [update_mask][crate::model::UpdateWatchlistRequest::update_mask].
2556 ///
2557 /// # Example
2558 /// ```ignore,no_run
2559 /// # use google_cloud_chronicle_v1::model::UpdateWatchlistRequest;
2560 /// use wkt::FieldMask;
2561 /// let x = UpdateWatchlistRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2562 /// let x = UpdateWatchlistRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2563 /// ```
2564 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2565 where
2566 T: std::convert::Into<wkt::FieldMask>,
2567 {
2568 self.update_mask = v.map(|x| x.into());
2569 self
2570 }
2571}
2572
2573impl wkt::message::Message for UpdateWatchlistRequest {
2574 fn typename() -> &'static str {
2575 "type.googleapis.com/google.cloud.chronicle.v1.UpdateWatchlistRequest"
2576 }
2577}
2578
2579/// Request message for deleting watchlist.
2580#[derive(Clone, Default, PartialEq)]
2581#[non_exhaustive]
2582pub struct DeleteWatchlistRequest {
2583 /// Required. The name of the watchlist to delete.
2584 /// Format:
2585 /// `projects/{project}/locations/{location}/instances/{instance}/watchlists/{watchlist}`
2586 pub name: std::string::String,
2587
2588 /// Optional. If set to true, any entities under this watchlist will also be
2589 /// deleted. (Otherwise, the request will only work if the watchlist has no
2590 /// entities.)
2591 pub force: bool,
2592
2593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2594}
2595
2596impl DeleteWatchlistRequest {
2597 pub fn new() -> Self {
2598 std::default::Default::default()
2599 }
2600
2601 /// Sets the value of [name][crate::model::DeleteWatchlistRequest::name].
2602 ///
2603 /// # Example
2604 /// ```ignore,no_run
2605 /// # use google_cloud_chronicle_v1::model::DeleteWatchlistRequest;
2606 /// let x = DeleteWatchlistRequest::new().set_name("example");
2607 /// ```
2608 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2609 self.name = v.into();
2610 self
2611 }
2612
2613 /// Sets the value of [force][crate::model::DeleteWatchlistRequest::force].
2614 ///
2615 /// # Example
2616 /// ```ignore,no_run
2617 /// # use google_cloud_chronicle_v1::model::DeleteWatchlistRequest;
2618 /// let x = DeleteWatchlistRequest::new().set_force(true);
2619 /// ```
2620 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2621 self.force = v.into();
2622 self
2623 }
2624}
2625
2626impl wkt::message::Message for DeleteWatchlistRequest {
2627 fn typename() -> &'static str {
2628 "type.googleapis.com/google.cloud.chronicle.v1.DeleteWatchlistRequest"
2629 }
2630}
2631
2632/// A Instance represents an instantiation of the Instance product.
2633#[derive(Clone, Default, PartialEq)]
2634#[non_exhaustive]
2635pub struct Instance {
2636 /// Identifier. The resource name of this instance.
2637 /// Format: `projects/{project}/locations/{location}/instances/{instance}`
2638 pub name: std::string::String,
2639
2640 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2641}
2642
2643impl Instance {
2644 pub fn new() -> Self {
2645 std::default::Default::default()
2646 }
2647
2648 /// Sets the value of [name][crate::model::Instance::name].
2649 ///
2650 /// # Example
2651 /// ```ignore,no_run
2652 /// # use google_cloud_chronicle_v1::model::Instance;
2653 /// let x = Instance::new().set_name("example");
2654 /// ```
2655 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2656 self.name = v.into();
2657 self
2658 }
2659}
2660
2661impl wkt::message::Message for Instance {
2662 fn typename() -> &'static str {
2663 "type.googleapis.com/google.cloud.chronicle.v1.Instance"
2664 }
2665}
2666
2667/// Request to get a Instance.
2668#[derive(Clone, Default, PartialEq)]
2669#[non_exhaustive]
2670pub struct GetInstanceRequest {
2671 /// Required. The name of the instance to retrieve.
2672 /// Format:
2673 /// `projects/{project_id}/locations/{location}/instances/{instance}`
2674 pub name: std::string::String,
2675
2676 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2677}
2678
2679impl GetInstanceRequest {
2680 pub fn new() -> Self {
2681 std::default::Default::default()
2682 }
2683
2684 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
2685 ///
2686 /// # Example
2687 /// ```ignore,no_run
2688 /// # use google_cloud_chronicle_v1::model::GetInstanceRequest;
2689 /// let x = GetInstanceRequest::new().set_name("example");
2690 /// ```
2691 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2692 self.name = v.into();
2693 self
2694 }
2695}
2696
2697impl wkt::message::Message for GetInstanceRequest {
2698 fn typename() -> &'static str {
2699 "type.googleapis.com/google.cloud.chronicle.v1.GetInstanceRequest"
2700 }
2701}
2702
2703/// ScopeInfo specifies the scope info of the reference list.
2704#[derive(Clone, Default, PartialEq)]
2705#[non_exhaustive]
2706pub struct ScopeInfo {
2707 /// Required. The list of scope names of the reference list, if the list is
2708 /// empty the reference list is treated as unscoped.
2709 pub reference_list_scope: std::option::Option<crate::model::ReferenceListScope>,
2710
2711 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2712}
2713
2714impl ScopeInfo {
2715 pub fn new() -> Self {
2716 std::default::Default::default()
2717 }
2718
2719 /// Sets the value of [reference_list_scope][crate::model::ScopeInfo::reference_list_scope].
2720 ///
2721 /// # Example
2722 /// ```ignore,no_run
2723 /// # use google_cloud_chronicle_v1::model::ScopeInfo;
2724 /// use google_cloud_chronicle_v1::model::ReferenceListScope;
2725 /// let x = ScopeInfo::new().set_reference_list_scope(ReferenceListScope::default()/* use setters */);
2726 /// ```
2727 pub fn set_reference_list_scope<T>(mut self, v: T) -> Self
2728 where
2729 T: std::convert::Into<crate::model::ReferenceListScope>,
2730 {
2731 self.reference_list_scope = std::option::Option::Some(v.into());
2732 self
2733 }
2734
2735 /// Sets or clears the value of [reference_list_scope][crate::model::ScopeInfo::reference_list_scope].
2736 ///
2737 /// # Example
2738 /// ```ignore,no_run
2739 /// # use google_cloud_chronicle_v1::model::ScopeInfo;
2740 /// use google_cloud_chronicle_v1::model::ReferenceListScope;
2741 /// let x = ScopeInfo::new().set_or_clear_reference_list_scope(Some(ReferenceListScope::default()/* use setters */));
2742 /// let x = ScopeInfo::new().set_or_clear_reference_list_scope(None::<ReferenceListScope>);
2743 /// ```
2744 pub fn set_or_clear_reference_list_scope<T>(mut self, v: std::option::Option<T>) -> Self
2745 where
2746 T: std::convert::Into<crate::model::ReferenceListScope>,
2747 {
2748 self.reference_list_scope = v.map(|x| x.into());
2749 self
2750 }
2751}
2752
2753impl wkt::message::Message for ScopeInfo {
2754 fn typename() -> &'static str {
2755 "type.googleapis.com/google.cloud.chronicle.v1.ScopeInfo"
2756 }
2757}
2758
2759/// ReferenceListScope specifies the list of scope names of the reference list.
2760#[derive(Clone, Default, PartialEq)]
2761#[non_exhaustive]
2762pub struct ReferenceListScope {
2763 /// Optional. The list of scope names of the reference list. The scope names
2764 /// should be full resource names and should be of the format:
2765 /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope_name}`.
2766 pub scope_names: std::vec::Vec<std::string::String>,
2767
2768 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2769}
2770
2771impl ReferenceListScope {
2772 pub fn new() -> Self {
2773 std::default::Default::default()
2774 }
2775
2776 /// Sets the value of [scope_names][crate::model::ReferenceListScope::scope_names].
2777 ///
2778 /// # Example
2779 /// ```ignore,no_run
2780 /// # use google_cloud_chronicle_v1::model::ReferenceListScope;
2781 /// let x = ReferenceListScope::new().set_scope_names(["a", "b", "c"]);
2782 /// ```
2783 pub fn set_scope_names<T, V>(mut self, v: T) -> Self
2784 where
2785 T: std::iter::IntoIterator<Item = V>,
2786 V: std::convert::Into<std::string::String>,
2787 {
2788 use std::iter::Iterator;
2789 self.scope_names = v.into_iter().map(|i| i.into()).collect();
2790 self
2791 }
2792}
2793
2794impl wkt::message::Message for ReferenceListScope {
2795 fn typename() -> &'static str {
2796 "type.googleapis.com/google.cloud.chronicle.v1.ReferenceListScope"
2797 }
2798}
2799
2800/// A request to get details about a reference list.
2801#[derive(Clone, Default, PartialEq)]
2802#[non_exhaustive]
2803pub struct GetReferenceListRequest {
2804 /// Required. The resource name of the reference list to retrieve.
2805 /// Format:
2806 /// `projects/{project}/locations/{locations}/instances/{instance}/referenceLists/{reference_list}`
2807 pub name: std::string::String,
2808
2809 /// How much of the ReferenceList to view. Defaults to
2810 /// REFERENCE_LIST_VIEW_FULL.
2811 pub view: crate::model::ReferenceListView,
2812
2813 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2814}
2815
2816impl GetReferenceListRequest {
2817 pub fn new() -> Self {
2818 std::default::Default::default()
2819 }
2820
2821 /// Sets the value of [name][crate::model::GetReferenceListRequest::name].
2822 ///
2823 /// # Example
2824 /// ```ignore,no_run
2825 /// # use google_cloud_chronicle_v1::model::GetReferenceListRequest;
2826 /// let x = GetReferenceListRequest::new().set_name("example");
2827 /// ```
2828 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2829 self.name = v.into();
2830 self
2831 }
2832
2833 /// Sets the value of [view][crate::model::GetReferenceListRequest::view].
2834 ///
2835 /// # Example
2836 /// ```ignore,no_run
2837 /// # use google_cloud_chronicle_v1::model::GetReferenceListRequest;
2838 /// use google_cloud_chronicle_v1::model::ReferenceListView;
2839 /// let x0 = GetReferenceListRequest::new().set_view(ReferenceListView::Basic);
2840 /// let x1 = GetReferenceListRequest::new().set_view(ReferenceListView::Full);
2841 /// ```
2842 pub fn set_view<T: std::convert::Into<crate::model::ReferenceListView>>(
2843 mut self,
2844 v: T,
2845 ) -> Self {
2846 self.view = v.into();
2847 self
2848 }
2849}
2850
2851impl wkt::message::Message for GetReferenceListRequest {
2852 fn typename() -> &'static str {
2853 "type.googleapis.com/google.cloud.chronicle.v1.GetReferenceListRequest"
2854 }
2855}
2856
2857/// A request for a list of reference lists.
2858#[derive(Clone, Default, PartialEq)]
2859#[non_exhaustive]
2860pub struct ListReferenceListsRequest {
2861 /// Required. The parent, which owns this collection of reference lists.
2862 /// Format:
2863 /// `projects/{project}/locations/{location}/instances/{instance}`
2864 pub parent: std::string::String,
2865
2866 /// The maximum number of reference lists to return.
2867 /// The service may return fewer than this value.
2868 /// If unspecified, at most 100 reference lists will be returned.
2869 /// The maximum value is 1000; values above 1000 will be coerced to 1000.
2870 pub page_size: i32,
2871
2872 /// A page token, received from a previous `ListReferenceLists` call.
2873 /// Provide this to retrieve the subsequent page.
2874 /// When paginating, all other parameters provided to `ListReferenceLists` must
2875 /// match the call that provided the page token.
2876 pub page_token: std::string::String,
2877
2878 /// How much of each ReferenceList to view. Defaults to
2879 /// REFERENCE_LIST_VIEW_BASIC.
2880 pub view: crate::model::ReferenceListView,
2881
2882 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2883}
2884
2885impl ListReferenceListsRequest {
2886 pub fn new() -> Self {
2887 std::default::Default::default()
2888 }
2889
2890 /// Sets the value of [parent][crate::model::ListReferenceListsRequest::parent].
2891 ///
2892 /// # Example
2893 /// ```ignore,no_run
2894 /// # use google_cloud_chronicle_v1::model::ListReferenceListsRequest;
2895 /// let x = ListReferenceListsRequest::new().set_parent("example");
2896 /// ```
2897 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2898 self.parent = v.into();
2899 self
2900 }
2901
2902 /// Sets the value of [page_size][crate::model::ListReferenceListsRequest::page_size].
2903 ///
2904 /// # Example
2905 /// ```ignore,no_run
2906 /// # use google_cloud_chronicle_v1::model::ListReferenceListsRequest;
2907 /// let x = ListReferenceListsRequest::new().set_page_size(42);
2908 /// ```
2909 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2910 self.page_size = v.into();
2911 self
2912 }
2913
2914 /// Sets the value of [page_token][crate::model::ListReferenceListsRequest::page_token].
2915 ///
2916 /// # Example
2917 /// ```ignore,no_run
2918 /// # use google_cloud_chronicle_v1::model::ListReferenceListsRequest;
2919 /// let x = ListReferenceListsRequest::new().set_page_token("example");
2920 /// ```
2921 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2922 self.page_token = v.into();
2923 self
2924 }
2925
2926 /// Sets the value of [view][crate::model::ListReferenceListsRequest::view].
2927 ///
2928 /// # Example
2929 /// ```ignore,no_run
2930 /// # use google_cloud_chronicle_v1::model::ListReferenceListsRequest;
2931 /// use google_cloud_chronicle_v1::model::ReferenceListView;
2932 /// let x0 = ListReferenceListsRequest::new().set_view(ReferenceListView::Basic);
2933 /// let x1 = ListReferenceListsRequest::new().set_view(ReferenceListView::Full);
2934 /// ```
2935 pub fn set_view<T: std::convert::Into<crate::model::ReferenceListView>>(
2936 mut self,
2937 v: T,
2938 ) -> Self {
2939 self.view = v.into();
2940 self
2941 }
2942}
2943
2944impl wkt::message::Message for ListReferenceListsRequest {
2945 fn typename() -> &'static str {
2946 "type.googleapis.com/google.cloud.chronicle.v1.ListReferenceListsRequest"
2947 }
2948}
2949
2950/// A response to a request for a list of reference lists.
2951#[derive(Clone, Default, PartialEq)]
2952#[non_exhaustive]
2953pub struct ListReferenceListsResponse {
2954 /// The reference lists.
2955 /// Ordered in ascending alphabetical order by name.
2956 pub reference_lists: std::vec::Vec<crate::model::ReferenceList>,
2957
2958 /// A token, which can be sent as `page_token` to retrieve the next page.
2959 /// If this field is omitted, there are no subsequent pages.
2960 pub next_page_token: std::string::String,
2961
2962 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2963}
2964
2965impl ListReferenceListsResponse {
2966 pub fn new() -> Self {
2967 std::default::Default::default()
2968 }
2969
2970 /// Sets the value of [reference_lists][crate::model::ListReferenceListsResponse::reference_lists].
2971 ///
2972 /// # Example
2973 /// ```ignore,no_run
2974 /// # use google_cloud_chronicle_v1::model::ListReferenceListsResponse;
2975 /// use google_cloud_chronicle_v1::model::ReferenceList;
2976 /// let x = ListReferenceListsResponse::new()
2977 /// .set_reference_lists([
2978 /// ReferenceList::default()/* use setters */,
2979 /// ReferenceList::default()/* use (different) setters */,
2980 /// ]);
2981 /// ```
2982 pub fn set_reference_lists<T, V>(mut self, v: T) -> Self
2983 where
2984 T: std::iter::IntoIterator<Item = V>,
2985 V: std::convert::Into<crate::model::ReferenceList>,
2986 {
2987 use std::iter::Iterator;
2988 self.reference_lists = v.into_iter().map(|i| i.into()).collect();
2989 self
2990 }
2991
2992 /// Sets the value of [next_page_token][crate::model::ListReferenceListsResponse::next_page_token].
2993 ///
2994 /// # Example
2995 /// ```ignore,no_run
2996 /// # use google_cloud_chronicle_v1::model::ListReferenceListsResponse;
2997 /// let x = ListReferenceListsResponse::new().set_next_page_token("example");
2998 /// ```
2999 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3000 self.next_page_token = v.into();
3001 self
3002 }
3003}
3004
3005impl wkt::message::Message for ListReferenceListsResponse {
3006 fn typename() -> &'static str {
3007 "type.googleapis.com/google.cloud.chronicle.v1.ListReferenceListsResponse"
3008 }
3009}
3010
3011#[doc(hidden)]
3012impl google_cloud_gax::paginator::internal::PageableResponse for ListReferenceListsResponse {
3013 type PageItem = crate::model::ReferenceList;
3014
3015 fn items(self) -> std::vec::Vec<Self::PageItem> {
3016 self.reference_lists
3017 }
3018
3019 fn next_page_token(&self) -> std::string::String {
3020 use std::clone::Clone;
3021 self.next_page_token.clone()
3022 }
3023}
3024
3025/// A request to create a reference list.
3026#[derive(Clone, Default, PartialEq)]
3027#[non_exhaustive]
3028pub struct CreateReferenceListRequest {
3029 /// Required. The parent resource where this reference list will be created.
3030 /// Format: `projects/{project}/locations/{location}/instances/{instance}`
3031 pub parent: std::string::String,
3032
3033 /// Required. The reference list to create.
3034 pub reference_list: std::option::Option<crate::model::ReferenceList>,
3035
3036 /// Required. The ID to use for the reference list. This is also the display
3037 /// name for the reference list. It must satisfy the following requirements:
3038 ///
3039 /// - Starts with letter.
3040 /// - Contains only letters, numbers and underscore.
3041 /// - Has length less than 256.
3042 /// - Must be unique.
3043 pub reference_list_id: std::string::String,
3044
3045 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3046}
3047
3048impl CreateReferenceListRequest {
3049 pub fn new() -> Self {
3050 std::default::Default::default()
3051 }
3052
3053 /// Sets the value of [parent][crate::model::CreateReferenceListRequest::parent].
3054 ///
3055 /// # Example
3056 /// ```ignore,no_run
3057 /// # use google_cloud_chronicle_v1::model::CreateReferenceListRequest;
3058 /// let x = CreateReferenceListRequest::new().set_parent("example");
3059 /// ```
3060 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3061 self.parent = v.into();
3062 self
3063 }
3064
3065 /// Sets the value of [reference_list][crate::model::CreateReferenceListRequest::reference_list].
3066 ///
3067 /// # Example
3068 /// ```ignore,no_run
3069 /// # use google_cloud_chronicle_v1::model::CreateReferenceListRequest;
3070 /// use google_cloud_chronicle_v1::model::ReferenceList;
3071 /// let x = CreateReferenceListRequest::new().set_reference_list(ReferenceList::default()/* use setters */);
3072 /// ```
3073 pub fn set_reference_list<T>(mut self, v: T) -> Self
3074 where
3075 T: std::convert::Into<crate::model::ReferenceList>,
3076 {
3077 self.reference_list = std::option::Option::Some(v.into());
3078 self
3079 }
3080
3081 /// Sets or clears the value of [reference_list][crate::model::CreateReferenceListRequest::reference_list].
3082 ///
3083 /// # Example
3084 /// ```ignore,no_run
3085 /// # use google_cloud_chronicle_v1::model::CreateReferenceListRequest;
3086 /// use google_cloud_chronicle_v1::model::ReferenceList;
3087 /// let x = CreateReferenceListRequest::new().set_or_clear_reference_list(Some(ReferenceList::default()/* use setters */));
3088 /// let x = CreateReferenceListRequest::new().set_or_clear_reference_list(None::<ReferenceList>);
3089 /// ```
3090 pub fn set_or_clear_reference_list<T>(mut self, v: std::option::Option<T>) -> Self
3091 where
3092 T: std::convert::Into<crate::model::ReferenceList>,
3093 {
3094 self.reference_list = v.map(|x| x.into());
3095 self
3096 }
3097
3098 /// Sets the value of [reference_list_id][crate::model::CreateReferenceListRequest::reference_list_id].
3099 ///
3100 /// # Example
3101 /// ```ignore,no_run
3102 /// # use google_cloud_chronicle_v1::model::CreateReferenceListRequest;
3103 /// let x = CreateReferenceListRequest::new().set_reference_list_id("example");
3104 /// ```
3105 pub fn set_reference_list_id<T: std::convert::Into<std::string::String>>(
3106 mut self,
3107 v: T,
3108 ) -> Self {
3109 self.reference_list_id = v.into();
3110 self
3111 }
3112}
3113
3114impl wkt::message::Message for CreateReferenceListRequest {
3115 fn typename() -> &'static str {
3116 "type.googleapis.com/google.cloud.chronicle.v1.CreateReferenceListRequest"
3117 }
3118}
3119
3120/// A request to update a reference list.
3121#[derive(Clone, Default, PartialEq)]
3122#[non_exhaustive]
3123pub struct UpdateReferenceListRequest {
3124 /// Required. The reference list to update.
3125 ///
3126 /// The reference list's `name` field is used to identify the reference list to
3127 /// update.
3128 /// Format:
3129 /// `projects/{project}/locations/{locations}/instances/{instance}/referenceLists/{reference_list}`
3130 pub reference_list: std::option::Option<crate::model::ReferenceList>,
3131
3132 /// The list of fields to update.
3133 /// When no field mask is supplied, all non-empty fields will be updated.
3134 /// A field mask of "*" will update all fields, whether empty or not.
3135 pub update_mask: std::option::Option<wkt::FieldMask>,
3136
3137 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3138}
3139
3140impl UpdateReferenceListRequest {
3141 pub fn new() -> Self {
3142 std::default::Default::default()
3143 }
3144
3145 /// Sets the value of [reference_list][crate::model::UpdateReferenceListRequest::reference_list].
3146 ///
3147 /// # Example
3148 /// ```ignore,no_run
3149 /// # use google_cloud_chronicle_v1::model::UpdateReferenceListRequest;
3150 /// use google_cloud_chronicle_v1::model::ReferenceList;
3151 /// let x = UpdateReferenceListRequest::new().set_reference_list(ReferenceList::default()/* use setters */);
3152 /// ```
3153 pub fn set_reference_list<T>(mut self, v: T) -> Self
3154 where
3155 T: std::convert::Into<crate::model::ReferenceList>,
3156 {
3157 self.reference_list = std::option::Option::Some(v.into());
3158 self
3159 }
3160
3161 /// Sets or clears the value of [reference_list][crate::model::UpdateReferenceListRequest::reference_list].
3162 ///
3163 /// # Example
3164 /// ```ignore,no_run
3165 /// # use google_cloud_chronicle_v1::model::UpdateReferenceListRequest;
3166 /// use google_cloud_chronicle_v1::model::ReferenceList;
3167 /// let x = UpdateReferenceListRequest::new().set_or_clear_reference_list(Some(ReferenceList::default()/* use setters */));
3168 /// let x = UpdateReferenceListRequest::new().set_or_clear_reference_list(None::<ReferenceList>);
3169 /// ```
3170 pub fn set_or_clear_reference_list<T>(mut self, v: std::option::Option<T>) -> Self
3171 where
3172 T: std::convert::Into<crate::model::ReferenceList>,
3173 {
3174 self.reference_list = v.map(|x| x.into());
3175 self
3176 }
3177
3178 /// Sets the value of [update_mask][crate::model::UpdateReferenceListRequest::update_mask].
3179 ///
3180 /// # Example
3181 /// ```ignore,no_run
3182 /// # use google_cloud_chronicle_v1::model::UpdateReferenceListRequest;
3183 /// use wkt::FieldMask;
3184 /// let x = UpdateReferenceListRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3185 /// ```
3186 pub fn set_update_mask<T>(mut self, v: T) -> Self
3187 where
3188 T: std::convert::Into<wkt::FieldMask>,
3189 {
3190 self.update_mask = std::option::Option::Some(v.into());
3191 self
3192 }
3193
3194 /// Sets or clears the value of [update_mask][crate::model::UpdateReferenceListRequest::update_mask].
3195 ///
3196 /// # Example
3197 /// ```ignore,no_run
3198 /// # use google_cloud_chronicle_v1::model::UpdateReferenceListRequest;
3199 /// use wkt::FieldMask;
3200 /// let x = UpdateReferenceListRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3201 /// let x = UpdateReferenceListRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3202 /// ```
3203 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3204 where
3205 T: std::convert::Into<wkt::FieldMask>,
3206 {
3207 self.update_mask = v.map(|x| x.into());
3208 self
3209 }
3210}
3211
3212impl wkt::message::Message for UpdateReferenceListRequest {
3213 fn typename() -> &'static str {
3214 "type.googleapis.com/google.cloud.chronicle.v1.UpdateReferenceListRequest"
3215 }
3216}
3217
3218/// A reference list.
3219/// Reference lists are user-defined lists of values which users can
3220/// use in multiple Rules.
3221#[derive(Clone, Default, PartialEq)]
3222#[non_exhaustive]
3223pub struct ReferenceList {
3224 /// Identifier. The resource name of the reference list.
3225 /// Format:
3226 /// `projects/{project}/locations/{location}/instances/{instance}/referenceLists/{reference_list}`
3227 pub name: std::string::String,
3228
3229 /// Output only. The unique display name of the reference list.
3230 pub display_name: std::string::String,
3231
3232 /// Output only. The timestamp when the reference list was last updated.
3233 pub revision_create_time: std::option::Option<wkt::Timestamp>,
3234
3235 /// Required. A user-provided description of the reference list.
3236 pub description: std::string::String,
3237
3238 /// Required. The entries of the reference list.
3239 /// When listed, they are returned in the order that was specified at creation
3240 /// or update. The combined size of the values of the reference list may not
3241 /// exceed 6MB.
3242 /// This is returned only when the view is REFERENCE_LIST_VIEW_FULL.
3243 pub entries: std::vec::Vec<crate::model::ReferenceListEntry>,
3244
3245 /// Output only. The resource names for the associated self-authored Rules that
3246 /// use this reference list. This is returned only when the view is
3247 /// REFERENCE_LIST_VIEW_FULL.
3248 pub rules: std::vec::Vec<std::string::String>,
3249
3250 /// Required. The syntax type indicating how list entries should be validated.
3251 pub syntax_type: crate::model::ReferenceListSyntaxType,
3252
3253 /// Output only. The count of self-authored rules using the reference list.
3254 pub rule_associations_count: i32,
3255
3256 /// The scope info of the reference list.
3257 /// During reference list creation, if this field is not set, the reference
3258 /// list without scopes (an unscoped list) will be created for an unscoped
3259 /// user. For a scoped user, this field must be set. During reference list
3260 /// update, if scope_info is requested to be updated, this field must be set.
3261 pub scope_info: std::option::Option<crate::model::ScopeInfo>,
3262
3263 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3264}
3265
3266impl ReferenceList {
3267 pub fn new() -> Self {
3268 std::default::Default::default()
3269 }
3270
3271 /// Sets the value of [name][crate::model::ReferenceList::name].
3272 ///
3273 /// # Example
3274 /// ```ignore,no_run
3275 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3276 /// let x = ReferenceList::new().set_name("example");
3277 /// ```
3278 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3279 self.name = v.into();
3280 self
3281 }
3282
3283 /// Sets the value of [display_name][crate::model::ReferenceList::display_name].
3284 ///
3285 /// # Example
3286 /// ```ignore,no_run
3287 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3288 /// let x = ReferenceList::new().set_display_name("example");
3289 /// ```
3290 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3291 self.display_name = v.into();
3292 self
3293 }
3294
3295 /// Sets the value of [revision_create_time][crate::model::ReferenceList::revision_create_time].
3296 ///
3297 /// # Example
3298 /// ```ignore,no_run
3299 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3300 /// use wkt::Timestamp;
3301 /// let x = ReferenceList::new().set_revision_create_time(Timestamp::default()/* use setters */);
3302 /// ```
3303 pub fn set_revision_create_time<T>(mut self, v: T) -> Self
3304 where
3305 T: std::convert::Into<wkt::Timestamp>,
3306 {
3307 self.revision_create_time = std::option::Option::Some(v.into());
3308 self
3309 }
3310
3311 /// Sets or clears the value of [revision_create_time][crate::model::ReferenceList::revision_create_time].
3312 ///
3313 /// # Example
3314 /// ```ignore,no_run
3315 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3316 /// use wkt::Timestamp;
3317 /// let x = ReferenceList::new().set_or_clear_revision_create_time(Some(Timestamp::default()/* use setters */));
3318 /// let x = ReferenceList::new().set_or_clear_revision_create_time(None::<Timestamp>);
3319 /// ```
3320 pub fn set_or_clear_revision_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3321 where
3322 T: std::convert::Into<wkt::Timestamp>,
3323 {
3324 self.revision_create_time = v.map(|x| x.into());
3325 self
3326 }
3327
3328 /// Sets the value of [description][crate::model::ReferenceList::description].
3329 ///
3330 /// # Example
3331 /// ```ignore,no_run
3332 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3333 /// let x = ReferenceList::new().set_description("example");
3334 /// ```
3335 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3336 self.description = v.into();
3337 self
3338 }
3339
3340 /// Sets the value of [entries][crate::model::ReferenceList::entries].
3341 ///
3342 /// # Example
3343 /// ```ignore,no_run
3344 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3345 /// use google_cloud_chronicle_v1::model::ReferenceListEntry;
3346 /// let x = ReferenceList::new()
3347 /// .set_entries([
3348 /// ReferenceListEntry::default()/* use setters */,
3349 /// ReferenceListEntry::default()/* use (different) setters */,
3350 /// ]);
3351 /// ```
3352 pub fn set_entries<T, V>(mut self, v: T) -> Self
3353 where
3354 T: std::iter::IntoIterator<Item = V>,
3355 V: std::convert::Into<crate::model::ReferenceListEntry>,
3356 {
3357 use std::iter::Iterator;
3358 self.entries = v.into_iter().map(|i| i.into()).collect();
3359 self
3360 }
3361
3362 /// Sets the value of [rules][crate::model::ReferenceList::rules].
3363 ///
3364 /// # Example
3365 /// ```ignore,no_run
3366 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3367 /// let x = ReferenceList::new().set_rules(["a", "b", "c"]);
3368 /// ```
3369 pub fn set_rules<T, V>(mut self, v: T) -> Self
3370 where
3371 T: std::iter::IntoIterator<Item = V>,
3372 V: std::convert::Into<std::string::String>,
3373 {
3374 use std::iter::Iterator;
3375 self.rules = v.into_iter().map(|i| i.into()).collect();
3376 self
3377 }
3378
3379 /// Sets the value of [syntax_type][crate::model::ReferenceList::syntax_type].
3380 ///
3381 /// # Example
3382 /// ```ignore,no_run
3383 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3384 /// use google_cloud_chronicle_v1::model::ReferenceListSyntaxType;
3385 /// let x0 = ReferenceList::new().set_syntax_type(ReferenceListSyntaxType::PlainTextString);
3386 /// let x1 = ReferenceList::new().set_syntax_type(ReferenceListSyntaxType::Regex);
3387 /// let x2 = ReferenceList::new().set_syntax_type(ReferenceListSyntaxType::Cidr);
3388 /// ```
3389 pub fn set_syntax_type<T: std::convert::Into<crate::model::ReferenceListSyntaxType>>(
3390 mut self,
3391 v: T,
3392 ) -> Self {
3393 self.syntax_type = v.into();
3394 self
3395 }
3396
3397 /// Sets the value of [rule_associations_count][crate::model::ReferenceList::rule_associations_count].
3398 ///
3399 /// # Example
3400 /// ```ignore,no_run
3401 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3402 /// let x = ReferenceList::new().set_rule_associations_count(42);
3403 /// ```
3404 pub fn set_rule_associations_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3405 self.rule_associations_count = v.into();
3406 self
3407 }
3408
3409 /// Sets the value of [scope_info][crate::model::ReferenceList::scope_info].
3410 ///
3411 /// # Example
3412 /// ```ignore,no_run
3413 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3414 /// use google_cloud_chronicle_v1::model::ScopeInfo;
3415 /// let x = ReferenceList::new().set_scope_info(ScopeInfo::default()/* use setters */);
3416 /// ```
3417 pub fn set_scope_info<T>(mut self, v: T) -> Self
3418 where
3419 T: std::convert::Into<crate::model::ScopeInfo>,
3420 {
3421 self.scope_info = std::option::Option::Some(v.into());
3422 self
3423 }
3424
3425 /// Sets or clears the value of [scope_info][crate::model::ReferenceList::scope_info].
3426 ///
3427 /// # Example
3428 /// ```ignore,no_run
3429 /// # use google_cloud_chronicle_v1::model::ReferenceList;
3430 /// use google_cloud_chronicle_v1::model::ScopeInfo;
3431 /// let x = ReferenceList::new().set_or_clear_scope_info(Some(ScopeInfo::default()/* use setters */));
3432 /// let x = ReferenceList::new().set_or_clear_scope_info(None::<ScopeInfo>);
3433 /// ```
3434 pub fn set_or_clear_scope_info<T>(mut self, v: std::option::Option<T>) -> Self
3435 where
3436 T: std::convert::Into<crate::model::ScopeInfo>,
3437 {
3438 self.scope_info = v.map(|x| x.into());
3439 self
3440 }
3441}
3442
3443impl wkt::message::Message for ReferenceList {
3444 fn typename() -> &'static str {
3445 "type.googleapis.com/google.cloud.chronicle.v1.ReferenceList"
3446 }
3447}
3448
3449/// An entry in a reference list.
3450#[derive(Clone, Default, PartialEq)]
3451#[non_exhaustive]
3452pub struct ReferenceListEntry {
3453 /// Required. The value of the entry. Maximum length is 512 characters.
3454 pub value: std::string::String,
3455
3456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3457}
3458
3459impl ReferenceListEntry {
3460 pub fn new() -> Self {
3461 std::default::Default::default()
3462 }
3463
3464 /// Sets the value of [value][crate::model::ReferenceListEntry::value].
3465 ///
3466 /// # Example
3467 /// ```ignore,no_run
3468 /// # use google_cloud_chronicle_v1::model::ReferenceListEntry;
3469 /// let x = ReferenceListEntry::new().set_value("example");
3470 /// ```
3471 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3472 self.value = v.into();
3473 self
3474 }
3475}
3476
3477impl wkt::message::Message for ReferenceListEntry {
3478 fn typename() -> &'static str {
3479 "type.googleapis.com/google.cloud.chronicle.v1.ReferenceListEntry"
3480 }
3481}
3482
3483/// The Rule resource represents a user-created rule.
3484/// NEXT TAG: 21
3485#[derive(Clone, Default, PartialEq)]
3486#[non_exhaustive]
3487pub struct Rule {
3488 /// Identifier. Full resource name for the rule.
3489 /// Format:
3490 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
3491 pub name: std::string::String,
3492
3493 /// Output only. The revision ID of the rule.
3494 /// A new revision is created whenever the rule text is changed in any way.
3495 /// Format: `v_{10 digits}_{9 digits}`
3496 /// Populated in REVISION_METADATA_ONLY view and FULL view.
3497 pub revision_id: std::string::String,
3498
3499 /// Output only. Display name of the rule.
3500 /// Populated in BASIC view and FULL view.
3501 pub display_name: std::string::String,
3502
3503 /// The YARA-L content of the rule.
3504 /// Populated in FULL view.
3505 pub text: std::string::String,
3506
3507 /// Output only. The author of the rule. Extracted from the meta section of
3508 /// text. Populated in BASIC view and FULL view.
3509 pub author: std::string::String,
3510
3511 /// Output only. The severity of the rule as specified in the meta section of
3512 /// text. Populated in BASIC view and FULL view.
3513 pub severity: std::option::Option<crate::model::Severity>,
3514
3515 /// Output only. Additional metadata specified in the meta section of text.
3516 /// Populated in FULL view.
3517 pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
3518
3519 /// Output only. The timestamp of when the rule was created.
3520 /// Populated in FULL view.
3521 pub create_time: std::option::Option<wkt::Timestamp>,
3522
3523 /// Output only. The timestamp of when the rule revision was created.
3524 /// Populated in FULL, REVISION_METADATA_ONLY views.
3525 pub revision_create_time: std::option::Option<wkt::Timestamp>,
3526
3527 /// Output only. The current compilation state of the rule.
3528 /// Populated in FULL view.
3529 pub compilation_state: crate::model::rule::CompilationState,
3530
3531 /// Output only. User-facing type of the rule. Extracted from the events
3532 /// section of rule text. Populated in BASIC view and FULL view.
3533 pub r#type: crate::model::RuleType,
3534
3535 /// Output only. Resource names of the reference lists used in this rule.
3536 /// Populated in FULL view.
3537 pub reference_lists: std::vec::Vec<std::string::String>,
3538
3539 /// Output only. The run frequencies that are allowed for the rule.
3540 /// Populated in BASIC view and FULL view.
3541 pub allowed_run_frequencies: std::vec::Vec<crate::model::RunFrequency>,
3542
3543 /// The etag for this rule.
3544 /// If this is provided on update, the request will succeed if and only if it
3545 /// matches the server-computed value, and will fail with an ABORTED error
3546 /// otherwise.
3547 /// Populated in BASIC view and FULL view.
3548 pub etag: std::string::String,
3549
3550 /// Resource name of the DataAccessScope bound to this rule.
3551 /// Populated in BASIC view and FULL view.
3552 /// If reference lists are used in the rule, validations will be performed
3553 /// against this scope to ensure that the reference lists are compatible with
3554 /// both the user's and the rule's scopes.
3555 /// The scope should be in the format:
3556 /// `projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope}`.
3557 pub scope: std::string::String,
3558
3559 /// Output only. A list of a rule's corresponding compilation diagnostic
3560 /// messages such as compilation errors and compilation warnings. Populated in
3561 /// FULL view.
3562 pub compilation_diagnostics: std::vec::Vec<crate::model::CompilationDiagnostic>,
3563
3564 /// Output only. Indicate the rule can run in near real time live rule.
3565 /// If this is true, the rule uses the near real time live rule when the run
3566 /// frequency is set to LIVE.
3567 pub near_real_time_live_rule_eligible: bool,
3568
3569 /// Output only. The set of inputs used in the rule. For example, if the rule
3570 /// uses $e.principal.hostname, then the uses_udm field will be true.
3571 pub inputs_used: std::option::Option<crate::model::InputsUsed>,
3572
3573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3574}
3575
3576impl Rule {
3577 pub fn new() -> Self {
3578 std::default::Default::default()
3579 }
3580
3581 /// Sets the value of [name][crate::model::Rule::name].
3582 ///
3583 /// # Example
3584 /// ```ignore,no_run
3585 /// # use google_cloud_chronicle_v1::model::Rule;
3586 /// let x = Rule::new().set_name("example");
3587 /// ```
3588 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3589 self.name = v.into();
3590 self
3591 }
3592
3593 /// Sets the value of [revision_id][crate::model::Rule::revision_id].
3594 ///
3595 /// # Example
3596 /// ```ignore,no_run
3597 /// # use google_cloud_chronicle_v1::model::Rule;
3598 /// let x = Rule::new().set_revision_id("example");
3599 /// ```
3600 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3601 self.revision_id = v.into();
3602 self
3603 }
3604
3605 /// Sets the value of [display_name][crate::model::Rule::display_name].
3606 ///
3607 /// # Example
3608 /// ```ignore,no_run
3609 /// # use google_cloud_chronicle_v1::model::Rule;
3610 /// let x = Rule::new().set_display_name("example");
3611 /// ```
3612 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3613 self.display_name = v.into();
3614 self
3615 }
3616
3617 /// Sets the value of [text][crate::model::Rule::text].
3618 ///
3619 /// # Example
3620 /// ```ignore,no_run
3621 /// # use google_cloud_chronicle_v1::model::Rule;
3622 /// let x = Rule::new().set_text("example");
3623 /// ```
3624 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3625 self.text = v.into();
3626 self
3627 }
3628
3629 /// Sets the value of [author][crate::model::Rule::author].
3630 ///
3631 /// # Example
3632 /// ```ignore,no_run
3633 /// # use google_cloud_chronicle_v1::model::Rule;
3634 /// let x = Rule::new().set_author("example");
3635 /// ```
3636 pub fn set_author<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3637 self.author = v.into();
3638 self
3639 }
3640
3641 /// Sets the value of [severity][crate::model::Rule::severity].
3642 ///
3643 /// # Example
3644 /// ```ignore,no_run
3645 /// # use google_cloud_chronicle_v1::model::Rule;
3646 /// use google_cloud_chronicle_v1::model::Severity;
3647 /// let x = Rule::new().set_severity(Severity::default()/* use setters */);
3648 /// ```
3649 pub fn set_severity<T>(mut self, v: T) -> Self
3650 where
3651 T: std::convert::Into<crate::model::Severity>,
3652 {
3653 self.severity = std::option::Option::Some(v.into());
3654 self
3655 }
3656
3657 /// Sets or clears the value of [severity][crate::model::Rule::severity].
3658 ///
3659 /// # Example
3660 /// ```ignore,no_run
3661 /// # use google_cloud_chronicle_v1::model::Rule;
3662 /// use google_cloud_chronicle_v1::model::Severity;
3663 /// let x = Rule::new().set_or_clear_severity(Some(Severity::default()/* use setters */));
3664 /// let x = Rule::new().set_or_clear_severity(None::<Severity>);
3665 /// ```
3666 pub fn set_or_clear_severity<T>(mut self, v: std::option::Option<T>) -> Self
3667 where
3668 T: std::convert::Into<crate::model::Severity>,
3669 {
3670 self.severity = v.map(|x| x.into());
3671 self
3672 }
3673
3674 /// Sets the value of [metadata][crate::model::Rule::metadata].
3675 ///
3676 /// # Example
3677 /// ```ignore,no_run
3678 /// # use google_cloud_chronicle_v1::model::Rule;
3679 /// let x = Rule::new().set_metadata([
3680 /// ("key0", "abc"),
3681 /// ("key1", "xyz"),
3682 /// ]);
3683 /// ```
3684 pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
3685 where
3686 T: std::iter::IntoIterator<Item = (K, V)>,
3687 K: std::convert::Into<std::string::String>,
3688 V: std::convert::Into<std::string::String>,
3689 {
3690 use std::iter::Iterator;
3691 self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3692 self
3693 }
3694
3695 /// Sets the value of [create_time][crate::model::Rule::create_time].
3696 ///
3697 /// # Example
3698 /// ```ignore,no_run
3699 /// # use google_cloud_chronicle_v1::model::Rule;
3700 /// use wkt::Timestamp;
3701 /// let x = Rule::new().set_create_time(Timestamp::default()/* use setters */);
3702 /// ```
3703 pub fn set_create_time<T>(mut self, v: T) -> Self
3704 where
3705 T: std::convert::Into<wkt::Timestamp>,
3706 {
3707 self.create_time = std::option::Option::Some(v.into());
3708 self
3709 }
3710
3711 /// Sets or clears the value of [create_time][crate::model::Rule::create_time].
3712 ///
3713 /// # Example
3714 /// ```ignore,no_run
3715 /// # use google_cloud_chronicle_v1::model::Rule;
3716 /// use wkt::Timestamp;
3717 /// let x = Rule::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3718 /// let x = Rule::new().set_or_clear_create_time(None::<Timestamp>);
3719 /// ```
3720 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3721 where
3722 T: std::convert::Into<wkt::Timestamp>,
3723 {
3724 self.create_time = v.map(|x| x.into());
3725 self
3726 }
3727
3728 /// Sets the value of [revision_create_time][crate::model::Rule::revision_create_time].
3729 ///
3730 /// # Example
3731 /// ```ignore,no_run
3732 /// # use google_cloud_chronicle_v1::model::Rule;
3733 /// use wkt::Timestamp;
3734 /// let x = Rule::new().set_revision_create_time(Timestamp::default()/* use setters */);
3735 /// ```
3736 pub fn set_revision_create_time<T>(mut self, v: T) -> Self
3737 where
3738 T: std::convert::Into<wkt::Timestamp>,
3739 {
3740 self.revision_create_time = std::option::Option::Some(v.into());
3741 self
3742 }
3743
3744 /// Sets or clears the value of [revision_create_time][crate::model::Rule::revision_create_time].
3745 ///
3746 /// # Example
3747 /// ```ignore,no_run
3748 /// # use google_cloud_chronicle_v1::model::Rule;
3749 /// use wkt::Timestamp;
3750 /// let x = Rule::new().set_or_clear_revision_create_time(Some(Timestamp::default()/* use setters */));
3751 /// let x = Rule::new().set_or_clear_revision_create_time(None::<Timestamp>);
3752 /// ```
3753 pub fn set_or_clear_revision_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3754 where
3755 T: std::convert::Into<wkt::Timestamp>,
3756 {
3757 self.revision_create_time = v.map(|x| x.into());
3758 self
3759 }
3760
3761 /// Sets the value of [compilation_state][crate::model::Rule::compilation_state].
3762 ///
3763 /// # Example
3764 /// ```ignore,no_run
3765 /// # use google_cloud_chronicle_v1::model::Rule;
3766 /// use google_cloud_chronicle_v1::model::rule::CompilationState;
3767 /// let x0 = Rule::new().set_compilation_state(CompilationState::Succeeded);
3768 /// let x1 = Rule::new().set_compilation_state(CompilationState::Failed);
3769 /// ```
3770 pub fn set_compilation_state<T: std::convert::Into<crate::model::rule::CompilationState>>(
3771 mut self,
3772 v: T,
3773 ) -> Self {
3774 self.compilation_state = v.into();
3775 self
3776 }
3777
3778 /// Sets the value of [r#type][crate::model::Rule::type].
3779 ///
3780 /// # Example
3781 /// ```ignore,no_run
3782 /// # use google_cloud_chronicle_v1::model::Rule;
3783 /// use google_cloud_chronicle_v1::model::RuleType;
3784 /// let x0 = Rule::new().set_type(RuleType::SingleEvent);
3785 /// let x1 = Rule::new().set_type(RuleType::MultiEvent);
3786 /// ```
3787 pub fn set_type<T: std::convert::Into<crate::model::RuleType>>(mut self, v: T) -> Self {
3788 self.r#type = v.into();
3789 self
3790 }
3791
3792 /// Sets the value of [reference_lists][crate::model::Rule::reference_lists].
3793 ///
3794 /// # Example
3795 /// ```ignore,no_run
3796 /// # use google_cloud_chronicle_v1::model::Rule;
3797 /// let x = Rule::new().set_reference_lists(["a", "b", "c"]);
3798 /// ```
3799 pub fn set_reference_lists<T, V>(mut self, v: T) -> Self
3800 where
3801 T: std::iter::IntoIterator<Item = V>,
3802 V: std::convert::Into<std::string::String>,
3803 {
3804 use std::iter::Iterator;
3805 self.reference_lists = v.into_iter().map(|i| i.into()).collect();
3806 self
3807 }
3808
3809 /// Sets the value of [allowed_run_frequencies][crate::model::Rule::allowed_run_frequencies].
3810 ///
3811 /// # Example
3812 /// ```ignore,no_run
3813 /// # use google_cloud_chronicle_v1::model::Rule;
3814 /// use google_cloud_chronicle_v1::model::RunFrequency;
3815 /// let x = Rule::new().set_allowed_run_frequencies([
3816 /// RunFrequency::Live,
3817 /// RunFrequency::Hourly,
3818 /// RunFrequency::Daily,
3819 /// ]);
3820 /// ```
3821 pub fn set_allowed_run_frequencies<T, V>(mut self, v: T) -> Self
3822 where
3823 T: std::iter::IntoIterator<Item = V>,
3824 V: std::convert::Into<crate::model::RunFrequency>,
3825 {
3826 use std::iter::Iterator;
3827 self.allowed_run_frequencies = v.into_iter().map(|i| i.into()).collect();
3828 self
3829 }
3830
3831 /// Sets the value of [etag][crate::model::Rule::etag].
3832 ///
3833 /// # Example
3834 /// ```ignore,no_run
3835 /// # use google_cloud_chronicle_v1::model::Rule;
3836 /// let x = Rule::new().set_etag("example");
3837 /// ```
3838 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3839 self.etag = v.into();
3840 self
3841 }
3842
3843 /// Sets the value of [scope][crate::model::Rule::scope].
3844 ///
3845 /// # Example
3846 /// ```ignore,no_run
3847 /// # use google_cloud_chronicle_v1::model::Rule;
3848 /// let x = Rule::new().set_scope("example");
3849 /// ```
3850 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3851 self.scope = v.into();
3852 self
3853 }
3854
3855 /// Sets the value of [compilation_diagnostics][crate::model::Rule::compilation_diagnostics].
3856 ///
3857 /// # Example
3858 /// ```ignore,no_run
3859 /// # use google_cloud_chronicle_v1::model::Rule;
3860 /// use google_cloud_chronicle_v1::model::CompilationDiagnostic;
3861 /// let x = Rule::new()
3862 /// .set_compilation_diagnostics([
3863 /// CompilationDiagnostic::default()/* use setters */,
3864 /// CompilationDiagnostic::default()/* use (different) setters */,
3865 /// ]);
3866 /// ```
3867 pub fn set_compilation_diagnostics<T, V>(mut self, v: T) -> Self
3868 where
3869 T: std::iter::IntoIterator<Item = V>,
3870 V: std::convert::Into<crate::model::CompilationDiagnostic>,
3871 {
3872 use std::iter::Iterator;
3873 self.compilation_diagnostics = v.into_iter().map(|i| i.into()).collect();
3874 self
3875 }
3876
3877 /// Sets the value of [near_real_time_live_rule_eligible][crate::model::Rule::near_real_time_live_rule_eligible].
3878 ///
3879 /// # Example
3880 /// ```ignore,no_run
3881 /// # use google_cloud_chronicle_v1::model::Rule;
3882 /// let x = Rule::new().set_near_real_time_live_rule_eligible(true);
3883 /// ```
3884 pub fn set_near_real_time_live_rule_eligible<T: std::convert::Into<bool>>(
3885 mut self,
3886 v: T,
3887 ) -> Self {
3888 self.near_real_time_live_rule_eligible = v.into();
3889 self
3890 }
3891
3892 /// Sets the value of [inputs_used][crate::model::Rule::inputs_used].
3893 ///
3894 /// # Example
3895 /// ```ignore,no_run
3896 /// # use google_cloud_chronicle_v1::model::Rule;
3897 /// use google_cloud_chronicle_v1::model::InputsUsed;
3898 /// let x = Rule::new().set_inputs_used(InputsUsed::default()/* use setters */);
3899 /// ```
3900 pub fn set_inputs_used<T>(mut self, v: T) -> Self
3901 where
3902 T: std::convert::Into<crate::model::InputsUsed>,
3903 {
3904 self.inputs_used = std::option::Option::Some(v.into());
3905 self
3906 }
3907
3908 /// Sets or clears the value of [inputs_used][crate::model::Rule::inputs_used].
3909 ///
3910 /// # Example
3911 /// ```ignore,no_run
3912 /// # use google_cloud_chronicle_v1::model::Rule;
3913 /// use google_cloud_chronicle_v1::model::InputsUsed;
3914 /// let x = Rule::new().set_or_clear_inputs_used(Some(InputsUsed::default()/* use setters */));
3915 /// let x = Rule::new().set_or_clear_inputs_used(None::<InputsUsed>);
3916 /// ```
3917 pub fn set_or_clear_inputs_used<T>(mut self, v: std::option::Option<T>) -> Self
3918 where
3919 T: std::convert::Into<crate::model::InputsUsed>,
3920 {
3921 self.inputs_used = v.map(|x| x.into());
3922 self
3923 }
3924}
3925
3926impl wkt::message::Message for Rule {
3927 fn typename() -> &'static str {
3928 "type.googleapis.com/google.cloud.chronicle.v1.Rule"
3929 }
3930}
3931
3932/// Defines additional types related to [Rule].
3933pub mod rule {
3934 #[allow(unused_imports)]
3935 use super::*;
3936
3937 /// The current compilation state of the rule.
3938 ///
3939 /// # Working with unknown values
3940 ///
3941 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3942 /// additional enum variants at any time. Adding new variants is not considered
3943 /// a breaking change. Applications should write their code in anticipation of:
3944 ///
3945 /// - New values appearing in future releases of the client library, **and**
3946 /// - New values received dynamically, without application changes.
3947 ///
3948 /// Please consult the [Working with enums] section in the user guide for some
3949 /// guidelines.
3950 ///
3951 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3952 #[derive(Clone, Debug, PartialEq)]
3953 #[non_exhaustive]
3954 pub enum CompilationState {
3955 /// The compilation state is unspecified/unknown.
3956 Unspecified,
3957 /// The Rule can successfully compile.
3958 Succeeded,
3959 /// The Rule cannot successfully compile.
3960 /// This is possible if a backwards-incompatible change was made to the
3961 /// compiler.
3962 Failed,
3963 /// If set, the enum was initialized with an unknown value.
3964 ///
3965 /// Applications can examine the value using [CompilationState::value] or
3966 /// [CompilationState::name].
3967 UnknownValue(compilation_state::UnknownValue),
3968 }
3969
3970 #[doc(hidden)]
3971 pub mod compilation_state {
3972 #[allow(unused_imports)]
3973 use super::*;
3974 #[derive(Clone, Debug, PartialEq)]
3975 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3976 }
3977
3978 impl CompilationState {
3979 /// Gets the enum value.
3980 ///
3981 /// Returns `None` if the enum contains an unknown value deserialized from
3982 /// the string representation of enums.
3983 pub fn value(&self) -> std::option::Option<i32> {
3984 match self {
3985 Self::Unspecified => std::option::Option::Some(0),
3986 Self::Succeeded => std::option::Option::Some(1),
3987 Self::Failed => std::option::Option::Some(2),
3988 Self::UnknownValue(u) => u.0.value(),
3989 }
3990 }
3991
3992 /// Gets the enum value as a string.
3993 ///
3994 /// Returns `None` if the enum contains an unknown value deserialized from
3995 /// the integer representation of enums.
3996 pub fn name(&self) -> std::option::Option<&str> {
3997 match self {
3998 Self::Unspecified => std::option::Option::Some("COMPILATION_STATE_UNSPECIFIED"),
3999 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4000 Self::Failed => std::option::Option::Some("FAILED"),
4001 Self::UnknownValue(u) => u.0.name(),
4002 }
4003 }
4004 }
4005
4006 impl std::default::Default for CompilationState {
4007 fn default() -> Self {
4008 use std::convert::From;
4009 Self::from(0)
4010 }
4011 }
4012
4013 impl std::fmt::Display for CompilationState {
4014 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4015 wkt::internal::display_enum(f, self.name(), self.value())
4016 }
4017 }
4018
4019 impl std::convert::From<i32> for CompilationState {
4020 fn from(value: i32) -> Self {
4021 match value {
4022 0 => Self::Unspecified,
4023 1 => Self::Succeeded,
4024 2 => Self::Failed,
4025 _ => Self::UnknownValue(compilation_state::UnknownValue(
4026 wkt::internal::UnknownEnumValue::Integer(value),
4027 )),
4028 }
4029 }
4030 }
4031
4032 impl std::convert::From<&str> for CompilationState {
4033 fn from(value: &str) -> Self {
4034 use std::string::ToString;
4035 match value {
4036 "COMPILATION_STATE_UNSPECIFIED" => Self::Unspecified,
4037 "SUCCEEDED" => Self::Succeeded,
4038 "FAILED" => Self::Failed,
4039 _ => Self::UnknownValue(compilation_state::UnknownValue(
4040 wkt::internal::UnknownEnumValue::String(value.to_string()),
4041 )),
4042 }
4043 }
4044 }
4045
4046 impl serde::ser::Serialize for CompilationState {
4047 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4048 where
4049 S: serde::Serializer,
4050 {
4051 match self {
4052 Self::Unspecified => serializer.serialize_i32(0),
4053 Self::Succeeded => serializer.serialize_i32(1),
4054 Self::Failed => serializer.serialize_i32(2),
4055 Self::UnknownValue(u) => u.0.serialize(serializer),
4056 }
4057 }
4058 }
4059
4060 impl<'de> serde::de::Deserialize<'de> for CompilationState {
4061 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4062 where
4063 D: serde::Deserializer<'de>,
4064 {
4065 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompilationState>::new(
4066 ".google.cloud.chronicle.v1.Rule.CompilationState",
4067 ))
4068 }
4069 }
4070}
4071
4072/// The RuleDeployment resource represents the deployment state of a Rule.
4073#[derive(Clone, Default, PartialEq)]
4074#[non_exhaustive]
4075pub struct RuleDeployment {
4076 /// Required. The resource name of the rule deployment.
4077 /// Note that RuleDeployment is a child of the overall Rule, not any individual
4078 /// revision, so the resource ID segment for the Rule resource must not
4079 /// reference a specific revision.
4080 /// Format:
4081 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment`
4082 pub name: std::string::String,
4083
4084 /// Whether the rule is currently deployed continuously against incoming data.
4085 pub enabled: bool,
4086
4087 /// Whether detections resulting from this deployment should be considered
4088 /// alerts.
4089 pub alerting: bool,
4090
4091 /// The archive state of the rule deployment.
4092 /// Cannot be set to true unless enabled is set to false.
4093 /// If set to true, alerting will automatically be set to false.
4094 /// If currently set to true, enabled, alerting, and run_frequency cannot be
4095 /// updated.
4096 pub archived: bool,
4097
4098 /// Output only. The timestamp when the rule deployment archive state was last
4099 /// set to true. If the rule deployment's current archive state is not set to
4100 /// true, the field will be empty.
4101 pub archive_time: std::option::Option<wkt::Timestamp>,
4102
4103 /// The run frequency of the rule deployment.
4104 pub run_frequency: crate::model::RunFrequency,
4105
4106 /// Output only. The execution state of the rule deployment.
4107 pub execution_state: crate::model::rule_deployment::ExecutionState,
4108
4109 /// Output only. The names of the associated/chained producer rules. Rules are
4110 /// considered producers for this rule if this rule explicitly filters on their
4111 /// ruleid. Format:
4112 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
4113 pub producer_rules: std::vec::Vec<std::string::String>,
4114
4115 /// Output only. The names of the associated/chained consumer rules. Rules are
4116 /// considered consumers of this rule if their rule text explicitly filters on
4117 /// this rule's ruleid. Format:
4118 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
4119 pub consumer_rules: std::vec::Vec<std::string::String>,
4120
4121 /// Output only. The timestamp when the rule deployment alert state was lastly
4122 /// changed. This is filled regardless of the current alert state. E.g. if the
4123 /// current alert status is false, this timestamp will be the timestamp when
4124 /// the alert status was changed to false.
4125 pub last_alert_status_change_time: std::option::Option<wkt::Timestamp>,
4126
4127 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4128}
4129
4130impl RuleDeployment {
4131 pub fn new() -> Self {
4132 std::default::Default::default()
4133 }
4134
4135 /// Sets the value of [name][crate::model::RuleDeployment::name].
4136 ///
4137 /// # Example
4138 /// ```ignore,no_run
4139 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4140 /// let x = RuleDeployment::new().set_name("example");
4141 /// ```
4142 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4143 self.name = v.into();
4144 self
4145 }
4146
4147 /// Sets the value of [enabled][crate::model::RuleDeployment::enabled].
4148 ///
4149 /// # Example
4150 /// ```ignore,no_run
4151 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4152 /// let x = RuleDeployment::new().set_enabled(true);
4153 /// ```
4154 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4155 self.enabled = v.into();
4156 self
4157 }
4158
4159 /// Sets the value of [alerting][crate::model::RuleDeployment::alerting].
4160 ///
4161 /// # Example
4162 /// ```ignore,no_run
4163 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4164 /// let x = RuleDeployment::new().set_alerting(true);
4165 /// ```
4166 pub fn set_alerting<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4167 self.alerting = v.into();
4168 self
4169 }
4170
4171 /// Sets the value of [archived][crate::model::RuleDeployment::archived].
4172 ///
4173 /// # Example
4174 /// ```ignore,no_run
4175 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4176 /// let x = RuleDeployment::new().set_archived(true);
4177 /// ```
4178 pub fn set_archived<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4179 self.archived = v.into();
4180 self
4181 }
4182
4183 /// Sets the value of [archive_time][crate::model::RuleDeployment::archive_time].
4184 ///
4185 /// # Example
4186 /// ```ignore,no_run
4187 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4188 /// use wkt::Timestamp;
4189 /// let x = RuleDeployment::new().set_archive_time(Timestamp::default()/* use setters */);
4190 /// ```
4191 pub fn set_archive_time<T>(mut self, v: T) -> Self
4192 where
4193 T: std::convert::Into<wkt::Timestamp>,
4194 {
4195 self.archive_time = std::option::Option::Some(v.into());
4196 self
4197 }
4198
4199 /// Sets or clears the value of [archive_time][crate::model::RuleDeployment::archive_time].
4200 ///
4201 /// # Example
4202 /// ```ignore,no_run
4203 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4204 /// use wkt::Timestamp;
4205 /// let x = RuleDeployment::new().set_or_clear_archive_time(Some(Timestamp::default()/* use setters */));
4206 /// let x = RuleDeployment::new().set_or_clear_archive_time(None::<Timestamp>);
4207 /// ```
4208 pub fn set_or_clear_archive_time<T>(mut self, v: std::option::Option<T>) -> Self
4209 where
4210 T: std::convert::Into<wkt::Timestamp>,
4211 {
4212 self.archive_time = v.map(|x| x.into());
4213 self
4214 }
4215
4216 /// Sets the value of [run_frequency][crate::model::RuleDeployment::run_frequency].
4217 ///
4218 /// # Example
4219 /// ```ignore,no_run
4220 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4221 /// use google_cloud_chronicle_v1::model::RunFrequency;
4222 /// let x0 = RuleDeployment::new().set_run_frequency(RunFrequency::Live);
4223 /// let x1 = RuleDeployment::new().set_run_frequency(RunFrequency::Hourly);
4224 /// let x2 = RuleDeployment::new().set_run_frequency(RunFrequency::Daily);
4225 /// ```
4226 pub fn set_run_frequency<T: std::convert::Into<crate::model::RunFrequency>>(
4227 mut self,
4228 v: T,
4229 ) -> Self {
4230 self.run_frequency = v.into();
4231 self
4232 }
4233
4234 /// Sets the value of [execution_state][crate::model::RuleDeployment::execution_state].
4235 ///
4236 /// # Example
4237 /// ```ignore,no_run
4238 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4239 /// use google_cloud_chronicle_v1::model::rule_deployment::ExecutionState;
4240 /// let x0 = RuleDeployment::new().set_execution_state(ExecutionState::Default);
4241 /// let x1 = RuleDeployment::new().set_execution_state(ExecutionState::Limited);
4242 /// let x2 = RuleDeployment::new().set_execution_state(ExecutionState::Paused);
4243 /// ```
4244 pub fn set_execution_state<
4245 T: std::convert::Into<crate::model::rule_deployment::ExecutionState>,
4246 >(
4247 mut self,
4248 v: T,
4249 ) -> Self {
4250 self.execution_state = v.into();
4251 self
4252 }
4253
4254 /// Sets the value of [producer_rules][crate::model::RuleDeployment::producer_rules].
4255 ///
4256 /// # Example
4257 /// ```ignore,no_run
4258 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4259 /// let x = RuleDeployment::new().set_producer_rules(["a", "b", "c"]);
4260 /// ```
4261 pub fn set_producer_rules<T, V>(mut self, v: T) -> Self
4262 where
4263 T: std::iter::IntoIterator<Item = V>,
4264 V: std::convert::Into<std::string::String>,
4265 {
4266 use std::iter::Iterator;
4267 self.producer_rules = v.into_iter().map(|i| i.into()).collect();
4268 self
4269 }
4270
4271 /// Sets the value of [consumer_rules][crate::model::RuleDeployment::consumer_rules].
4272 ///
4273 /// # Example
4274 /// ```ignore,no_run
4275 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4276 /// let x = RuleDeployment::new().set_consumer_rules(["a", "b", "c"]);
4277 /// ```
4278 pub fn set_consumer_rules<T, V>(mut self, v: T) -> Self
4279 where
4280 T: std::iter::IntoIterator<Item = V>,
4281 V: std::convert::Into<std::string::String>,
4282 {
4283 use std::iter::Iterator;
4284 self.consumer_rules = v.into_iter().map(|i| i.into()).collect();
4285 self
4286 }
4287
4288 /// Sets the value of [last_alert_status_change_time][crate::model::RuleDeployment::last_alert_status_change_time].
4289 ///
4290 /// # Example
4291 /// ```ignore,no_run
4292 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4293 /// use wkt::Timestamp;
4294 /// let x = RuleDeployment::new().set_last_alert_status_change_time(Timestamp::default()/* use setters */);
4295 /// ```
4296 pub fn set_last_alert_status_change_time<T>(mut self, v: T) -> Self
4297 where
4298 T: std::convert::Into<wkt::Timestamp>,
4299 {
4300 self.last_alert_status_change_time = std::option::Option::Some(v.into());
4301 self
4302 }
4303
4304 /// Sets or clears the value of [last_alert_status_change_time][crate::model::RuleDeployment::last_alert_status_change_time].
4305 ///
4306 /// # Example
4307 /// ```ignore,no_run
4308 /// # use google_cloud_chronicle_v1::model::RuleDeployment;
4309 /// use wkt::Timestamp;
4310 /// let x = RuleDeployment::new().set_or_clear_last_alert_status_change_time(Some(Timestamp::default()/* use setters */));
4311 /// let x = RuleDeployment::new().set_or_clear_last_alert_status_change_time(None::<Timestamp>);
4312 /// ```
4313 pub fn set_or_clear_last_alert_status_change_time<T>(
4314 mut self,
4315 v: std::option::Option<T>,
4316 ) -> Self
4317 where
4318 T: std::convert::Into<wkt::Timestamp>,
4319 {
4320 self.last_alert_status_change_time = v.map(|x| x.into());
4321 self
4322 }
4323}
4324
4325impl wkt::message::Message for RuleDeployment {
4326 fn typename() -> &'static str {
4327 "type.googleapis.com/google.cloud.chronicle.v1.RuleDeployment"
4328 }
4329}
4330
4331/// Defines additional types related to [RuleDeployment].
4332pub mod rule_deployment {
4333 #[allow(unused_imports)]
4334 use super::*;
4335
4336 /// The possible execution states the rule deployment can be in.
4337 ///
4338 /// # Working with unknown values
4339 ///
4340 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4341 /// additional enum variants at any time. Adding new variants is not considered
4342 /// a breaking change. Applications should write their code in anticipation of:
4343 ///
4344 /// - New values appearing in future releases of the client library, **and**
4345 /// - New values received dynamically, without application changes.
4346 ///
4347 /// Please consult the [Working with enums] section in the user guide for some
4348 /// guidelines.
4349 ///
4350 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4351 #[derive(Clone, Debug, PartialEq)]
4352 #[non_exhaustive]
4353 pub enum ExecutionState {
4354 /// Unspecified or unknown execution state.
4355 Unspecified,
4356 /// Default execution state.
4357 Default,
4358 /// Rules in limited state may not have their executions guaranteed.
4359 Limited,
4360 /// Paused rules are not executed at all.
4361 Paused,
4362 /// If set, the enum was initialized with an unknown value.
4363 ///
4364 /// Applications can examine the value using [ExecutionState::value] or
4365 /// [ExecutionState::name].
4366 UnknownValue(execution_state::UnknownValue),
4367 }
4368
4369 #[doc(hidden)]
4370 pub mod execution_state {
4371 #[allow(unused_imports)]
4372 use super::*;
4373 #[derive(Clone, Debug, PartialEq)]
4374 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4375 }
4376
4377 impl ExecutionState {
4378 /// Gets the enum value.
4379 ///
4380 /// Returns `None` if the enum contains an unknown value deserialized from
4381 /// the string representation of enums.
4382 pub fn value(&self) -> std::option::Option<i32> {
4383 match self {
4384 Self::Unspecified => std::option::Option::Some(0),
4385 Self::Default => std::option::Option::Some(1),
4386 Self::Limited => std::option::Option::Some(2),
4387 Self::Paused => std::option::Option::Some(3),
4388 Self::UnknownValue(u) => u.0.value(),
4389 }
4390 }
4391
4392 /// Gets the enum value as a string.
4393 ///
4394 /// Returns `None` if the enum contains an unknown value deserialized from
4395 /// the integer representation of enums.
4396 pub fn name(&self) -> std::option::Option<&str> {
4397 match self {
4398 Self::Unspecified => std::option::Option::Some("EXECUTION_STATE_UNSPECIFIED"),
4399 Self::Default => std::option::Option::Some("DEFAULT"),
4400 Self::Limited => std::option::Option::Some("LIMITED"),
4401 Self::Paused => std::option::Option::Some("PAUSED"),
4402 Self::UnknownValue(u) => u.0.name(),
4403 }
4404 }
4405 }
4406
4407 impl std::default::Default for ExecutionState {
4408 fn default() -> Self {
4409 use std::convert::From;
4410 Self::from(0)
4411 }
4412 }
4413
4414 impl std::fmt::Display for ExecutionState {
4415 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4416 wkt::internal::display_enum(f, self.name(), self.value())
4417 }
4418 }
4419
4420 impl std::convert::From<i32> for ExecutionState {
4421 fn from(value: i32) -> Self {
4422 match value {
4423 0 => Self::Unspecified,
4424 1 => Self::Default,
4425 2 => Self::Limited,
4426 3 => Self::Paused,
4427 _ => Self::UnknownValue(execution_state::UnknownValue(
4428 wkt::internal::UnknownEnumValue::Integer(value),
4429 )),
4430 }
4431 }
4432 }
4433
4434 impl std::convert::From<&str> for ExecutionState {
4435 fn from(value: &str) -> Self {
4436 use std::string::ToString;
4437 match value {
4438 "EXECUTION_STATE_UNSPECIFIED" => Self::Unspecified,
4439 "DEFAULT" => Self::Default,
4440 "LIMITED" => Self::Limited,
4441 "PAUSED" => Self::Paused,
4442 _ => Self::UnknownValue(execution_state::UnknownValue(
4443 wkt::internal::UnknownEnumValue::String(value.to_string()),
4444 )),
4445 }
4446 }
4447 }
4448
4449 impl serde::ser::Serialize for ExecutionState {
4450 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4451 where
4452 S: serde::Serializer,
4453 {
4454 match self {
4455 Self::Unspecified => serializer.serialize_i32(0),
4456 Self::Default => serializer.serialize_i32(1),
4457 Self::Limited => serializer.serialize_i32(2),
4458 Self::Paused => serializer.serialize_i32(3),
4459 Self::UnknownValue(u) => u.0.serialize(serializer),
4460 }
4461 }
4462 }
4463
4464 impl<'de> serde::de::Deserialize<'de> for ExecutionState {
4465 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4466 where
4467 D: serde::Deserializer<'de>,
4468 {
4469 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionState>::new(
4470 ".google.cloud.chronicle.v1.RuleDeployment.ExecutionState",
4471 ))
4472 }
4473 }
4474}
4475
4476/// Retrohunt is an execution of a Rule over a time range in the past.
4477#[derive(Clone, Default, PartialEq)]
4478#[non_exhaustive]
4479pub struct Retrohunt {
4480 /// The resource name of the retrohunt.
4481 /// Retrohunt is the child of a rule revision. {rule} in the format below is
4482 /// structured as {rule_id@revision_id}.
4483 /// Format:
4484 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/retrohunts/{retrohunt}`
4485 pub name: std::string::String,
4486
4487 /// Required. The start and end time of the event time range this retrohunt
4488 /// processes.
4489 pub process_interval: std::option::Option<google_cloud_type::model::Interval>,
4490
4491 /// Output only. The start and end time of the retrohunt execution. If the
4492 /// retrohunt is not yet finished, the end time of the interval will not be
4493 /// populated.
4494 pub execution_interval: std::option::Option<google_cloud_type::model::Interval>,
4495
4496 /// Output only. The state of the retrohunt.
4497 pub state: crate::model::retrohunt::State,
4498
4499 /// Output only. Percent progress of the retrohunt towards completion, from
4500 /// 0.00 to 100.00.
4501 pub progress_percentage: f32,
4502
4503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4504}
4505
4506impl Retrohunt {
4507 pub fn new() -> Self {
4508 std::default::Default::default()
4509 }
4510
4511 /// Sets the value of [name][crate::model::Retrohunt::name].
4512 ///
4513 /// # Example
4514 /// ```ignore,no_run
4515 /// # use google_cloud_chronicle_v1::model::Retrohunt;
4516 /// let x = Retrohunt::new().set_name("example");
4517 /// ```
4518 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4519 self.name = v.into();
4520 self
4521 }
4522
4523 /// Sets the value of [process_interval][crate::model::Retrohunt::process_interval].
4524 ///
4525 /// # Example
4526 /// ```ignore,no_run
4527 /// # use google_cloud_chronicle_v1::model::Retrohunt;
4528 /// use google_cloud_type::model::Interval;
4529 /// let x = Retrohunt::new().set_process_interval(Interval::default()/* use setters */);
4530 /// ```
4531 pub fn set_process_interval<T>(mut self, v: T) -> Self
4532 where
4533 T: std::convert::Into<google_cloud_type::model::Interval>,
4534 {
4535 self.process_interval = std::option::Option::Some(v.into());
4536 self
4537 }
4538
4539 /// Sets or clears the value of [process_interval][crate::model::Retrohunt::process_interval].
4540 ///
4541 /// # Example
4542 /// ```ignore,no_run
4543 /// # use google_cloud_chronicle_v1::model::Retrohunt;
4544 /// use google_cloud_type::model::Interval;
4545 /// let x = Retrohunt::new().set_or_clear_process_interval(Some(Interval::default()/* use setters */));
4546 /// let x = Retrohunt::new().set_or_clear_process_interval(None::<Interval>);
4547 /// ```
4548 pub fn set_or_clear_process_interval<T>(mut self, v: std::option::Option<T>) -> Self
4549 where
4550 T: std::convert::Into<google_cloud_type::model::Interval>,
4551 {
4552 self.process_interval = v.map(|x| x.into());
4553 self
4554 }
4555
4556 /// Sets the value of [execution_interval][crate::model::Retrohunt::execution_interval].
4557 ///
4558 /// # Example
4559 /// ```ignore,no_run
4560 /// # use google_cloud_chronicle_v1::model::Retrohunt;
4561 /// use google_cloud_type::model::Interval;
4562 /// let x = Retrohunt::new().set_execution_interval(Interval::default()/* use setters */);
4563 /// ```
4564 pub fn set_execution_interval<T>(mut self, v: T) -> Self
4565 where
4566 T: std::convert::Into<google_cloud_type::model::Interval>,
4567 {
4568 self.execution_interval = std::option::Option::Some(v.into());
4569 self
4570 }
4571
4572 /// Sets or clears the value of [execution_interval][crate::model::Retrohunt::execution_interval].
4573 ///
4574 /// # Example
4575 /// ```ignore,no_run
4576 /// # use google_cloud_chronicle_v1::model::Retrohunt;
4577 /// use google_cloud_type::model::Interval;
4578 /// let x = Retrohunt::new().set_or_clear_execution_interval(Some(Interval::default()/* use setters */));
4579 /// let x = Retrohunt::new().set_or_clear_execution_interval(None::<Interval>);
4580 /// ```
4581 pub fn set_or_clear_execution_interval<T>(mut self, v: std::option::Option<T>) -> Self
4582 where
4583 T: std::convert::Into<google_cloud_type::model::Interval>,
4584 {
4585 self.execution_interval = v.map(|x| x.into());
4586 self
4587 }
4588
4589 /// Sets the value of [state][crate::model::Retrohunt::state].
4590 ///
4591 /// # Example
4592 /// ```ignore,no_run
4593 /// # use google_cloud_chronicle_v1::model::Retrohunt;
4594 /// use google_cloud_chronicle_v1::model::retrohunt::State;
4595 /// let x0 = Retrohunt::new().set_state(State::Running);
4596 /// let x1 = Retrohunt::new().set_state(State::Done);
4597 /// let x2 = Retrohunt::new().set_state(State::Cancelled);
4598 /// ```
4599 pub fn set_state<T: std::convert::Into<crate::model::retrohunt::State>>(
4600 mut self,
4601 v: T,
4602 ) -> Self {
4603 self.state = v.into();
4604 self
4605 }
4606
4607 /// Sets the value of [progress_percentage][crate::model::Retrohunt::progress_percentage].
4608 ///
4609 /// # Example
4610 /// ```ignore,no_run
4611 /// # use google_cloud_chronicle_v1::model::Retrohunt;
4612 /// let x = Retrohunt::new().set_progress_percentage(42.0);
4613 /// ```
4614 pub fn set_progress_percentage<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4615 self.progress_percentage = v.into();
4616 self
4617 }
4618}
4619
4620impl wkt::message::Message for Retrohunt {
4621 fn typename() -> &'static str {
4622 "type.googleapis.com/google.cloud.chronicle.v1.Retrohunt"
4623 }
4624}
4625
4626/// Defines additional types related to [Retrohunt].
4627pub mod retrohunt {
4628 #[allow(unused_imports)]
4629 use super::*;
4630
4631 /// The possible states a retrohunt can be in.
4632 ///
4633 /// # Working with unknown values
4634 ///
4635 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4636 /// additional enum variants at any time. Adding new variants is not considered
4637 /// a breaking change. Applications should write their code in anticipation of:
4638 ///
4639 /// - New values appearing in future releases of the client library, **and**
4640 /// - New values received dynamically, without application changes.
4641 ///
4642 /// Please consult the [Working with enums] section in the user guide for some
4643 /// guidelines.
4644 ///
4645 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4646 #[derive(Clone, Debug, PartialEq)]
4647 #[non_exhaustive]
4648 pub enum State {
4649 /// Unspecified or unknown retrohunt state.
4650 Unspecified,
4651 /// Running state.
4652 Running,
4653 /// Done state.
4654 Done,
4655 /// Cancelled state.
4656 Cancelled,
4657 /// Failed state.
4658 Failed,
4659 /// If set, the enum was initialized with an unknown value.
4660 ///
4661 /// Applications can examine the value using [State::value] or
4662 /// [State::name].
4663 UnknownValue(state::UnknownValue),
4664 }
4665
4666 #[doc(hidden)]
4667 pub mod state {
4668 #[allow(unused_imports)]
4669 use super::*;
4670 #[derive(Clone, Debug, PartialEq)]
4671 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4672 }
4673
4674 impl State {
4675 /// Gets the enum value.
4676 ///
4677 /// Returns `None` if the enum contains an unknown value deserialized from
4678 /// the string representation of enums.
4679 pub fn value(&self) -> std::option::Option<i32> {
4680 match self {
4681 Self::Unspecified => std::option::Option::Some(0),
4682 Self::Running => std::option::Option::Some(1),
4683 Self::Done => std::option::Option::Some(2),
4684 Self::Cancelled => std::option::Option::Some(3),
4685 Self::Failed => std::option::Option::Some(4),
4686 Self::UnknownValue(u) => u.0.value(),
4687 }
4688 }
4689
4690 /// Gets the enum value as a string.
4691 ///
4692 /// Returns `None` if the enum contains an unknown value deserialized from
4693 /// the integer representation of enums.
4694 pub fn name(&self) -> std::option::Option<&str> {
4695 match self {
4696 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4697 Self::Running => std::option::Option::Some("RUNNING"),
4698 Self::Done => std::option::Option::Some("DONE"),
4699 Self::Cancelled => std::option::Option::Some("CANCELLED"),
4700 Self::Failed => std::option::Option::Some("FAILED"),
4701 Self::UnknownValue(u) => u.0.name(),
4702 }
4703 }
4704 }
4705
4706 impl std::default::Default for State {
4707 fn default() -> Self {
4708 use std::convert::From;
4709 Self::from(0)
4710 }
4711 }
4712
4713 impl std::fmt::Display for State {
4714 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4715 wkt::internal::display_enum(f, self.name(), self.value())
4716 }
4717 }
4718
4719 impl std::convert::From<i32> for State {
4720 fn from(value: i32) -> Self {
4721 match value {
4722 0 => Self::Unspecified,
4723 1 => Self::Running,
4724 2 => Self::Done,
4725 3 => Self::Cancelled,
4726 4 => Self::Failed,
4727 _ => Self::UnknownValue(state::UnknownValue(
4728 wkt::internal::UnknownEnumValue::Integer(value),
4729 )),
4730 }
4731 }
4732 }
4733
4734 impl std::convert::From<&str> for State {
4735 fn from(value: &str) -> Self {
4736 use std::string::ToString;
4737 match value {
4738 "STATE_UNSPECIFIED" => Self::Unspecified,
4739 "RUNNING" => Self::Running,
4740 "DONE" => Self::Done,
4741 "CANCELLED" => Self::Cancelled,
4742 "FAILED" => Self::Failed,
4743 _ => Self::UnknownValue(state::UnknownValue(
4744 wkt::internal::UnknownEnumValue::String(value.to_string()),
4745 )),
4746 }
4747 }
4748 }
4749
4750 impl serde::ser::Serialize for State {
4751 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4752 where
4753 S: serde::Serializer,
4754 {
4755 match self {
4756 Self::Unspecified => serializer.serialize_i32(0),
4757 Self::Running => serializer.serialize_i32(1),
4758 Self::Done => serializer.serialize_i32(2),
4759 Self::Cancelled => serializer.serialize_i32(3),
4760 Self::Failed => serializer.serialize_i32(4),
4761 Self::UnknownValue(u) => u.0.serialize(serializer),
4762 }
4763 }
4764 }
4765
4766 impl<'de> serde::de::Deserialize<'de> for State {
4767 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4768 where
4769 D: serde::Deserializer<'de>,
4770 {
4771 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4772 ".google.cloud.chronicle.v1.Retrohunt.State",
4773 ))
4774 }
4775 }
4776}
4777
4778/// Request message for CreateRule method.
4779#[derive(Clone, Default, PartialEq)]
4780#[non_exhaustive]
4781pub struct CreateRuleRequest {
4782 /// Required. The parent resource where this rule will be created.
4783 /// Format: `projects/{project}/locations/{location}/instances/{instance}`
4784 pub parent: std::string::String,
4785
4786 /// Required. The rule to create.
4787 pub rule: std::option::Option<crate::model::Rule>,
4788
4789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4790}
4791
4792impl CreateRuleRequest {
4793 pub fn new() -> Self {
4794 std::default::Default::default()
4795 }
4796
4797 /// Sets the value of [parent][crate::model::CreateRuleRequest::parent].
4798 ///
4799 /// # Example
4800 /// ```ignore,no_run
4801 /// # use google_cloud_chronicle_v1::model::CreateRuleRequest;
4802 /// let x = CreateRuleRequest::new().set_parent("example");
4803 /// ```
4804 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4805 self.parent = v.into();
4806 self
4807 }
4808
4809 /// Sets the value of [rule][crate::model::CreateRuleRequest::rule].
4810 ///
4811 /// # Example
4812 /// ```ignore,no_run
4813 /// # use google_cloud_chronicle_v1::model::CreateRuleRequest;
4814 /// use google_cloud_chronicle_v1::model::Rule;
4815 /// let x = CreateRuleRequest::new().set_rule(Rule::default()/* use setters */);
4816 /// ```
4817 pub fn set_rule<T>(mut self, v: T) -> Self
4818 where
4819 T: std::convert::Into<crate::model::Rule>,
4820 {
4821 self.rule = std::option::Option::Some(v.into());
4822 self
4823 }
4824
4825 /// Sets or clears the value of [rule][crate::model::CreateRuleRequest::rule].
4826 ///
4827 /// # Example
4828 /// ```ignore,no_run
4829 /// # use google_cloud_chronicle_v1::model::CreateRuleRequest;
4830 /// use google_cloud_chronicle_v1::model::Rule;
4831 /// let x = CreateRuleRequest::new().set_or_clear_rule(Some(Rule::default()/* use setters */));
4832 /// let x = CreateRuleRequest::new().set_or_clear_rule(None::<Rule>);
4833 /// ```
4834 pub fn set_or_clear_rule<T>(mut self, v: std::option::Option<T>) -> Self
4835 where
4836 T: std::convert::Into<crate::model::Rule>,
4837 {
4838 self.rule = v.map(|x| x.into());
4839 self
4840 }
4841}
4842
4843impl wkt::message::Message for CreateRuleRequest {
4844 fn typename() -> &'static str {
4845 "type.googleapis.com/google.cloud.chronicle.v1.CreateRuleRequest"
4846 }
4847}
4848
4849/// Request message for GetRule method.
4850#[derive(Clone, Default, PartialEq)]
4851#[non_exhaustive]
4852pub struct GetRuleRequest {
4853 /// Required. The name of the rule to retrieve.
4854 /// Format:
4855 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
4856 pub name: std::string::String,
4857
4858 /// The view field indicates the scope of fields to populate for the Rule being
4859 /// returned. If unspecified, defaults to FULL.
4860 pub view: crate::model::RuleView,
4861
4862 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4863}
4864
4865impl GetRuleRequest {
4866 pub fn new() -> Self {
4867 std::default::Default::default()
4868 }
4869
4870 /// Sets the value of [name][crate::model::GetRuleRequest::name].
4871 ///
4872 /// # Example
4873 /// ```ignore,no_run
4874 /// # use google_cloud_chronicle_v1::model::GetRuleRequest;
4875 /// let x = GetRuleRequest::new().set_name("example");
4876 /// ```
4877 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4878 self.name = v.into();
4879 self
4880 }
4881
4882 /// Sets the value of [view][crate::model::GetRuleRequest::view].
4883 ///
4884 /// # Example
4885 /// ```ignore,no_run
4886 /// # use google_cloud_chronicle_v1::model::GetRuleRequest;
4887 /// use google_cloud_chronicle_v1::model::RuleView;
4888 /// let x0 = GetRuleRequest::new().set_view(RuleView::Basic);
4889 /// let x1 = GetRuleRequest::new().set_view(RuleView::Full);
4890 /// let x2 = GetRuleRequest::new().set_view(RuleView::RevisionMetadataOnly);
4891 /// ```
4892 pub fn set_view<T: std::convert::Into<crate::model::RuleView>>(mut self, v: T) -> Self {
4893 self.view = v.into();
4894 self
4895 }
4896}
4897
4898impl wkt::message::Message for GetRuleRequest {
4899 fn typename() -> &'static str {
4900 "type.googleapis.com/google.cloud.chronicle.v1.GetRuleRequest"
4901 }
4902}
4903
4904/// Request message for ListRules method.
4905#[derive(Clone, Default, PartialEq)]
4906#[non_exhaustive]
4907pub struct ListRulesRequest {
4908 /// Required. The parent, which owns this collection of rules.
4909 /// Format:
4910 /// `projects/{project}/locations/{location}/instances/{instance}`
4911 pub parent: std::string::String,
4912
4913 /// The maximum number of rules to return. The service may return fewer than
4914 /// this value. If unspecified, at most 100 rules will be returned. The
4915 /// maximum value is 1000; values above 1000 will be coerced to 1000.
4916 pub page_size: i32,
4917
4918 /// A page token, received from a previous `ListRules` call.
4919 /// Provide this to retrieve the subsequent page.
4920 ///
4921 /// When paginating, all other parameters provided to `ListRules`
4922 /// must match the call that provided the page token.
4923 pub page_token: std::string::String,
4924
4925 /// view indicates the scope of fields to populate for the Rule being returned.
4926 /// If unspecified, defaults to BASIC.
4927 pub view: crate::model::RuleView,
4928
4929 /// Only the following filters are allowed:
4930 /// "reference_lists:{reference_list_name}"
4931 /// "data_tables:{data_table_name}"
4932 /// "display_name:{display_name}"
4933 pub filter: std::string::String,
4934
4935 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4936}
4937
4938impl ListRulesRequest {
4939 pub fn new() -> Self {
4940 std::default::Default::default()
4941 }
4942
4943 /// Sets the value of [parent][crate::model::ListRulesRequest::parent].
4944 ///
4945 /// # Example
4946 /// ```ignore,no_run
4947 /// # use google_cloud_chronicle_v1::model::ListRulesRequest;
4948 /// let x = ListRulesRequest::new().set_parent("example");
4949 /// ```
4950 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4951 self.parent = v.into();
4952 self
4953 }
4954
4955 /// Sets the value of [page_size][crate::model::ListRulesRequest::page_size].
4956 ///
4957 /// # Example
4958 /// ```ignore,no_run
4959 /// # use google_cloud_chronicle_v1::model::ListRulesRequest;
4960 /// let x = ListRulesRequest::new().set_page_size(42);
4961 /// ```
4962 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4963 self.page_size = v.into();
4964 self
4965 }
4966
4967 /// Sets the value of [page_token][crate::model::ListRulesRequest::page_token].
4968 ///
4969 /// # Example
4970 /// ```ignore,no_run
4971 /// # use google_cloud_chronicle_v1::model::ListRulesRequest;
4972 /// let x = ListRulesRequest::new().set_page_token("example");
4973 /// ```
4974 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4975 self.page_token = v.into();
4976 self
4977 }
4978
4979 /// Sets the value of [view][crate::model::ListRulesRequest::view].
4980 ///
4981 /// # Example
4982 /// ```ignore,no_run
4983 /// # use google_cloud_chronicle_v1::model::ListRulesRequest;
4984 /// use google_cloud_chronicle_v1::model::RuleView;
4985 /// let x0 = ListRulesRequest::new().set_view(RuleView::Basic);
4986 /// let x1 = ListRulesRequest::new().set_view(RuleView::Full);
4987 /// let x2 = ListRulesRequest::new().set_view(RuleView::RevisionMetadataOnly);
4988 /// ```
4989 pub fn set_view<T: std::convert::Into<crate::model::RuleView>>(mut self, v: T) -> Self {
4990 self.view = v.into();
4991 self
4992 }
4993
4994 /// Sets the value of [filter][crate::model::ListRulesRequest::filter].
4995 ///
4996 /// # Example
4997 /// ```ignore,no_run
4998 /// # use google_cloud_chronicle_v1::model::ListRulesRequest;
4999 /// let x = ListRulesRequest::new().set_filter("example");
5000 /// ```
5001 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5002 self.filter = v.into();
5003 self
5004 }
5005}
5006
5007impl wkt::message::Message for ListRulesRequest {
5008 fn typename() -> &'static str {
5009 "type.googleapis.com/google.cloud.chronicle.v1.ListRulesRequest"
5010 }
5011}
5012
5013/// Response message for ListRules method.
5014#[derive(Clone, Default, PartialEq)]
5015#[non_exhaustive]
5016pub struct ListRulesResponse {
5017 /// The rules from the specified instance.
5018 pub rules: std::vec::Vec<crate::model::Rule>,
5019
5020 /// A token, which can be sent as `page_token` to retrieve the next page.
5021 /// If this field is omitted, there are no subsequent pages.
5022 pub next_page_token: std::string::String,
5023
5024 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5025}
5026
5027impl ListRulesResponse {
5028 pub fn new() -> Self {
5029 std::default::Default::default()
5030 }
5031
5032 /// Sets the value of [rules][crate::model::ListRulesResponse::rules].
5033 ///
5034 /// # Example
5035 /// ```ignore,no_run
5036 /// # use google_cloud_chronicle_v1::model::ListRulesResponse;
5037 /// use google_cloud_chronicle_v1::model::Rule;
5038 /// let x = ListRulesResponse::new()
5039 /// .set_rules([
5040 /// Rule::default()/* use setters */,
5041 /// Rule::default()/* use (different) setters */,
5042 /// ]);
5043 /// ```
5044 pub fn set_rules<T, V>(mut self, v: T) -> Self
5045 where
5046 T: std::iter::IntoIterator<Item = V>,
5047 V: std::convert::Into<crate::model::Rule>,
5048 {
5049 use std::iter::Iterator;
5050 self.rules = v.into_iter().map(|i| i.into()).collect();
5051 self
5052 }
5053
5054 /// Sets the value of [next_page_token][crate::model::ListRulesResponse::next_page_token].
5055 ///
5056 /// # Example
5057 /// ```ignore,no_run
5058 /// # use google_cloud_chronicle_v1::model::ListRulesResponse;
5059 /// let x = ListRulesResponse::new().set_next_page_token("example");
5060 /// ```
5061 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5062 self.next_page_token = v.into();
5063 self
5064 }
5065}
5066
5067impl wkt::message::Message for ListRulesResponse {
5068 fn typename() -> &'static str {
5069 "type.googleapis.com/google.cloud.chronicle.v1.ListRulesResponse"
5070 }
5071}
5072
5073#[doc(hidden)]
5074impl google_cloud_gax::paginator::internal::PageableResponse for ListRulesResponse {
5075 type PageItem = crate::model::Rule;
5076
5077 fn items(self) -> std::vec::Vec<Self::PageItem> {
5078 self.rules
5079 }
5080
5081 fn next_page_token(&self) -> std::string::String {
5082 use std::clone::Clone;
5083 self.next_page_token.clone()
5084 }
5085}
5086
5087/// Request message for UpdateRule method.
5088#[derive(Clone, Default, PartialEq)]
5089#[non_exhaustive]
5090pub struct UpdateRuleRequest {
5091 /// Required. The rule to update.
5092 ///
5093 /// The rule's `name` field is used to identify the rule to update.
5094 /// Format:
5095 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
5096 pub rule: std::option::Option<crate::model::Rule>,
5097
5098 /// The list of fields to update. If not included, all fields with a non-empty
5099 /// value will be overwritten.
5100 pub update_mask: std::option::Option<wkt::FieldMask>,
5101
5102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5103}
5104
5105impl UpdateRuleRequest {
5106 pub fn new() -> Self {
5107 std::default::Default::default()
5108 }
5109
5110 /// Sets the value of [rule][crate::model::UpdateRuleRequest::rule].
5111 ///
5112 /// # Example
5113 /// ```ignore,no_run
5114 /// # use google_cloud_chronicle_v1::model::UpdateRuleRequest;
5115 /// use google_cloud_chronicle_v1::model::Rule;
5116 /// let x = UpdateRuleRequest::new().set_rule(Rule::default()/* use setters */);
5117 /// ```
5118 pub fn set_rule<T>(mut self, v: T) -> Self
5119 where
5120 T: std::convert::Into<crate::model::Rule>,
5121 {
5122 self.rule = std::option::Option::Some(v.into());
5123 self
5124 }
5125
5126 /// Sets or clears the value of [rule][crate::model::UpdateRuleRequest::rule].
5127 ///
5128 /// # Example
5129 /// ```ignore,no_run
5130 /// # use google_cloud_chronicle_v1::model::UpdateRuleRequest;
5131 /// use google_cloud_chronicle_v1::model::Rule;
5132 /// let x = UpdateRuleRequest::new().set_or_clear_rule(Some(Rule::default()/* use setters */));
5133 /// let x = UpdateRuleRequest::new().set_or_clear_rule(None::<Rule>);
5134 /// ```
5135 pub fn set_or_clear_rule<T>(mut self, v: std::option::Option<T>) -> Self
5136 where
5137 T: std::convert::Into<crate::model::Rule>,
5138 {
5139 self.rule = v.map(|x| x.into());
5140 self
5141 }
5142
5143 /// Sets the value of [update_mask][crate::model::UpdateRuleRequest::update_mask].
5144 ///
5145 /// # Example
5146 /// ```ignore,no_run
5147 /// # use google_cloud_chronicle_v1::model::UpdateRuleRequest;
5148 /// use wkt::FieldMask;
5149 /// let x = UpdateRuleRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5150 /// ```
5151 pub fn set_update_mask<T>(mut self, v: T) -> Self
5152 where
5153 T: std::convert::Into<wkt::FieldMask>,
5154 {
5155 self.update_mask = std::option::Option::Some(v.into());
5156 self
5157 }
5158
5159 /// Sets or clears the value of [update_mask][crate::model::UpdateRuleRequest::update_mask].
5160 ///
5161 /// # Example
5162 /// ```ignore,no_run
5163 /// # use google_cloud_chronicle_v1::model::UpdateRuleRequest;
5164 /// use wkt::FieldMask;
5165 /// let x = UpdateRuleRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5166 /// let x = UpdateRuleRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5167 /// ```
5168 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5169 where
5170 T: std::convert::Into<wkt::FieldMask>,
5171 {
5172 self.update_mask = v.map(|x| x.into());
5173 self
5174 }
5175}
5176
5177impl wkt::message::Message for UpdateRuleRequest {
5178 fn typename() -> &'static str {
5179 "type.googleapis.com/google.cloud.chronicle.v1.UpdateRuleRequest"
5180 }
5181}
5182
5183/// Request message for the DeleteRule method.
5184#[derive(Clone, Default, PartialEq)]
5185#[non_exhaustive]
5186pub struct DeleteRuleRequest {
5187 /// Required. The name of the rule to delete. A rule revision timestamp cannot
5188 /// be specified as part of the name, as deleting specific revisions is not
5189 /// supported.
5190 /// Format:
5191 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
5192 pub name: std::string::String,
5193
5194 /// Optional. If set to true, any retrohunts and any detections associated with
5195 /// the rule will also be deleted. If set to false, the call will only succeed
5196 /// if the rule has no associated retrohunts, including completed retrohunts,
5197 /// and no associated detections. Regardless of this field's value, the rule
5198 /// deployment associated with this rule will also be deleted.
5199 pub force: bool,
5200
5201 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5202}
5203
5204impl DeleteRuleRequest {
5205 pub fn new() -> Self {
5206 std::default::Default::default()
5207 }
5208
5209 /// Sets the value of [name][crate::model::DeleteRuleRequest::name].
5210 ///
5211 /// # Example
5212 /// ```ignore,no_run
5213 /// # use google_cloud_chronicle_v1::model::DeleteRuleRequest;
5214 /// let x = DeleteRuleRequest::new().set_name("example");
5215 /// ```
5216 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5217 self.name = v.into();
5218 self
5219 }
5220
5221 /// Sets the value of [force][crate::model::DeleteRuleRequest::force].
5222 ///
5223 /// # Example
5224 /// ```ignore,no_run
5225 /// # use google_cloud_chronicle_v1::model::DeleteRuleRequest;
5226 /// let x = DeleteRuleRequest::new().set_force(true);
5227 /// ```
5228 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5229 self.force = v.into();
5230 self
5231 }
5232}
5233
5234impl wkt::message::Message for DeleteRuleRequest {
5235 fn typename() -> &'static str {
5236 "type.googleapis.com/google.cloud.chronicle.v1.DeleteRuleRequest"
5237 }
5238}
5239
5240/// Request message for ListRuleRevisions method.
5241#[derive(Clone, Default, PartialEq)]
5242#[non_exhaustive]
5243pub struct ListRuleRevisionsRequest {
5244 /// Required. The name of the rule to list revisions for.
5245 /// Format:
5246 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
5247 pub name: std::string::String,
5248
5249 /// The maximum number of revisions to return per page. The service may return
5250 /// fewer than this value. If unspecified, at most 100 revisions will be
5251 /// returned. The maximum value is 1000; values above 1000 will be coerced to
5252 /// 1000.
5253 pub page_size: i32,
5254
5255 /// The page token, received from a previous `ListRuleRevisions` call.
5256 /// Provide this to retrieve the subsequent page.
5257 ///
5258 /// When paginating, all other parameters provided to `ListRuleRevisions`
5259 /// must match the call that provided the page token.
5260 pub page_token: std::string::String,
5261
5262 /// The view field indicates the scope of fields to populate for the revision
5263 /// being returned. If unspecified, defaults to BASIC.
5264 pub view: crate::model::RuleView,
5265
5266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5267}
5268
5269impl ListRuleRevisionsRequest {
5270 pub fn new() -> Self {
5271 std::default::Default::default()
5272 }
5273
5274 /// Sets the value of [name][crate::model::ListRuleRevisionsRequest::name].
5275 ///
5276 /// # Example
5277 /// ```ignore,no_run
5278 /// # use google_cloud_chronicle_v1::model::ListRuleRevisionsRequest;
5279 /// let x = ListRuleRevisionsRequest::new().set_name("example");
5280 /// ```
5281 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5282 self.name = v.into();
5283 self
5284 }
5285
5286 /// Sets the value of [page_size][crate::model::ListRuleRevisionsRequest::page_size].
5287 ///
5288 /// # Example
5289 /// ```ignore,no_run
5290 /// # use google_cloud_chronicle_v1::model::ListRuleRevisionsRequest;
5291 /// let x = ListRuleRevisionsRequest::new().set_page_size(42);
5292 /// ```
5293 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5294 self.page_size = v.into();
5295 self
5296 }
5297
5298 /// Sets the value of [page_token][crate::model::ListRuleRevisionsRequest::page_token].
5299 ///
5300 /// # Example
5301 /// ```ignore,no_run
5302 /// # use google_cloud_chronicle_v1::model::ListRuleRevisionsRequest;
5303 /// let x = ListRuleRevisionsRequest::new().set_page_token("example");
5304 /// ```
5305 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5306 self.page_token = v.into();
5307 self
5308 }
5309
5310 /// Sets the value of [view][crate::model::ListRuleRevisionsRequest::view].
5311 ///
5312 /// # Example
5313 /// ```ignore,no_run
5314 /// # use google_cloud_chronicle_v1::model::ListRuleRevisionsRequest;
5315 /// use google_cloud_chronicle_v1::model::RuleView;
5316 /// let x0 = ListRuleRevisionsRequest::new().set_view(RuleView::Basic);
5317 /// let x1 = ListRuleRevisionsRequest::new().set_view(RuleView::Full);
5318 /// let x2 = ListRuleRevisionsRequest::new().set_view(RuleView::RevisionMetadataOnly);
5319 /// ```
5320 pub fn set_view<T: std::convert::Into<crate::model::RuleView>>(mut self, v: T) -> Self {
5321 self.view = v.into();
5322 self
5323 }
5324}
5325
5326impl wkt::message::Message for ListRuleRevisionsRequest {
5327 fn typename() -> &'static str {
5328 "type.googleapis.com/google.cloud.chronicle.v1.ListRuleRevisionsRequest"
5329 }
5330}
5331
5332/// Response message for ListRuleRevisions method.
5333#[derive(Clone, Default, PartialEq)]
5334#[non_exhaustive]
5335pub struct ListRuleRevisionsResponse {
5336 /// The revisions of the rule.
5337 pub rules: std::vec::Vec<crate::model::Rule>,
5338
5339 /// A token that can be sent as `page_token` to retrieve the next page.
5340 /// If this field is omitted, there are no subsequent pages.
5341 pub next_page_token: std::string::String,
5342
5343 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5344}
5345
5346impl ListRuleRevisionsResponse {
5347 pub fn new() -> Self {
5348 std::default::Default::default()
5349 }
5350
5351 /// Sets the value of [rules][crate::model::ListRuleRevisionsResponse::rules].
5352 ///
5353 /// # Example
5354 /// ```ignore,no_run
5355 /// # use google_cloud_chronicle_v1::model::ListRuleRevisionsResponse;
5356 /// use google_cloud_chronicle_v1::model::Rule;
5357 /// let x = ListRuleRevisionsResponse::new()
5358 /// .set_rules([
5359 /// Rule::default()/* use setters */,
5360 /// Rule::default()/* use (different) setters */,
5361 /// ]);
5362 /// ```
5363 pub fn set_rules<T, V>(mut self, v: T) -> Self
5364 where
5365 T: std::iter::IntoIterator<Item = V>,
5366 V: std::convert::Into<crate::model::Rule>,
5367 {
5368 use std::iter::Iterator;
5369 self.rules = v.into_iter().map(|i| i.into()).collect();
5370 self
5371 }
5372
5373 /// Sets the value of [next_page_token][crate::model::ListRuleRevisionsResponse::next_page_token].
5374 ///
5375 /// # Example
5376 /// ```ignore,no_run
5377 /// # use google_cloud_chronicle_v1::model::ListRuleRevisionsResponse;
5378 /// let x = ListRuleRevisionsResponse::new().set_next_page_token("example");
5379 /// ```
5380 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5381 self.next_page_token = v.into();
5382 self
5383 }
5384}
5385
5386impl wkt::message::Message for ListRuleRevisionsResponse {
5387 fn typename() -> &'static str {
5388 "type.googleapis.com/google.cloud.chronicle.v1.ListRuleRevisionsResponse"
5389 }
5390}
5391
5392#[doc(hidden)]
5393impl google_cloud_gax::paginator::internal::PageableResponse for ListRuleRevisionsResponse {
5394 type PageItem = crate::model::Rule;
5395
5396 fn items(self) -> std::vec::Vec<Self::PageItem> {
5397 self.rules
5398 }
5399
5400 fn next_page_token(&self) -> std::string::String {
5401 use std::clone::Clone;
5402 self.next_page_token.clone()
5403 }
5404}
5405
5406/// Request message for CreateRetrohunt method.
5407#[derive(Clone, Default, PartialEq)]
5408#[non_exhaustive]
5409pub struct CreateRetrohuntRequest {
5410 /// Required. The parent of retrohunt, which is a rule.
5411 /// Format:
5412 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
5413 pub parent: std::string::String,
5414
5415 /// Required. The retrohunt to create.
5416 pub retrohunt: std::option::Option<crate::model::Retrohunt>,
5417
5418 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5419}
5420
5421impl CreateRetrohuntRequest {
5422 pub fn new() -> Self {
5423 std::default::Default::default()
5424 }
5425
5426 /// Sets the value of [parent][crate::model::CreateRetrohuntRequest::parent].
5427 ///
5428 /// # Example
5429 /// ```ignore,no_run
5430 /// # use google_cloud_chronicle_v1::model::CreateRetrohuntRequest;
5431 /// let x = CreateRetrohuntRequest::new().set_parent("example");
5432 /// ```
5433 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5434 self.parent = v.into();
5435 self
5436 }
5437
5438 /// Sets the value of [retrohunt][crate::model::CreateRetrohuntRequest::retrohunt].
5439 ///
5440 /// # Example
5441 /// ```ignore,no_run
5442 /// # use google_cloud_chronicle_v1::model::CreateRetrohuntRequest;
5443 /// use google_cloud_chronicle_v1::model::Retrohunt;
5444 /// let x = CreateRetrohuntRequest::new().set_retrohunt(Retrohunt::default()/* use setters */);
5445 /// ```
5446 pub fn set_retrohunt<T>(mut self, v: T) -> Self
5447 where
5448 T: std::convert::Into<crate::model::Retrohunt>,
5449 {
5450 self.retrohunt = std::option::Option::Some(v.into());
5451 self
5452 }
5453
5454 /// Sets or clears the value of [retrohunt][crate::model::CreateRetrohuntRequest::retrohunt].
5455 ///
5456 /// # Example
5457 /// ```ignore,no_run
5458 /// # use google_cloud_chronicle_v1::model::CreateRetrohuntRequest;
5459 /// use google_cloud_chronicle_v1::model::Retrohunt;
5460 /// let x = CreateRetrohuntRequest::new().set_or_clear_retrohunt(Some(Retrohunt::default()/* use setters */));
5461 /// let x = CreateRetrohuntRequest::new().set_or_clear_retrohunt(None::<Retrohunt>);
5462 /// ```
5463 pub fn set_or_clear_retrohunt<T>(mut self, v: std::option::Option<T>) -> Self
5464 where
5465 T: std::convert::Into<crate::model::Retrohunt>,
5466 {
5467 self.retrohunt = v.map(|x| x.into());
5468 self
5469 }
5470}
5471
5472impl wkt::message::Message for CreateRetrohuntRequest {
5473 fn typename() -> &'static str {
5474 "type.googleapis.com/google.cloud.chronicle.v1.CreateRetrohuntRequest"
5475 }
5476}
5477
5478/// Request message for GetRetrohunt method.
5479#[derive(Clone, Default, PartialEq)]
5480#[non_exhaustive]
5481pub struct GetRetrohuntRequest {
5482 /// Required. The name of the retrohunt to retrieve.
5483 /// Format:
5484 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/retrohunts/{retrohunt}`
5485 pub name: std::string::String,
5486
5487 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5488}
5489
5490impl GetRetrohuntRequest {
5491 pub fn new() -> Self {
5492 std::default::Default::default()
5493 }
5494
5495 /// Sets the value of [name][crate::model::GetRetrohuntRequest::name].
5496 ///
5497 /// # Example
5498 /// ```ignore,no_run
5499 /// # use google_cloud_chronicle_v1::model::GetRetrohuntRequest;
5500 /// let x = GetRetrohuntRequest::new().set_name("example");
5501 /// ```
5502 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5503 self.name = v.into();
5504 self
5505 }
5506}
5507
5508impl wkt::message::Message for GetRetrohuntRequest {
5509 fn typename() -> &'static str {
5510 "type.googleapis.com/google.cloud.chronicle.v1.GetRetrohuntRequest"
5511 }
5512}
5513
5514/// Request message for ListRetrohunts method.
5515#[derive(Clone, Default, PartialEq)]
5516#[non_exhaustive]
5517pub struct ListRetrohuntsRequest {
5518 /// Required. The rule that the retrohunts belong to.
5519 /// Format:
5520 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}`
5521 pub parent: std::string::String,
5522
5523 /// The maximum number of retrohunt to return. The service may return fewer
5524 /// than this value. If unspecified, at most 100 retrohunts will be returned.
5525 /// The maximum value is 1000; values above 1000 will be coerced to
5526 /// 1000.
5527 pub page_size: i32,
5528
5529 /// A page token, received from a previous `ListRetrohunts` call.
5530 /// Provide this to retrieve the subsequent page.
5531 ///
5532 /// When paginating, all other parameters provided to `ListRetrohunts` must
5533 /// match the call that provided the page token.
5534 pub page_token: std::string::String,
5535
5536 /// A filter that can be used to retrieve specific rule deployments.
5537 /// The following fields are filterable:
5538 /// state
5539 pub filter: std::string::String,
5540
5541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5542}
5543
5544impl ListRetrohuntsRequest {
5545 pub fn new() -> Self {
5546 std::default::Default::default()
5547 }
5548
5549 /// Sets the value of [parent][crate::model::ListRetrohuntsRequest::parent].
5550 ///
5551 /// # Example
5552 /// ```ignore,no_run
5553 /// # use google_cloud_chronicle_v1::model::ListRetrohuntsRequest;
5554 /// let x = ListRetrohuntsRequest::new().set_parent("example");
5555 /// ```
5556 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5557 self.parent = v.into();
5558 self
5559 }
5560
5561 /// Sets the value of [page_size][crate::model::ListRetrohuntsRequest::page_size].
5562 ///
5563 /// # Example
5564 /// ```ignore,no_run
5565 /// # use google_cloud_chronicle_v1::model::ListRetrohuntsRequest;
5566 /// let x = ListRetrohuntsRequest::new().set_page_size(42);
5567 /// ```
5568 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5569 self.page_size = v.into();
5570 self
5571 }
5572
5573 /// Sets the value of [page_token][crate::model::ListRetrohuntsRequest::page_token].
5574 ///
5575 /// # Example
5576 /// ```ignore,no_run
5577 /// # use google_cloud_chronicle_v1::model::ListRetrohuntsRequest;
5578 /// let x = ListRetrohuntsRequest::new().set_page_token("example");
5579 /// ```
5580 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5581 self.page_token = v.into();
5582 self
5583 }
5584
5585 /// Sets the value of [filter][crate::model::ListRetrohuntsRequest::filter].
5586 ///
5587 /// # Example
5588 /// ```ignore,no_run
5589 /// # use google_cloud_chronicle_v1::model::ListRetrohuntsRequest;
5590 /// let x = ListRetrohuntsRequest::new().set_filter("example");
5591 /// ```
5592 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5593 self.filter = v.into();
5594 self
5595 }
5596}
5597
5598impl wkt::message::Message for ListRetrohuntsRequest {
5599 fn typename() -> &'static str {
5600 "type.googleapis.com/google.cloud.chronicle.v1.ListRetrohuntsRequest"
5601 }
5602}
5603
5604/// Response message for ListRetrohunts method.
5605#[derive(Clone, Default, PartialEq)]
5606#[non_exhaustive]
5607pub struct ListRetrohuntsResponse {
5608 /// The retrohunts from the specified rule.
5609 pub retrohunts: std::vec::Vec<crate::model::Retrohunt>,
5610
5611 /// A token, which can be sent as `page_token` to retrieve the next page.
5612 /// If this field is omitted, there are no subsequent pages.
5613 pub next_page_token: std::string::String,
5614
5615 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5616}
5617
5618impl ListRetrohuntsResponse {
5619 pub fn new() -> Self {
5620 std::default::Default::default()
5621 }
5622
5623 /// Sets the value of [retrohunts][crate::model::ListRetrohuntsResponse::retrohunts].
5624 ///
5625 /// # Example
5626 /// ```ignore,no_run
5627 /// # use google_cloud_chronicle_v1::model::ListRetrohuntsResponse;
5628 /// use google_cloud_chronicle_v1::model::Retrohunt;
5629 /// let x = ListRetrohuntsResponse::new()
5630 /// .set_retrohunts([
5631 /// Retrohunt::default()/* use setters */,
5632 /// Retrohunt::default()/* use (different) setters */,
5633 /// ]);
5634 /// ```
5635 pub fn set_retrohunts<T, V>(mut self, v: T) -> Self
5636 where
5637 T: std::iter::IntoIterator<Item = V>,
5638 V: std::convert::Into<crate::model::Retrohunt>,
5639 {
5640 use std::iter::Iterator;
5641 self.retrohunts = v.into_iter().map(|i| i.into()).collect();
5642 self
5643 }
5644
5645 /// Sets the value of [next_page_token][crate::model::ListRetrohuntsResponse::next_page_token].
5646 ///
5647 /// # Example
5648 /// ```ignore,no_run
5649 /// # use google_cloud_chronicle_v1::model::ListRetrohuntsResponse;
5650 /// let x = ListRetrohuntsResponse::new().set_next_page_token("example");
5651 /// ```
5652 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5653 self.next_page_token = v.into();
5654 self
5655 }
5656}
5657
5658impl wkt::message::Message for ListRetrohuntsResponse {
5659 fn typename() -> &'static str {
5660 "type.googleapis.com/google.cloud.chronicle.v1.ListRetrohuntsResponse"
5661 }
5662}
5663
5664#[doc(hidden)]
5665impl google_cloud_gax::paginator::internal::PageableResponse for ListRetrohuntsResponse {
5666 type PageItem = crate::model::Retrohunt;
5667
5668 fn items(self) -> std::vec::Vec<Self::PageItem> {
5669 self.retrohunts
5670 }
5671
5672 fn next_page_token(&self) -> std::string::String {
5673 use std::clone::Clone;
5674 self.next_page_token.clone()
5675 }
5676}
5677
5678/// Request message for GetRuleDeployment.
5679#[derive(Clone, Default, PartialEq)]
5680#[non_exhaustive]
5681pub struct GetRuleDeploymentRequest {
5682 /// Required. The name of the rule deployment to retrieve.
5683 /// Format:
5684 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment`
5685 pub name: std::string::String,
5686
5687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5688}
5689
5690impl GetRuleDeploymentRequest {
5691 pub fn new() -> Self {
5692 std::default::Default::default()
5693 }
5694
5695 /// Sets the value of [name][crate::model::GetRuleDeploymentRequest::name].
5696 ///
5697 /// # Example
5698 /// ```ignore,no_run
5699 /// # use google_cloud_chronicle_v1::model::GetRuleDeploymentRequest;
5700 /// let x = GetRuleDeploymentRequest::new().set_name("example");
5701 /// ```
5702 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5703 self.name = v.into();
5704 self
5705 }
5706}
5707
5708impl wkt::message::Message for GetRuleDeploymentRequest {
5709 fn typename() -> &'static str {
5710 "type.googleapis.com/google.cloud.chronicle.v1.GetRuleDeploymentRequest"
5711 }
5712}
5713
5714/// Request message for ListRuleDeployments.
5715#[derive(Clone, Default, PartialEq)]
5716#[non_exhaustive]
5717pub struct ListRuleDeploymentsRequest {
5718 /// Required. The collection of all parents which own all rule deployments. The
5719 /// "-" wildcard token must be used as the rule identifier in the resource
5720 /// path. Format:
5721 /// `projects/{project}/locations/{location}/instances/{instance}/rules/-`
5722 pub parent: std::string::String,
5723
5724 /// The maximum number of rule deployments to return. The service may return
5725 /// fewer than this value. If unspecified, at most 100 rule deployments will be
5726 /// returned. The maximum value is 1000; values above 1000 will be coerced to
5727 /// 1000.
5728 pub page_size: i32,
5729
5730 /// A page token, received from a previous `ListRuleDeployments` call.
5731 /// Provide this to retrieve the subsequent page.
5732 ///
5733 /// When paginating, all other parameters provided to `ListRuleDeployments`
5734 /// must match the call that provided the page token.
5735 pub page_token: std::string::String,
5736
5737 /// A filter that can be used to retrieve specific rule deployments.
5738 /// The following fields are filterable:
5739 /// archived, name
5740 pub filter: std::string::String,
5741
5742 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5743}
5744
5745impl ListRuleDeploymentsRequest {
5746 pub fn new() -> Self {
5747 std::default::Default::default()
5748 }
5749
5750 /// Sets the value of [parent][crate::model::ListRuleDeploymentsRequest::parent].
5751 ///
5752 /// # Example
5753 /// ```ignore,no_run
5754 /// # use google_cloud_chronicle_v1::model::ListRuleDeploymentsRequest;
5755 /// let x = ListRuleDeploymentsRequest::new().set_parent("example");
5756 /// ```
5757 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5758 self.parent = v.into();
5759 self
5760 }
5761
5762 /// Sets the value of [page_size][crate::model::ListRuleDeploymentsRequest::page_size].
5763 ///
5764 /// # Example
5765 /// ```ignore,no_run
5766 /// # use google_cloud_chronicle_v1::model::ListRuleDeploymentsRequest;
5767 /// let x = ListRuleDeploymentsRequest::new().set_page_size(42);
5768 /// ```
5769 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5770 self.page_size = v.into();
5771 self
5772 }
5773
5774 /// Sets the value of [page_token][crate::model::ListRuleDeploymentsRequest::page_token].
5775 ///
5776 /// # Example
5777 /// ```ignore,no_run
5778 /// # use google_cloud_chronicle_v1::model::ListRuleDeploymentsRequest;
5779 /// let x = ListRuleDeploymentsRequest::new().set_page_token("example");
5780 /// ```
5781 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5782 self.page_token = v.into();
5783 self
5784 }
5785
5786 /// Sets the value of [filter][crate::model::ListRuleDeploymentsRequest::filter].
5787 ///
5788 /// # Example
5789 /// ```ignore,no_run
5790 /// # use google_cloud_chronicle_v1::model::ListRuleDeploymentsRequest;
5791 /// let x = ListRuleDeploymentsRequest::new().set_filter("example");
5792 /// ```
5793 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5794 self.filter = v.into();
5795 self
5796 }
5797}
5798
5799impl wkt::message::Message for ListRuleDeploymentsRequest {
5800 fn typename() -> &'static str {
5801 "type.googleapis.com/google.cloud.chronicle.v1.ListRuleDeploymentsRequest"
5802 }
5803}
5804
5805/// Response message for ListRuleDeployments.
5806#[derive(Clone, Default, PartialEq)]
5807#[non_exhaustive]
5808pub struct ListRuleDeploymentsResponse {
5809 /// The rule deployments from all rules.
5810 pub rule_deployments: std::vec::Vec<crate::model::RuleDeployment>,
5811
5812 /// A token, which can be sent as `page_token` to retrieve the next page.
5813 /// If this field is omitted, there are no subsequent pages.
5814 pub next_page_token: std::string::String,
5815
5816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5817}
5818
5819impl ListRuleDeploymentsResponse {
5820 pub fn new() -> Self {
5821 std::default::Default::default()
5822 }
5823
5824 /// Sets the value of [rule_deployments][crate::model::ListRuleDeploymentsResponse::rule_deployments].
5825 ///
5826 /// # Example
5827 /// ```ignore,no_run
5828 /// # use google_cloud_chronicle_v1::model::ListRuleDeploymentsResponse;
5829 /// use google_cloud_chronicle_v1::model::RuleDeployment;
5830 /// let x = ListRuleDeploymentsResponse::new()
5831 /// .set_rule_deployments([
5832 /// RuleDeployment::default()/* use setters */,
5833 /// RuleDeployment::default()/* use (different) setters */,
5834 /// ]);
5835 /// ```
5836 pub fn set_rule_deployments<T, V>(mut self, v: T) -> Self
5837 where
5838 T: std::iter::IntoIterator<Item = V>,
5839 V: std::convert::Into<crate::model::RuleDeployment>,
5840 {
5841 use std::iter::Iterator;
5842 self.rule_deployments = v.into_iter().map(|i| i.into()).collect();
5843 self
5844 }
5845
5846 /// Sets the value of [next_page_token][crate::model::ListRuleDeploymentsResponse::next_page_token].
5847 ///
5848 /// # Example
5849 /// ```ignore,no_run
5850 /// # use google_cloud_chronicle_v1::model::ListRuleDeploymentsResponse;
5851 /// let x = ListRuleDeploymentsResponse::new().set_next_page_token("example");
5852 /// ```
5853 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5854 self.next_page_token = v.into();
5855 self
5856 }
5857}
5858
5859impl wkt::message::Message for ListRuleDeploymentsResponse {
5860 fn typename() -> &'static str {
5861 "type.googleapis.com/google.cloud.chronicle.v1.ListRuleDeploymentsResponse"
5862 }
5863}
5864
5865#[doc(hidden)]
5866impl google_cloud_gax::paginator::internal::PageableResponse for ListRuleDeploymentsResponse {
5867 type PageItem = crate::model::RuleDeployment;
5868
5869 fn items(self) -> std::vec::Vec<Self::PageItem> {
5870 self.rule_deployments
5871 }
5872
5873 fn next_page_token(&self) -> std::string::String {
5874 use std::clone::Clone;
5875 self.next_page_token.clone()
5876 }
5877}
5878
5879/// Request message for UpdateRuleDeployment.
5880#[derive(Clone, Default, PartialEq)]
5881#[non_exhaustive]
5882pub struct UpdateRuleDeploymentRequest {
5883 /// Required. The rule deployment to update.
5884 ///
5885 /// The rule deployment's `name` field is used to identify the rule deployment
5886 /// to update. Format:
5887 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/deployment`
5888 pub rule_deployment: std::option::Option<crate::model::RuleDeployment>,
5889
5890 /// Required. The list of fields to update.
5891 pub update_mask: std::option::Option<wkt::FieldMask>,
5892
5893 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5894}
5895
5896impl UpdateRuleDeploymentRequest {
5897 pub fn new() -> Self {
5898 std::default::Default::default()
5899 }
5900
5901 /// Sets the value of [rule_deployment][crate::model::UpdateRuleDeploymentRequest::rule_deployment].
5902 ///
5903 /// # Example
5904 /// ```ignore,no_run
5905 /// # use google_cloud_chronicle_v1::model::UpdateRuleDeploymentRequest;
5906 /// use google_cloud_chronicle_v1::model::RuleDeployment;
5907 /// let x = UpdateRuleDeploymentRequest::new().set_rule_deployment(RuleDeployment::default()/* use setters */);
5908 /// ```
5909 pub fn set_rule_deployment<T>(mut self, v: T) -> Self
5910 where
5911 T: std::convert::Into<crate::model::RuleDeployment>,
5912 {
5913 self.rule_deployment = std::option::Option::Some(v.into());
5914 self
5915 }
5916
5917 /// Sets or clears the value of [rule_deployment][crate::model::UpdateRuleDeploymentRequest::rule_deployment].
5918 ///
5919 /// # Example
5920 /// ```ignore,no_run
5921 /// # use google_cloud_chronicle_v1::model::UpdateRuleDeploymentRequest;
5922 /// use google_cloud_chronicle_v1::model::RuleDeployment;
5923 /// let x = UpdateRuleDeploymentRequest::new().set_or_clear_rule_deployment(Some(RuleDeployment::default()/* use setters */));
5924 /// let x = UpdateRuleDeploymentRequest::new().set_or_clear_rule_deployment(None::<RuleDeployment>);
5925 /// ```
5926 pub fn set_or_clear_rule_deployment<T>(mut self, v: std::option::Option<T>) -> Self
5927 where
5928 T: std::convert::Into<crate::model::RuleDeployment>,
5929 {
5930 self.rule_deployment = v.map(|x| x.into());
5931 self
5932 }
5933
5934 /// Sets the value of [update_mask][crate::model::UpdateRuleDeploymentRequest::update_mask].
5935 ///
5936 /// # Example
5937 /// ```ignore,no_run
5938 /// # use google_cloud_chronicle_v1::model::UpdateRuleDeploymentRequest;
5939 /// use wkt::FieldMask;
5940 /// let x = UpdateRuleDeploymentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5941 /// ```
5942 pub fn set_update_mask<T>(mut self, v: T) -> Self
5943 where
5944 T: std::convert::Into<wkt::FieldMask>,
5945 {
5946 self.update_mask = std::option::Option::Some(v.into());
5947 self
5948 }
5949
5950 /// Sets or clears the value of [update_mask][crate::model::UpdateRuleDeploymentRequest::update_mask].
5951 ///
5952 /// # Example
5953 /// ```ignore,no_run
5954 /// # use google_cloud_chronicle_v1::model::UpdateRuleDeploymentRequest;
5955 /// use wkt::FieldMask;
5956 /// let x = UpdateRuleDeploymentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5957 /// let x = UpdateRuleDeploymentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5958 /// ```
5959 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5960 where
5961 T: std::convert::Into<wkt::FieldMask>,
5962 {
5963 self.update_mask = v.map(|x| x.into());
5964 self
5965 }
5966}
5967
5968impl wkt::message::Message for UpdateRuleDeploymentRequest {
5969 fn typename() -> &'static str {
5970 "type.googleapis.com/google.cloud.chronicle.v1.UpdateRuleDeploymentRequest"
5971 }
5972}
5973
5974/// CompilationPosition represents the location of a compilation diagnostic in
5975/// rule text.
5976#[derive(Clone, Default, PartialEq)]
5977#[non_exhaustive]
5978pub struct CompilationPosition {
5979 /// Output only. Start line number, beginning at 1.
5980 pub start_line: i32,
5981
5982 /// Output only. Start column number, beginning at 1.
5983 pub start_column: i32,
5984
5985 /// Output only. End line number, beginning at 1.
5986 pub end_line: i32,
5987
5988 /// Output only. End column number, beginning at 1.
5989 pub end_column: i32,
5990
5991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5992}
5993
5994impl CompilationPosition {
5995 pub fn new() -> Self {
5996 std::default::Default::default()
5997 }
5998
5999 /// Sets the value of [start_line][crate::model::CompilationPosition::start_line].
6000 ///
6001 /// # Example
6002 /// ```ignore,no_run
6003 /// # use google_cloud_chronicle_v1::model::CompilationPosition;
6004 /// let x = CompilationPosition::new().set_start_line(42);
6005 /// ```
6006 pub fn set_start_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6007 self.start_line = v.into();
6008 self
6009 }
6010
6011 /// Sets the value of [start_column][crate::model::CompilationPosition::start_column].
6012 ///
6013 /// # Example
6014 /// ```ignore,no_run
6015 /// # use google_cloud_chronicle_v1::model::CompilationPosition;
6016 /// let x = CompilationPosition::new().set_start_column(42);
6017 /// ```
6018 pub fn set_start_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6019 self.start_column = v.into();
6020 self
6021 }
6022
6023 /// Sets the value of [end_line][crate::model::CompilationPosition::end_line].
6024 ///
6025 /// # Example
6026 /// ```ignore,no_run
6027 /// # use google_cloud_chronicle_v1::model::CompilationPosition;
6028 /// let x = CompilationPosition::new().set_end_line(42);
6029 /// ```
6030 pub fn set_end_line<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6031 self.end_line = v.into();
6032 self
6033 }
6034
6035 /// Sets the value of [end_column][crate::model::CompilationPosition::end_column].
6036 ///
6037 /// # Example
6038 /// ```ignore,no_run
6039 /// # use google_cloud_chronicle_v1::model::CompilationPosition;
6040 /// let x = CompilationPosition::new().set_end_column(42);
6041 /// ```
6042 pub fn set_end_column<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6043 self.end_column = v.into();
6044 self
6045 }
6046}
6047
6048impl wkt::message::Message for CompilationPosition {
6049 fn typename() -> &'static str {
6050 "type.googleapis.com/google.cloud.chronicle.v1.CompilationPosition"
6051 }
6052}
6053
6054/// CompilationDiagnostic represents a compilation diagnostic generated
6055/// during a rule's compilation, such as a compilation error or a compilation
6056/// warning.
6057#[derive(Clone, Default, PartialEq)]
6058#[non_exhaustive]
6059pub struct CompilationDiagnostic {
6060 /// Output only. The diagnostic message.
6061 pub message: std::string::String,
6062
6063 /// Output only. The approximate position in the rule text associated with the
6064 /// compilation diagnostic.
6065 /// Compilation Position may be empty.
6066 pub position: std::option::Option<crate::model::CompilationPosition>,
6067
6068 /// Output only. The severity of a rule's compilation diagnostic.
6069 pub severity: crate::model::compilation_diagnostic::Severity,
6070
6071 /// Output only. Link to documentation that describes a diagnostic in more
6072 /// detail.
6073 pub uri: std::string::String,
6074
6075 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6076}
6077
6078impl CompilationDiagnostic {
6079 pub fn new() -> Self {
6080 std::default::Default::default()
6081 }
6082
6083 /// Sets the value of [message][crate::model::CompilationDiagnostic::message].
6084 ///
6085 /// # Example
6086 /// ```ignore,no_run
6087 /// # use google_cloud_chronicle_v1::model::CompilationDiagnostic;
6088 /// let x = CompilationDiagnostic::new().set_message("example");
6089 /// ```
6090 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6091 self.message = v.into();
6092 self
6093 }
6094
6095 /// Sets the value of [position][crate::model::CompilationDiagnostic::position].
6096 ///
6097 /// # Example
6098 /// ```ignore,no_run
6099 /// # use google_cloud_chronicle_v1::model::CompilationDiagnostic;
6100 /// use google_cloud_chronicle_v1::model::CompilationPosition;
6101 /// let x = CompilationDiagnostic::new().set_position(CompilationPosition::default()/* use setters */);
6102 /// ```
6103 pub fn set_position<T>(mut self, v: T) -> Self
6104 where
6105 T: std::convert::Into<crate::model::CompilationPosition>,
6106 {
6107 self.position = std::option::Option::Some(v.into());
6108 self
6109 }
6110
6111 /// Sets or clears the value of [position][crate::model::CompilationDiagnostic::position].
6112 ///
6113 /// # Example
6114 /// ```ignore,no_run
6115 /// # use google_cloud_chronicle_v1::model::CompilationDiagnostic;
6116 /// use google_cloud_chronicle_v1::model::CompilationPosition;
6117 /// let x = CompilationDiagnostic::new().set_or_clear_position(Some(CompilationPosition::default()/* use setters */));
6118 /// let x = CompilationDiagnostic::new().set_or_clear_position(None::<CompilationPosition>);
6119 /// ```
6120 pub fn set_or_clear_position<T>(mut self, v: std::option::Option<T>) -> Self
6121 where
6122 T: std::convert::Into<crate::model::CompilationPosition>,
6123 {
6124 self.position = v.map(|x| x.into());
6125 self
6126 }
6127
6128 /// Sets the value of [severity][crate::model::CompilationDiagnostic::severity].
6129 ///
6130 /// # Example
6131 /// ```ignore,no_run
6132 /// # use google_cloud_chronicle_v1::model::CompilationDiagnostic;
6133 /// use google_cloud_chronicle_v1::model::compilation_diagnostic::Severity;
6134 /// let x0 = CompilationDiagnostic::new().set_severity(Severity::Warning);
6135 /// let x1 = CompilationDiagnostic::new().set_severity(Severity::Error);
6136 /// ```
6137 pub fn set_severity<T: std::convert::Into<crate::model::compilation_diagnostic::Severity>>(
6138 mut self,
6139 v: T,
6140 ) -> Self {
6141 self.severity = v.into();
6142 self
6143 }
6144
6145 /// Sets the value of [uri][crate::model::CompilationDiagnostic::uri].
6146 ///
6147 /// # Example
6148 /// ```ignore,no_run
6149 /// # use google_cloud_chronicle_v1::model::CompilationDiagnostic;
6150 /// let x = CompilationDiagnostic::new().set_uri("example");
6151 /// ```
6152 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6153 self.uri = v.into();
6154 self
6155 }
6156}
6157
6158impl wkt::message::Message for CompilationDiagnostic {
6159 fn typename() -> &'static str {
6160 "type.googleapis.com/google.cloud.chronicle.v1.CompilationDiagnostic"
6161 }
6162}
6163
6164/// Defines additional types related to [CompilationDiagnostic].
6165pub mod compilation_diagnostic {
6166 #[allow(unused_imports)]
6167 use super::*;
6168
6169 /// The severity level of the compilation diagnostic.
6170 ///
6171 /// # Working with unknown values
6172 ///
6173 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6174 /// additional enum variants at any time. Adding new variants is not considered
6175 /// a breaking change. Applications should write their code in anticipation of:
6176 ///
6177 /// - New values appearing in future releases of the client library, **and**
6178 /// - New values received dynamically, without application changes.
6179 ///
6180 /// Please consult the [Working with enums] section in the user guide for some
6181 /// guidelines.
6182 ///
6183 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6184 #[derive(Clone, Debug, PartialEq)]
6185 #[non_exhaustive]
6186 pub enum Severity {
6187 /// An unspecified severity level.
6188 Unspecified,
6189 /// A compilation warning.
6190 Warning,
6191 /// A compilation error.
6192 Error,
6193 /// If set, the enum was initialized with an unknown value.
6194 ///
6195 /// Applications can examine the value using [Severity::value] or
6196 /// [Severity::name].
6197 UnknownValue(severity::UnknownValue),
6198 }
6199
6200 #[doc(hidden)]
6201 pub mod severity {
6202 #[allow(unused_imports)]
6203 use super::*;
6204 #[derive(Clone, Debug, PartialEq)]
6205 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6206 }
6207
6208 impl Severity {
6209 /// Gets the enum value.
6210 ///
6211 /// Returns `None` if the enum contains an unknown value deserialized from
6212 /// the string representation of enums.
6213 pub fn value(&self) -> std::option::Option<i32> {
6214 match self {
6215 Self::Unspecified => std::option::Option::Some(0),
6216 Self::Warning => std::option::Option::Some(1),
6217 Self::Error => std::option::Option::Some(2),
6218 Self::UnknownValue(u) => u.0.value(),
6219 }
6220 }
6221
6222 /// Gets the enum value as a string.
6223 ///
6224 /// Returns `None` if the enum contains an unknown value deserialized from
6225 /// the integer representation of enums.
6226 pub fn name(&self) -> std::option::Option<&str> {
6227 match self {
6228 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
6229 Self::Warning => std::option::Option::Some("WARNING"),
6230 Self::Error => std::option::Option::Some("ERROR"),
6231 Self::UnknownValue(u) => u.0.name(),
6232 }
6233 }
6234 }
6235
6236 impl std::default::Default for Severity {
6237 fn default() -> Self {
6238 use std::convert::From;
6239 Self::from(0)
6240 }
6241 }
6242
6243 impl std::fmt::Display for Severity {
6244 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6245 wkt::internal::display_enum(f, self.name(), self.value())
6246 }
6247 }
6248
6249 impl std::convert::From<i32> for Severity {
6250 fn from(value: i32) -> Self {
6251 match value {
6252 0 => Self::Unspecified,
6253 1 => Self::Warning,
6254 2 => Self::Error,
6255 _ => Self::UnknownValue(severity::UnknownValue(
6256 wkt::internal::UnknownEnumValue::Integer(value),
6257 )),
6258 }
6259 }
6260 }
6261
6262 impl std::convert::From<&str> for Severity {
6263 fn from(value: &str) -> Self {
6264 use std::string::ToString;
6265 match value {
6266 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
6267 "WARNING" => Self::Warning,
6268 "ERROR" => Self::Error,
6269 _ => Self::UnknownValue(severity::UnknownValue(
6270 wkt::internal::UnknownEnumValue::String(value.to_string()),
6271 )),
6272 }
6273 }
6274 }
6275
6276 impl serde::ser::Serialize for Severity {
6277 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6278 where
6279 S: serde::Serializer,
6280 {
6281 match self {
6282 Self::Unspecified => serializer.serialize_i32(0),
6283 Self::Warning => serializer.serialize_i32(1),
6284 Self::Error => serializer.serialize_i32(2),
6285 Self::UnknownValue(u) => u.0.serialize(serializer),
6286 }
6287 }
6288 }
6289
6290 impl<'de> serde::de::Deserialize<'de> for Severity {
6291 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6292 where
6293 D: serde::Deserializer<'de>,
6294 {
6295 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
6296 ".google.cloud.chronicle.v1.CompilationDiagnostic.Severity",
6297 ))
6298 }
6299 }
6300}
6301
6302/// Severity represents the severity level of the rule.
6303#[derive(Clone, Default, PartialEq)]
6304#[non_exhaustive]
6305pub struct Severity {
6306 /// The display name of the severity level. Extracted from the meta section of
6307 /// the rule text.
6308 pub display_name: std::string::String,
6309
6310 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6311}
6312
6313impl Severity {
6314 pub fn new() -> Self {
6315 std::default::Default::default()
6316 }
6317
6318 /// Sets the value of [display_name][crate::model::Severity::display_name].
6319 ///
6320 /// # Example
6321 /// ```ignore,no_run
6322 /// # use google_cloud_chronicle_v1::model::Severity;
6323 /// let x = Severity::new().set_display_name("example");
6324 /// ```
6325 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6326 self.display_name = v.into();
6327 self
6328 }
6329}
6330
6331impl wkt::message::Message for Severity {
6332 fn typename() -> &'static str {
6333 "type.googleapis.com/google.cloud.chronicle.v1.Severity"
6334 }
6335}
6336
6337/// Operation Metadata for Retrohunts.
6338#[derive(Clone, Default, PartialEq)]
6339#[non_exhaustive]
6340pub struct RetrohuntMetadata {
6341 /// The name of the retrohunt.
6342 /// Format:
6343 /// `projects/{project}/locations/{location}/instances/{instance}/rules/{rule}/retrohunts/{retrohunt}`
6344 pub retrohunt: std::string::String,
6345
6346 /// The start and end time of the retrohunt execution. If the retrohunt is not
6347 /// yet finished, the end time of the interval will not be filled.
6348 pub execution_interval: std::option::Option<google_cloud_type::model::Interval>,
6349
6350 /// Percent progress of the retrohunt towards completion, from 0.00 to 100.00.
6351 pub progress_percentage: f32,
6352
6353 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6354}
6355
6356impl RetrohuntMetadata {
6357 pub fn new() -> Self {
6358 std::default::Default::default()
6359 }
6360
6361 /// Sets the value of [retrohunt][crate::model::RetrohuntMetadata::retrohunt].
6362 ///
6363 /// # Example
6364 /// ```ignore,no_run
6365 /// # use google_cloud_chronicle_v1::model::RetrohuntMetadata;
6366 /// let x = RetrohuntMetadata::new().set_retrohunt("example");
6367 /// ```
6368 pub fn set_retrohunt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6369 self.retrohunt = v.into();
6370 self
6371 }
6372
6373 /// Sets the value of [execution_interval][crate::model::RetrohuntMetadata::execution_interval].
6374 ///
6375 /// # Example
6376 /// ```ignore,no_run
6377 /// # use google_cloud_chronicle_v1::model::RetrohuntMetadata;
6378 /// use google_cloud_type::model::Interval;
6379 /// let x = RetrohuntMetadata::new().set_execution_interval(Interval::default()/* use setters */);
6380 /// ```
6381 pub fn set_execution_interval<T>(mut self, v: T) -> Self
6382 where
6383 T: std::convert::Into<google_cloud_type::model::Interval>,
6384 {
6385 self.execution_interval = std::option::Option::Some(v.into());
6386 self
6387 }
6388
6389 /// Sets or clears the value of [execution_interval][crate::model::RetrohuntMetadata::execution_interval].
6390 ///
6391 /// # Example
6392 /// ```ignore,no_run
6393 /// # use google_cloud_chronicle_v1::model::RetrohuntMetadata;
6394 /// use google_cloud_type::model::Interval;
6395 /// let x = RetrohuntMetadata::new().set_or_clear_execution_interval(Some(Interval::default()/* use setters */));
6396 /// let x = RetrohuntMetadata::new().set_or_clear_execution_interval(None::<Interval>);
6397 /// ```
6398 pub fn set_or_clear_execution_interval<T>(mut self, v: std::option::Option<T>) -> Self
6399 where
6400 T: std::convert::Into<google_cloud_type::model::Interval>,
6401 {
6402 self.execution_interval = v.map(|x| x.into());
6403 self
6404 }
6405
6406 /// Sets the value of [progress_percentage][crate::model::RetrohuntMetadata::progress_percentage].
6407 ///
6408 /// # Example
6409 /// ```ignore,no_run
6410 /// # use google_cloud_chronicle_v1::model::RetrohuntMetadata;
6411 /// let x = RetrohuntMetadata::new().set_progress_percentage(42.0);
6412 /// ```
6413 pub fn set_progress_percentage<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6414 self.progress_percentage = v.into();
6415 self
6416 }
6417}
6418
6419impl wkt::message::Message for RetrohuntMetadata {
6420 fn typename() -> &'static str {
6421 "type.googleapis.com/google.cloud.chronicle.v1.RetrohuntMetadata"
6422 }
6423}
6424
6425/// InputsUsed is a convenience field that tells us which sources
6426/// of events (if any) were used in the rule.
6427/// NEXT TAG: 4
6428#[derive(Clone, Default, PartialEq)]
6429#[non_exhaustive]
6430pub struct InputsUsed {
6431 /// Optional. Whether the rule queries UDM events.
6432 pub uses_udm: bool,
6433
6434 /// Optional. Whether the rule queries entity events.
6435 pub uses_entity: bool,
6436
6437 /// Optional. Whether the rule queries detections.
6438 pub uses_detection: bool,
6439
6440 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6441}
6442
6443impl InputsUsed {
6444 pub fn new() -> Self {
6445 std::default::Default::default()
6446 }
6447
6448 /// Sets the value of [uses_udm][crate::model::InputsUsed::uses_udm].
6449 ///
6450 /// # Example
6451 /// ```ignore,no_run
6452 /// # use google_cloud_chronicle_v1::model::InputsUsed;
6453 /// let x = InputsUsed::new().set_uses_udm(true);
6454 /// ```
6455 pub fn set_uses_udm<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6456 self.uses_udm = v.into();
6457 self
6458 }
6459
6460 /// Sets the value of [uses_entity][crate::model::InputsUsed::uses_entity].
6461 ///
6462 /// # Example
6463 /// ```ignore,no_run
6464 /// # use google_cloud_chronicle_v1::model::InputsUsed;
6465 /// let x = InputsUsed::new().set_uses_entity(true);
6466 /// ```
6467 pub fn set_uses_entity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6468 self.uses_entity = v.into();
6469 self
6470 }
6471
6472 /// Sets the value of [uses_detection][crate::model::InputsUsed::uses_detection].
6473 ///
6474 /// # Example
6475 /// ```ignore,no_run
6476 /// # use google_cloud_chronicle_v1::model::InputsUsed;
6477 /// let x = InputsUsed::new().set_uses_detection(true);
6478 /// ```
6479 pub fn set_uses_detection<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6480 self.uses_detection = v.into();
6481 self
6482 }
6483}
6484
6485impl wkt::message::Message for InputsUsed {
6486 fn typename() -> &'static str {
6487 "type.googleapis.com/google.cloud.chronicle.v1.InputsUsed"
6488 }
6489}
6490
6491/// The syntax type indicating how list entries should be validated.
6492///
6493/// # Working with unknown values
6494///
6495/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6496/// additional enum variants at any time. Adding new variants is not considered
6497/// a breaking change. Applications should write their code in anticipation of:
6498///
6499/// - New values appearing in future releases of the client library, **and**
6500/// - New values received dynamically, without application changes.
6501///
6502/// Please consult the [Working with enums] section in the user guide for some
6503/// guidelines.
6504///
6505/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6506#[derive(Clone, Debug, PartialEq)]
6507#[non_exhaustive]
6508pub enum ReferenceListSyntaxType {
6509 /// Defaults to REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING.
6510 Unspecified,
6511 /// List contains plain text patterns.
6512 PlainTextString,
6513 /// List contains only Regular Expression patterns.
6514 Regex,
6515 /// List contains only CIDR patterns.
6516 Cidr,
6517 /// If set, the enum was initialized with an unknown value.
6518 ///
6519 /// Applications can examine the value using [ReferenceListSyntaxType::value] or
6520 /// [ReferenceListSyntaxType::name].
6521 UnknownValue(reference_list_syntax_type::UnknownValue),
6522}
6523
6524#[doc(hidden)]
6525pub mod reference_list_syntax_type {
6526 #[allow(unused_imports)]
6527 use super::*;
6528 #[derive(Clone, Debug, PartialEq)]
6529 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6530}
6531
6532impl ReferenceListSyntaxType {
6533 /// Gets the enum value.
6534 ///
6535 /// Returns `None` if the enum contains an unknown value deserialized from
6536 /// the string representation of enums.
6537 pub fn value(&self) -> std::option::Option<i32> {
6538 match self {
6539 Self::Unspecified => std::option::Option::Some(0),
6540 Self::PlainTextString => std::option::Option::Some(1),
6541 Self::Regex => std::option::Option::Some(2),
6542 Self::Cidr => std::option::Option::Some(3),
6543 Self::UnknownValue(u) => u.0.value(),
6544 }
6545 }
6546
6547 /// Gets the enum value as a string.
6548 ///
6549 /// Returns `None` if the enum contains an unknown value deserialized from
6550 /// the integer representation of enums.
6551 pub fn name(&self) -> std::option::Option<&str> {
6552 match self {
6553 Self::Unspecified => {
6554 std::option::Option::Some("REFERENCE_LIST_SYNTAX_TYPE_UNSPECIFIED")
6555 }
6556 Self::PlainTextString => {
6557 std::option::Option::Some("REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING")
6558 }
6559 Self::Regex => std::option::Option::Some("REFERENCE_LIST_SYNTAX_TYPE_REGEX"),
6560 Self::Cidr => std::option::Option::Some("REFERENCE_LIST_SYNTAX_TYPE_CIDR"),
6561 Self::UnknownValue(u) => u.0.name(),
6562 }
6563 }
6564}
6565
6566impl std::default::Default for ReferenceListSyntaxType {
6567 fn default() -> Self {
6568 use std::convert::From;
6569 Self::from(0)
6570 }
6571}
6572
6573impl std::fmt::Display for ReferenceListSyntaxType {
6574 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6575 wkt::internal::display_enum(f, self.name(), self.value())
6576 }
6577}
6578
6579impl std::convert::From<i32> for ReferenceListSyntaxType {
6580 fn from(value: i32) -> Self {
6581 match value {
6582 0 => Self::Unspecified,
6583 1 => Self::PlainTextString,
6584 2 => Self::Regex,
6585 3 => Self::Cidr,
6586 _ => Self::UnknownValue(reference_list_syntax_type::UnknownValue(
6587 wkt::internal::UnknownEnumValue::Integer(value),
6588 )),
6589 }
6590 }
6591}
6592
6593impl std::convert::From<&str> for ReferenceListSyntaxType {
6594 fn from(value: &str) -> Self {
6595 use std::string::ToString;
6596 match value {
6597 "REFERENCE_LIST_SYNTAX_TYPE_UNSPECIFIED" => Self::Unspecified,
6598 "REFERENCE_LIST_SYNTAX_TYPE_PLAIN_TEXT_STRING" => Self::PlainTextString,
6599 "REFERENCE_LIST_SYNTAX_TYPE_REGEX" => Self::Regex,
6600 "REFERENCE_LIST_SYNTAX_TYPE_CIDR" => Self::Cidr,
6601 _ => Self::UnknownValue(reference_list_syntax_type::UnknownValue(
6602 wkt::internal::UnknownEnumValue::String(value.to_string()),
6603 )),
6604 }
6605 }
6606}
6607
6608impl serde::ser::Serialize for ReferenceListSyntaxType {
6609 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6610 where
6611 S: serde::Serializer,
6612 {
6613 match self {
6614 Self::Unspecified => serializer.serialize_i32(0),
6615 Self::PlainTextString => serializer.serialize_i32(1),
6616 Self::Regex => serializer.serialize_i32(2),
6617 Self::Cidr => serializer.serialize_i32(3),
6618 Self::UnknownValue(u) => u.0.serialize(serializer),
6619 }
6620 }
6621}
6622
6623impl<'de> serde::de::Deserialize<'de> for ReferenceListSyntaxType {
6624 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6625 where
6626 D: serde::Deserializer<'de>,
6627 {
6628 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReferenceListSyntaxType>::new(
6629 ".google.cloud.chronicle.v1.ReferenceListSyntaxType",
6630 ))
6631 }
6632}
6633
6634/// ReferenceListView is a mechanism for viewing partial responses of the
6635/// ReferenceList resource.
6636///
6637/// # Working with unknown values
6638///
6639/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6640/// additional enum variants at any time. Adding new variants is not considered
6641/// a breaking change. Applications should write their code in anticipation of:
6642///
6643/// - New values appearing in future releases of the client library, **and**
6644/// - New values received dynamically, without application changes.
6645///
6646/// Please consult the [Working with enums] section in the user guide for some
6647/// guidelines.
6648///
6649/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6650#[derive(Clone, Debug, PartialEq)]
6651#[non_exhaustive]
6652pub enum ReferenceListView {
6653 /// The default / unset value.
6654 /// The API will default to the BASIC view for ListReferenceLists.
6655 /// The API will default to the FULL view for methods that return a single
6656 /// ReferenceList resource.
6657 Unspecified,
6658 /// Include metadata about the ReferenceList.
6659 /// This is the default view for ListReferenceLists.
6660 Basic,
6661 /// Include all details about the ReferenceList: metadata, content lines,
6662 /// associated rule counts. This is the default view for GetReferenceList.
6663 Full,
6664 /// If set, the enum was initialized with an unknown value.
6665 ///
6666 /// Applications can examine the value using [ReferenceListView::value] or
6667 /// [ReferenceListView::name].
6668 UnknownValue(reference_list_view::UnknownValue),
6669}
6670
6671#[doc(hidden)]
6672pub mod reference_list_view {
6673 #[allow(unused_imports)]
6674 use super::*;
6675 #[derive(Clone, Debug, PartialEq)]
6676 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6677}
6678
6679impl ReferenceListView {
6680 /// Gets the enum value.
6681 ///
6682 /// Returns `None` if the enum contains an unknown value deserialized from
6683 /// the string representation of enums.
6684 pub fn value(&self) -> std::option::Option<i32> {
6685 match self {
6686 Self::Unspecified => std::option::Option::Some(0),
6687 Self::Basic => std::option::Option::Some(1),
6688 Self::Full => std::option::Option::Some(2),
6689 Self::UnknownValue(u) => u.0.value(),
6690 }
6691 }
6692
6693 /// Gets the enum value as a string.
6694 ///
6695 /// Returns `None` if the enum contains an unknown value deserialized from
6696 /// the integer representation of enums.
6697 pub fn name(&self) -> std::option::Option<&str> {
6698 match self {
6699 Self::Unspecified => std::option::Option::Some("REFERENCE_LIST_VIEW_UNSPECIFIED"),
6700 Self::Basic => std::option::Option::Some("REFERENCE_LIST_VIEW_BASIC"),
6701 Self::Full => std::option::Option::Some("REFERENCE_LIST_VIEW_FULL"),
6702 Self::UnknownValue(u) => u.0.name(),
6703 }
6704 }
6705}
6706
6707impl std::default::Default for ReferenceListView {
6708 fn default() -> Self {
6709 use std::convert::From;
6710 Self::from(0)
6711 }
6712}
6713
6714impl std::fmt::Display for ReferenceListView {
6715 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6716 wkt::internal::display_enum(f, self.name(), self.value())
6717 }
6718}
6719
6720impl std::convert::From<i32> for ReferenceListView {
6721 fn from(value: i32) -> Self {
6722 match value {
6723 0 => Self::Unspecified,
6724 1 => Self::Basic,
6725 2 => Self::Full,
6726 _ => Self::UnknownValue(reference_list_view::UnknownValue(
6727 wkt::internal::UnknownEnumValue::Integer(value),
6728 )),
6729 }
6730 }
6731}
6732
6733impl std::convert::From<&str> for ReferenceListView {
6734 fn from(value: &str) -> Self {
6735 use std::string::ToString;
6736 match value {
6737 "REFERENCE_LIST_VIEW_UNSPECIFIED" => Self::Unspecified,
6738 "REFERENCE_LIST_VIEW_BASIC" => Self::Basic,
6739 "REFERENCE_LIST_VIEW_FULL" => Self::Full,
6740 _ => Self::UnknownValue(reference_list_view::UnknownValue(
6741 wkt::internal::UnknownEnumValue::String(value.to_string()),
6742 )),
6743 }
6744 }
6745}
6746
6747impl serde::ser::Serialize for ReferenceListView {
6748 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6749 where
6750 S: serde::Serializer,
6751 {
6752 match self {
6753 Self::Unspecified => serializer.serialize_i32(0),
6754 Self::Basic => serializer.serialize_i32(1),
6755 Self::Full => serializer.serialize_i32(2),
6756 Self::UnknownValue(u) => u.0.serialize(serializer),
6757 }
6758 }
6759}
6760
6761impl<'de> serde::de::Deserialize<'de> for ReferenceListView {
6762 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6763 where
6764 D: serde::Deserializer<'de>,
6765 {
6766 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReferenceListView>::new(
6767 ".google.cloud.chronicle.v1.ReferenceListView",
6768 ))
6769 }
6770}
6771
6772/// RunFrequency indicates the run frequency at which a YARA-L 2 rule will run if
6773/// enabled.
6774///
6775/// # Working with unknown values
6776///
6777/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6778/// additional enum variants at any time. Adding new variants is not considered
6779/// a breaking change. Applications should write their code in anticipation of:
6780///
6781/// - New values appearing in future releases of the client library, **and**
6782/// - New values received dynamically, without application changes.
6783///
6784/// Please consult the [Working with enums] section in the user guide for some
6785/// guidelines.
6786///
6787/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6788#[derive(Clone, Debug, PartialEq)]
6789#[non_exhaustive]
6790pub enum RunFrequency {
6791 /// The run frequency is unspecified/unknown.
6792 Unspecified,
6793 /// Executes in real time.
6794 Live,
6795 /// Executes once per hour.
6796 Hourly,
6797 /// Executes once per day.
6798 Daily,
6799 /// If set, the enum was initialized with an unknown value.
6800 ///
6801 /// Applications can examine the value using [RunFrequency::value] or
6802 /// [RunFrequency::name].
6803 UnknownValue(run_frequency::UnknownValue),
6804}
6805
6806#[doc(hidden)]
6807pub mod run_frequency {
6808 #[allow(unused_imports)]
6809 use super::*;
6810 #[derive(Clone, Debug, PartialEq)]
6811 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6812}
6813
6814impl RunFrequency {
6815 /// Gets the enum value.
6816 ///
6817 /// Returns `None` if the enum contains an unknown value deserialized from
6818 /// the string representation of enums.
6819 pub fn value(&self) -> std::option::Option<i32> {
6820 match self {
6821 Self::Unspecified => std::option::Option::Some(0),
6822 Self::Live => std::option::Option::Some(1),
6823 Self::Hourly => std::option::Option::Some(2),
6824 Self::Daily => std::option::Option::Some(3),
6825 Self::UnknownValue(u) => u.0.value(),
6826 }
6827 }
6828
6829 /// Gets the enum value as a string.
6830 ///
6831 /// Returns `None` if the enum contains an unknown value deserialized from
6832 /// the integer representation of enums.
6833 pub fn name(&self) -> std::option::Option<&str> {
6834 match self {
6835 Self::Unspecified => std::option::Option::Some("RUN_FREQUENCY_UNSPECIFIED"),
6836 Self::Live => std::option::Option::Some("LIVE"),
6837 Self::Hourly => std::option::Option::Some("HOURLY"),
6838 Self::Daily => std::option::Option::Some("DAILY"),
6839 Self::UnknownValue(u) => u.0.name(),
6840 }
6841 }
6842}
6843
6844impl std::default::Default for RunFrequency {
6845 fn default() -> Self {
6846 use std::convert::From;
6847 Self::from(0)
6848 }
6849}
6850
6851impl std::fmt::Display for RunFrequency {
6852 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6853 wkt::internal::display_enum(f, self.name(), self.value())
6854 }
6855}
6856
6857impl std::convert::From<i32> for RunFrequency {
6858 fn from(value: i32) -> Self {
6859 match value {
6860 0 => Self::Unspecified,
6861 1 => Self::Live,
6862 2 => Self::Hourly,
6863 3 => Self::Daily,
6864 _ => Self::UnknownValue(run_frequency::UnknownValue(
6865 wkt::internal::UnknownEnumValue::Integer(value),
6866 )),
6867 }
6868 }
6869}
6870
6871impl std::convert::From<&str> for RunFrequency {
6872 fn from(value: &str) -> Self {
6873 use std::string::ToString;
6874 match value {
6875 "RUN_FREQUENCY_UNSPECIFIED" => Self::Unspecified,
6876 "LIVE" => Self::Live,
6877 "HOURLY" => Self::Hourly,
6878 "DAILY" => Self::Daily,
6879 _ => Self::UnknownValue(run_frequency::UnknownValue(
6880 wkt::internal::UnknownEnumValue::String(value.to_string()),
6881 )),
6882 }
6883 }
6884}
6885
6886impl serde::ser::Serialize for RunFrequency {
6887 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6888 where
6889 S: serde::Serializer,
6890 {
6891 match self {
6892 Self::Unspecified => serializer.serialize_i32(0),
6893 Self::Live => serializer.serialize_i32(1),
6894 Self::Hourly => serializer.serialize_i32(2),
6895 Self::Daily => serializer.serialize_i32(3),
6896 Self::UnknownValue(u) => u.0.serialize(serializer),
6897 }
6898 }
6899}
6900
6901impl<'de> serde::de::Deserialize<'de> for RunFrequency {
6902 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6903 where
6904 D: serde::Deserializer<'de>,
6905 {
6906 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RunFrequency>::new(
6907 ".google.cloud.chronicle.v1.RunFrequency",
6908 ))
6909 }
6910}
6911
6912/// RuleType indicates the YARA-L rule type of user-created and Google Cloud
6913/// Threat Intelligence (GCTI) authored rules.
6914///
6915/// # Working with unknown values
6916///
6917/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6918/// additional enum variants at any time. Adding new variants is not considered
6919/// a breaking change. Applications should write their code in anticipation of:
6920///
6921/// - New values appearing in future releases of the client library, **and**
6922/// - New values received dynamically, without application changes.
6923///
6924/// Please consult the [Working with enums] section in the user guide for some
6925/// guidelines.
6926///
6927/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6928#[derive(Clone, Debug, PartialEq)]
6929#[non_exhaustive]
6930pub enum RuleType {
6931 /// The rule type is unspecified/unknown.
6932 Unspecified,
6933 /// Rule checks for the existence of a single event.
6934 SingleEvent,
6935 /// Rule checks for correlation between multiple events
6936 MultiEvent,
6937 /// If set, the enum was initialized with an unknown value.
6938 ///
6939 /// Applications can examine the value using [RuleType::value] or
6940 /// [RuleType::name].
6941 UnknownValue(rule_type::UnknownValue),
6942}
6943
6944#[doc(hidden)]
6945pub mod rule_type {
6946 #[allow(unused_imports)]
6947 use super::*;
6948 #[derive(Clone, Debug, PartialEq)]
6949 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6950}
6951
6952impl RuleType {
6953 /// Gets the enum value.
6954 ///
6955 /// Returns `None` if the enum contains an unknown value deserialized from
6956 /// the string representation of enums.
6957 pub fn value(&self) -> std::option::Option<i32> {
6958 match self {
6959 Self::Unspecified => std::option::Option::Some(0),
6960 Self::SingleEvent => std::option::Option::Some(1),
6961 Self::MultiEvent => std::option::Option::Some(2),
6962 Self::UnknownValue(u) => u.0.value(),
6963 }
6964 }
6965
6966 /// Gets the enum value as a string.
6967 ///
6968 /// Returns `None` if the enum contains an unknown value deserialized from
6969 /// the integer representation of enums.
6970 pub fn name(&self) -> std::option::Option<&str> {
6971 match self {
6972 Self::Unspecified => std::option::Option::Some("RULE_TYPE_UNSPECIFIED"),
6973 Self::SingleEvent => std::option::Option::Some("SINGLE_EVENT"),
6974 Self::MultiEvent => std::option::Option::Some("MULTI_EVENT"),
6975 Self::UnknownValue(u) => u.0.name(),
6976 }
6977 }
6978}
6979
6980impl std::default::Default for RuleType {
6981 fn default() -> Self {
6982 use std::convert::From;
6983 Self::from(0)
6984 }
6985}
6986
6987impl std::fmt::Display for RuleType {
6988 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6989 wkt::internal::display_enum(f, self.name(), self.value())
6990 }
6991}
6992
6993impl std::convert::From<i32> for RuleType {
6994 fn from(value: i32) -> Self {
6995 match value {
6996 0 => Self::Unspecified,
6997 1 => Self::SingleEvent,
6998 2 => Self::MultiEvent,
6999 _ => Self::UnknownValue(rule_type::UnknownValue(
7000 wkt::internal::UnknownEnumValue::Integer(value),
7001 )),
7002 }
7003 }
7004}
7005
7006impl std::convert::From<&str> for RuleType {
7007 fn from(value: &str) -> Self {
7008 use std::string::ToString;
7009 match value {
7010 "RULE_TYPE_UNSPECIFIED" => Self::Unspecified,
7011 "SINGLE_EVENT" => Self::SingleEvent,
7012 "MULTI_EVENT" => Self::MultiEvent,
7013 _ => Self::UnknownValue(rule_type::UnknownValue(
7014 wkt::internal::UnknownEnumValue::String(value.to_string()),
7015 )),
7016 }
7017 }
7018}
7019
7020impl serde::ser::Serialize for RuleType {
7021 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7022 where
7023 S: serde::Serializer,
7024 {
7025 match self {
7026 Self::Unspecified => serializer.serialize_i32(0),
7027 Self::SingleEvent => serializer.serialize_i32(1),
7028 Self::MultiEvent => serializer.serialize_i32(2),
7029 Self::UnknownValue(u) => u.0.serialize(serializer),
7030 }
7031 }
7032}
7033
7034impl<'de> serde::de::Deserialize<'de> for RuleType {
7035 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7036 where
7037 D: serde::Deserializer<'de>,
7038 {
7039 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RuleType>::new(
7040 ".google.cloud.chronicle.v1.RuleType",
7041 ))
7042 }
7043}
7044
7045/// RuleView indicates the scope of fields to populate when returning the Rule
7046/// resource.
7047///
7048/// # Working with unknown values
7049///
7050/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7051/// additional enum variants at any time. Adding new variants is not considered
7052/// a breaking change. Applications should write their code in anticipation of:
7053///
7054/// - New values appearing in future releases of the client library, **and**
7055/// - New values received dynamically, without application changes.
7056///
7057/// Please consult the [Working with enums] section in the user guide for some
7058/// guidelines.
7059///
7060/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7061#[derive(Clone, Debug, PartialEq)]
7062#[non_exhaustive]
7063pub enum RuleView {
7064 /// The default/unset value.
7065 /// The API will default to the BASIC view for ListRules/ListRuleRevisions.
7066 /// The API will default to the FULL view for GetRule.
7067 Unspecified,
7068 /// Include basic metadata about the rule, but not the full contents.
7069 /// Returned fields include: revision_id, revision_create_time, display_name,
7070 /// author, severity, type, allowed_run_frequency,
7071 /// near_real_time_live_rule_eligible, etag, and scope.
7072 /// This is the default value for ListRules and ListRuleRevisions.
7073 Basic,
7074 /// Include all fields.
7075 /// This is the default value for GetRule.
7076 Full,
7077 /// Include basic metadata about the rule's revision only.
7078 /// Returned fields include: revision_id and revision_create_time.
7079 RevisionMetadataOnly,
7080 /// If set, the enum was initialized with an unknown value.
7081 ///
7082 /// Applications can examine the value using [RuleView::value] or
7083 /// [RuleView::name].
7084 UnknownValue(rule_view::UnknownValue),
7085}
7086
7087#[doc(hidden)]
7088pub mod rule_view {
7089 #[allow(unused_imports)]
7090 use super::*;
7091 #[derive(Clone, Debug, PartialEq)]
7092 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7093}
7094
7095impl RuleView {
7096 /// Gets the enum value.
7097 ///
7098 /// Returns `None` if the enum contains an unknown value deserialized from
7099 /// the string representation of enums.
7100 pub fn value(&self) -> std::option::Option<i32> {
7101 match self {
7102 Self::Unspecified => std::option::Option::Some(0),
7103 Self::Basic => std::option::Option::Some(1),
7104 Self::Full => std::option::Option::Some(2),
7105 Self::RevisionMetadataOnly => std::option::Option::Some(3),
7106 Self::UnknownValue(u) => u.0.value(),
7107 }
7108 }
7109
7110 /// Gets the enum value as a string.
7111 ///
7112 /// Returns `None` if the enum contains an unknown value deserialized from
7113 /// the integer representation of enums.
7114 pub fn name(&self) -> std::option::Option<&str> {
7115 match self {
7116 Self::Unspecified => std::option::Option::Some("RULE_VIEW_UNSPECIFIED"),
7117 Self::Basic => std::option::Option::Some("BASIC"),
7118 Self::Full => std::option::Option::Some("FULL"),
7119 Self::RevisionMetadataOnly => std::option::Option::Some("REVISION_METADATA_ONLY"),
7120 Self::UnknownValue(u) => u.0.name(),
7121 }
7122 }
7123}
7124
7125impl std::default::Default for RuleView {
7126 fn default() -> Self {
7127 use std::convert::From;
7128 Self::from(0)
7129 }
7130}
7131
7132impl std::fmt::Display for RuleView {
7133 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7134 wkt::internal::display_enum(f, self.name(), self.value())
7135 }
7136}
7137
7138impl std::convert::From<i32> for RuleView {
7139 fn from(value: i32) -> Self {
7140 match value {
7141 0 => Self::Unspecified,
7142 1 => Self::Basic,
7143 2 => Self::Full,
7144 3 => Self::RevisionMetadataOnly,
7145 _ => Self::UnknownValue(rule_view::UnknownValue(
7146 wkt::internal::UnknownEnumValue::Integer(value),
7147 )),
7148 }
7149 }
7150}
7151
7152impl std::convert::From<&str> for RuleView {
7153 fn from(value: &str) -> Self {
7154 use std::string::ToString;
7155 match value {
7156 "RULE_VIEW_UNSPECIFIED" => Self::Unspecified,
7157 "BASIC" => Self::Basic,
7158 "FULL" => Self::Full,
7159 "REVISION_METADATA_ONLY" => Self::RevisionMetadataOnly,
7160 _ => Self::UnknownValue(rule_view::UnknownValue(
7161 wkt::internal::UnknownEnumValue::String(value.to_string()),
7162 )),
7163 }
7164 }
7165}
7166
7167impl serde::ser::Serialize for RuleView {
7168 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7169 where
7170 S: serde::Serializer,
7171 {
7172 match self {
7173 Self::Unspecified => serializer.serialize_i32(0),
7174 Self::Basic => serializer.serialize_i32(1),
7175 Self::Full => serializer.serialize_i32(2),
7176 Self::RevisionMetadataOnly => serializer.serialize_i32(3),
7177 Self::UnknownValue(u) => u.0.serialize(serializer),
7178 }
7179 }
7180}
7181
7182impl<'de> serde::de::Deserialize<'de> for RuleView {
7183 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7184 where
7185 D: serde::Deserializer<'de>,
7186 {
7187 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RuleView>::new(
7188 ".google.cloud.chronicle.v1.RuleView",
7189 ))
7190 }
7191}