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