google_cloud_logging_v2/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 api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate lazy_static;
26extern crate logging_type;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate rpc;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38mod debug;
39mod deserialize;
40mod serialize;
41
42/// An individual entry in a log.
43#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct LogEntry {
46 /// Required. The resource name of the log to which this log entry belongs:
47 ///
48 /// ```norust
49 /// "projects/[PROJECT_ID]/logs/[LOG_ID]"
50 /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
51 /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
52 /// "folders/[FOLDER_ID]/logs/[LOG_ID]"
53 /// ```
54 ///
55 /// A project number may be used in place of PROJECT_ID. The project number is
56 /// translated to its corresponding PROJECT_ID internally and the `log_name`
57 /// field will contain PROJECT_ID in queries and exports.
58 ///
59 /// `[LOG_ID]` must be URL-encoded within `log_name`. Example:
60 /// `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
61 ///
62 /// `[LOG_ID]` must be less than 512 characters long and can only include the
63 /// following characters: upper and lower case alphanumeric characters,
64 /// forward-slash, underscore, hyphen, and period.
65 ///
66 /// For backward compatibility, if `log_name` begins with a forward-slash, such
67 /// as `/projects/...`, then the log entry is ingested as usual, but the
68 /// forward-slash is removed. Listing the log entry will not show the leading
69 /// slash and filtering for a log name with a leading slash will never return
70 /// any results.
71 pub log_name: std::string::String,
72
73 /// Required. The monitored resource that produced this log entry.
74 ///
75 /// Example: a log entry that reports a database error would be associated with
76 /// the monitored resource designating the particular database that reported
77 /// the error.
78 pub resource: std::option::Option<api::model::MonitoredResource>,
79
80 /// Optional. The time the event described by the log entry occurred. This time
81 /// is used to compute the log entry's age and to enforce the logs retention
82 /// period. If this field is omitted in a new log entry, then Logging assigns
83 /// it the current time. Timestamps have nanosecond accuracy, but trailing
84 /// zeros in the fractional seconds might be omitted when the timestamp is
85 /// displayed.
86 ///
87 /// Incoming log entries must have timestamps that don't exceed the
88 /// [logs retention
89 /// period](https://cloud.google.com/logging/quotas#logs_retention_periods) in
90 /// the past, and that don't exceed 24 hours in the future. Log entries outside
91 /// those time boundaries aren't ingested by Logging.
92 pub timestamp: std::option::Option<wkt::Timestamp>,
93
94 /// Output only. The time the log entry was received by Logging.
95 pub receive_timestamp: std::option::Option<wkt::Timestamp>,
96
97 /// Optional. The severity of the log entry. The default value is
98 /// `LogSeverity.DEFAULT`.
99 pub severity: logging_type::model::LogSeverity,
100
101 /// Optional. A unique identifier for the log entry. If you provide a value,
102 /// then Logging considers other log entries in the same project, with the same
103 /// `timestamp`, and with the same `insert_id` to be duplicates which are
104 /// removed in a single query result. However, there are no guarantees of
105 /// de-duplication in the export of logs.
106 ///
107 /// If the `insert_id` is omitted when writing a log entry, the Logging API
108 /// assigns its own unique identifier in this field.
109 ///
110 /// In queries, the `insert_id` is also used to order log entries that have
111 /// the same `log_name` and `timestamp` values.
112 pub insert_id: std::string::String,
113
114 /// Optional. Information about the HTTP request associated with this log
115 /// entry, if applicable.
116 pub http_request: std::option::Option<logging_type::model::HttpRequest>,
117
118 /// Optional. A map of key, value pairs that provides additional information
119 /// about the log entry. The labels can be user-defined or system-defined.
120 ///
121 /// User-defined labels are arbitrary key, value pairs that you can use to
122 /// classify logs.
123 ///
124 /// System-defined labels are defined by GCP services for platform logs.
125 /// They have two components - a service namespace component and the
126 /// attribute name. For example: `compute.googleapis.com/resource_name`.
127 ///
128 /// Cloud Logging truncates label keys that exceed 512 B and label
129 /// values that exceed 64 KB upon their associated log entry being
130 /// written. The truncation is indicated by an ellipsis at the
131 /// end of the character string.
132 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
133
134 /// Optional. Information about an operation associated with the log entry, if
135 /// applicable.
136 pub operation: std::option::Option<crate::model::LogEntryOperation>,
137
138 /// Optional. The REST resource name of the trace being written to
139 /// [Cloud Trace](https://cloud.google.com/trace) in
140 /// association with this log entry. For example, if your trace data is stored
141 /// in the Cloud project "my-trace-project" and if the service that is creating
142 /// the log entry receives a trace header that includes the trace ID "12345",
143 /// then the service should use "projects/my-tracing-project/traces/12345".
144 ///
145 /// The `trace` field provides the link between logs and traces. By using
146 /// this field, you can navigate from a log entry to a trace.
147 pub trace: std::string::String,
148
149 /// Optional. The ID of the [Cloud Trace](https://cloud.google.com/trace) span
150 /// associated with the current operation in which the log is being written.
151 /// For example, if a span has the REST resource name of
152 /// "projects/some-project/traces/some-trace/spans/some-span-id", then the
153 /// `span_id` field is "some-span-id".
154 ///
155 /// A
156 /// [Span](https://cloud.google.com/trace/docs/reference/v2/rest/v2/projects.traces/batchWrite#Span)
157 /// represents a single operation within a trace. Whereas a trace may involve
158 /// multiple different microservices running on multiple different machines,
159 /// a span generally corresponds to a single logical operation being performed
160 /// in a single instance of a microservice on one specific machine. Spans
161 /// are the nodes within the tree that is a trace.
162 ///
163 /// Applications that are [instrumented for
164 /// tracing](https://cloud.google.com/trace/docs/setup) will generally assign a
165 /// new, unique span ID on each incoming request. It is also common to create
166 /// and record additional spans corresponding to internal processing elements
167 /// as well as issuing requests to dependencies.
168 ///
169 /// The span ID is expected to be a 16-character, hexadecimal encoding of an
170 /// 8-byte array and should not be zero. It should be unique within the trace
171 /// and should, ideally, be generated in a manner that is uniformly random.
172 ///
173 /// Example values:
174 ///
175 /// - `000000000000004a`
176 /// - `7a2190356c3fc94b`
177 /// - `0000f00300090021`
178 /// - `d39223e101960076`
179 pub span_id: std::string::String,
180
181 /// Optional. The sampling decision of the trace associated with the log entry.
182 ///
183 /// True means that the trace resource name in the `trace` field was sampled
184 /// for storage in a trace backend. False means that the trace was not sampled
185 /// for storage when this log entry was written, or the sampling decision was
186 /// unknown at the time. A non-sampled `trace` value is still useful as a
187 /// request correlation identifier. The default is False.
188 pub trace_sampled: bool,
189
190 /// Optional. Source code location information associated with the log entry,
191 /// if any.
192 pub source_location: std::option::Option<crate::model::LogEntrySourceLocation>,
193
194 /// Optional. Information indicating this LogEntry is part of a sequence of
195 /// multiple log entries split from a single LogEntry.
196 pub split: std::option::Option<crate::model::LogSplit>,
197
198 /// The log entry payload, which can be one of multiple types.
199 pub payload: std::option::Option<crate::model::log_entry::Payload>,
200
201 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
202}
203
204impl LogEntry {
205 pub fn new() -> Self {
206 std::default::Default::default()
207 }
208
209 /// Sets the value of [log_name][crate::model::LogEntry::log_name].
210 ///
211 /// # Example
212 /// ```ignore,no_run
213 /// # use google_cloud_logging_v2::model::LogEntry;
214 /// let x = LogEntry::new().set_log_name("example");
215 /// ```
216 pub fn set_log_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
217 self.log_name = v.into();
218 self
219 }
220
221 /// Sets the value of [resource][crate::model::LogEntry::resource].
222 ///
223 /// # Example
224 /// ```ignore,no_run
225 /// # use google_cloud_logging_v2::model::LogEntry;
226 /// use api::model::MonitoredResource;
227 /// let x = LogEntry::new().set_resource(MonitoredResource::default()/* use setters */);
228 /// ```
229 pub fn set_resource<T>(mut self, v: T) -> Self
230 where
231 T: std::convert::Into<api::model::MonitoredResource>,
232 {
233 self.resource = std::option::Option::Some(v.into());
234 self
235 }
236
237 /// Sets or clears the value of [resource][crate::model::LogEntry::resource].
238 ///
239 /// # Example
240 /// ```ignore,no_run
241 /// # use google_cloud_logging_v2::model::LogEntry;
242 /// use api::model::MonitoredResource;
243 /// let x = LogEntry::new().set_or_clear_resource(Some(MonitoredResource::default()/* use setters */));
244 /// let x = LogEntry::new().set_or_clear_resource(None::<MonitoredResource>);
245 /// ```
246 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
247 where
248 T: std::convert::Into<api::model::MonitoredResource>,
249 {
250 self.resource = v.map(|x| x.into());
251 self
252 }
253
254 /// Sets the value of [timestamp][crate::model::LogEntry::timestamp].
255 ///
256 /// # Example
257 /// ```ignore,no_run
258 /// # use google_cloud_logging_v2::model::LogEntry;
259 /// use wkt::Timestamp;
260 /// let x = LogEntry::new().set_timestamp(Timestamp::default()/* use setters */);
261 /// ```
262 pub fn set_timestamp<T>(mut self, v: T) -> Self
263 where
264 T: std::convert::Into<wkt::Timestamp>,
265 {
266 self.timestamp = std::option::Option::Some(v.into());
267 self
268 }
269
270 /// Sets or clears the value of [timestamp][crate::model::LogEntry::timestamp].
271 ///
272 /// # Example
273 /// ```ignore,no_run
274 /// # use google_cloud_logging_v2::model::LogEntry;
275 /// use wkt::Timestamp;
276 /// let x = LogEntry::new().set_or_clear_timestamp(Some(Timestamp::default()/* use setters */));
277 /// let x = LogEntry::new().set_or_clear_timestamp(None::<Timestamp>);
278 /// ```
279 pub fn set_or_clear_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
280 where
281 T: std::convert::Into<wkt::Timestamp>,
282 {
283 self.timestamp = v.map(|x| x.into());
284 self
285 }
286
287 /// Sets the value of [receive_timestamp][crate::model::LogEntry::receive_timestamp].
288 ///
289 /// # Example
290 /// ```ignore,no_run
291 /// # use google_cloud_logging_v2::model::LogEntry;
292 /// use wkt::Timestamp;
293 /// let x = LogEntry::new().set_receive_timestamp(Timestamp::default()/* use setters */);
294 /// ```
295 pub fn set_receive_timestamp<T>(mut self, v: T) -> Self
296 where
297 T: std::convert::Into<wkt::Timestamp>,
298 {
299 self.receive_timestamp = std::option::Option::Some(v.into());
300 self
301 }
302
303 /// Sets or clears the value of [receive_timestamp][crate::model::LogEntry::receive_timestamp].
304 ///
305 /// # Example
306 /// ```ignore,no_run
307 /// # use google_cloud_logging_v2::model::LogEntry;
308 /// use wkt::Timestamp;
309 /// let x = LogEntry::new().set_or_clear_receive_timestamp(Some(Timestamp::default()/* use setters */));
310 /// let x = LogEntry::new().set_or_clear_receive_timestamp(None::<Timestamp>);
311 /// ```
312 pub fn set_or_clear_receive_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
313 where
314 T: std::convert::Into<wkt::Timestamp>,
315 {
316 self.receive_timestamp = v.map(|x| x.into());
317 self
318 }
319
320 /// Sets the value of [severity][crate::model::LogEntry::severity].
321 ///
322 /// # Example
323 /// ```ignore,no_run
324 /// # use google_cloud_logging_v2::model::LogEntry;
325 /// use logging_type::model::LogSeverity;
326 /// let x0 = LogEntry::new().set_severity(LogSeverity::Debug);
327 /// let x1 = LogEntry::new().set_severity(LogSeverity::Info);
328 /// let x2 = LogEntry::new().set_severity(LogSeverity::Notice);
329 /// ```
330 pub fn set_severity<T: std::convert::Into<logging_type::model::LogSeverity>>(
331 mut self,
332 v: T,
333 ) -> Self {
334 self.severity = v.into();
335 self
336 }
337
338 /// Sets the value of [insert_id][crate::model::LogEntry::insert_id].
339 ///
340 /// # Example
341 /// ```ignore,no_run
342 /// # use google_cloud_logging_v2::model::LogEntry;
343 /// let x = LogEntry::new().set_insert_id("example");
344 /// ```
345 pub fn set_insert_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
346 self.insert_id = v.into();
347 self
348 }
349
350 /// Sets the value of [http_request][crate::model::LogEntry::http_request].
351 ///
352 /// # Example
353 /// ```ignore,no_run
354 /// # use google_cloud_logging_v2::model::LogEntry;
355 /// use logging_type::model::HttpRequest;
356 /// let x = LogEntry::new().set_http_request(HttpRequest::default()/* use setters */);
357 /// ```
358 pub fn set_http_request<T>(mut self, v: T) -> Self
359 where
360 T: std::convert::Into<logging_type::model::HttpRequest>,
361 {
362 self.http_request = std::option::Option::Some(v.into());
363 self
364 }
365
366 /// Sets or clears the value of [http_request][crate::model::LogEntry::http_request].
367 ///
368 /// # Example
369 /// ```ignore,no_run
370 /// # use google_cloud_logging_v2::model::LogEntry;
371 /// use logging_type::model::HttpRequest;
372 /// let x = LogEntry::new().set_or_clear_http_request(Some(HttpRequest::default()/* use setters */));
373 /// let x = LogEntry::new().set_or_clear_http_request(None::<HttpRequest>);
374 /// ```
375 pub fn set_or_clear_http_request<T>(mut self, v: std::option::Option<T>) -> Self
376 where
377 T: std::convert::Into<logging_type::model::HttpRequest>,
378 {
379 self.http_request = v.map(|x| x.into());
380 self
381 }
382
383 /// Sets the value of [labels][crate::model::LogEntry::labels].
384 ///
385 /// # Example
386 /// ```ignore,no_run
387 /// # use google_cloud_logging_v2::model::LogEntry;
388 /// let x = LogEntry::new().set_labels([
389 /// ("key0", "abc"),
390 /// ("key1", "xyz"),
391 /// ]);
392 /// ```
393 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
394 where
395 T: std::iter::IntoIterator<Item = (K, V)>,
396 K: std::convert::Into<std::string::String>,
397 V: std::convert::Into<std::string::String>,
398 {
399 use std::iter::Iterator;
400 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
401 self
402 }
403
404 /// Sets the value of [operation][crate::model::LogEntry::operation].
405 ///
406 /// # Example
407 /// ```ignore,no_run
408 /// # use google_cloud_logging_v2::model::LogEntry;
409 /// use google_cloud_logging_v2::model::LogEntryOperation;
410 /// let x = LogEntry::new().set_operation(LogEntryOperation::default()/* use setters */);
411 /// ```
412 pub fn set_operation<T>(mut self, v: T) -> Self
413 where
414 T: std::convert::Into<crate::model::LogEntryOperation>,
415 {
416 self.operation = std::option::Option::Some(v.into());
417 self
418 }
419
420 /// Sets or clears the value of [operation][crate::model::LogEntry::operation].
421 ///
422 /// # Example
423 /// ```ignore,no_run
424 /// # use google_cloud_logging_v2::model::LogEntry;
425 /// use google_cloud_logging_v2::model::LogEntryOperation;
426 /// let x = LogEntry::new().set_or_clear_operation(Some(LogEntryOperation::default()/* use setters */));
427 /// let x = LogEntry::new().set_or_clear_operation(None::<LogEntryOperation>);
428 /// ```
429 pub fn set_or_clear_operation<T>(mut self, v: std::option::Option<T>) -> Self
430 where
431 T: std::convert::Into<crate::model::LogEntryOperation>,
432 {
433 self.operation = v.map(|x| x.into());
434 self
435 }
436
437 /// Sets the value of [trace][crate::model::LogEntry::trace].
438 ///
439 /// # Example
440 /// ```ignore,no_run
441 /// # use google_cloud_logging_v2::model::LogEntry;
442 /// let x = LogEntry::new().set_trace("example");
443 /// ```
444 pub fn set_trace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
445 self.trace = v.into();
446 self
447 }
448
449 /// Sets the value of [span_id][crate::model::LogEntry::span_id].
450 ///
451 /// # Example
452 /// ```ignore,no_run
453 /// # use google_cloud_logging_v2::model::LogEntry;
454 /// let x = LogEntry::new().set_span_id("example");
455 /// ```
456 pub fn set_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
457 self.span_id = v.into();
458 self
459 }
460
461 /// Sets the value of [trace_sampled][crate::model::LogEntry::trace_sampled].
462 ///
463 /// # Example
464 /// ```ignore,no_run
465 /// # use google_cloud_logging_v2::model::LogEntry;
466 /// let x = LogEntry::new().set_trace_sampled(true);
467 /// ```
468 pub fn set_trace_sampled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
469 self.trace_sampled = v.into();
470 self
471 }
472
473 /// Sets the value of [source_location][crate::model::LogEntry::source_location].
474 ///
475 /// # Example
476 /// ```ignore,no_run
477 /// # use google_cloud_logging_v2::model::LogEntry;
478 /// use google_cloud_logging_v2::model::LogEntrySourceLocation;
479 /// let x = LogEntry::new().set_source_location(LogEntrySourceLocation::default()/* use setters */);
480 /// ```
481 pub fn set_source_location<T>(mut self, v: T) -> Self
482 where
483 T: std::convert::Into<crate::model::LogEntrySourceLocation>,
484 {
485 self.source_location = std::option::Option::Some(v.into());
486 self
487 }
488
489 /// Sets or clears the value of [source_location][crate::model::LogEntry::source_location].
490 ///
491 /// # Example
492 /// ```ignore,no_run
493 /// # use google_cloud_logging_v2::model::LogEntry;
494 /// use google_cloud_logging_v2::model::LogEntrySourceLocation;
495 /// let x = LogEntry::new().set_or_clear_source_location(Some(LogEntrySourceLocation::default()/* use setters */));
496 /// let x = LogEntry::new().set_or_clear_source_location(None::<LogEntrySourceLocation>);
497 /// ```
498 pub fn set_or_clear_source_location<T>(mut self, v: std::option::Option<T>) -> Self
499 where
500 T: std::convert::Into<crate::model::LogEntrySourceLocation>,
501 {
502 self.source_location = v.map(|x| x.into());
503 self
504 }
505
506 /// Sets the value of [split][crate::model::LogEntry::split].
507 ///
508 /// # Example
509 /// ```ignore,no_run
510 /// # use google_cloud_logging_v2::model::LogEntry;
511 /// use google_cloud_logging_v2::model::LogSplit;
512 /// let x = LogEntry::new().set_split(LogSplit::default()/* use setters */);
513 /// ```
514 pub fn set_split<T>(mut self, v: T) -> Self
515 where
516 T: std::convert::Into<crate::model::LogSplit>,
517 {
518 self.split = std::option::Option::Some(v.into());
519 self
520 }
521
522 /// Sets or clears the value of [split][crate::model::LogEntry::split].
523 ///
524 /// # Example
525 /// ```ignore,no_run
526 /// # use google_cloud_logging_v2::model::LogEntry;
527 /// use google_cloud_logging_v2::model::LogSplit;
528 /// let x = LogEntry::new().set_or_clear_split(Some(LogSplit::default()/* use setters */));
529 /// let x = LogEntry::new().set_or_clear_split(None::<LogSplit>);
530 /// ```
531 pub fn set_or_clear_split<T>(mut self, v: std::option::Option<T>) -> Self
532 where
533 T: std::convert::Into<crate::model::LogSplit>,
534 {
535 self.split = v.map(|x| x.into());
536 self
537 }
538
539 /// Sets the value of [payload][crate::model::LogEntry::payload].
540 ///
541 /// Note that all the setters affecting `payload` are mutually
542 /// exclusive.
543 ///
544 /// # Example
545 /// ```ignore,no_run
546 /// # use google_cloud_logging_v2::model::LogEntry;
547 /// use google_cloud_logging_v2::model::log_entry::Payload;
548 /// let x = LogEntry::new().set_payload(Some(Payload::TextPayload("example".to_string())));
549 /// ```
550 pub fn set_payload<
551 T: std::convert::Into<std::option::Option<crate::model::log_entry::Payload>>,
552 >(
553 mut self,
554 v: T,
555 ) -> Self {
556 self.payload = v.into();
557 self
558 }
559
560 /// The value of [payload][crate::model::LogEntry::payload]
561 /// if it holds a `ProtoPayload`, `None` if the field is not set or
562 /// holds a different branch.
563 pub fn proto_payload(&self) -> std::option::Option<&std::boxed::Box<wkt::Any>> {
564 #[allow(unreachable_patterns)]
565 self.payload.as_ref().and_then(|v| match v {
566 crate::model::log_entry::Payload::ProtoPayload(v) => std::option::Option::Some(v),
567 _ => std::option::Option::None,
568 })
569 }
570
571 /// Sets the value of [payload][crate::model::LogEntry::payload]
572 /// to hold a `ProtoPayload`.
573 ///
574 /// Note that all the setters affecting `payload` are
575 /// mutually exclusive.
576 ///
577 /// # Example
578 /// ```ignore,no_run
579 /// # use google_cloud_logging_v2::model::LogEntry;
580 /// use wkt::Any;
581 /// let x = LogEntry::new().set_proto_payload(Any::default()/* use setters */);
582 /// assert!(x.proto_payload().is_some());
583 /// assert!(x.text_payload().is_none());
584 /// assert!(x.json_payload().is_none());
585 /// ```
586 pub fn set_proto_payload<T: std::convert::Into<std::boxed::Box<wkt::Any>>>(
587 mut self,
588 v: T,
589 ) -> Self {
590 self.payload =
591 std::option::Option::Some(crate::model::log_entry::Payload::ProtoPayload(v.into()));
592 self
593 }
594
595 /// The value of [payload][crate::model::LogEntry::payload]
596 /// if it holds a `TextPayload`, `None` if the field is not set or
597 /// holds a different branch.
598 pub fn text_payload(&self) -> std::option::Option<&std::string::String> {
599 #[allow(unreachable_patterns)]
600 self.payload.as_ref().and_then(|v| match v {
601 crate::model::log_entry::Payload::TextPayload(v) => std::option::Option::Some(v),
602 _ => std::option::Option::None,
603 })
604 }
605
606 /// Sets the value of [payload][crate::model::LogEntry::payload]
607 /// to hold a `TextPayload`.
608 ///
609 /// Note that all the setters affecting `payload` are
610 /// mutually exclusive.
611 ///
612 /// # Example
613 /// ```ignore,no_run
614 /// # use google_cloud_logging_v2::model::LogEntry;
615 /// let x = LogEntry::new().set_text_payload("example");
616 /// assert!(x.text_payload().is_some());
617 /// assert!(x.proto_payload().is_none());
618 /// assert!(x.json_payload().is_none());
619 /// ```
620 pub fn set_text_payload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
621 self.payload =
622 std::option::Option::Some(crate::model::log_entry::Payload::TextPayload(v.into()));
623 self
624 }
625
626 /// The value of [payload][crate::model::LogEntry::payload]
627 /// if it holds a `JsonPayload`, `None` if the field is not set or
628 /// holds a different branch.
629 pub fn json_payload(&self) -> std::option::Option<&std::boxed::Box<wkt::Struct>> {
630 #[allow(unreachable_patterns)]
631 self.payload.as_ref().and_then(|v| match v {
632 crate::model::log_entry::Payload::JsonPayload(v) => std::option::Option::Some(v),
633 _ => std::option::Option::None,
634 })
635 }
636
637 /// Sets the value of [payload][crate::model::LogEntry::payload]
638 /// to hold a `JsonPayload`.
639 ///
640 /// Note that all the setters affecting `payload` are
641 /// mutually exclusive.
642 ///
643 /// # Example
644 /// ```ignore,no_run
645 /// # use google_cloud_logging_v2::model::LogEntry;
646 /// use wkt::Struct;
647 /// let x = LogEntry::new().set_json_payload(Struct::default()/* use setters */);
648 /// assert!(x.json_payload().is_some());
649 /// assert!(x.proto_payload().is_none());
650 /// assert!(x.text_payload().is_none());
651 /// ```
652 pub fn set_json_payload<T: std::convert::Into<std::boxed::Box<wkt::Struct>>>(
653 mut self,
654 v: T,
655 ) -> Self {
656 self.payload =
657 std::option::Option::Some(crate::model::log_entry::Payload::JsonPayload(v.into()));
658 self
659 }
660}
661
662impl wkt::message::Message for LogEntry {
663 fn typename() -> &'static str {
664 "type.googleapis.com/google.logging.v2.LogEntry"
665 }
666}
667
668/// Defines additional types related to [LogEntry].
669pub mod log_entry {
670 #[allow(unused_imports)]
671 use super::*;
672
673 /// The log entry payload, which can be one of multiple types.
674 #[derive(Clone, Debug, PartialEq)]
675 #[non_exhaustive]
676 pub enum Payload {
677 /// The log entry payload, represented as a protocol buffer. Some Google
678 /// Cloud Platform services use this field for their log entry payloads.
679 ///
680 /// The following protocol buffer types are supported; user-defined types
681 /// are not supported:
682 ///
683 /// "type.googleapis.com/google.cloud.audit.AuditLog"
684 /// "type.googleapis.com/google.appengine.logging.v1.RequestLog"
685 ProtoPayload(std::boxed::Box<wkt::Any>),
686 /// The log entry payload, represented as a Unicode string (UTF-8).
687 TextPayload(std::string::String),
688 /// The log entry payload, represented as a structure that is
689 /// expressed as a JSON object.
690 JsonPayload(std::boxed::Box<wkt::Struct>),
691 }
692}
693
694/// Additional information about a potentially long-running operation with which
695/// a log entry is associated.
696#[derive(Clone, Default, PartialEq)]
697#[non_exhaustive]
698pub struct LogEntryOperation {
699 /// Optional. An arbitrary operation identifier. Log entries with the same
700 /// identifier are assumed to be part of the same operation.
701 pub id: std::string::String,
702
703 /// Optional. An arbitrary producer identifier. The combination of `id` and
704 /// `producer` must be globally unique. Examples for `producer`:
705 /// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
706 pub producer: std::string::String,
707
708 /// Optional. Set this to True if this is the first log entry in the operation.
709 pub first: bool,
710
711 /// Optional. Set this to True if this is the last log entry in the operation.
712 pub last: bool,
713
714 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
715}
716
717impl LogEntryOperation {
718 pub fn new() -> Self {
719 std::default::Default::default()
720 }
721
722 /// Sets the value of [id][crate::model::LogEntryOperation::id].
723 ///
724 /// # Example
725 /// ```ignore,no_run
726 /// # use google_cloud_logging_v2::model::LogEntryOperation;
727 /// let x = LogEntryOperation::new().set_id("example");
728 /// ```
729 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
730 self.id = v.into();
731 self
732 }
733
734 /// Sets the value of [producer][crate::model::LogEntryOperation::producer].
735 ///
736 /// # Example
737 /// ```ignore,no_run
738 /// # use google_cloud_logging_v2::model::LogEntryOperation;
739 /// let x = LogEntryOperation::new().set_producer("example");
740 /// ```
741 pub fn set_producer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
742 self.producer = v.into();
743 self
744 }
745
746 /// Sets the value of [first][crate::model::LogEntryOperation::first].
747 ///
748 /// # Example
749 /// ```ignore,no_run
750 /// # use google_cloud_logging_v2::model::LogEntryOperation;
751 /// let x = LogEntryOperation::new().set_first(true);
752 /// ```
753 pub fn set_first<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
754 self.first = v.into();
755 self
756 }
757
758 /// Sets the value of [last][crate::model::LogEntryOperation::last].
759 ///
760 /// # Example
761 /// ```ignore,no_run
762 /// # use google_cloud_logging_v2::model::LogEntryOperation;
763 /// let x = LogEntryOperation::new().set_last(true);
764 /// ```
765 pub fn set_last<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
766 self.last = v.into();
767 self
768 }
769}
770
771impl wkt::message::Message for LogEntryOperation {
772 fn typename() -> &'static str {
773 "type.googleapis.com/google.logging.v2.LogEntryOperation"
774 }
775}
776
777/// Additional information about the source code location that produced the log
778/// entry.
779#[derive(Clone, Default, PartialEq)]
780#[non_exhaustive]
781pub struct LogEntrySourceLocation {
782 /// Optional. Source file name. Depending on the runtime environment, this
783 /// might be a simple name or a fully-qualified name.
784 pub file: std::string::String,
785
786 /// Optional. Line within the source file. 1-based; 0 indicates no line number
787 /// available.
788 pub line: i64,
789
790 /// Optional. Human-readable name of the function or method being invoked, with
791 /// optional context such as the class or package name. This information may be
792 /// used in contexts such as the logs viewer, where a file and line number are
793 /// less meaningful. The format can vary by language. For example:
794 /// `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
795 /// (Python).
796 pub function: std::string::String,
797
798 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
799}
800
801impl LogEntrySourceLocation {
802 pub fn new() -> Self {
803 std::default::Default::default()
804 }
805
806 /// Sets the value of [file][crate::model::LogEntrySourceLocation::file].
807 ///
808 /// # Example
809 /// ```ignore,no_run
810 /// # use google_cloud_logging_v2::model::LogEntrySourceLocation;
811 /// let x = LogEntrySourceLocation::new().set_file("example");
812 /// ```
813 pub fn set_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
814 self.file = v.into();
815 self
816 }
817
818 /// Sets the value of [line][crate::model::LogEntrySourceLocation::line].
819 ///
820 /// # Example
821 /// ```ignore,no_run
822 /// # use google_cloud_logging_v2::model::LogEntrySourceLocation;
823 /// let x = LogEntrySourceLocation::new().set_line(42);
824 /// ```
825 pub fn set_line<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
826 self.line = v.into();
827 self
828 }
829
830 /// Sets the value of [function][crate::model::LogEntrySourceLocation::function].
831 ///
832 /// # Example
833 /// ```ignore,no_run
834 /// # use google_cloud_logging_v2::model::LogEntrySourceLocation;
835 /// let x = LogEntrySourceLocation::new().set_function("example");
836 /// ```
837 pub fn set_function<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
838 self.function = v.into();
839 self
840 }
841}
842
843impl wkt::message::Message for LogEntrySourceLocation {
844 fn typename() -> &'static str {
845 "type.googleapis.com/google.logging.v2.LogEntrySourceLocation"
846 }
847}
848
849/// Additional information used to correlate multiple log entries. Used when a
850/// single LogEntry would exceed the Google Cloud Logging size limit and is
851/// split across multiple log entries.
852#[derive(Clone, Default, PartialEq)]
853#[non_exhaustive]
854pub struct LogSplit {
855 /// A globally unique identifier for all log entries in a sequence of split log
856 /// entries. All log entries with the same |LogSplit.uid| are assumed to be
857 /// part of the same sequence of split log entries.
858 pub uid: std::string::String,
859
860 /// The index of this LogEntry in the sequence of split log entries. Log
861 /// entries are given |index| values 0, 1, ..., n-1 for a sequence of n log
862 /// entries.
863 pub index: i32,
864
865 /// The total number of log entries that the original LogEntry was split into.
866 pub total_splits: i32,
867
868 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
869}
870
871impl LogSplit {
872 pub fn new() -> Self {
873 std::default::Default::default()
874 }
875
876 /// Sets the value of [uid][crate::model::LogSplit::uid].
877 ///
878 /// # Example
879 /// ```ignore,no_run
880 /// # use google_cloud_logging_v2::model::LogSplit;
881 /// let x = LogSplit::new().set_uid("example");
882 /// ```
883 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
884 self.uid = v.into();
885 self
886 }
887
888 /// Sets the value of [index][crate::model::LogSplit::index].
889 ///
890 /// # Example
891 /// ```ignore,no_run
892 /// # use google_cloud_logging_v2::model::LogSplit;
893 /// let x = LogSplit::new().set_index(42);
894 /// ```
895 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
896 self.index = v.into();
897 self
898 }
899
900 /// Sets the value of [total_splits][crate::model::LogSplit::total_splits].
901 ///
902 /// # Example
903 /// ```ignore,no_run
904 /// # use google_cloud_logging_v2::model::LogSplit;
905 /// let x = LogSplit::new().set_total_splits(42);
906 /// ```
907 pub fn set_total_splits<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
908 self.total_splits = v.into();
909 self
910 }
911}
912
913impl wkt::message::Message for LogSplit {
914 fn typename() -> &'static str {
915 "type.googleapis.com/google.logging.v2.LogSplit"
916 }
917}
918
919/// The parameters to DeleteLog.
920#[derive(Clone, Default, PartialEq)]
921#[non_exhaustive]
922pub struct DeleteLogRequest {
923 /// Required. The resource name of the log to delete:
924 ///
925 /// * `projects/[PROJECT_ID]/logs/[LOG_ID]`
926 /// * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]`
927 /// * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]`
928 /// * `folders/[FOLDER_ID]/logs/[LOG_ID]`
929 ///
930 /// `[LOG_ID]` must be URL-encoded. For example,
931 /// `"projects/my-project-id/logs/syslog"`,
932 /// `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`.
933 ///
934 /// For more information about log names, see
935 /// [LogEntry][google.logging.v2.LogEntry].
936 ///
937 /// [google.logging.v2.LogEntry]: crate::model::LogEntry
938 pub log_name: std::string::String,
939
940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
941}
942
943impl DeleteLogRequest {
944 pub fn new() -> Self {
945 std::default::Default::default()
946 }
947
948 /// Sets the value of [log_name][crate::model::DeleteLogRequest::log_name].
949 ///
950 /// # Example
951 /// ```ignore,no_run
952 /// # use google_cloud_logging_v2::model::DeleteLogRequest;
953 /// let x = DeleteLogRequest::new().set_log_name("example");
954 /// ```
955 pub fn set_log_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
956 self.log_name = v.into();
957 self
958 }
959}
960
961impl wkt::message::Message for DeleteLogRequest {
962 fn typename() -> &'static str {
963 "type.googleapis.com/google.logging.v2.DeleteLogRequest"
964 }
965}
966
967/// The parameters to WriteLogEntries.
968#[derive(Clone, Default, PartialEq)]
969#[non_exhaustive]
970pub struct WriteLogEntriesRequest {
971 /// Optional. A default log resource name that is assigned to all log entries
972 /// in `entries` that do not specify a value for `log_name`:
973 ///
974 /// * `projects/[PROJECT_ID]/logs/[LOG_ID]`
975 /// * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]`
976 /// * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]`
977 /// * `folders/[FOLDER_ID]/logs/[LOG_ID]`
978 ///
979 /// `[LOG_ID]` must be URL-encoded. For example:
980 ///
981 /// ```norust
982 /// "projects/my-project-id/logs/syslog"
983 /// "organizations/123/logs/cloudaudit.googleapis.com%2Factivity"
984 /// ```
985 ///
986 /// The permission `logging.logEntries.create` is needed on each project,
987 /// organization, billing account, or folder that is receiving new log
988 /// entries, whether the resource is specified in `logName` or in an
989 /// individual log entry.
990 pub log_name: std::string::String,
991
992 /// Optional. A default monitored resource object that is assigned to all log
993 /// entries in `entries` that do not specify a value for `resource`. Example:
994 ///
995 /// ```norust
996 /// { "type": "gce_instance",
997 /// "labels": {
998 /// "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
999 /// ```
1000 ///
1001 /// See [LogEntry][google.logging.v2.LogEntry].
1002 ///
1003 /// [google.logging.v2.LogEntry]: crate::model::LogEntry
1004 pub resource: std::option::Option<api::model::MonitoredResource>,
1005
1006 /// Optional. Default labels that are added to the `labels` field of all log
1007 /// entries in `entries`. If a log entry already has a label with the same key
1008 /// as a label in this parameter, then the log entry's label is not changed.
1009 /// See [LogEntry][google.logging.v2.LogEntry].
1010 ///
1011 /// [google.logging.v2.LogEntry]: crate::model::LogEntry
1012 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1013
1014 /// Required. The log entries to send to Logging. The order of log
1015 /// entries in this list does not matter. Values supplied in this method's
1016 /// `log_name`, `resource`, and `labels` fields are copied into those log
1017 /// entries in this list that do not include values for their corresponding
1018 /// fields. For more information, see the
1019 /// [LogEntry][google.logging.v2.LogEntry] type.
1020 ///
1021 /// If the `timestamp` or `insert_id` fields are missing in log entries, then
1022 /// this method supplies the current time or a unique identifier, respectively.
1023 /// The supplied values are chosen so that, among the log entries that did not
1024 /// supply their own values, the entries earlier in the list will sort before
1025 /// the entries later in the list. See the `entries.list` method.
1026 ///
1027 /// Log entries with timestamps that are more than the
1028 /// [logs retention period](https://cloud.google.com/logging/quotas) in
1029 /// the past or more than 24 hours in the future will not be available when
1030 /// calling `entries.list`. However, those log entries can still be [exported
1031 /// with
1032 /// LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
1033 ///
1034 /// To improve throughput and to avoid exceeding the
1035 /// [quota limit](https://cloud.google.com/logging/quotas) for calls to
1036 /// `entries.write`, you should try to include several log entries in this
1037 /// list, rather than calling this method for each individual log entry.
1038 ///
1039 /// [google.logging.v2.LogEntry]: crate::model::LogEntry
1040 pub entries: std::vec::Vec<crate::model::LogEntry>,
1041
1042 /// Optional. Whether a batch's valid entries should be written even if some
1043 /// other entry failed due to a permanent error such as INVALID_ARGUMENT or
1044 /// PERMISSION_DENIED. If any entry failed, then the response status is the
1045 /// response status of one of the failed entries. The response will include
1046 /// error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by
1047 /// the entries' zero-based index in the `entries`. Failed requests for which
1048 /// no entries are written will not include per-entry errors.
1049 pub partial_success: bool,
1050
1051 /// Optional. If true, the request should expect normal response, but the
1052 /// entries won't be persisted nor exported. Useful for checking whether the
1053 /// logging API endpoints are working properly before sending valuable data.
1054 pub dry_run: bool,
1055
1056 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1057}
1058
1059impl WriteLogEntriesRequest {
1060 pub fn new() -> Self {
1061 std::default::Default::default()
1062 }
1063
1064 /// Sets the value of [log_name][crate::model::WriteLogEntriesRequest::log_name].
1065 ///
1066 /// # Example
1067 /// ```ignore,no_run
1068 /// # use google_cloud_logging_v2::model::WriteLogEntriesRequest;
1069 /// let x = WriteLogEntriesRequest::new().set_log_name("example");
1070 /// ```
1071 pub fn set_log_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1072 self.log_name = v.into();
1073 self
1074 }
1075
1076 /// Sets the value of [resource][crate::model::WriteLogEntriesRequest::resource].
1077 ///
1078 /// # Example
1079 /// ```ignore,no_run
1080 /// # use google_cloud_logging_v2::model::WriteLogEntriesRequest;
1081 /// use api::model::MonitoredResource;
1082 /// let x = WriteLogEntriesRequest::new().set_resource(MonitoredResource::default()/* use setters */);
1083 /// ```
1084 pub fn set_resource<T>(mut self, v: T) -> Self
1085 where
1086 T: std::convert::Into<api::model::MonitoredResource>,
1087 {
1088 self.resource = std::option::Option::Some(v.into());
1089 self
1090 }
1091
1092 /// Sets or clears the value of [resource][crate::model::WriteLogEntriesRequest::resource].
1093 ///
1094 /// # Example
1095 /// ```ignore,no_run
1096 /// # use google_cloud_logging_v2::model::WriteLogEntriesRequest;
1097 /// use api::model::MonitoredResource;
1098 /// let x = WriteLogEntriesRequest::new().set_or_clear_resource(Some(MonitoredResource::default()/* use setters */));
1099 /// let x = WriteLogEntriesRequest::new().set_or_clear_resource(None::<MonitoredResource>);
1100 /// ```
1101 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
1102 where
1103 T: std::convert::Into<api::model::MonitoredResource>,
1104 {
1105 self.resource = v.map(|x| x.into());
1106 self
1107 }
1108
1109 /// Sets the value of [labels][crate::model::WriteLogEntriesRequest::labels].
1110 ///
1111 /// # Example
1112 /// ```ignore,no_run
1113 /// # use google_cloud_logging_v2::model::WriteLogEntriesRequest;
1114 /// let x = WriteLogEntriesRequest::new().set_labels([
1115 /// ("key0", "abc"),
1116 /// ("key1", "xyz"),
1117 /// ]);
1118 /// ```
1119 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1120 where
1121 T: std::iter::IntoIterator<Item = (K, V)>,
1122 K: std::convert::Into<std::string::String>,
1123 V: std::convert::Into<std::string::String>,
1124 {
1125 use std::iter::Iterator;
1126 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1127 self
1128 }
1129
1130 /// Sets the value of [entries][crate::model::WriteLogEntriesRequest::entries].
1131 ///
1132 /// # Example
1133 /// ```ignore,no_run
1134 /// # use google_cloud_logging_v2::model::WriteLogEntriesRequest;
1135 /// use google_cloud_logging_v2::model::LogEntry;
1136 /// let x = WriteLogEntriesRequest::new()
1137 /// .set_entries([
1138 /// LogEntry::default()/* use setters */,
1139 /// LogEntry::default()/* use (different) setters */,
1140 /// ]);
1141 /// ```
1142 pub fn set_entries<T, V>(mut self, v: T) -> Self
1143 where
1144 T: std::iter::IntoIterator<Item = V>,
1145 V: std::convert::Into<crate::model::LogEntry>,
1146 {
1147 use std::iter::Iterator;
1148 self.entries = v.into_iter().map(|i| i.into()).collect();
1149 self
1150 }
1151
1152 /// Sets the value of [partial_success][crate::model::WriteLogEntriesRequest::partial_success].
1153 ///
1154 /// # Example
1155 /// ```ignore,no_run
1156 /// # use google_cloud_logging_v2::model::WriteLogEntriesRequest;
1157 /// let x = WriteLogEntriesRequest::new().set_partial_success(true);
1158 /// ```
1159 pub fn set_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1160 self.partial_success = v.into();
1161 self
1162 }
1163
1164 /// Sets the value of [dry_run][crate::model::WriteLogEntriesRequest::dry_run].
1165 ///
1166 /// # Example
1167 /// ```ignore,no_run
1168 /// # use google_cloud_logging_v2::model::WriteLogEntriesRequest;
1169 /// let x = WriteLogEntriesRequest::new().set_dry_run(true);
1170 /// ```
1171 pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1172 self.dry_run = v.into();
1173 self
1174 }
1175}
1176
1177impl wkt::message::Message for WriteLogEntriesRequest {
1178 fn typename() -> &'static str {
1179 "type.googleapis.com/google.logging.v2.WriteLogEntriesRequest"
1180 }
1181}
1182
1183/// Result returned from WriteLogEntries.
1184#[derive(Clone, Default, PartialEq)]
1185#[non_exhaustive]
1186pub struct WriteLogEntriesResponse {
1187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1188}
1189
1190impl WriteLogEntriesResponse {
1191 pub fn new() -> Self {
1192 std::default::Default::default()
1193 }
1194}
1195
1196impl wkt::message::Message for WriteLogEntriesResponse {
1197 fn typename() -> &'static str {
1198 "type.googleapis.com/google.logging.v2.WriteLogEntriesResponse"
1199 }
1200}
1201
1202/// Error details for WriteLogEntries with partial success.
1203#[derive(Clone, Default, PartialEq)]
1204#[non_exhaustive]
1205pub struct WriteLogEntriesPartialErrors {
1206 /// When `WriteLogEntriesRequest.partial_success` is true, records the error
1207 /// status for entries that were not written due to a permanent error, keyed
1208 /// by the entry's zero-based index in `WriteLogEntriesRequest.entries`.
1209 ///
1210 /// Failed requests for which no entries are written will not include
1211 /// per-entry errors.
1212 pub log_entry_errors: std::collections::HashMap<i32, rpc::model::Status>,
1213
1214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1215}
1216
1217impl WriteLogEntriesPartialErrors {
1218 pub fn new() -> Self {
1219 std::default::Default::default()
1220 }
1221
1222 /// Sets the value of [log_entry_errors][crate::model::WriteLogEntriesPartialErrors::log_entry_errors].
1223 ///
1224 /// # Example
1225 /// ```ignore,no_run
1226 /// # use google_cloud_logging_v2::model::WriteLogEntriesPartialErrors;
1227 /// use rpc::model::Status;
1228 /// let x = WriteLogEntriesPartialErrors::new().set_log_entry_errors([
1229 /// (0, Status::default()/* use setters */),
1230 /// (1, Status::default()/* use (different) setters */),
1231 /// ]);
1232 /// ```
1233 pub fn set_log_entry_errors<T, K, V>(mut self, v: T) -> Self
1234 where
1235 T: std::iter::IntoIterator<Item = (K, V)>,
1236 K: std::convert::Into<i32>,
1237 V: std::convert::Into<rpc::model::Status>,
1238 {
1239 use std::iter::Iterator;
1240 self.log_entry_errors = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1241 self
1242 }
1243}
1244
1245impl wkt::message::Message for WriteLogEntriesPartialErrors {
1246 fn typename() -> &'static str {
1247 "type.googleapis.com/google.logging.v2.WriteLogEntriesPartialErrors"
1248 }
1249}
1250
1251/// The parameters to `ListLogEntries`.
1252#[derive(Clone, Default, PartialEq)]
1253#[non_exhaustive]
1254pub struct ListLogEntriesRequest {
1255 /// Required. Names of one or more parent resources from which to
1256 /// retrieve log entries:
1257 ///
1258 /// * `projects/[PROJECT_ID]`
1259 /// * `organizations/[ORGANIZATION_ID]`
1260 /// * `billingAccounts/[BILLING_ACCOUNT_ID]`
1261 /// * `folders/[FOLDER_ID]`
1262 ///
1263 /// May alternatively be one or more views:
1264 ///
1265 /// * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1266 /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1267 /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1268 /// * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1269 ///
1270 /// Projects listed in the `project_ids` field are added to this list.
1271 /// A maximum of 100 resources may be specified in a single request.
1272 pub resource_names: std::vec::Vec<std::string::String>,
1273
1274 /// Optional. Only log entries that match the filter are returned. An empty
1275 /// filter matches all log entries in the resources listed in `resource_names`.
1276 /// Referencing a parent resource that is not listed in `resource_names` will
1277 /// cause the filter to return no results. The maximum length of a filter is
1278 /// 20,000 characters.
1279 pub filter: std::string::String,
1280
1281 /// Optional. How the results should be sorted. Presently, the only permitted
1282 /// values are `"timestamp asc"` (default) and `"timestamp desc"`. The first
1283 /// option returns entries in order of increasing values of
1284 /// `LogEntry.timestamp` (oldest first), and the second option returns entries
1285 /// in order of decreasing timestamps (newest first). Entries with equal
1286 /// timestamps are returned in order of their `insert_id` values.
1287 pub order_by: std::string::String,
1288
1289 /// Optional. The maximum number of results to return from this request.
1290 /// Default is 50. If the value is negative or exceeds 1000, the request is
1291 /// rejected. The presence of `next_page_token` in the response indicates that
1292 /// more results might be available.
1293 pub page_size: i32,
1294
1295 /// Optional. If present, then retrieve the next batch of results from the
1296 /// preceding call to this method. `page_token` must be the value of
1297 /// `next_page_token` from the previous response. The values of other method
1298 /// parameters should be identical to those in the previous call.
1299 pub page_token: std::string::String,
1300
1301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1302}
1303
1304impl ListLogEntriesRequest {
1305 pub fn new() -> Self {
1306 std::default::Default::default()
1307 }
1308
1309 /// Sets the value of [resource_names][crate::model::ListLogEntriesRequest::resource_names].
1310 ///
1311 /// # Example
1312 /// ```ignore,no_run
1313 /// # use google_cloud_logging_v2::model::ListLogEntriesRequest;
1314 /// let x = ListLogEntriesRequest::new().set_resource_names(["a", "b", "c"]);
1315 /// ```
1316 pub fn set_resource_names<T, V>(mut self, v: T) -> Self
1317 where
1318 T: std::iter::IntoIterator<Item = V>,
1319 V: std::convert::Into<std::string::String>,
1320 {
1321 use std::iter::Iterator;
1322 self.resource_names = v.into_iter().map(|i| i.into()).collect();
1323 self
1324 }
1325
1326 /// Sets the value of [filter][crate::model::ListLogEntriesRequest::filter].
1327 ///
1328 /// # Example
1329 /// ```ignore,no_run
1330 /// # use google_cloud_logging_v2::model::ListLogEntriesRequest;
1331 /// let x = ListLogEntriesRequest::new().set_filter("example");
1332 /// ```
1333 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1334 self.filter = v.into();
1335 self
1336 }
1337
1338 /// Sets the value of [order_by][crate::model::ListLogEntriesRequest::order_by].
1339 ///
1340 /// # Example
1341 /// ```ignore,no_run
1342 /// # use google_cloud_logging_v2::model::ListLogEntriesRequest;
1343 /// let x = ListLogEntriesRequest::new().set_order_by("example");
1344 /// ```
1345 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1346 self.order_by = v.into();
1347 self
1348 }
1349
1350 /// Sets the value of [page_size][crate::model::ListLogEntriesRequest::page_size].
1351 ///
1352 /// # Example
1353 /// ```ignore,no_run
1354 /// # use google_cloud_logging_v2::model::ListLogEntriesRequest;
1355 /// let x = ListLogEntriesRequest::new().set_page_size(42);
1356 /// ```
1357 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1358 self.page_size = v.into();
1359 self
1360 }
1361
1362 /// Sets the value of [page_token][crate::model::ListLogEntriesRequest::page_token].
1363 ///
1364 /// # Example
1365 /// ```ignore,no_run
1366 /// # use google_cloud_logging_v2::model::ListLogEntriesRequest;
1367 /// let x = ListLogEntriesRequest::new().set_page_token("example");
1368 /// ```
1369 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1370 self.page_token = v.into();
1371 self
1372 }
1373}
1374
1375impl wkt::message::Message for ListLogEntriesRequest {
1376 fn typename() -> &'static str {
1377 "type.googleapis.com/google.logging.v2.ListLogEntriesRequest"
1378 }
1379}
1380
1381/// Result returned from `ListLogEntries`.
1382#[derive(Clone, Default, PartialEq)]
1383#[non_exhaustive]
1384pub struct ListLogEntriesResponse {
1385 /// A list of log entries. If `entries` is empty, `nextPageToken` may still be
1386 /// returned, indicating that more entries may exist. See `nextPageToken` for
1387 /// more information.
1388 pub entries: std::vec::Vec<crate::model::LogEntry>,
1389
1390 /// If there might be more results than those appearing in this response, then
1391 /// `nextPageToken` is included. To get the next set of results, call this
1392 /// method again using the value of `nextPageToken` as `pageToken`.
1393 ///
1394 /// If a value for `next_page_token` appears and the `entries` field is empty,
1395 /// it means that the search found no log entries so far but it did not have
1396 /// time to search all the possible log entries. Retry the method with this
1397 /// value for `page_token` to continue the search. Alternatively, consider
1398 /// speeding up the search by changing your filter to specify a single log name
1399 /// or resource type, or to narrow the time range of the search.
1400 pub next_page_token: std::string::String,
1401
1402 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1403}
1404
1405impl ListLogEntriesResponse {
1406 pub fn new() -> Self {
1407 std::default::Default::default()
1408 }
1409
1410 /// Sets the value of [entries][crate::model::ListLogEntriesResponse::entries].
1411 ///
1412 /// # Example
1413 /// ```ignore,no_run
1414 /// # use google_cloud_logging_v2::model::ListLogEntriesResponse;
1415 /// use google_cloud_logging_v2::model::LogEntry;
1416 /// let x = ListLogEntriesResponse::new()
1417 /// .set_entries([
1418 /// LogEntry::default()/* use setters */,
1419 /// LogEntry::default()/* use (different) setters */,
1420 /// ]);
1421 /// ```
1422 pub fn set_entries<T, V>(mut self, v: T) -> Self
1423 where
1424 T: std::iter::IntoIterator<Item = V>,
1425 V: std::convert::Into<crate::model::LogEntry>,
1426 {
1427 use std::iter::Iterator;
1428 self.entries = v.into_iter().map(|i| i.into()).collect();
1429 self
1430 }
1431
1432 /// Sets the value of [next_page_token][crate::model::ListLogEntriesResponse::next_page_token].
1433 ///
1434 /// # Example
1435 /// ```ignore,no_run
1436 /// # use google_cloud_logging_v2::model::ListLogEntriesResponse;
1437 /// let x = ListLogEntriesResponse::new().set_next_page_token("example");
1438 /// ```
1439 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1440 self.next_page_token = v.into();
1441 self
1442 }
1443}
1444
1445impl wkt::message::Message for ListLogEntriesResponse {
1446 fn typename() -> &'static str {
1447 "type.googleapis.com/google.logging.v2.ListLogEntriesResponse"
1448 }
1449}
1450
1451#[doc(hidden)]
1452impl gax::paginator::internal::PageableResponse for ListLogEntriesResponse {
1453 type PageItem = crate::model::LogEntry;
1454
1455 fn items(self) -> std::vec::Vec<Self::PageItem> {
1456 self.entries
1457 }
1458
1459 fn next_page_token(&self) -> std::string::String {
1460 use std::clone::Clone;
1461 self.next_page_token.clone()
1462 }
1463}
1464
1465/// The parameters to ListMonitoredResourceDescriptors
1466#[derive(Clone, Default, PartialEq)]
1467#[non_exhaustive]
1468pub struct ListMonitoredResourceDescriptorsRequest {
1469 /// Optional. The maximum number of results to return from this request.
1470 /// Non-positive values are ignored. The presence of `nextPageToken` in the
1471 /// response indicates that more results might be available.
1472 pub page_size: i32,
1473
1474 /// Optional. If present, then retrieve the next batch of results from the
1475 /// preceding call to this method. `pageToken` must be the value of
1476 /// `nextPageToken` from the previous response. The values of other method
1477 /// parameters should be identical to those in the previous call.
1478 pub page_token: std::string::String,
1479
1480 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1481}
1482
1483impl ListMonitoredResourceDescriptorsRequest {
1484 pub fn new() -> Self {
1485 std::default::Default::default()
1486 }
1487
1488 /// Sets the value of [page_size][crate::model::ListMonitoredResourceDescriptorsRequest::page_size].
1489 ///
1490 /// # Example
1491 /// ```ignore,no_run
1492 /// # use google_cloud_logging_v2::model::ListMonitoredResourceDescriptorsRequest;
1493 /// let x = ListMonitoredResourceDescriptorsRequest::new().set_page_size(42);
1494 /// ```
1495 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1496 self.page_size = v.into();
1497 self
1498 }
1499
1500 /// Sets the value of [page_token][crate::model::ListMonitoredResourceDescriptorsRequest::page_token].
1501 ///
1502 /// # Example
1503 /// ```ignore,no_run
1504 /// # use google_cloud_logging_v2::model::ListMonitoredResourceDescriptorsRequest;
1505 /// let x = ListMonitoredResourceDescriptorsRequest::new().set_page_token("example");
1506 /// ```
1507 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1508 self.page_token = v.into();
1509 self
1510 }
1511}
1512
1513impl wkt::message::Message for ListMonitoredResourceDescriptorsRequest {
1514 fn typename() -> &'static str {
1515 "type.googleapis.com/google.logging.v2.ListMonitoredResourceDescriptorsRequest"
1516 }
1517}
1518
1519/// Result returned from ListMonitoredResourceDescriptors.
1520#[derive(Clone, Default, PartialEq)]
1521#[non_exhaustive]
1522pub struct ListMonitoredResourceDescriptorsResponse {
1523 /// A list of resource descriptors.
1524 pub resource_descriptors: std::vec::Vec<api::model::MonitoredResourceDescriptor>,
1525
1526 /// If there might be more results than those appearing in this response, then
1527 /// `nextPageToken` is included. To get the next set of results, call this
1528 /// method again using the value of `nextPageToken` as `pageToken`.
1529 pub next_page_token: std::string::String,
1530
1531 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1532}
1533
1534impl ListMonitoredResourceDescriptorsResponse {
1535 pub fn new() -> Self {
1536 std::default::Default::default()
1537 }
1538
1539 /// Sets the value of [resource_descriptors][crate::model::ListMonitoredResourceDescriptorsResponse::resource_descriptors].
1540 ///
1541 /// # Example
1542 /// ```ignore,no_run
1543 /// # use google_cloud_logging_v2::model::ListMonitoredResourceDescriptorsResponse;
1544 /// use api::model::MonitoredResourceDescriptor;
1545 /// let x = ListMonitoredResourceDescriptorsResponse::new()
1546 /// .set_resource_descriptors([
1547 /// MonitoredResourceDescriptor::default()/* use setters */,
1548 /// MonitoredResourceDescriptor::default()/* use (different) setters */,
1549 /// ]);
1550 /// ```
1551 pub fn set_resource_descriptors<T, V>(mut self, v: T) -> Self
1552 where
1553 T: std::iter::IntoIterator<Item = V>,
1554 V: std::convert::Into<api::model::MonitoredResourceDescriptor>,
1555 {
1556 use std::iter::Iterator;
1557 self.resource_descriptors = v.into_iter().map(|i| i.into()).collect();
1558 self
1559 }
1560
1561 /// Sets the value of [next_page_token][crate::model::ListMonitoredResourceDescriptorsResponse::next_page_token].
1562 ///
1563 /// # Example
1564 /// ```ignore,no_run
1565 /// # use google_cloud_logging_v2::model::ListMonitoredResourceDescriptorsResponse;
1566 /// let x = ListMonitoredResourceDescriptorsResponse::new().set_next_page_token("example");
1567 /// ```
1568 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1569 self.next_page_token = v.into();
1570 self
1571 }
1572}
1573
1574impl wkt::message::Message for ListMonitoredResourceDescriptorsResponse {
1575 fn typename() -> &'static str {
1576 "type.googleapis.com/google.logging.v2.ListMonitoredResourceDescriptorsResponse"
1577 }
1578}
1579
1580#[doc(hidden)]
1581impl gax::paginator::internal::PageableResponse for ListMonitoredResourceDescriptorsResponse {
1582 type PageItem = api::model::MonitoredResourceDescriptor;
1583
1584 fn items(self) -> std::vec::Vec<Self::PageItem> {
1585 self.resource_descriptors
1586 }
1587
1588 fn next_page_token(&self) -> std::string::String {
1589 use std::clone::Clone;
1590 self.next_page_token.clone()
1591 }
1592}
1593
1594/// The parameters to ListLogs.
1595#[derive(Clone, Default, PartialEq)]
1596#[non_exhaustive]
1597pub struct ListLogsRequest {
1598 /// Required. The resource name to list logs for:
1599 ///
1600 /// * `projects/[PROJECT_ID]`
1601 /// * `organizations/[ORGANIZATION_ID]`
1602 /// * `billingAccounts/[BILLING_ACCOUNT_ID]`
1603 /// * `folders/[FOLDER_ID]`
1604 pub parent: std::string::String,
1605
1606 /// Optional. List of resource names to list logs for:
1607 ///
1608 /// * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1609 /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1610 /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1611 /// * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1612 ///
1613 /// To support legacy queries, it could also be:
1614 ///
1615 /// * `projects/[PROJECT_ID]`
1616 /// * `organizations/[ORGANIZATION_ID]`
1617 /// * `billingAccounts/[BILLING_ACCOUNT_ID]`
1618 /// * `folders/[FOLDER_ID]`
1619 ///
1620 /// The resource name in the `parent` field is added to this list.
1621 pub resource_names: std::vec::Vec<std::string::String>,
1622
1623 /// Optional. The maximum number of results to return from this request.
1624 /// Non-positive values are ignored. The presence of `nextPageToken` in the
1625 /// response indicates that more results might be available.
1626 pub page_size: i32,
1627
1628 /// Optional. If present, then retrieve the next batch of results from the
1629 /// preceding call to this method. `pageToken` must be the value of
1630 /// `nextPageToken` from the previous response. The values of other method
1631 /// parameters should be identical to those in the previous call.
1632 pub page_token: std::string::String,
1633
1634 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1635}
1636
1637impl ListLogsRequest {
1638 pub fn new() -> Self {
1639 std::default::Default::default()
1640 }
1641
1642 /// Sets the value of [parent][crate::model::ListLogsRequest::parent].
1643 ///
1644 /// # Example
1645 /// ```ignore,no_run
1646 /// # use google_cloud_logging_v2::model::ListLogsRequest;
1647 /// let x = ListLogsRequest::new().set_parent("example");
1648 /// ```
1649 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1650 self.parent = v.into();
1651 self
1652 }
1653
1654 /// Sets the value of [resource_names][crate::model::ListLogsRequest::resource_names].
1655 ///
1656 /// # Example
1657 /// ```ignore,no_run
1658 /// # use google_cloud_logging_v2::model::ListLogsRequest;
1659 /// let x = ListLogsRequest::new().set_resource_names(["a", "b", "c"]);
1660 /// ```
1661 pub fn set_resource_names<T, V>(mut self, v: T) -> Self
1662 where
1663 T: std::iter::IntoIterator<Item = V>,
1664 V: std::convert::Into<std::string::String>,
1665 {
1666 use std::iter::Iterator;
1667 self.resource_names = v.into_iter().map(|i| i.into()).collect();
1668 self
1669 }
1670
1671 /// Sets the value of [page_size][crate::model::ListLogsRequest::page_size].
1672 ///
1673 /// # Example
1674 /// ```ignore,no_run
1675 /// # use google_cloud_logging_v2::model::ListLogsRequest;
1676 /// let x = ListLogsRequest::new().set_page_size(42);
1677 /// ```
1678 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1679 self.page_size = v.into();
1680 self
1681 }
1682
1683 /// Sets the value of [page_token][crate::model::ListLogsRequest::page_token].
1684 ///
1685 /// # Example
1686 /// ```ignore,no_run
1687 /// # use google_cloud_logging_v2::model::ListLogsRequest;
1688 /// let x = ListLogsRequest::new().set_page_token("example");
1689 /// ```
1690 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1691 self.page_token = v.into();
1692 self
1693 }
1694}
1695
1696impl wkt::message::Message for ListLogsRequest {
1697 fn typename() -> &'static str {
1698 "type.googleapis.com/google.logging.v2.ListLogsRequest"
1699 }
1700}
1701
1702/// Result returned from ListLogs.
1703#[derive(Clone, Default, PartialEq)]
1704#[non_exhaustive]
1705pub struct ListLogsResponse {
1706 /// A list of log names. For example,
1707 /// `"projects/my-project/logs/syslog"` or
1708 /// `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
1709 pub log_names: std::vec::Vec<std::string::String>,
1710
1711 /// If there might be more results than those appearing in this response, then
1712 /// `nextPageToken` is included. To get the next set of results, call this
1713 /// method again using the value of `nextPageToken` as `pageToken`.
1714 pub next_page_token: std::string::String,
1715
1716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1717}
1718
1719impl ListLogsResponse {
1720 pub fn new() -> Self {
1721 std::default::Default::default()
1722 }
1723
1724 /// Sets the value of [log_names][crate::model::ListLogsResponse::log_names].
1725 ///
1726 /// # Example
1727 /// ```ignore,no_run
1728 /// # use google_cloud_logging_v2::model::ListLogsResponse;
1729 /// let x = ListLogsResponse::new().set_log_names(["a", "b", "c"]);
1730 /// ```
1731 pub fn set_log_names<T, V>(mut self, v: T) -> Self
1732 where
1733 T: std::iter::IntoIterator<Item = V>,
1734 V: std::convert::Into<std::string::String>,
1735 {
1736 use std::iter::Iterator;
1737 self.log_names = v.into_iter().map(|i| i.into()).collect();
1738 self
1739 }
1740
1741 /// Sets the value of [next_page_token][crate::model::ListLogsResponse::next_page_token].
1742 ///
1743 /// # Example
1744 /// ```ignore,no_run
1745 /// # use google_cloud_logging_v2::model::ListLogsResponse;
1746 /// let x = ListLogsResponse::new().set_next_page_token("example");
1747 /// ```
1748 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1749 self.next_page_token = v.into();
1750 self
1751 }
1752}
1753
1754impl wkt::message::Message for ListLogsResponse {
1755 fn typename() -> &'static str {
1756 "type.googleapis.com/google.logging.v2.ListLogsResponse"
1757 }
1758}
1759
1760/// The parameters to `TailLogEntries`.
1761#[derive(Clone, Default, PartialEq)]
1762#[non_exhaustive]
1763pub struct TailLogEntriesRequest {
1764 /// Required. Name of a parent resource from which to retrieve log entries:
1765 ///
1766 /// * `projects/[PROJECT_ID]`
1767 /// * `organizations/[ORGANIZATION_ID]`
1768 /// * `billingAccounts/[BILLING_ACCOUNT_ID]`
1769 /// * `folders/[FOLDER_ID]`
1770 ///
1771 /// May alternatively be one or more views:
1772 ///
1773 /// * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1774 /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1775 /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1776 /// * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
1777 pub resource_names: std::vec::Vec<std::string::String>,
1778
1779 /// Optional. Only log entries that match the filter are returned. An empty
1780 /// filter matches all log entries in the resources listed in `resource_names`.
1781 /// Referencing a parent resource that is not listed in `resource_names` will
1782 /// cause the filter to return no results. The maximum length of a filter is
1783 /// 20,000 characters.
1784 pub filter: std::string::String,
1785
1786 /// Optional. The amount of time to buffer log entries at the server before
1787 /// being returned to prevent out of order results due to late arriving log
1788 /// entries. Valid values are between 0-60000 milliseconds. Defaults to 2000
1789 /// milliseconds.
1790 pub buffer_window: std::option::Option<wkt::Duration>,
1791
1792 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1793}
1794
1795impl TailLogEntriesRequest {
1796 pub fn new() -> Self {
1797 std::default::Default::default()
1798 }
1799
1800 /// Sets the value of [resource_names][crate::model::TailLogEntriesRequest::resource_names].
1801 ///
1802 /// # Example
1803 /// ```ignore,no_run
1804 /// # use google_cloud_logging_v2::model::TailLogEntriesRequest;
1805 /// let x = TailLogEntriesRequest::new().set_resource_names(["a", "b", "c"]);
1806 /// ```
1807 pub fn set_resource_names<T, V>(mut self, v: T) -> Self
1808 where
1809 T: std::iter::IntoIterator<Item = V>,
1810 V: std::convert::Into<std::string::String>,
1811 {
1812 use std::iter::Iterator;
1813 self.resource_names = v.into_iter().map(|i| i.into()).collect();
1814 self
1815 }
1816
1817 /// Sets the value of [filter][crate::model::TailLogEntriesRequest::filter].
1818 ///
1819 /// # Example
1820 /// ```ignore,no_run
1821 /// # use google_cloud_logging_v2::model::TailLogEntriesRequest;
1822 /// let x = TailLogEntriesRequest::new().set_filter("example");
1823 /// ```
1824 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1825 self.filter = v.into();
1826 self
1827 }
1828
1829 /// Sets the value of [buffer_window][crate::model::TailLogEntriesRequest::buffer_window].
1830 ///
1831 /// # Example
1832 /// ```ignore,no_run
1833 /// # use google_cloud_logging_v2::model::TailLogEntriesRequest;
1834 /// use wkt::Duration;
1835 /// let x = TailLogEntriesRequest::new().set_buffer_window(Duration::default()/* use setters */);
1836 /// ```
1837 pub fn set_buffer_window<T>(mut self, v: T) -> Self
1838 where
1839 T: std::convert::Into<wkt::Duration>,
1840 {
1841 self.buffer_window = std::option::Option::Some(v.into());
1842 self
1843 }
1844
1845 /// Sets or clears the value of [buffer_window][crate::model::TailLogEntriesRequest::buffer_window].
1846 ///
1847 /// # Example
1848 /// ```ignore,no_run
1849 /// # use google_cloud_logging_v2::model::TailLogEntriesRequest;
1850 /// use wkt::Duration;
1851 /// let x = TailLogEntriesRequest::new().set_or_clear_buffer_window(Some(Duration::default()/* use setters */));
1852 /// let x = TailLogEntriesRequest::new().set_or_clear_buffer_window(None::<Duration>);
1853 /// ```
1854 pub fn set_or_clear_buffer_window<T>(mut self, v: std::option::Option<T>) -> Self
1855 where
1856 T: std::convert::Into<wkt::Duration>,
1857 {
1858 self.buffer_window = v.map(|x| x.into());
1859 self
1860 }
1861}
1862
1863impl wkt::message::Message for TailLogEntriesRequest {
1864 fn typename() -> &'static str {
1865 "type.googleapis.com/google.logging.v2.TailLogEntriesRequest"
1866 }
1867}
1868
1869/// Result returned from `TailLogEntries`.
1870#[derive(Clone, Default, PartialEq)]
1871#[non_exhaustive]
1872pub struct TailLogEntriesResponse {
1873 /// A list of log entries. Each response in the stream will order entries with
1874 /// increasing values of `LogEntry.timestamp`. Ordering is not guaranteed
1875 /// between separate responses.
1876 pub entries: std::vec::Vec<crate::model::LogEntry>,
1877
1878 /// If entries that otherwise would have been included in the session were not
1879 /// sent back to the client, counts of relevant entries omitted from the
1880 /// session with the reason that they were not included. There will be at most
1881 /// one of each reason per response. The counts represent the number of
1882 /// suppressed entries since the last streamed response.
1883 pub suppression_info: std::vec::Vec<crate::model::tail_log_entries_response::SuppressionInfo>,
1884
1885 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1886}
1887
1888impl TailLogEntriesResponse {
1889 pub fn new() -> Self {
1890 std::default::Default::default()
1891 }
1892
1893 /// Sets the value of [entries][crate::model::TailLogEntriesResponse::entries].
1894 ///
1895 /// # Example
1896 /// ```ignore,no_run
1897 /// # use google_cloud_logging_v2::model::TailLogEntriesResponse;
1898 /// use google_cloud_logging_v2::model::LogEntry;
1899 /// let x = TailLogEntriesResponse::new()
1900 /// .set_entries([
1901 /// LogEntry::default()/* use setters */,
1902 /// LogEntry::default()/* use (different) setters */,
1903 /// ]);
1904 /// ```
1905 pub fn set_entries<T, V>(mut self, v: T) -> Self
1906 where
1907 T: std::iter::IntoIterator<Item = V>,
1908 V: std::convert::Into<crate::model::LogEntry>,
1909 {
1910 use std::iter::Iterator;
1911 self.entries = v.into_iter().map(|i| i.into()).collect();
1912 self
1913 }
1914
1915 /// Sets the value of [suppression_info][crate::model::TailLogEntriesResponse::suppression_info].
1916 ///
1917 /// # Example
1918 /// ```ignore,no_run
1919 /// # use google_cloud_logging_v2::model::TailLogEntriesResponse;
1920 /// use google_cloud_logging_v2::model::tail_log_entries_response::SuppressionInfo;
1921 /// let x = TailLogEntriesResponse::new()
1922 /// .set_suppression_info([
1923 /// SuppressionInfo::default()/* use setters */,
1924 /// SuppressionInfo::default()/* use (different) setters */,
1925 /// ]);
1926 /// ```
1927 pub fn set_suppression_info<T, V>(mut self, v: T) -> Self
1928 where
1929 T: std::iter::IntoIterator<Item = V>,
1930 V: std::convert::Into<crate::model::tail_log_entries_response::SuppressionInfo>,
1931 {
1932 use std::iter::Iterator;
1933 self.suppression_info = v.into_iter().map(|i| i.into()).collect();
1934 self
1935 }
1936}
1937
1938impl wkt::message::Message for TailLogEntriesResponse {
1939 fn typename() -> &'static str {
1940 "type.googleapis.com/google.logging.v2.TailLogEntriesResponse"
1941 }
1942}
1943
1944/// Defines additional types related to [TailLogEntriesResponse].
1945pub mod tail_log_entries_response {
1946 #[allow(unused_imports)]
1947 use super::*;
1948
1949 /// Information about entries that were omitted from the session.
1950 #[derive(Clone, Default, PartialEq)]
1951 #[non_exhaustive]
1952 pub struct SuppressionInfo {
1953 /// The reason that entries were omitted from the session.
1954 pub reason: crate::model::tail_log_entries_response::suppression_info::Reason,
1955
1956 /// A lower bound on the count of entries omitted due to `reason`.
1957 pub suppressed_count: i32,
1958
1959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1960 }
1961
1962 impl SuppressionInfo {
1963 pub fn new() -> Self {
1964 std::default::Default::default()
1965 }
1966
1967 /// Sets the value of [reason][crate::model::tail_log_entries_response::SuppressionInfo::reason].
1968 ///
1969 /// # Example
1970 /// ```ignore,no_run
1971 /// # use google_cloud_logging_v2::model::tail_log_entries_response::SuppressionInfo;
1972 /// use google_cloud_logging_v2::model::tail_log_entries_response::suppression_info::Reason;
1973 /// let x0 = SuppressionInfo::new().set_reason(Reason::RateLimit);
1974 /// let x1 = SuppressionInfo::new().set_reason(Reason::NotConsumed);
1975 /// ```
1976 pub fn set_reason<
1977 T: std::convert::Into<crate::model::tail_log_entries_response::suppression_info::Reason>,
1978 >(
1979 mut self,
1980 v: T,
1981 ) -> Self {
1982 self.reason = v.into();
1983 self
1984 }
1985
1986 /// Sets the value of [suppressed_count][crate::model::tail_log_entries_response::SuppressionInfo::suppressed_count].
1987 ///
1988 /// # Example
1989 /// ```ignore,no_run
1990 /// # use google_cloud_logging_v2::model::tail_log_entries_response::SuppressionInfo;
1991 /// let x = SuppressionInfo::new().set_suppressed_count(42);
1992 /// ```
1993 pub fn set_suppressed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1994 self.suppressed_count = v.into();
1995 self
1996 }
1997 }
1998
1999 impl wkt::message::Message for SuppressionInfo {
2000 fn typename() -> &'static str {
2001 "type.googleapis.com/google.logging.v2.TailLogEntriesResponse.SuppressionInfo"
2002 }
2003 }
2004
2005 /// Defines additional types related to [SuppressionInfo].
2006 pub mod suppression_info {
2007 #[allow(unused_imports)]
2008 use super::*;
2009
2010 /// An indicator of why entries were omitted.
2011 ///
2012 /// # Working with unknown values
2013 ///
2014 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2015 /// additional enum variants at any time. Adding new variants is not considered
2016 /// a breaking change. Applications should write their code in anticipation of:
2017 ///
2018 /// - New values appearing in future releases of the client library, **and**
2019 /// - New values received dynamically, without application changes.
2020 ///
2021 /// Please consult the [Working with enums] section in the user guide for some
2022 /// guidelines.
2023 ///
2024 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2025 #[derive(Clone, Debug, PartialEq)]
2026 #[non_exhaustive]
2027 pub enum Reason {
2028 /// Unexpected default.
2029 Unspecified,
2030 /// Indicates suppression occurred due to relevant entries being
2031 /// received in excess of rate limits. For quotas and limits, see
2032 /// [Logging API quotas and
2033 /// limits](https://cloud.google.com/logging/quotas#api-limits).
2034 RateLimit,
2035 /// Indicates suppression occurred due to the client not consuming
2036 /// responses quickly enough.
2037 NotConsumed,
2038 /// If set, the enum was initialized with an unknown value.
2039 ///
2040 /// Applications can examine the value using [Reason::value] or
2041 /// [Reason::name].
2042 UnknownValue(reason::UnknownValue),
2043 }
2044
2045 #[doc(hidden)]
2046 pub mod reason {
2047 #[allow(unused_imports)]
2048 use super::*;
2049 #[derive(Clone, Debug, PartialEq)]
2050 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2051 }
2052
2053 impl Reason {
2054 /// Gets the enum value.
2055 ///
2056 /// Returns `None` if the enum contains an unknown value deserialized from
2057 /// the string representation of enums.
2058 pub fn value(&self) -> std::option::Option<i32> {
2059 match self {
2060 Self::Unspecified => std::option::Option::Some(0),
2061 Self::RateLimit => std::option::Option::Some(1),
2062 Self::NotConsumed => std::option::Option::Some(2),
2063 Self::UnknownValue(u) => u.0.value(),
2064 }
2065 }
2066
2067 /// Gets the enum value as a string.
2068 ///
2069 /// Returns `None` if the enum contains an unknown value deserialized from
2070 /// the integer representation of enums.
2071 pub fn name(&self) -> std::option::Option<&str> {
2072 match self {
2073 Self::Unspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
2074 Self::RateLimit => std::option::Option::Some("RATE_LIMIT"),
2075 Self::NotConsumed => std::option::Option::Some("NOT_CONSUMED"),
2076 Self::UnknownValue(u) => u.0.name(),
2077 }
2078 }
2079 }
2080
2081 impl std::default::Default for Reason {
2082 fn default() -> Self {
2083 use std::convert::From;
2084 Self::from(0)
2085 }
2086 }
2087
2088 impl std::fmt::Display for Reason {
2089 fn fmt(
2090 &self,
2091 f: &mut std::fmt::Formatter<'_>,
2092 ) -> std::result::Result<(), std::fmt::Error> {
2093 wkt::internal::display_enum(f, self.name(), self.value())
2094 }
2095 }
2096
2097 impl std::convert::From<i32> for Reason {
2098 fn from(value: i32) -> Self {
2099 match value {
2100 0 => Self::Unspecified,
2101 1 => Self::RateLimit,
2102 2 => Self::NotConsumed,
2103 _ => Self::UnknownValue(reason::UnknownValue(
2104 wkt::internal::UnknownEnumValue::Integer(value),
2105 )),
2106 }
2107 }
2108 }
2109
2110 impl std::convert::From<&str> for Reason {
2111 fn from(value: &str) -> Self {
2112 use std::string::ToString;
2113 match value {
2114 "REASON_UNSPECIFIED" => Self::Unspecified,
2115 "RATE_LIMIT" => Self::RateLimit,
2116 "NOT_CONSUMED" => Self::NotConsumed,
2117 _ => Self::UnknownValue(reason::UnknownValue(
2118 wkt::internal::UnknownEnumValue::String(value.to_string()),
2119 )),
2120 }
2121 }
2122 }
2123
2124 impl serde::ser::Serialize for Reason {
2125 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2126 where
2127 S: serde::Serializer,
2128 {
2129 match self {
2130 Self::Unspecified => serializer.serialize_i32(0),
2131 Self::RateLimit => serializer.serialize_i32(1),
2132 Self::NotConsumed => serializer.serialize_i32(2),
2133 Self::UnknownValue(u) => u.0.serialize(serializer),
2134 }
2135 }
2136 }
2137
2138 impl<'de> serde::de::Deserialize<'de> for Reason {
2139 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2140 where
2141 D: serde::Deserializer<'de>,
2142 {
2143 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reason>::new(
2144 ".google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason",
2145 ))
2146 }
2147 }
2148 }
2149}
2150
2151/// Configuration for an indexed field.
2152#[derive(Clone, Default, PartialEq)]
2153#[non_exhaustive]
2154pub struct IndexConfig {
2155 /// Required. The LogEntry field path to index.
2156 ///
2157 /// Note that some paths are automatically indexed, and other paths are not
2158 /// eligible for indexing. See [indexing documentation](
2159 /// <https://cloud.google.com/logging/docs/view/advanced-queries#indexed-fields>)
2160 /// for details.
2161 ///
2162 /// For example: `jsonPayload.request.status`
2163 pub field_path: std::string::String,
2164
2165 /// Required. The type of data in this index.
2166 pub r#type: crate::model::IndexType,
2167
2168 /// Output only. The timestamp when the index was last modified.
2169 ///
2170 /// This is used to return the timestamp, and will be ignored if supplied
2171 /// during update.
2172 pub create_time: std::option::Option<wkt::Timestamp>,
2173
2174 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2175}
2176
2177impl IndexConfig {
2178 pub fn new() -> Self {
2179 std::default::Default::default()
2180 }
2181
2182 /// Sets the value of [field_path][crate::model::IndexConfig::field_path].
2183 ///
2184 /// # Example
2185 /// ```ignore,no_run
2186 /// # use google_cloud_logging_v2::model::IndexConfig;
2187 /// let x = IndexConfig::new().set_field_path("example");
2188 /// ```
2189 pub fn set_field_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2190 self.field_path = v.into();
2191 self
2192 }
2193
2194 /// Sets the value of [r#type][crate::model::IndexConfig::type].
2195 ///
2196 /// # Example
2197 /// ```ignore,no_run
2198 /// # use google_cloud_logging_v2::model::IndexConfig;
2199 /// use google_cloud_logging_v2::model::IndexType;
2200 /// let x0 = IndexConfig::new().set_type(IndexType::String);
2201 /// let x1 = IndexConfig::new().set_type(IndexType::Integer);
2202 /// ```
2203 pub fn set_type<T: std::convert::Into<crate::model::IndexType>>(mut self, v: T) -> Self {
2204 self.r#type = v.into();
2205 self
2206 }
2207
2208 /// Sets the value of [create_time][crate::model::IndexConfig::create_time].
2209 ///
2210 /// # Example
2211 /// ```ignore,no_run
2212 /// # use google_cloud_logging_v2::model::IndexConfig;
2213 /// use wkt::Timestamp;
2214 /// let x = IndexConfig::new().set_create_time(Timestamp::default()/* use setters */);
2215 /// ```
2216 pub fn set_create_time<T>(mut self, v: T) -> Self
2217 where
2218 T: std::convert::Into<wkt::Timestamp>,
2219 {
2220 self.create_time = std::option::Option::Some(v.into());
2221 self
2222 }
2223
2224 /// Sets or clears the value of [create_time][crate::model::IndexConfig::create_time].
2225 ///
2226 /// # Example
2227 /// ```ignore,no_run
2228 /// # use google_cloud_logging_v2::model::IndexConfig;
2229 /// use wkt::Timestamp;
2230 /// let x = IndexConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2231 /// let x = IndexConfig::new().set_or_clear_create_time(None::<Timestamp>);
2232 /// ```
2233 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2234 where
2235 T: std::convert::Into<wkt::Timestamp>,
2236 {
2237 self.create_time = v.map(|x| x.into());
2238 self
2239 }
2240}
2241
2242impl wkt::message::Message for IndexConfig {
2243 fn typename() -> &'static str {
2244 "type.googleapis.com/google.logging.v2.IndexConfig"
2245 }
2246}
2247
2248/// Describes a repository in which log entries are stored.
2249#[derive(Clone, Default, PartialEq)]
2250#[non_exhaustive]
2251pub struct LogBucket {
2252 /// Output only. The resource name of the bucket.
2253 ///
2254 /// For example:
2255 ///
2256 /// `projects/my-project/locations/global/buckets/my-bucket`
2257 ///
2258 /// For a list of supported locations, see [Supported
2259 /// Regions](https://cloud.google.com/logging/docs/region-support)
2260 ///
2261 /// For the location of `global` it is unspecified where log entries are
2262 /// actually stored.
2263 ///
2264 /// After a bucket has been created, the location cannot be changed.
2265 pub name: std::string::String,
2266
2267 /// Describes this bucket.
2268 pub description: std::string::String,
2269
2270 /// Output only. The creation timestamp of the bucket. This is not set for any
2271 /// of the default buckets.
2272 pub create_time: std::option::Option<wkt::Timestamp>,
2273
2274 /// Output only. The last update timestamp of the bucket.
2275 pub update_time: std::option::Option<wkt::Timestamp>,
2276
2277 /// Logs will be retained by default for this amount of time, after which they
2278 /// will automatically be deleted. The minimum retention period is 1 day. If
2279 /// this value is set to zero at bucket creation time, the default time of 30
2280 /// days will be used.
2281 pub retention_days: i32,
2282
2283 /// Whether the bucket is locked.
2284 ///
2285 /// The retention period on a locked bucket cannot be changed. Locked buckets
2286 /// may only be deleted if they are empty.
2287 pub locked: bool,
2288
2289 /// Output only. The bucket lifecycle state.
2290 pub lifecycle_state: crate::model::LifecycleState,
2291
2292 /// Whether log analytics is enabled for this bucket.
2293 ///
2294 /// Once enabled, log analytics features cannot be disabled.
2295 pub analytics_enabled: bool,
2296
2297 /// Log entry field paths that are denied access in this bucket.
2298 ///
2299 /// The following fields and their children are eligible: `textPayload`,
2300 /// `jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`.
2301 ///
2302 /// Restricting a repeated field will restrict all values. Adding a parent will
2303 /// block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`)
2304 pub restricted_fields: std::vec::Vec<std::string::String>,
2305
2306 /// A list of indexed fields and related configuration data.
2307 pub index_configs: std::vec::Vec<crate::model::IndexConfig>,
2308
2309 /// The CMEK settings of the log bucket. If present, new log entries written to
2310 /// this log bucket are encrypted using the CMEK key provided in this
2311 /// configuration. If a log bucket has CMEK settings, the CMEK settings cannot
2312 /// be disabled later by updating the log bucket. Changing the KMS key is
2313 /// allowed.
2314 pub cmek_settings: std::option::Option<crate::model::CmekSettings>,
2315
2316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2317}
2318
2319impl LogBucket {
2320 pub fn new() -> Self {
2321 std::default::Default::default()
2322 }
2323
2324 /// Sets the value of [name][crate::model::LogBucket::name].
2325 ///
2326 /// # Example
2327 /// ```ignore,no_run
2328 /// # use google_cloud_logging_v2::model::LogBucket;
2329 /// let x = LogBucket::new().set_name("example");
2330 /// ```
2331 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2332 self.name = v.into();
2333 self
2334 }
2335
2336 /// Sets the value of [description][crate::model::LogBucket::description].
2337 ///
2338 /// # Example
2339 /// ```ignore,no_run
2340 /// # use google_cloud_logging_v2::model::LogBucket;
2341 /// let x = LogBucket::new().set_description("example");
2342 /// ```
2343 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2344 self.description = v.into();
2345 self
2346 }
2347
2348 /// Sets the value of [create_time][crate::model::LogBucket::create_time].
2349 ///
2350 /// # Example
2351 /// ```ignore,no_run
2352 /// # use google_cloud_logging_v2::model::LogBucket;
2353 /// use wkt::Timestamp;
2354 /// let x = LogBucket::new().set_create_time(Timestamp::default()/* use setters */);
2355 /// ```
2356 pub fn set_create_time<T>(mut self, v: T) -> Self
2357 where
2358 T: std::convert::Into<wkt::Timestamp>,
2359 {
2360 self.create_time = std::option::Option::Some(v.into());
2361 self
2362 }
2363
2364 /// Sets or clears the value of [create_time][crate::model::LogBucket::create_time].
2365 ///
2366 /// # Example
2367 /// ```ignore,no_run
2368 /// # use google_cloud_logging_v2::model::LogBucket;
2369 /// use wkt::Timestamp;
2370 /// let x = LogBucket::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2371 /// let x = LogBucket::new().set_or_clear_create_time(None::<Timestamp>);
2372 /// ```
2373 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2374 where
2375 T: std::convert::Into<wkt::Timestamp>,
2376 {
2377 self.create_time = v.map(|x| x.into());
2378 self
2379 }
2380
2381 /// Sets the value of [update_time][crate::model::LogBucket::update_time].
2382 ///
2383 /// # Example
2384 /// ```ignore,no_run
2385 /// # use google_cloud_logging_v2::model::LogBucket;
2386 /// use wkt::Timestamp;
2387 /// let x = LogBucket::new().set_update_time(Timestamp::default()/* use setters */);
2388 /// ```
2389 pub fn set_update_time<T>(mut self, v: T) -> Self
2390 where
2391 T: std::convert::Into<wkt::Timestamp>,
2392 {
2393 self.update_time = std::option::Option::Some(v.into());
2394 self
2395 }
2396
2397 /// Sets or clears the value of [update_time][crate::model::LogBucket::update_time].
2398 ///
2399 /// # Example
2400 /// ```ignore,no_run
2401 /// # use google_cloud_logging_v2::model::LogBucket;
2402 /// use wkt::Timestamp;
2403 /// let x = LogBucket::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2404 /// let x = LogBucket::new().set_or_clear_update_time(None::<Timestamp>);
2405 /// ```
2406 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2407 where
2408 T: std::convert::Into<wkt::Timestamp>,
2409 {
2410 self.update_time = v.map(|x| x.into());
2411 self
2412 }
2413
2414 /// Sets the value of [retention_days][crate::model::LogBucket::retention_days].
2415 ///
2416 /// # Example
2417 /// ```ignore,no_run
2418 /// # use google_cloud_logging_v2::model::LogBucket;
2419 /// let x = LogBucket::new().set_retention_days(42);
2420 /// ```
2421 pub fn set_retention_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2422 self.retention_days = v.into();
2423 self
2424 }
2425
2426 /// Sets the value of [locked][crate::model::LogBucket::locked].
2427 ///
2428 /// # Example
2429 /// ```ignore,no_run
2430 /// # use google_cloud_logging_v2::model::LogBucket;
2431 /// let x = LogBucket::new().set_locked(true);
2432 /// ```
2433 pub fn set_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2434 self.locked = v.into();
2435 self
2436 }
2437
2438 /// Sets the value of [lifecycle_state][crate::model::LogBucket::lifecycle_state].
2439 ///
2440 /// # Example
2441 /// ```ignore,no_run
2442 /// # use google_cloud_logging_v2::model::LogBucket;
2443 /// use google_cloud_logging_v2::model::LifecycleState;
2444 /// let x0 = LogBucket::new().set_lifecycle_state(LifecycleState::Active);
2445 /// let x1 = LogBucket::new().set_lifecycle_state(LifecycleState::DeleteRequested);
2446 /// let x2 = LogBucket::new().set_lifecycle_state(LifecycleState::Updating);
2447 /// ```
2448 pub fn set_lifecycle_state<T: std::convert::Into<crate::model::LifecycleState>>(
2449 mut self,
2450 v: T,
2451 ) -> Self {
2452 self.lifecycle_state = v.into();
2453 self
2454 }
2455
2456 /// Sets the value of [analytics_enabled][crate::model::LogBucket::analytics_enabled].
2457 ///
2458 /// # Example
2459 /// ```ignore,no_run
2460 /// # use google_cloud_logging_v2::model::LogBucket;
2461 /// let x = LogBucket::new().set_analytics_enabled(true);
2462 /// ```
2463 pub fn set_analytics_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2464 self.analytics_enabled = v.into();
2465 self
2466 }
2467
2468 /// Sets the value of [restricted_fields][crate::model::LogBucket::restricted_fields].
2469 ///
2470 /// # Example
2471 /// ```ignore,no_run
2472 /// # use google_cloud_logging_v2::model::LogBucket;
2473 /// let x = LogBucket::new().set_restricted_fields(["a", "b", "c"]);
2474 /// ```
2475 pub fn set_restricted_fields<T, V>(mut self, v: T) -> Self
2476 where
2477 T: std::iter::IntoIterator<Item = V>,
2478 V: std::convert::Into<std::string::String>,
2479 {
2480 use std::iter::Iterator;
2481 self.restricted_fields = v.into_iter().map(|i| i.into()).collect();
2482 self
2483 }
2484
2485 /// Sets the value of [index_configs][crate::model::LogBucket::index_configs].
2486 ///
2487 /// # Example
2488 /// ```ignore,no_run
2489 /// # use google_cloud_logging_v2::model::LogBucket;
2490 /// use google_cloud_logging_v2::model::IndexConfig;
2491 /// let x = LogBucket::new()
2492 /// .set_index_configs([
2493 /// IndexConfig::default()/* use setters */,
2494 /// IndexConfig::default()/* use (different) setters */,
2495 /// ]);
2496 /// ```
2497 pub fn set_index_configs<T, V>(mut self, v: T) -> Self
2498 where
2499 T: std::iter::IntoIterator<Item = V>,
2500 V: std::convert::Into<crate::model::IndexConfig>,
2501 {
2502 use std::iter::Iterator;
2503 self.index_configs = v.into_iter().map(|i| i.into()).collect();
2504 self
2505 }
2506
2507 /// Sets the value of [cmek_settings][crate::model::LogBucket::cmek_settings].
2508 ///
2509 /// # Example
2510 /// ```ignore,no_run
2511 /// # use google_cloud_logging_v2::model::LogBucket;
2512 /// use google_cloud_logging_v2::model::CmekSettings;
2513 /// let x = LogBucket::new().set_cmek_settings(CmekSettings::default()/* use setters */);
2514 /// ```
2515 pub fn set_cmek_settings<T>(mut self, v: T) -> Self
2516 where
2517 T: std::convert::Into<crate::model::CmekSettings>,
2518 {
2519 self.cmek_settings = std::option::Option::Some(v.into());
2520 self
2521 }
2522
2523 /// Sets or clears the value of [cmek_settings][crate::model::LogBucket::cmek_settings].
2524 ///
2525 /// # Example
2526 /// ```ignore,no_run
2527 /// # use google_cloud_logging_v2::model::LogBucket;
2528 /// use google_cloud_logging_v2::model::CmekSettings;
2529 /// let x = LogBucket::new().set_or_clear_cmek_settings(Some(CmekSettings::default()/* use setters */));
2530 /// let x = LogBucket::new().set_or_clear_cmek_settings(None::<CmekSettings>);
2531 /// ```
2532 pub fn set_or_clear_cmek_settings<T>(mut self, v: std::option::Option<T>) -> Self
2533 where
2534 T: std::convert::Into<crate::model::CmekSettings>,
2535 {
2536 self.cmek_settings = v.map(|x| x.into());
2537 self
2538 }
2539}
2540
2541impl wkt::message::Message for LogBucket {
2542 fn typename() -> &'static str {
2543 "type.googleapis.com/google.logging.v2.LogBucket"
2544 }
2545}
2546
2547/// Describes a view over log entries in a bucket.
2548#[derive(Clone, Default, PartialEq)]
2549#[non_exhaustive]
2550pub struct LogView {
2551 /// The resource name of the view.
2552 ///
2553 /// For example:
2554 ///
2555 /// `projects/my-project/locations/global/buckets/my-bucket/views/my-view`
2556 pub name: std::string::String,
2557
2558 /// Describes this view.
2559 pub description: std::string::String,
2560
2561 /// Output only. The creation timestamp of the view.
2562 pub create_time: std::option::Option<wkt::Timestamp>,
2563
2564 /// Output only. The last update timestamp of the view.
2565 pub update_time: std::option::Option<wkt::Timestamp>,
2566
2567 /// Filter that restricts which log entries in a bucket are visible in this
2568 /// view.
2569 ///
2570 /// Filters are restricted to be a logical AND of ==/!= of any of the
2571 /// following:
2572 ///
2573 /// - originating project/folder/organization/billing account.
2574 /// - resource type
2575 /// - log id
2576 ///
2577 /// For example:
2578 ///
2579 /// SOURCE("projects/myproject") AND resource.type = "gce_instance"
2580 /// AND LOG_ID("stdout")
2581 pub filter: std::string::String,
2582
2583 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2584}
2585
2586impl LogView {
2587 pub fn new() -> Self {
2588 std::default::Default::default()
2589 }
2590
2591 /// Sets the value of [name][crate::model::LogView::name].
2592 ///
2593 /// # Example
2594 /// ```ignore,no_run
2595 /// # use google_cloud_logging_v2::model::LogView;
2596 /// let x = LogView::new().set_name("example");
2597 /// ```
2598 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2599 self.name = v.into();
2600 self
2601 }
2602
2603 /// Sets the value of [description][crate::model::LogView::description].
2604 ///
2605 /// # Example
2606 /// ```ignore,no_run
2607 /// # use google_cloud_logging_v2::model::LogView;
2608 /// let x = LogView::new().set_description("example");
2609 /// ```
2610 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2611 self.description = v.into();
2612 self
2613 }
2614
2615 /// Sets the value of [create_time][crate::model::LogView::create_time].
2616 ///
2617 /// # Example
2618 /// ```ignore,no_run
2619 /// # use google_cloud_logging_v2::model::LogView;
2620 /// use wkt::Timestamp;
2621 /// let x = LogView::new().set_create_time(Timestamp::default()/* use setters */);
2622 /// ```
2623 pub fn set_create_time<T>(mut self, v: T) -> Self
2624 where
2625 T: std::convert::Into<wkt::Timestamp>,
2626 {
2627 self.create_time = std::option::Option::Some(v.into());
2628 self
2629 }
2630
2631 /// Sets or clears the value of [create_time][crate::model::LogView::create_time].
2632 ///
2633 /// # Example
2634 /// ```ignore,no_run
2635 /// # use google_cloud_logging_v2::model::LogView;
2636 /// use wkt::Timestamp;
2637 /// let x = LogView::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2638 /// let x = LogView::new().set_or_clear_create_time(None::<Timestamp>);
2639 /// ```
2640 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2641 where
2642 T: std::convert::Into<wkt::Timestamp>,
2643 {
2644 self.create_time = v.map(|x| x.into());
2645 self
2646 }
2647
2648 /// Sets the value of [update_time][crate::model::LogView::update_time].
2649 ///
2650 /// # Example
2651 /// ```ignore,no_run
2652 /// # use google_cloud_logging_v2::model::LogView;
2653 /// use wkt::Timestamp;
2654 /// let x = LogView::new().set_update_time(Timestamp::default()/* use setters */);
2655 /// ```
2656 pub fn set_update_time<T>(mut self, v: T) -> Self
2657 where
2658 T: std::convert::Into<wkt::Timestamp>,
2659 {
2660 self.update_time = std::option::Option::Some(v.into());
2661 self
2662 }
2663
2664 /// Sets or clears the value of [update_time][crate::model::LogView::update_time].
2665 ///
2666 /// # Example
2667 /// ```ignore,no_run
2668 /// # use google_cloud_logging_v2::model::LogView;
2669 /// use wkt::Timestamp;
2670 /// let x = LogView::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2671 /// let x = LogView::new().set_or_clear_update_time(None::<Timestamp>);
2672 /// ```
2673 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2674 where
2675 T: std::convert::Into<wkt::Timestamp>,
2676 {
2677 self.update_time = v.map(|x| x.into());
2678 self
2679 }
2680
2681 /// Sets the value of [filter][crate::model::LogView::filter].
2682 ///
2683 /// # Example
2684 /// ```ignore,no_run
2685 /// # use google_cloud_logging_v2::model::LogView;
2686 /// let x = LogView::new().set_filter("example");
2687 /// ```
2688 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2689 self.filter = v.into();
2690 self
2691 }
2692}
2693
2694impl wkt::message::Message for LogView {
2695 fn typename() -> &'static str {
2696 "type.googleapis.com/google.logging.v2.LogView"
2697 }
2698}
2699
2700/// Describes a sink used to export log entries to one of the following
2701/// destinations in any project: a Cloud Storage bucket, a BigQuery dataset, a
2702/// Pub/Sub topic or a Cloud Logging log bucket. A logs filter controls which log
2703/// entries are exported. The sink must be created within a project,
2704/// organization, billing account, or folder.
2705#[derive(Clone, Default, PartialEq)]
2706#[non_exhaustive]
2707pub struct LogSink {
2708 /// Required. The client-assigned sink identifier, unique within the project.
2709 ///
2710 /// For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited
2711 /// to 100 characters and can include only the following characters: upper and
2712 /// lower-case alphanumeric characters, underscores, hyphens, and periods.
2713 /// First character has to be alphanumeric.
2714 pub name: std::string::String,
2715
2716 /// Required. The export destination:
2717 ///
2718 /// ```norust
2719 /// "storage.googleapis.com/[GCS_BUCKET]"
2720 /// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
2721 /// "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
2722 /// ```
2723 ///
2724 /// The sink's `writer_identity`, set when the sink is created, must have
2725 /// permission to write to the destination or else the log entries are not
2726 /// exported. For more information, see
2727 /// [Exporting Logs with
2728 /// Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
2729 pub destination: std::string::String,
2730
2731 /// Optional. An [advanced logs
2732 /// filter](https://cloud.google.com/logging/docs/view/advanced-queries). The
2733 /// only exported log entries are those that are in the resource owning the
2734 /// sink and that match the filter.
2735 ///
2736 /// For example:
2737 ///
2738 /// `logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR`
2739 pub filter: std::string::String,
2740
2741 /// Optional. A description of this sink.
2742 ///
2743 /// The maximum length of the description is 8000 characters.
2744 pub description: std::string::String,
2745
2746 /// Optional. If set to true, then this sink is disabled and it does not export
2747 /// any log entries.
2748 pub disabled: bool,
2749
2750 /// Optional. Log entries that match any of these exclusion filters will not be
2751 /// exported.
2752 ///
2753 /// If a log entry is matched by both `filter` and one of `exclusion_filters`
2754 /// it will not be exported.
2755 pub exclusions: std::vec::Vec<crate::model::LogExclusion>,
2756
2757 /// Deprecated. This field is unused.
2758 #[deprecated]
2759 pub output_version_format: crate::model::log_sink::VersionFormat,
2760
2761 /// Output only. An IAM identity—a service account or group—under
2762 /// which Cloud Logging writes the exported log entries to the sink's
2763 /// destination. This field is either set by specifying
2764 /// `custom_writer_identity` or set automatically by
2765 /// [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] and
2766 /// [sinks.update][google.logging.v2.ConfigServiceV2.UpdateSink] based on the
2767 /// value of `unique_writer_identity` in those methods.
2768 ///
2769 /// Until you grant this identity write-access to the destination, log entry
2770 /// exports from this sink will fail. For more information, see [Granting
2771 /// Access for a
2772 /// Resource](https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource).
2773 /// Consult the destination service's documentation to determine the
2774 /// appropriate IAM roles to assign to the identity.
2775 ///
2776 /// Sinks that have a destination that is a log bucket in the same project as
2777 /// the sink cannot have a writer_identity and no additional permissions are
2778 /// required.
2779 ///
2780 /// [google.logging.v2.ConfigServiceV2.CreateSink]: crate::client::ConfigServiceV2::create_sink
2781 /// [google.logging.v2.ConfigServiceV2.UpdateSink]: crate::client::ConfigServiceV2::update_sink
2782 pub writer_identity: std::string::String,
2783
2784 /// Optional. This field applies only to sinks owned by organizations and
2785 /// folders. If the field is false, the default, only the logs owned by the
2786 /// sink's parent resource are available for export. If the field is true, then
2787 /// log entries from all the projects, folders, and billing accounts contained
2788 /// in the sink's parent resource are also available for export. Whether a
2789 /// particular log entry from the children is exported depends on the sink's
2790 /// filter expression.
2791 ///
2792 /// For example, if this field is true, then the filter
2793 /// `resource.type=gce_instance` would export all Compute Engine VM instance
2794 /// log entries from all projects in the sink's parent.
2795 ///
2796 /// To only export entries from certain child projects, filter on the project
2797 /// part of the log name:
2798 ///
2799 /// logName:("projects/test-project1/" OR "projects/test-project2/") AND
2800 /// resource.type=gce_instance
2801 pub include_children: bool,
2802
2803 /// Output only. The creation timestamp of the sink.
2804 ///
2805 /// This field may not be present for older sinks.
2806 pub create_time: std::option::Option<wkt::Timestamp>,
2807
2808 /// Output only. The last update timestamp of the sink.
2809 ///
2810 /// This field may not be present for older sinks.
2811 pub update_time: std::option::Option<wkt::Timestamp>,
2812
2813 /// Destination dependent options.
2814 pub options: std::option::Option<crate::model::log_sink::Options>,
2815
2816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2817}
2818
2819impl LogSink {
2820 pub fn new() -> Self {
2821 std::default::Default::default()
2822 }
2823
2824 /// Sets the value of [name][crate::model::LogSink::name].
2825 ///
2826 /// # Example
2827 /// ```ignore,no_run
2828 /// # use google_cloud_logging_v2::model::LogSink;
2829 /// let x = LogSink::new().set_name("example");
2830 /// ```
2831 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2832 self.name = v.into();
2833 self
2834 }
2835
2836 /// Sets the value of [destination][crate::model::LogSink::destination].
2837 ///
2838 /// # Example
2839 /// ```ignore,no_run
2840 /// # use google_cloud_logging_v2::model::LogSink;
2841 /// let x = LogSink::new().set_destination("example");
2842 /// ```
2843 pub fn set_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2844 self.destination = v.into();
2845 self
2846 }
2847
2848 /// Sets the value of [filter][crate::model::LogSink::filter].
2849 ///
2850 /// # Example
2851 /// ```ignore,no_run
2852 /// # use google_cloud_logging_v2::model::LogSink;
2853 /// let x = LogSink::new().set_filter("example");
2854 /// ```
2855 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2856 self.filter = v.into();
2857 self
2858 }
2859
2860 /// Sets the value of [description][crate::model::LogSink::description].
2861 ///
2862 /// # Example
2863 /// ```ignore,no_run
2864 /// # use google_cloud_logging_v2::model::LogSink;
2865 /// let x = LogSink::new().set_description("example");
2866 /// ```
2867 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2868 self.description = v.into();
2869 self
2870 }
2871
2872 /// Sets the value of [disabled][crate::model::LogSink::disabled].
2873 ///
2874 /// # Example
2875 /// ```ignore,no_run
2876 /// # use google_cloud_logging_v2::model::LogSink;
2877 /// let x = LogSink::new().set_disabled(true);
2878 /// ```
2879 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2880 self.disabled = v.into();
2881 self
2882 }
2883
2884 /// Sets the value of [exclusions][crate::model::LogSink::exclusions].
2885 ///
2886 /// # Example
2887 /// ```ignore,no_run
2888 /// # use google_cloud_logging_v2::model::LogSink;
2889 /// use google_cloud_logging_v2::model::LogExclusion;
2890 /// let x = LogSink::new()
2891 /// .set_exclusions([
2892 /// LogExclusion::default()/* use setters */,
2893 /// LogExclusion::default()/* use (different) setters */,
2894 /// ]);
2895 /// ```
2896 pub fn set_exclusions<T, V>(mut self, v: T) -> Self
2897 where
2898 T: std::iter::IntoIterator<Item = V>,
2899 V: std::convert::Into<crate::model::LogExclusion>,
2900 {
2901 use std::iter::Iterator;
2902 self.exclusions = v.into_iter().map(|i| i.into()).collect();
2903 self
2904 }
2905
2906 /// Sets the value of [output_version_format][crate::model::LogSink::output_version_format].
2907 ///
2908 /// # Example
2909 /// ```ignore,no_run
2910 /// # use google_cloud_logging_v2::model::LogSink;
2911 /// use google_cloud_logging_v2::model::log_sink::VersionFormat;
2912 /// let x0 = LogSink::new().set_output_version_format(VersionFormat::V2);
2913 /// let x1 = LogSink::new().set_output_version_format(VersionFormat::V1);
2914 /// ```
2915 #[deprecated]
2916 pub fn set_output_version_format<
2917 T: std::convert::Into<crate::model::log_sink::VersionFormat>,
2918 >(
2919 mut self,
2920 v: T,
2921 ) -> Self {
2922 self.output_version_format = v.into();
2923 self
2924 }
2925
2926 /// Sets the value of [writer_identity][crate::model::LogSink::writer_identity].
2927 ///
2928 /// # Example
2929 /// ```ignore,no_run
2930 /// # use google_cloud_logging_v2::model::LogSink;
2931 /// let x = LogSink::new().set_writer_identity("example");
2932 /// ```
2933 pub fn set_writer_identity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2934 self.writer_identity = v.into();
2935 self
2936 }
2937
2938 /// Sets the value of [include_children][crate::model::LogSink::include_children].
2939 ///
2940 /// # Example
2941 /// ```ignore,no_run
2942 /// # use google_cloud_logging_v2::model::LogSink;
2943 /// let x = LogSink::new().set_include_children(true);
2944 /// ```
2945 pub fn set_include_children<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2946 self.include_children = v.into();
2947 self
2948 }
2949
2950 /// Sets the value of [create_time][crate::model::LogSink::create_time].
2951 ///
2952 /// # Example
2953 /// ```ignore,no_run
2954 /// # use google_cloud_logging_v2::model::LogSink;
2955 /// use wkt::Timestamp;
2956 /// let x = LogSink::new().set_create_time(Timestamp::default()/* use setters */);
2957 /// ```
2958 pub fn set_create_time<T>(mut self, v: T) -> Self
2959 where
2960 T: std::convert::Into<wkt::Timestamp>,
2961 {
2962 self.create_time = std::option::Option::Some(v.into());
2963 self
2964 }
2965
2966 /// Sets or clears the value of [create_time][crate::model::LogSink::create_time].
2967 ///
2968 /// # Example
2969 /// ```ignore,no_run
2970 /// # use google_cloud_logging_v2::model::LogSink;
2971 /// use wkt::Timestamp;
2972 /// let x = LogSink::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2973 /// let x = LogSink::new().set_or_clear_create_time(None::<Timestamp>);
2974 /// ```
2975 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2976 where
2977 T: std::convert::Into<wkt::Timestamp>,
2978 {
2979 self.create_time = v.map(|x| x.into());
2980 self
2981 }
2982
2983 /// Sets the value of [update_time][crate::model::LogSink::update_time].
2984 ///
2985 /// # Example
2986 /// ```ignore,no_run
2987 /// # use google_cloud_logging_v2::model::LogSink;
2988 /// use wkt::Timestamp;
2989 /// let x = LogSink::new().set_update_time(Timestamp::default()/* use setters */);
2990 /// ```
2991 pub fn set_update_time<T>(mut self, v: T) -> Self
2992 where
2993 T: std::convert::Into<wkt::Timestamp>,
2994 {
2995 self.update_time = std::option::Option::Some(v.into());
2996 self
2997 }
2998
2999 /// Sets or clears the value of [update_time][crate::model::LogSink::update_time].
3000 ///
3001 /// # Example
3002 /// ```ignore,no_run
3003 /// # use google_cloud_logging_v2::model::LogSink;
3004 /// use wkt::Timestamp;
3005 /// let x = LogSink::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3006 /// let x = LogSink::new().set_or_clear_update_time(None::<Timestamp>);
3007 /// ```
3008 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3009 where
3010 T: std::convert::Into<wkt::Timestamp>,
3011 {
3012 self.update_time = v.map(|x| x.into());
3013 self
3014 }
3015
3016 /// Sets the value of [options][crate::model::LogSink::options].
3017 ///
3018 /// Note that all the setters affecting `options` are mutually
3019 /// exclusive.
3020 ///
3021 /// # Example
3022 /// ```ignore,no_run
3023 /// # use google_cloud_logging_v2::model::LogSink;
3024 /// use google_cloud_logging_v2::model::BigQueryOptions;
3025 /// let x = LogSink::new().set_options(Some(
3026 /// google_cloud_logging_v2::model::log_sink::Options::BigqueryOptions(BigQueryOptions::default().into())));
3027 /// ```
3028 pub fn set_options<
3029 T: std::convert::Into<std::option::Option<crate::model::log_sink::Options>>,
3030 >(
3031 mut self,
3032 v: T,
3033 ) -> Self {
3034 self.options = v.into();
3035 self
3036 }
3037
3038 /// The value of [options][crate::model::LogSink::options]
3039 /// if it holds a `BigqueryOptions`, `None` if the field is not set or
3040 /// holds a different branch.
3041 pub fn bigquery_options(
3042 &self,
3043 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQueryOptions>> {
3044 #[allow(unreachable_patterns)]
3045 self.options.as_ref().and_then(|v| match v {
3046 crate::model::log_sink::Options::BigqueryOptions(v) => std::option::Option::Some(v),
3047 _ => std::option::Option::None,
3048 })
3049 }
3050
3051 /// Sets the value of [options][crate::model::LogSink::options]
3052 /// to hold a `BigqueryOptions`.
3053 ///
3054 /// Note that all the setters affecting `options` are
3055 /// mutually exclusive.
3056 ///
3057 /// # Example
3058 /// ```ignore,no_run
3059 /// # use google_cloud_logging_v2::model::LogSink;
3060 /// use google_cloud_logging_v2::model::BigQueryOptions;
3061 /// let x = LogSink::new().set_bigquery_options(BigQueryOptions::default()/* use setters */);
3062 /// assert!(x.bigquery_options().is_some());
3063 /// ```
3064 pub fn set_bigquery_options<
3065 T: std::convert::Into<std::boxed::Box<crate::model::BigQueryOptions>>,
3066 >(
3067 mut self,
3068 v: T,
3069 ) -> Self {
3070 self.options =
3071 std::option::Option::Some(crate::model::log_sink::Options::BigqueryOptions(v.into()));
3072 self
3073 }
3074}
3075
3076impl wkt::message::Message for LogSink {
3077 fn typename() -> &'static str {
3078 "type.googleapis.com/google.logging.v2.LogSink"
3079 }
3080}
3081
3082/// Defines additional types related to [LogSink].
3083pub mod log_sink {
3084 #[allow(unused_imports)]
3085 use super::*;
3086
3087 /// Deprecated. This is unused.
3088 ///
3089 /// # Working with unknown values
3090 ///
3091 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3092 /// additional enum variants at any time. Adding new variants is not considered
3093 /// a breaking change. Applications should write their code in anticipation of:
3094 ///
3095 /// - New values appearing in future releases of the client library, **and**
3096 /// - New values received dynamically, without application changes.
3097 ///
3098 /// Please consult the [Working with enums] section in the user guide for some
3099 /// guidelines.
3100 ///
3101 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3102 #[derive(Clone, Debug, PartialEq)]
3103 #[non_exhaustive]
3104 pub enum VersionFormat {
3105 /// An unspecified format version that will default to V2.
3106 Unspecified,
3107 /// `LogEntry` version 2 format.
3108 V2,
3109 /// `LogEntry` version 1 format.
3110 V1,
3111 /// If set, the enum was initialized with an unknown value.
3112 ///
3113 /// Applications can examine the value using [VersionFormat::value] or
3114 /// [VersionFormat::name].
3115 UnknownValue(version_format::UnknownValue),
3116 }
3117
3118 #[doc(hidden)]
3119 pub mod version_format {
3120 #[allow(unused_imports)]
3121 use super::*;
3122 #[derive(Clone, Debug, PartialEq)]
3123 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3124 }
3125
3126 impl VersionFormat {
3127 /// Gets the enum value.
3128 ///
3129 /// Returns `None` if the enum contains an unknown value deserialized from
3130 /// the string representation of enums.
3131 pub fn value(&self) -> std::option::Option<i32> {
3132 match self {
3133 Self::Unspecified => std::option::Option::Some(0),
3134 Self::V2 => std::option::Option::Some(1),
3135 Self::V1 => std::option::Option::Some(2),
3136 Self::UnknownValue(u) => u.0.value(),
3137 }
3138 }
3139
3140 /// Gets the enum value as a string.
3141 ///
3142 /// Returns `None` if the enum contains an unknown value deserialized from
3143 /// the integer representation of enums.
3144 pub fn name(&self) -> std::option::Option<&str> {
3145 match self {
3146 Self::Unspecified => std::option::Option::Some("VERSION_FORMAT_UNSPECIFIED"),
3147 Self::V2 => std::option::Option::Some("V2"),
3148 Self::V1 => std::option::Option::Some("V1"),
3149 Self::UnknownValue(u) => u.0.name(),
3150 }
3151 }
3152 }
3153
3154 impl std::default::Default for VersionFormat {
3155 fn default() -> Self {
3156 use std::convert::From;
3157 Self::from(0)
3158 }
3159 }
3160
3161 impl std::fmt::Display for VersionFormat {
3162 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3163 wkt::internal::display_enum(f, self.name(), self.value())
3164 }
3165 }
3166
3167 impl std::convert::From<i32> for VersionFormat {
3168 fn from(value: i32) -> Self {
3169 match value {
3170 0 => Self::Unspecified,
3171 1 => Self::V2,
3172 2 => Self::V1,
3173 _ => Self::UnknownValue(version_format::UnknownValue(
3174 wkt::internal::UnknownEnumValue::Integer(value),
3175 )),
3176 }
3177 }
3178 }
3179
3180 impl std::convert::From<&str> for VersionFormat {
3181 fn from(value: &str) -> Self {
3182 use std::string::ToString;
3183 match value {
3184 "VERSION_FORMAT_UNSPECIFIED" => Self::Unspecified,
3185 "V2" => Self::V2,
3186 "V1" => Self::V1,
3187 _ => Self::UnknownValue(version_format::UnknownValue(
3188 wkt::internal::UnknownEnumValue::String(value.to_string()),
3189 )),
3190 }
3191 }
3192 }
3193
3194 impl serde::ser::Serialize for VersionFormat {
3195 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3196 where
3197 S: serde::Serializer,
3198 {
3199 match self {
3200 Self::Unspecified => serializer.serialize_i32(0),
3201 Self::V2 => serializer.serialize_i32(1),
3202 Self::V1 => serializer.serialize_i32(2),
3203 Self::UnknownValue(u) => u.0.serialize(serializer),
3204 }
3205 }
3206 }
3207
3208 impl<'de> serde::de::Deserialize<'de> for VersionFormat {
3209 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3210 where
3211 D: serde::Deserializer<'de>,
3212 {
3213 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VersionFormat>::new(
3214 ".google.logging.v2.LogSink.VersionFormat",
3215 ))
3216 }
3217 }
3218
3219 /// Destination dependent options.
3220 #[derive(Clone, Debug, PartialEq)]
3221 #[non_exhaustive]
3222 pub enum Options {
3223 /// Optional. Options that affect sinks exporting data to BigQuery.
3224 BigqueryOptions(std::boxed::Box<crate::model::BigQueryOptions>),
3225 }
3226}
3227
3228/// Describes a BigQuery dataset that was created by a link.
3229#[derive(Clone, Default, PartialEq)]
3230#[non_exhaustive]
3231pub struct BigQueryDataset {
3232 /// Output only. The full resource name of the BigQuery dataset. The DATASET_ID
3233 /// will match the ID of the link, so the link must match the naming
3234 /// restrictions of BigQuery datasets (alphanumeric characters and underscores
3235 /// only).
3236 ///
3237 /// The dataset will have a resource path of
3238 /// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET_ID]"
3239 pub dataset_id: std::string::String,
3240
3241 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3242}
3243
3244impl BigQueryDataset {
3245 pub fn new() -> Self {
3246 std::default::Default::default()
3247 }
3248
3249 /// Sets the value of [dataset_id][crate::model::BigQueryDataset::dataset_id].
3250 ///
3251 /// # Example
3252 /// ```ignore,no_run
3253 /// # use google_cloud_logging_v2::model::BigQueryDataset;
3254 /// let x = BigQueryDataset::new().set_dataset_id("example");
3255 /// ```
3256 pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3257 self.dataset_id = v.into();
3258 self
3259 }
3260}
3261
3262impl wkt::message::Message for BigQueryDataset {
3263 fn typename() -> &'static str {
3264 "type.googleapis.com/google.logging.v2.BigQueryDataset"
3265 }
3266}
3267
3268/// Describes a link connected to an analytics enabled bucket.
3269#[derive(Clone, Default, PartialEq)]
3270#[non_exhaustive]
3271pub struct Link {
3272 /// The resource name of the link. The name can have up to 100 characters.
3273 /// A valid link id (at the end of the link name) must only have alphanumeric
3274 /// characters and underscores within it.
3275 ///
3276 /// ```norust
3277 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
3278 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
3279 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
3280 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
3281 /// ```
3282 ///
3283 /// For example:
3284 ///
3285 /// `projects/my-project/locations/global/buckets/my-bucket/links/my_link
3286 pub name: std::string::String,
3287
3288 /// Describes this link.
3289 ///
3290 /// The maximum length of the description is 8000 characters.
3291 pub description: std::string::String,
3292
3293 /// Output only. The creation timestamp of the link.
3294 pub create_time: std::option::Option<wkt::Timestamp>,
3295
3296 /// Output only. The resource lifecycle state.
3297 pub lifecycle_state: crate::model::LifecycleState,
3298
3299 /// The information of a BigQuery Dataset. When a link is created, a BigQuery
3300 /// dataset is created along with it, in the same project as the LogBucket it's
3301 /// linked to. This dataset will also have BigQuery Views corresponding to the
3302 /// LogViews in the bucket.
3303 pub bigquery_dataset: std::option::Option<crate::model::BigQueryDataset>,
3304
3305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3306}
3307
3308impl Link {
3309 pub fn new() -> Self {
3310 std::default::Default::default()
3311 }
3312
3313 /// Sets the value of [name][crate::model::Link::name].
3314 ///
3315 /// # Example
3316 /// ```ignore,no_run
3317 /// # use google_cloud_logging_v2::model::Link;
3318 /// let x = Link::new().set_name("example");
3319 /// ```
3320 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3321 self.name = v.into();
3322 self
3323 }
3324
3325 /// Sets the value of [description][crate::model::Link::description].
3326 ///
3327 /// # Example
3328 /// ```ignore,no_run
3329 /// # use google_cloud_logging_v2::model::Link;
3330 /// let x = Link::new().set_description("example");
3331 /// ```
3332 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3333 self.description = v.into();
3334 self
3335 }
3336
3337 /// Sets the value of [create_time][crate::model::Link::create_time].
3338 ///
3339 /// # Example
3340 /// ```ignore,no_run
3341 /// # use google_cloud_logging_v2::model::Link;
3342 /// use wkt::Timestamp;
3343 /// let x = Link::new().set_create_time(Timestamp::default()/* use setters */);
3344 /// ```
3345 pub fn set_create_time<T>(mut self, v: T) -> Self
3346 where
3347 T: std::convert::Into<wkt::Timestamp>,
3348 {
3349 self.create_time = std::option::Option::Some(v.into());
3350 self
3351 }
3352
3353 /// Sets or clears the value of [create_time][crate::model::Link::create_time].
3354 ///
3355 /// # Example
3356 /// ```ignore,no_run
3357 /// # use google_cloud_logging_v2::model::Link;
3358 /// use wkt::Timestamp;
3359 /// let x = Link::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3360 /// let x = Link::new().set_or_clear_create_time(None::<Timestamp>);
3361 /// ```
3362 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3363 where
3364 T: std::convert::Into<wkt::Timestamp>,
3365 {
3366 self.create_time = v.map(|x| x.into());
3367 self
3368 }
3369
3370 /// Sets the value of [lifecycle_state][crate::model::Link::lifecycle_state].
3371 ///
3372 /// # Example
3373 /// ```ignore,no_run
3374 /// # use google_cloud_logging_v2::model::Link;
3375 /// use google_cloud_logging_v2::model::LifecycleState;
3376 /// let x0 = Link::new().set_lifecycle_state(LifecycleState::Active);
3377 /// let x1 = Link::new().set_lifecycle_state(LifecycleState::DeleteRequested);
3378 /// let x2 = Link::new().set_lifecycle_state(LifecycleState::Updating);
3379 /// ```
3380 pub fn set_lifecycle_state<T: std::convert::Into<crate::model::LifecycleState>>(
3381 mut self,
3382 v: T,
3383 ) -> Self {
3384 self.lifecycle_state = v.into();
3385 self
3386 }
3387
3388 /// Sets the value of [bigquery_dataset][crate::model::Link::bigquery_dataset].
3389 ///
3390 /// # Example
3391 /// ```ignore,no_run
3392 /// # use google_cloud_logging_v2::model::Link;
3393 /// use google_cloud_logging_v2::model::BigQueryDataset;
3394 /// let x = Link::new().set_bigquery_dataset(BigQueryDataset::default()/* use setters */);
3395 /// ```
3396 pub fn set_bigquery_dataset<T>(mut self, v: T) -> Self
3397 where
3398 T: std::convert::Into<crate::model::BigQueryDataset>,
3399 {
3400 self.bigquery_dataset = std::option::Option::Some(v.into());
3401 self
3402 }
3403
3404 /// Sets or clears the value of [bigquery_dataset][crate::model::Link::bigquery_dataset].
3405 ///
3406 /// # Example
3407 /// ```ignore,no_run
3408 /// # use google_cloud_logging_v2::model::Link;
3409 /// use google_cloud_logging_v2::model::BigQueryDataset;
3410 /// let x = Link::new().set_or_clear_bigquery_dataset(Some(BigQueryDataset::default()/* use setters */));
3411 /// let x = Link::new().set_or_clear_bigquery_dataset(None::<BigQueryDataset>);
3412 /// ```
3413 pub fn set_or_clear_bigquery_dataset<T>(mut self, v: std::option::Option<T>) -> Self
3414 where
3415 T: std::convert::Into<crate::model::BigQueryDataset>,
3416 {
3417 self.bigquery_dataset = v.map(|x| x.into());
3418 self
3419 }
3420}
3421
3422impl wkt::message::Message for Link {
3423 fn typename() -> &'static str {
3424 "type.googleapis.com/google.logging.v2.Link"
3425 }
3426}
3427
3428/// Options that change functionality of a sink exporting data to BigQuery.
3429#[derive(Clone, Default, PartialEq)]
3430#[non_exhaustive]
3431pub struct BigQueryOptions {
3432 /// Optional. Whether to use [BigQuery's partition
3433 /// tables](https://cloud.google.com/bigquery/docs/partitioned-tables). By
3434 /// default, Cloud Logging creates dated tables based on the log entries'
3435 /// timestamps, e.g. syslog_20170523. With partitioned tables the date suffix
3436 /// is no longer present and [special query
3437 /// syntax](https://cloud.google.com/bigquery/docs/querying-partitioned-tables)
3438 /// has to be used instead. In both cases, tables are sharded based on UTC
3439 /// timezone.
3440 pub use_partitioned_tables: bool,
3441
3442 /// Output only. True if new timestamp column based partitioning is in use,
3443 /// false if legacy ingestion-time partitioning is in use.
3444 ///
3445 /// All new sinks will have this field set true and will use timestamp column
3446 /// based partitioning. If use_partitioned_tables is false, this value has no
3447 /// meaning and will be false. Legacy sinks using partitioned tables will have
3448 /// this field set to false.
3449 pub uses_timestamp_column_partitioning: bool,
3450
3451 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3452}
3453
3454impl BigQueryOptions {
3455 pub fn new() -> Self {
3456 std::default::Default::default()
3457 }
3458
3459 /// Sets the value of [use_partitioned_tables][crate::model::BigQueryOptions::use_partitioned_tables].
3460 ///
3461 /// # Example
3462 /// ```ignore,no_run
3463 /// # use google_cloud_logging_v2::model::BigQueryOptions;
3464 /// let x = BigQueryOptions::new().set_use_partitioned_tables(true);
3465 /// ```
3466 pub fn set_use_partitioned_tables<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3467 self.use_partitioned_tables = v.into();
3468 self
3469 }
3470
3471 /// Sets the value of [uses_timestamp_column_partitioning][crate::model::BigQueryOptions::uses_timestamp_column_partitioning].
3472 ///
3473 /// # Example
3474 /// ```ignore,no_run
3475 /// # use google_cloud_logging_v2::model::BigQueryOptions;
3476 /// let x = BigQueryOptions::new().set_uses_timestamp_column_partitioning(true);
3477 /// ```
3478 pub fn set_uses_timestamp_column_partitioning<T: std::convert::Into<bool>>(
3479 mut self,
3480 v: T,
3481 ) -> Self {
3482 self.uses_timestamp_column_partitioning = v.into();
3483 self
3484 }
3485}
3486
3487impl wkt::message::Message for BigQueryOptions {
3488 fn typename() -> &'static str {
3489 "type.googleapis.com/google.logging.v2.BigQueryOptions"
3490 }
3491}
3492
3493/// The parameters to `ListBuckets`.
3494#[derive(Clone, Default, PartialEq)]
3495#[non_exhaustive]
3496pub struct ListBucketsRequest {
3497 /// Required. The parent resource whose buckets are to be listed:
3498 ///
3499 /// ```norust
3500 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
3501 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]"
3502 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]"
3503 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]"
3504 /// ```
3505 ///
3506 /// Note: The locations portion of the resource must be specified, but
3507 /// supplying the character `-` in place of [LOCATION_ID] will return all
3508 /// buckets.
3509 pub parent: std::string::String,
3510
3511 /// Optional. If present, then retrieve the next batch of results from the
3512 /// preceding call to this method. `pageToken` must be the value of
3513 /// `nextPageToken` from the previous response. The values of other method
3514 /// parameters should be identical to those in the previous call.
3515 pub page_token: std::string::String,
3516
3517 /// Optional. The maximum number of results to return from this request.
3518 /// Non-positive values are ignored. The presence of `nextPageToken` in the
3519 /// response indicates that more results might be available.
3520 pub page_size: i32,
3521
3522 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3523}
3524
3525impl ListBucketsRequest {
3526 pub fn new() -> Self {
3527 std::default::Default::default()
3528 }
3529
3530 /// Sets the value of [parent][crate::model::ListBucketsRequest::parent].
3531 ///
3532 /// # Example
3533 /// ```ignore,no_run
3534 /// # use google_cloud_logging_v2::model::ListBucketsRequest;
3535 /// let x = ListBucketsRequest::new().set_parent("example");
3536 /// ```
3537 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3538 self.parent = v.into();
3539 self
3540 }
3541
3542 /// Sets the value of [page_token][crate::model::ListBucketsRequest::page_token].
3543 ///
3544 /// # Example
3545 /// ```ignore,no_run
3546 /// # use google_cloud_logging_v2::model::ListBucketsRequest;
3547 /// let x = ListBucketsRequest::new().set_page_token("example");
3548 /// ```
3549 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3550 self.page_token = v.into();
3551 self
3552 }
3553
3554 /// Sets the value of [page_size][crate::model::ListBucketsRequest::page_size].
3555 ///
3556 /// # Example
3557 /// ```ignore,no_run
3558 /// # use google_cloud_logging_v2::model::ListBucketsRequest;
3559 /// let x = ListBucketsRequest::new().set_page_size(42);
3560 /// ```
3561 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3562 self.page_size = v.into();
3563 self
3564 }
3565}
3566
3567impl wkt::message::Message for ListBucketsRequest {
3568 fn typename() -> &'static str {
3569 "type.googleapis.com/google.logging.v2.ListBucketsRequest"
3570 }
3571}
3572
3573/// The response from ListBuckets.
3574#[derive(Clone, Default, PartialEq)]
3575#[non_exhaustive]
3576pub struct ListBucketsResponse {
3577 /// A list of buckets.
3578 pub buckets: std::vec::Vec<crate::model::LogBucket>,
3579
3580 /// If there might be more results than appear in this response, then
3581 /// `nextPageToken` is included. To get the next set of results, call the same
3582 /// method again using the value of `nextPageToken` as `pageToken`.
3583 pub next_page_token: std::string::String,
3584
3585 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3586}
3587
3588impl ListBucketsResponse {
3589 pub fn new() -> Self {
3590 std::default::Default::default()
3591 }
3592
3593 /// Sets the value of [buckets][crate::model::ListBucketsResponse::buckets].
3594 ///
3595 /// # Example
3596 /// ```ignore,no_run
3597 /// # use google_cloud_logging_v2::model::ListBucketsResponse;
3598 /// use google_cloud_logging_v2::model::LogBucket;
3599 /// let x = ListBucketsResponse::new()
3600 /// .set_buckets([
3601 /// LogBucket::default()/* use setters */,
3602 /// LogBucket::default()/* use (different) setters */,
3603 /// ]);
3604 /// ```
3605 pub fn set_buckets<T, V>(mut self, v: T) -> Self
3606 where
3607 T: std::iter::IntoIterator<Item = V>,
3608 V: std::convert::Into<crate::model::LogBucket>,
3609 {
3610 use std::iter::Iterator;
3611 self.buckets = v.into_iter().map(|i| i.into()).collect();
3612 self
3613 }
3614
3615 /// Sets the value of [next_page_token][crate::model::ListBucketsResponse::next_page_token].
3616 ///
3617 /// # Example
3618 /// ```ignore,no_run
3619 /// # use google_cloud_logging_v2::model::ListBucketsResponse;
3620 /// let x = ListBucketsResponse::new().set_next_page_token("example");
3621 /// ```
3622 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3623 self.next_page_token = v.into();
3624 self
3625 }
3626}
3627
3628impl wkt::message::Message for ListBucketsResponse {
3629 fn typename() -> &'static str {
3630 "type.googleapis.com/google.logging.v2.ListBucketsResponse"
3631 }
3632}
3633
3634#[doc(hidden)]
3635impl gax::paginator::internal::PageableResponse for ListBucketsResponse {
3636 type PageItem = crate::model::LogBucket;
3637
3638 fn items(self) -> std::vec::Vec<Self::PageItem> {
3639 self.buckets
3640 }
3641
3642 fn next_page_token(&self) -> std::string::String {
3643 use std::clone::Clone;
3644 self.next_page_token.clone()
3645 }
3646}
3647
3648/// The parameters to `CreateBucket`.
3649#[derive(Clone, Default, PartialEq)]
3650#[non_exhaustive]
3651pub struct CreateBucketRequest {
3652 /// Required. The resource in which to create the log bucket:
3653 ///
3654 /// ```norust
3655 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
3656 /// ```
3657 ///
3658 /// For example:
3659 ///
3660 /// `"projects/my-project/locations/global"`
3661 pub parent: std::string::String,
3662
3663 /// Required. A client-assigned identifier such as `"my-bucket"`. Identifiers
3664 /// are limited to 100 characters and can include only letters, digits,
3665 /// underscores, hyphens, and periods.
3666 pub bucket_id: std::string::String,
3667
3668 /// Required. The new bucket. The region specified in the new bucket must be
3669 /// compliant with any Location Restriction Org Policy. The name field in the
3670 /// bucket is ignored.
3671 pub bucket: std::option::Option<crate::model::LogBucket>,
3672
3673 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3674}
3675
3676impl CreateBucketRequest {
3677 pub fn new() -> Self {
3678 std::default::Default::default()
3679 }
3680
3681 /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
3682 ///
3683 /// # Example
3684 /// ```ignore,no_run
3685 /// # use google_cloud_logging_v2::model::CreateBucketRequest;
3686 /// let x = CreateBucketRequest::new().set_parent("example");
3687 /// ```
3688 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3689 self.parent = v.into();
3690 self
3691 }
3692
3693 /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
3694 ///
3695 /// # Example
3696 /// ```ignore,no_run
3697 /// # use google_cloud_logging_v2::model::CreateBucketRequest;
3698 /// let x = CreateBucketRequest::new().set_bucket_id("example");
3699 /// ```
3700 pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3701 self.bucket_id = v.into();
3702 self
3703 }
3704
3705 /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
3706 ///
3707 /// # Example
3708 /// ```ignore,no_run
3709 /// # use google_cloud_logging_v2::model::CreateBucketRequest;
3710 /// use google_cloud_logging_v2::model::LogBucket;
3711 /// let x = CreateBucketRequest::new().set_bucket(LogBucket::default()/* use setters */);
3712 /// ```
3713 pub fn set_bucket<T>(mut self, v: T) -> Self
3714 where
3715 T: std::convert::Into<crate::model::LogBucket>,
3716 {
3717 self.bucket = std::option::Option::Some(v.into());
3718 self
3719 }
3720
3721 /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
3722 ///
3723 /// # Example
3724 /// ```ignore,no_run
3725 /// # use google_cloud_logging_v2::model::CreateBucketRequest;
3726 /// use google_cloud_logging_v2::model::LogBucket;
3727 /// let x = CreateBucketRequest::new().set_or_clear_bucket(Some(LogBucket::default()/* use setters */));
3728 /// let x = CreateBucketRequest::new().set_or_clear_bucket(None::<LogBucket>);
3729 /// ```
3730 pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
3731 where
3732 T: std::convert::Into<crate::model::LogBucket>,
3733 {
3734 self.bucket = v.map(|x| x.into());
3735 self
3736 }
3737}
3738
3739impl wkt::message::Message for CreateBucketRequest {
3740 fn typename() -> &'static str {
3741 "type.googleapis.com/google.logging.v2.CreateBucketRequest"
3742 }
3743}
3744
3745/// The parameters to `UpdateBucket`.
3746#[derive(Clone, Default, PartialEq)]
3747#[non_exhaustive]
3748pub struct UpdateBucketRequest {
3749 /// Required. The full resource name of the bucket to update.
3750 ///
3751 /// ```norust
3752 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3753 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3754 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3755 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3756 /// ```
3757 ///
3758 /// For example:
3759 ///
3760 /// `"projects/my-project/locations/global/buckets/my-bucket"`
3761 pub name: std::string::String,
3762
3763 /// Required. The updated bucket.
3764 pub bucket: std::option::Option<crate::model::LogBucket>,
3765
3766 /// Required. Field mask that specifies the fields in `bucket` that need an
3767 /// update. A bucket field will be overwritten if, and only if, it is in the
3768 /// update mask. `name` and output only fields cannot be updated.
3769 ///
3770 /// For a detailed `FieldMask` definition, see:
3771 /// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask>
3772 ///
3773 /// For example: `updateMask=retention_days`
3774 pub update_mask: std::option::Option<wkt::FieldMask>,
3775
3776 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3777}
3778
3779impl UpdateBucketRequest {
3780 pub fn new() -> Self {
3781 std::default::Default::default()
3782 }
3783
3784 /// Sets the value of [name][crate::model::UpdateBucketRequest::name].
3785 ///
3786 /// # Example
3787 /// ```ignore,no_run
3788 /// # use google_cloud_logging_v2::model::UpdateBucketRequest;
3789 /// let x = UpdateBucketRequest::new().set_name("example");
3790 /// ```
3791 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3792 self.name = v.into();
3793 self
3794 }
3795
3796 /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
3797 ///
3798 /// # Example
3799 /// ```ignore,no_run
3800 /// # use google_cloud_logging_v2::model::UpdateBucketRequest;
3801 /// use google_cloud_logging_v2::model::LogBucket;
3802 /// let x = UpdateBucketRequest::new().set_bucket(LogBucket::default()/* use setters */);
3803 /// ```
3804 pub fn set_bucket<T>(mut self, v: T) -> Self
3805 where
3806 T: std::convert::Into<crate::model::LogBucket>,
3807 {
3808 self.bucket = std::option::Option::Some(v.into());
3809 self
3810 }
3811
3812 /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
3813 ///
3814 /// # Example
3815 /// ```ignore,no_run
3816 /// # use google_cloud_logging_v2::model::UpdateBucketRequest;
3817 /// use google_cloud_logging_v2::model::LogBucket;
3818 /// let x = UpdateBucketRequest::new().set_or_clear_bucket(Some(LogBucket::default()/* use setters */));
3819 /// let x = UpdateBucketRequest::new().set_or_clear_bucket(None::<LogBucket>);
3820 /// ```
3821 pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
3822 where
3823 T: std::convert::Into<crate::model::LogBucket>,
3824 {
3825 self.bucket = v.map(|x| x.into());
3826 self
3827 }
3828
3829 /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
3830 ///
3831 /// # Example
3832 /// ```ignore,no_run
3833 /// # use google_cloud_logging_v2::model::UpdateBucketRequest;
3834 /// use wkt::FieldMask;
3835 /// let x = UpdateBucketRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3836 /// ```
3837 pub fn set_update_mask<T>(mut self, v: T) -> Self
3838 where
3839 T: std::convert::Into<wkt::FieldMask>,
3840 {
3841 self.update_mask = std::option::Option::Some(v.into());
3842 self
3843 }
3844
3845 /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
3846 ///
3847 /// # Example
3848 /// ```ignore,no_run
3849 /// # use google_cloud_logging_v2::model::UpdateBucketRequest;
3850 /// use wkt::FieldMask;
3851 /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3852 /// let x = UpdateBucketRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3853 /// ```
3854 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3855 where
3856 T: std::convert::Into<wkt::FieldMask>,
3857 {
3858 self.update_mask = v.map(|x| x.into());
3859 self
3860 }
3861}
3862
3863impl wkt::message::Message for UpdateBucketRequest {
3864 fn typename() -> &'static str {
3865 "type.googleapis.com/google.logging.v2.UpdateBucketRequest"
3866 }
3867}
3868
3869/// The parameters to `GetBucket`.
3870#[derive(Clone, Default, PartialEq)]
3871#[non_exhaustive]
3872pub struct GetBucketRequest {
3873 /// Required. The resource name of the bucket:
3874 ///
3875 /// ```norust
3876 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3877 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3878 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3879 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3880 /// ```
3881 ///
3882 /// For example:
3883 ///
3884 /// `"projects/my-project/locations/global/buckets/my-bucket"`
3885 pub name: std::string::String,
3886
3887 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3888}
3889
3890impl GetBucketRequest {
3891 pub fn new() -> Self {
3892 std::default::Default::default()
3893 }
3894
3895 /// Sets the value of [name][crate::model::GetBucketRequest::name].
3896 ///
3897 /// # Example
3898 /// ```ignore,no_run
3899 /// # use google_cloud_logging_v2::model::GetBucketRequest;
3900 /// let x = GetBucketRequest::new().set_name("example");
3901 /// ```
3902 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3903 self.name = v.into();
3904 self
3905 }
3906}
3907
3908impl wkt::message::Message for GetBucketRequest {
3909 fn typename() -> &'static str {
3910 "type.googleapis.com/google.logging.v2.GetBucketRequest"
3911 }
3912}
3913
3914/// The parameters to `DeleteBucket`.
3915#[derive(Clone, Default, PartialEq)]
3916#[non_exhaustive]
3917pub struct DeleteBucketRequest {
3918 /// Required. The full resource name of the bucket to delete.
3919 ///
3920 /// ```norust
3921 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3922 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3923 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3924 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3925 /// ```
3926 ///
3927 /// For example:
3928 ///
3929 /// `"projects/my-project/locations/global/buckets/my-bucket"`
3930 pub name: std::string::String,
3931
3932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3933}
3934
3935impl DeleteBucketRequest {
3936 pub fn new() -> Self {
3937 std::default::Default::default()
3938 }
3939
3940 /// Sets the value of [name][crate::model::DeleteBucketRequest::name].
3941 ///
3942 /// # Example
3943 /// ```ignore,no_run
3944 /// # use google_cloud_logging_v2::model::DeleteBucketRequest;
3945 /// let x = DeleteBucketRequest::new().set_name("example");
3946 /// ```
3947 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3948 self.name = v.into();
3949 self
3950 }
3951}
3952
3953impl wkt::message::Message for DeleteBucketRequest {
3954 fn typename() -> &'static str {
3955 "type.googleapis.com/google.logging.v2.DeleteBucketRequest"
3956 }
3957}
3958
3959/// The parameters to `UndeleteBucket`.
3960#[derive(Clone, Default, PartialEq)]
3961#[non_exhaustive]
3962pub struct UndeleteBucketRequest {
3963 /// Required. The full resource name of the bucket to undelete.
3964 ///
3965 /// ```norust
3966 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3967 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3968 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3969 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
3970 /// ```
3971 ///
3972 /// For example:
3973 ///
3974 /// `"projects/my-project/locations/global/buckets/my-bucket"`
3975 pub name: std::string::String,
3976
3977 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3978}
3979
3980impl UndeleteBucketRequest {
3981 pub fn new() -> Self {
3982 std::default::Default::default()
3983 }
3984
3985 /// Sets the value of [name][crate::model::UndeleteBucketRequest::name].
3986 ///
3987 /// # Example
3988 /// ```ignore,no_run
3989 /// # use google_cloud_logging_v2::model::UndeleteBucketRequest;
3990 /// let x = UndeleteBucketRequest::new().set_name("example");
3991 /// ```
3992 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3993 self.name = v.into();
3994 self
3995 }
3996}
3997
3998impl wkt::message::Message for UndeleteBucketRequest {
3999 fn typename() -> &'static str {
4000 "type.googleapis.com/google.logging.v2.UndeleteBucketRequest"
4001 }
4002}
4003
4004/// The parameters to `ListViews`.
4005#[derive(Clone, Default, PartialEq)]
4006#[non_exhaustive]
4007pub struct ListViewsRequest {
4008 /// Required. The bucket whose views are to be listed:
4009 ///
4010 /// ```norust
4011 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
4012 /// ```
4013 pub parent: std::string::String,
4014
4015 /// Optional. If present, then retrieve the next batch of results from the
4016 /// preceding call to this method. `pageToken` must be the value of
4017 /// `nextPageToken` from the previous response. The values of other method
4018 /// parameters should be identical to those in the previous call.
4019 pub page_token: std::string::String,
4020
4021 /// Optional. The maximum number of results to return from this request.
4022 ///
4023 /// Non-positive values are ignored. The presence of `nextPageToken` in the
4024 /// response indicates that more results might be available.
4025 pub page_size: i32,
4026
4027 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4028}
4029
4030impl ListViewsRequest {
4031 pub fn new() -> Self {
4032 std::default::Default::default()
4033 }
4034
4035 /// Sets the value of [parent][crate::model::ListViewsRequest::parent].
4036 ///
4037 /// # Example
4038 /// ```ignore,no_run
4039 /// # use google_cloud_logging_v2::model::ListViewsRequest;
4040 /// let x = ListViewsRequest::new().set_parent("example");
4041 /// ```
4042 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4043 self.parent = v.into();
4044 self
4045 }
4046
4047 /// Sets the value of [page_token][crate::model::ListViewsRequest::page_token].
4048 ///
4049 /// # Example
4050 /// ```ignore,no_run
4051 /// # use google_cloud_logging_v2::model::ListViewsRequest;
4052 /// let x = ListViewsRequest::new().set_page_token("example");
4053 /// ```
4054 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4055 self.page_token = v.into();
4056 self
4057 }
4058
4059 /// Sets the value of [page_size][crate::model::ListViewsRequest::page_size].
4060 ///
4061 /// # Example
4062 /// ```ignore,no_run
4063 /// # use google_cloud_logging_v2::model::ListViewsRequest;
4064 /// let x = ListViewsRequest::new().set_page_size(42);
4065 /// ```
4066 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4067 self.page_size = v.into();
4068 self
4069 }
4070}
4071
4072impl wkt::message::Message for ListViewsRequest {
4073 fn typename() -> &'static str {
4074 "type.googleapis.com/google.logging.v2.ListViewsRequest"
4075 }
4076}
4077
4078/// The response from ListViews.
4079#[derive(Clone, Default, PartialEq)]
4080#[non_exhaustive]
4081pub struct ListViewsResponse {
4082 /// A list of views.
4083 pub views: std::vec::Vec<crate::model::LogView>,
4084
4085 /// If there might be more results than appear in this response, then
4086 /// `nextPageToken` is included. To get the next set of results, call the same
4087 /// method again using the value of `nextPageToken` as `pageToken`.
4088 pub next_page_token: std::string::String,
4089
4090 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4091}
4092
4093impl ListViewsResponse {
4094 pub fn new() -> Self {
4095 std::default::Default::default()
4096 }
4097
4098 /// Sets the value of [views][crate::model::ListViewsResponse::views].
4099 ///
4100 /// # Example
4101 /// ```ignore,no_run
4102 /// # use google_cloud_logging_v2::model::ListViewsResponse;
4103 /// use google_cloud_logging_v2::model::LogView;
4104 /// let x = ListViewsResponse::new()
4105 /// .set_views([
4106 /// LogView::default()/* use setters */,
4107 /// LogView::default()/* use (different) setters */,
4108 /// ]);
4109 /// ```
4110 pub fn set_views<T, V>(mut self, v: T) -> Self
4111 where
4112 T: std::iter::IntoIterator<Item = V>,
4113 V: std::convert::Into<crate::model::LogView>,
4114 {
4115 use std::iter::Iterator;
4116 self.views = v.into_iter().map(|i| i.into()).collect();
4117 self
4118 }
4119
4120 /// Sets the value of [next_page_token][crate::model::ListViewsResponse::next_page_token].
4121 ///
4122 /// # Example
4123 /// ```ignore,no_run
4124 /// # use google_cloud_logging_v2::model::ListViewsResponse;
4125 /// let x = ListViewsResponse::new().set_next_page_token("example");
4126 /// ```
4127 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4128 self.next_page_token = v.into();
4129 self
4130 }
4131}
4132
4133impl wkt::message::Message for ListViewsResponse {
4134 fn typename() -> &'static str {
4135 "type.googleapis.com/google.logging.v2.ListViewsResponse"
4136 }
4137}
4138
4139#[doc(hidden)]
4140impl gax::paginator::internal::PageableResponse for ListViewsResponse {
4141 type PageItem = crate::model::LogView;
4142
4143 fn items(self) -> std::vec::Vec<Self::PageItem> {
4144 self.views
4145 }
4146
4147 fn next_page_token(&self) -> std::string::String {
4148 use std::clone::Clone;
4149 self.next_page_token.clone()
4150 }
4151}
4152
4153/// The parameters to `CreateView`.
4154#[derive(Clone, Default, PartialEq)]
4155#[non_exhaustive]
4156pub struct CreateViewRequest {
4157 /// Required. The bucket in which to create the view
4158 ///
4159 /// ```norust
4160 /// `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"`
4161 /// ```
4162 ///
4163 /// For example:
4164 ///
4165 /// `"projects/my-project/locations/global/buckets/my-bucket"`
4166 pub parent: std::string::String,
4167
4168 /// Required. A client-assigned identifier such as `"my-view"`. Identifiers are
4169 /// limited to 100 characters and can include only letters, digits,
4170 /// underscores, hyphens, and periods.
4171 pub view_id: std::string::String,
4172
4173 /// Required. The new view.
4174 pub view: std::option::Option<crate::model::LogView>,
4175
4176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4177}
4178
4179impl CreateViewRequest {
4180 pub fn new() -> Self {
4181 std::default::Default::default()
4182 }
4183
4184 /// Sets the value of [parent][crate::model::CreateViewRequest::parent].
4185 ///
4186 /// # Example
4187 /// ```ignore,no_run
4188 /// # use google_cloud_logging_v2::model::CreateViewRequest;
4189 /// let x = CreateViewRequest::new().set_parent("example");
4190 /// ```
4191 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4192 self.parent = v.into();
4193 self
4194 }
4195
4196 /// Sets the value of [view_id][crate::model::CreateViewRequest::view_id].
4197 ///
4198 /// # Example
4199 /// ```ignore,no_run
4200 /// # use google_cloud_logging_v2::model::CreateViewRequest;
4201 /// let x = CreateViewRequest::new().set_view_id("example");
4202 /// ```
4203 pub fn set_view_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4204 self.view_id = v.into();
4205 self
4206 }
4207
4208 /// Sets the value of [view][crate::model::CreateViewRequest::view].
4209 ///
4210 /// # Example
4211 /// ```ignore,no_run
4212 /// # use google_cloud_logging_v2::model::CreateViewRequest;
4213 /// use google_cloud_logging_v2::model::LogView;
4214 /// let x = CreateViewRequest::new().set_view(LogView::default()/* use setters */);
4215 /// ```
4216 pub fn set_view<T>(mut self, v: T) -> Self
4217 where
4218 T: std::convert::Into<crate::model::LogView>,
4219 {
4220 self.view = std::option::Option::Some(v.into());
4221 self
4222 }
4223
4224 /// Sets or clears the value of [view][crate::model::CreateViewRequest::view].
4225 ///
4226 /// # Example
4227 /// ```ignore,no_run
4228 /// # use google_cloud_logging_v2::model::CreateViewRequest;
4229 /// use google_cloud_logging_v2::model::LogView;
4230 /// let x = CreateViewRequest::new().set_or_clear_view(Some(LogView::default()/* use setters */));
4231 /// let x = CreateViewRequest::new().set_or_clear_view(None::<LogView>);
4232 /// ```
4233 pub fn set_or_clear_view<T>(mut self, v: std::option::Option<T>) -> Self
4234 where
4235 T: std::convert::Into<crate::model::LogView>,
4236 {
4237 self.view = v.map(|x| x.into());
4238 self
4239 }
4240}
4241
4242impl wkt::message::Message for CreateViewRequest {
4243 fn typename() -> &'static str {
4244 "type.googleapis.com/google.logging.v2.CreateViewRequest"
4245 }
4246}
4247
4248/// The parameters to `UpdateView`.
4249#[derive(Clone, Default, PartialEq)]
4250#[non_exhaustive]
4251pub struct UpdateViewRequest {
4252 /// Required. The full resource name of the view to update
4253 ///
4254 /// ```norust
4255 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
4256 /// ```
4257 ///
4258 /// For example:
4259 ///
4260 /// `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
4261 pub name: std::string::String,
4262
4263 /// Required. The updated view.
4264 pub view: std::option::Option<crate::model::LogView>,
4265
4266 /// Optional. Field mask that specifies the fields in `view` that need
4267 /// an update. A field will be overwritten if, and only if, it is
4268 /// in the update mask. `name` and output only fields cannot be updated.
4269 ///
4270 /// For a detailed `FieldMask` definition, see
4271 /// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask>
4272 ///
4273 /// For example: `updateMask=filter`
4274 pub update_mask: std::option::Option<wkt::FieldMask>,
4275
4276 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4277}
4278
4279impl UpdateViewRequest {
4280 pub fn new() -> Self {
4281 std::default::Default::default()
4282 }
4283
4284 /// Sets the value of [name][crate::model::UpdateViewRequest::name].
4285 ///
4286 /// # Example
4287 /// ```ignore,no_run
4288 /// # use google_cloud_logging_v2::model::UpdateViewRequest;
4289 /// let x = UpdateViewRequest::new().set_name("example");
4290 /// ```
4291 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4292 self.name = v.into();
4293 self
4294 }
4295
4296 /// Sets the value of [view][crate::model::UpdateViewRequest::view].
4297 ///
4298 /// # Example
4299 /// ```ignore,no_run
4300 /// # use google_cloud_logging_v2::model::UpdateViewRequest;
4301 /// use google_cloud_logging_v2::model::LogView;
4302 /// let x = UpdateViewRequest::new().set_view(LogView::default()/* use setters */);
4303 /// ```
4304 pub fn set_view<T>(mut self, v: T) -> Self
4305 where
4306 T: std::convert::Into<crate::model::LogView>,
4307 {
4308 self.view = std::option::Option::Some(v.into());
4309 self
4310 }
4311
4312 /// Sets or clears the value of [view][crate::model::UpdateViewRequest::view].
4313 ///
4314 /// # Example
4315 /// ```ignore,no_run
4316 /// # use google_cloud_logging_v2::model::UpdateViewRequest;
4317 /// use google_cloud_logging_v2::model::LogView;
4318 /// let x = UpdateViewRequest::new().set_or_clear_view(Some(LogView::default()/* use setters */));
4319 /// let x = UpdateViewRequest::new().set_or_clear_view(None::<LogView>);
4320 /// ```
4321 pub fn set_or_clear_view<T>(mut self, v: std::option::Option<T>) -> Self
4322 where
4323 T: std::convert::Into<crate::model::LogView>,
4324 {
4325 self.view = v.map(|x| x.into());
4326 self
4327 }
4328
4329 /// Sets the value of [update_mask][crate::model::UpdateViewRequest::update_mask].
4330 ///
4331 /// # Example
4332 /// ```ignore,no_run
4333 /// # use google_cloud_logging_v2::model::UpdateViewRequest;
4334 /// use wkt::FieldMask;
4335 /// let x = UpdateViewRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4336 /// ```
4337 pub fn set_update_mask<T>(mut self, v: T) -> Self
4338 where
4339 T: std::convert::Into<wkt::FieldMask>,
4340 {
4341 self.update_mask = std::option::Option::Some(v.into());
4342 self
4343 }
4344
4345 /// Sets or clears the value of [update_mask][crate::model::UpdateViewRequest::update_mask].
4346 ///
4347 /// # Example
4348 /// ```ignore,no_run
4349 /// # use google_cloud_logging_v2::model::UpdateViewRequest;
4350 /// use wkt::FieldMask;
4351 /// let x = UpdateViewRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4352 /// let x = UpdateViewRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4353 /// ```
4354 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4355 where
4356 T: std::convert::Into<wkt::FieldMask>,
4357 {
4358 self.update_mask = v.map(|x| x.into());
4359 self
4360 }
4361}
4362
4363impl wkt::message::Message for UpdateViewRequest {
4364 fn typename() -> &'static str {
4365 "type.googleapis.com/google.logging.v2.UpdateViewRequest"
4366 }
4367}
4368
4369/// The parameters to `GetView`.
4370#[derive(Clone, Default, PartialEq)]
4371#[non_exhaustive]
4372pub struct GetViewRequest {
4373 /// Required. The resource name of the policy:
4374 ///
4375 /// ```norust
4376 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
4377 /// ```
4378 ///
4379 /// For example:
4380 ///
4381 /// `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
4382 pub name: std::string::String,
4383
4384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4385}
4386
4387impl GetViewRequest {
4388 pub fn new() -> Self {
4389 std::default::Default::default()
4390 }
4391
4392 /// Sets the value of [name][crate::model::GetViewRequest::name].
4393 ///
4394 /// # Example
4395 /// ```ignore,no_run
4396 /// # use google_cloud_logging_v2::model::GetViewRequest;
4397 /// let x = GetViewRequest::new().set_name("example");
4398 /// ```
4399 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4400 self.name = v.into();
4401 self
4402 }
4403}
4404
4405impl wkt::message::Message for GetViewRequest {
4406 fn typename() -> &'static str {
4407 "type.googleapis.com/google.logging.v2.GetViewRequest"
4408 }
4409}
4410
4411/// The parameters to `DeleteView`.
4412#[derive(Clone, Default, PartialEq)]
4413#[non_exhaustive]
4414pub struct DeleteViewRequest {
4415 /// Required. The full resource name of the view to delete:
4416 ///
4417 /// ```norust
4418 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
4419 /// ```
4420 ///
4421 /// For example:
4422 ///
4423 /// `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
4424 pub name: std::string::String,
4425
4426 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4427}
4428
4429impl DeleteViewRequest {
4430 pub fn new() -> Self {
4431 std::default::Default::default()
4432 }
4433
4434 /// Sets the value of [name][crate::model::DeleteViewRequest::name].
4435 ///
4436 /// # Example
4437 /// ```ignore,no_run
4438 /// # use google_cloud_logging_v2::model::DeleteViewRequest;
4439 /// let x = DeleteViewRequest::new().set_name("example");
4440 /// ```
4441 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4442 self.name = v.into();
4443 self
4444 }
4445}
4446
4447impl wkt::message::Message for DeleteViewRequest {
4448 fn typename() -> &'static str {
4449 "type.googleapis.com/google.logging.v2.DeleteViewRequest"
4450 }
4451}
4452
4453/// The parameters to `ListSinks`.
4454#[derive(Clone, Default, PartialEq)]
4455#[non_exhaustive]
4456pub struct ListSinksRequest {
4457 /// Required. The parent resource whose sinks are to be listed:
4458 ///
4459 /// ```norust
4460 /// "projects/[PROJECT_ID]"
4461 /// "organizations/[ORGANIZATION_ID]"
4462 /// "billingAccounts/[BILLING_ACCOUNT_ID]"
4463 /// "folders/[FOLDER_ID]"
4464 /// ```
4465 pub parent: std::string::String,
4466
4467 /// Optional. If present, then retrieve the next batch of results from the
4468 /// preceding call to this method. `pageToken` must be the value of
4469 /// `nextPageToken` from the previous response. The values of other method
4470 /// parameters should be identical to those in the previous call.
4471 pub page_token: std::string::String,
4472
4473 /// Optional. The maximum number of results to return from this request.
4474 /// Non-positive values are ignored. The presence of `nextPageToken` in the
4475 /// response indicates that more results might be available.
4476 pub page_size: i32,
4477
4478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4479}
4480
4481impl ListSinksRequest {
4482 pub fn new() -> Self {
4483 std::default::Default::default()
4484 }
4485
4486 /// Sets the value of [parent][crate::model::ListSinksRequest::parent].
4487 ///
4488 /// # Example
4489 /// ```ignore,no_run
4490 /// # use google_cloud_logging_v2::model::ListSinksRequest;
4491 /// let x = ListSinksRequest::new().set_parent("example");
4492 /// ```
4493 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4494 self.parent = v.into();
4495 self
4496 }
4497
4498 /// Sets the value of [page_token][crate::model::ListSinksRequest::page_token].
4499 ///
4500 /// # Example
4501 /// ```ignore,no_run
4502 /// # use google_cloud_logging_v2::model::ListSinksRequest;
4503 /// let x = ListSinksRequest::new().set_page_token("example");
4504 /// ```
4505 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4506 self.page_token = v.into();
4507 self
4508 }
4509
4510 /// Sets the value of [page_size][crate::model::ListSinksRequest::page_size].
4511 ///
4512 /// # Example
4513 /// ```ignore,no_run
4514 /// # use google_cloud_logging_v2::model::ListSinksRequest;
4515 /// let x = ListSinksRequest::new().set_page_size(42);
4516 /// ```
4517 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4518 self.page_size = v.into();
4519 self
4520 }
4521}
4522
4523impl wkt::message::Message for ListSinksRequest {
4524 fn typename() -> &'static str {
4525 "type.googleapis.com/google.logging.v2.ListSinksRequest"
4526 }
4527}
4528
4529/// Result returned from `ListSinks`.
4530#[derive(Clone, Default, PartialEq)]
4531#[non_exhaustive]
4532pub struct ListSinksResponse {
4533 /// A list of sinks.
4534 pub sinks: std::vec::Vec<crate::model::LogSink>,
4535
4536 /// If there might be more results than appear in this response, then
4537 /// `nextPageToken` is included. To get the next set of results, call the same
4538 /// method again using the value of `nextPageToken` as `pageToken`.
4539 pub next_page_token: std::string::String,
4540
4541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4542}
4543
4544impl ListSinksResponse {
4545 pub fn new() -> Self {
4546 std::default::Default::default()
4547 }
4548
4549 /// Sets the value of [sinks][crate::model::ListSinksResponse::sinks].
4550 ///
4551 /// # Example
4552 /// ```ignore,no_run
4553 /// # use google_cloud_logging_v2::model::ListSinksResponse;
4554 /// use google_cloud_logging_v2::model::LogSink;
4555 /// let x = ListSinksResponse::new()
4556 /// .set_sinks([
4557 /// LogSink::default()/* use setters */,
4558 /// LogSink::default()/* use (different) setters */,
4559 /// ]);
4560 /// ```
4561 pub fn set_sinks<T, V>(mut self, v: T) -> Self
4562 where
4563 T: std::iter::IntoIterator<Item = V>,
4564 V: std::convert::Into<crate::model::LogSink>,
4565 {
4566 use std::iter::Iterator;
4567 self.sinks = v.into_iter().map(|i| i.into()).collect();
4568 self
4569 }
4570
4571 /// Sets the value of [next_page_token][crate::model::ListSinksResponse::next_page_token].
4572 ///
4573 /// # Example
4574 /// ```ignore,no_run
4575 /// # use google_cloud_logging_v2::model::ListSinksResponse;
4576 /// let x = ListSinksResponse::new().set_next_page_token("example");
4577 /// ```
4578 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4579 self.next_page_token = v.into();
4580 self
4581 }
4582}
4583
4584impl wkt::message::Message for ListSinksResponse {
4585 fn typename() -> &'static str {
4586 "type.googleapis.com/google.logging.v2.ListSinksResponse"
4587 }
4588}
4589
4590#[doc(hidden)]
4591impl gax::paginator::internal::PageableResponse for ListSinksResponse {
4592 type PageItem = crate::model::LogSink;
4593
4594 fn items(self) -> std::vec::Vec<Self::PageItem> {
4595 self.sinks
4596 }
4597
4598 fn next_page_token(&self) -> std::string::String {
4599 use std::clone::Clone;
4600 self.next_page_token.clone()
4601 }
4602}
4603
4604/// The parameters to `GetSink`.
4605#[derive(Clone, Default, PartialEq)]
4606#[non_exhaustive]
4607pub struct GetSinkRequest {
4608 /// Required. The resource name of the sink:
4609 ///
4610 /// ```norust
4611 /// "projects/[PROJECT_ID]/sinks/[SINK_ID]"
4612 /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
4613 /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
4614 /// "folders/[FOLDER_ID]/sinks/[SINK_ID]"
4615 /// ```
4616 ///
4617 /// For example:
4618 ///
4619 /// `"projects/my-project/sinks/my-sink"`
4620 pub sink_name: std::string::String,
4621
4622 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4623}
4624
4625impl GetSinkRequest {
4626 pub fn new() -> Self {
4627 std::default::Default::default()
4628 }
4629
4630 /// Sets the value of [sink_name][crate::model::GetSinkRequest::sink_name].
4631 ///
4632 /// # Example
4633 /// ```ignore,no_run
4634 /// # use google_cloud_logging_v2::model::GetSinkRequest;
4635 /// let x = GetSinkRequest::new().set_sink_name("example");
4636 /// ```
4637 pub fn set_sink_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4638 self.sink_name = v.into();
4639 self
4640 }
4641}
4642
4643impl wkt::message::Message for GetSinkRequest {
4644 fn typename() -> &'static str {
4645 "type.googleapis.com/google.logging.v2.GetSinkRequest"
4646 }
4647}
4648
4649/// The parameters to `CreateSink`.
4650#[derive(Clone, Default, PartialEq)]
4651#[non_exhaustive]
4652pub struct CreateSinkRequest {
4653 /// Required. The resource in which to create the sink:
4654 ///
4655 /// ```norust
4656 /// "projects/[PROJECT_ID]"
4657 /// "organizations/[ORGANIZATION_ID]"
4658 /// "billingAccounts/[BILLING_ACCOUNT_ID]"
4659 /// "folders/[FOLDER_ID]"
4660 /// ```
4661 ///
4662 /// For examples:
4663 ///
4664 /// `"projects/my-project"`
4665 /// `"organizations/123456789"`
4666 pub parent: std::string::String,
4667
4668 /// Required. The new sink, whose `name` parameter is a sink identifier that
4669 /// is not already in use.
4670 pub sink: std::option::Option<crate::model::LogSink>,
4671
4672 /// Optional. Determines the kind of IAM identity returned as `writer_identity`
4673 /// in the new sink. If this value is omitted or set to false, and if the
4674 /// sink's parent is a project, then the value returned as `writer_identity` is
4675 /// the same group or service account used by Cloud Logging before the addition
4676 /// of writer identities to this API. The sink's destination must be in the
4677 /// same project as the sink itself.
4678 ///
4679 /// If this field is set to true, or if the sink is owned by a non-project
4680 /// resource such as an organization, then the value of `writer_identity` will
4681 /// be a unique service account used only for exports from the new sink. For
4682 /// more information, see `writer_identity` in
4683 /// [LogSink][google.logging.v2.LogSink].
4684 ///
4685 /// [google.logging.v2.LogSink]: crate::model::LogSink
4686 pub unique_writer_identity: bool,
4687
4688 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4689}
4690
4691impl CreateSinkRequest {
4692 pub fn new() -> Self {
4693 std::default::Default::default()
4694 }
4695
4696 /// Sets the value of [parent][crate::model::CreateSinkRequest::parent].
4697 ///
4698 /// # Example
4699 /// ```ignore,no_run
4700 /// # use google_cloud_logging_v2::model::CreateSinkRequest;
4701 /// let x = CreateSinkRequest::new().set_parent("example");
4702 /// ```
4703 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4704 self.parent = v.into();
4705 self
4706 }
4707
4708 /// Sets the value of [sink][crate::model::CreateSinkRequest::sink].
4709 ///
4710 /// # Example
4711 /// ```ignore,no_run
4712 /// # use google_cloud_logging_v2::model::CreateSinkRequest;
4713 /// use google_cloud_logging_v2::model::LogSink;
4714 /// let x = CreateSinkRequest::new().set_sink(LogSink::default()/* use setters */);
4715 /// ```
4716 pub fn set_sink<T>(mut self, v: T) -> Self
4717 where
4718 T: std::convert::Into<crate::model::LogSink>,
4719 {
4720 self.sink = std::option::Option::Some(v.into());
4721 self
4722 }
4723
4724 /// Sets or clears the value of [sink][crate::model::CreateSinkRequest::sink].
4725 ///
4726 /// # Example
4727 /// ```ignore,no_run
4728 /// # use google_cloud_logging_v2::model::CreateSinkRequest;
4729 /// use google_cloud_logging_v2::model::LogSink;
4730 /// let x = CreateSinkRequest::new().set_or_clear_sink(Some(LogSink::default()/* use setters */));
4731 /// let x = CreateSinkRequest::new().set_or_clear_sink(None::<LogSink>);
4732 /// ```
4733 pub fn set_or_clear_sink<T>(mut self, v: std::option::Option<T>) -> Self
4734 where
4735 T: std::convert::Into<crate::model::LogSink>,
4736 {
4737 self.sink = v.map(|x| x.into());
4738 self
4739 }
4740
4741 /// Sets the value of [unique_writer_identity][crate::model::CreateSinkRequest::unique_writer_identity].
4742 ///
4743 /// # Example
4744 /// ```ignore,no_run
4745 /// # use google_cloud_logging_v2::model::CreateSinkRequest;
4746 /// let x = CreateSinkRequest::new().set_unique_writer_identity(true);
4747 /// ```
4748 pub fn set_unique_writer_identity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4749 self.unique_writer_identity = v.into();
4750 self
4751 }
4752}
4753
4754impl wkt::message::Message for CreateSinkRequest {
4755 fn typename() -> &'static str {
4756 "type.googleapis.com/google.logging.v2.CreateSinkRequest"
4757 }
4758}
4759
4760/// The parameters to `UpdateSink`.
4761#[derive(Clone, Default, PartialEq)]
4762#[non_exhaustive]
4763pub struct UpdateSinkRequest {
4764 /// Required. The full resource name of the sink to update, including the
4765 /// parent resource and the sink identifier:
4766 ///
4767 /// ```norust
4768 /// "projects/[PROJECT_ID]/sinks/[SINK_ID]"
4769 /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
4770 /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
4771 /// "folders/[FOLDER_ID]/sinks/[SINK_ID]"
4772 /// ```
4773 ///
4774 /// For example:
4775 ///
4776 /// `"projects/my-project/sinks/my-sink"`
4777 pub sink_name: std::string::String,
4778
4779 /// Required. The updated sink, whose name is the same identifier that appears
4780 /// as part of `sink_name`.
4781 pub sink: std::option::Option<crate::model::LogSink>,
4782
4783 /// Optional. See [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink]
4784 /// for a description of this field. When updating a sink, the effect of this
4785 /// field on the value of `writer_identity` in the updated sink depends on both
4786 /// the old and new values of this field:
4787 ///
4788 /// + If the old and new values of this field are both false or both true,
4789 /// then there is no change to the sink's `writer_identity`.
4790 /// + If the old value is false and the new value is true, then
4791 /// `writer_identity` is changed to a unique service account.
4792 /// + It is an error if the old value is true and the new value is
4793 /// set to false or defaulted to false.
4794 ///
4795 /// [google.logging.v2.ConfigServiceV2.CreateSink]: crate::client::ConfigServiceV2::create_sink
4796 pub unique_writer_identity: bool,
4797
4798 /// Optional. Field mask that specifies the fields in `sink` that need
4799 /// an update. A sink field will be overwritten if, and only if, it is
4800 /// in the update mask. `name` and output only fields cannot be updated.
4801 ///
4802 /// An empty `updateMask` is temporarily treated as using the following mask
4803 /// for backwards compatibility purposes:
4804 ///
4805 /// `destination,filter,includeChildren`
4806 ///
4807 /// At some point in the future, behavior will be removed and specifying an
4808 /// empty `updateMask` will be an error.
4809 ///
4810 /// For a detailed `FieldMask` definition, see
4811 /// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask>
4812 ///
4813 /// For example: `updateMask=filter`
4814 pub update_mask: std::option::Option<wkt::FieldMask>,
4815
4816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4817}
4818
4819impl UpdateSinkRequest {
4820 pub fn new() -> Self {
4821 std::default::Default::default()
4822 }
4823
4824 /// Sets the value of [sink_name][crate::model::UpdateSinkRequest::sink_name].
4825 ///
4826 /// # Example
4827 /// ```ignore,no_run
4828 /// # use google_cloud_logging_v2::model::UpdateSinkRequest;
4829 /// let x = UpdateSinkRequest::new().set_sink_name("example");
4830 /// ```
4831 pub fn set_sink_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4832 self.sink_name = v.into();
4833 self
4834 }
4835
4836 /// Sets the value of [sink][crate::model::UpdateSinkRequest::sink].
4837 ///
4838 /// # Example
4839 /// ```ignore,no_run
4840 /// # use google_cloud_logging_v2::model::UpdateSinkRequest;
4841 /// use google_cloud_logging_v2::model::LogSink;
4842 /// let x = UpdateSinkRequest::new().set_sink(LogSink::default()/* use setters */);
4843 /// ```
4844 pub fn set_sink<T>(mut self, v: T) -> Self
4845 where
4846 T: std::convert::Into<crate::model::LogSink>,
4847 {
4848 self.sink = std::option::Option::Some(v.into());
4849 self
4850 }
4851
4852 /// Sets or clears the value of [sink][crate::model::UpdateSinkRequest::sink].
4853 ///
4854 /// # Example
4855 /// ```ignore,no_run
4856 /// # use google_cloud_logging_v2::model::UpdateSinkRequest;
4857 /// use google_cloud_logging_v2::model::LogSink;
4858 /// let x = UpdateSinkRequest::new().set_or_clear_sink(Some(LogSink::default()/* use setters */));
4859 /// let x = UpdateSinkRequest::new().set_or_clear_sink(None::<LogSink>);
4860 /// ```
4861 pub fn set_or_clear_sink<T>(mut self, v: std::option::Option<T>) -> Self
4862 where
4863 T: std::convert::Into<crate::model::LogSink>,
4864 {
4865 self.sink = v.map(|x| x.into());
4866 self
4867 }
4868
4869 /// Sets the value of [unique_writer_identity][crate::model::UpdateSinkRequest::unique_writer_identity].
4870 ///
4871 /// # Example
4872 /// ```ignore,no_run
4873 /// # use google_cloud_logging_v2::model::UpdateSinkRequest;
4874 /// let x = UpdateSinkRequest::new().set_unique_writer_identity(true);
4875 /// ```
4876 pub fn set_unique_writer_identity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4877 self.unique_writer_identity = v.into();
4878 self
4879 }
4880
4881 /// Sets the value of [update_mask][crate::model::UpdateSinkRequest::update_mask].
4882 ///
4883 /// # Example
4884 /// ```ignore,no_run
4885 /// # use google_cloud_logging_v2::model::UpdateSinkRequest;
4886 /// use wkt::FieldMask;
4887 /// let x = UpdateSinkRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4888 /// ```
4889 pub fn set_update_mask<T>(mut self, v: T) -> Self
4890 where
4891 T: std::convert::Into<wkt::FieldMask>,
4892 {
4893 self.update_mask = std::option::Option::Some(v.into());
4894 self
4895 }
4896
4897 /// Sets or clears the value of [update_mask][crate::model::UpdateSinkRequest::update_mask].
4898 ///
4899 /// # Example
4900 /// ```ignore,no_run
4901 /// # use google_cloud_logging_v2::model::UpdateSinkRequest;
4902 /// use wkt::FieldMask;
4903 /// let x = UpdateSinkRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4904 /// let x = UpdateSinkRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4905 /// ```
4906 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4907 where
4908 T: std::convert::Into<wkt::FieldMask>,
4909 {
4910 self.update_mask = v.map(|x| x.into());
4911 self
4912 }
4913}
4914
4915impl wkt::message::Message for UpdateSinkRequest {
4916 fn typename() -> &'static str {
4917 "type.googleapis.com/google.logging.v2.UpdateSinkRequest"
4918 }
4919}
4920
4921/// The parameters to `DeleteSink`.
4922#[derive(Clone, Default, PartialEq)]
4923#[non_exhaustive]
4924pub struct DeleteSinkRequest {
4925 /// Required. The full resource name of the sink to delete, including the
4926 /// parent resource and the sink identifier:
4927 ///
4928 /// ```norust
4929 /// "projects/[PROJECT_ID]/sinks/[SINK_ID]"
4930 /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
4931 /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
4932 /// "folders/[FOLDER_ID]/sinks/[SINK_ID]"
4933 /// ```
4934 ///
4935 /// For example:
4936 ///
4937 /// `"projects/my-project/sinks/my-sink"`
4938 pub sink_name: std::string::String,
4939
4940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4941}
4942
4943impl DeleteSinkRequest {
4944 pub fn new() -> Self {
4945 std::default::Default::default()
4946 }
4947
4948 /// Sets the value of [sink_name][crate::model::DeleteSinkRequest::sink_name].
4949 ///
4950 /// # Example
4951 /// ```ignore,no_run
4952 /// # use google_cloud_logging_v2::model::DeleteSinkRequest;
4953 /// let x = DeleteSinkRequest::new().set_sink_name("example");
4954 /// ```
4955 pub fn set_sink_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4956 self.sink_name = v.into();
4957 self
4958 }
4959}
4960
4961impl wkt::message::Message for DeleteSinkRequest {
4962 fn typename() -> &'static str {
4963 "type.googleapis.com/google.logging.v2.DeleteSinkRequest"
4964 }
4965}
4966
4967/// The parameters to CreateLink.
4968#[derive(Clone, Default, PartialEq)]
4969#[non_exhaustive]
4970pub struct CreateLinkRequest {
4971 /// Required. The full resource name of the bucket to create a link for.
4972 ///
4973 /// ```norust
4974 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
4975 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
4976 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
4977 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
4978 /// ```
4979 pub parent: std::string::String,
4980
4981 /// Required. The new link.
4982 pub link: std::option::Option<crate::model::Link>,
4983
4984 /// Required. The ID to use for the link. The link_id can have up to 100
4985 /// characters. A valid link_id must only have alphanumeric characters and
4986 /// underscores within it.
4987 pub link_id: std::string::String,
4988
4989 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4990}
4991
4992impl CreateLinkRequest {
4993 pub fn new() -> Self {
4994 std::default::Default::default()
4995 }
4996
4997 /// Sets the value of [parent][crate::model::CreateLinkRequest::parent].
4998 ///
4999 /// # Example
5000 /// ```ignore,no_run
5001 /// # use google_cloud_logging_v2::model::CreateLinkRequest;
5002 /// let x = CreateLinkRequest::new().set_parent("example");
5003 /// ```
5004 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5005 self.parent = v.into();
5006 self
5007 }
5008
5009 /// Sets the value of [link][crate::model::CreateLinkRequest::link].
5010 ///
5011 /// # Example
5012 /// ```ignore,no_run
5013 /// # use google_cloud_logging_v2::model::CreateLinkRequest;
5014 /// use google_cloud_logging_v2::model::Link;
5015 /// let x = CreateLinkRequest::new().set_link(Link::default()/* use setters */);
5016 /// ```
5017 pub fn set_link<T>(mut self, v: T) -> Self
5018 where
5019 T: std::convert::Into<crate::model::Link>,
5020 {
5021 self.link = std::option::Option::Some(v.into());
5022 self
5023 }
5024
5025 /// Sets or clears the value of [link][crate::model::CreateLinkRequest::link].
5026 ///
5027 /// # Example
5028 /// ```ignore,no_run
5029 /// # use google_cloud_logging_v2::model::CreateLinkRequest;
5030 /// use google_cloud_logging_v2::model::Link;
5031 /// let x = CreateLinkRequest::new().set_or_clear_link(Some(Link::default()/* use setters */));
5032 /// let x = CreateLinkRequest::new().set_or_clear_link(None::<Link>);
5033 /// ```
5034 pub fn set_or_clear_link<T>(mut self, v: std::option::Option<T>) -> Self
5035 where
5036 T: std::convert::Into<crate::model::Link>,
5037 {
5038 self.link = v.map(|x| x.into());
5039 self
5040 }
5041
5042 /// Sets the value of [link_id][crate::model::CreateLinkRequest::link_id].
5043 ///
5044 /// # Example
5045 /// ```ignore,no_run
5046 /// # use google_cloud_logging_v2::model::CreateLinkRequest;
5047 /// let x = CreateLinkRequest::new().set_link_id("example");
5048 /// ```
5049 pub fn set_link_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5050 self.link_id = v.into();
5051 self
5052 }
5053}
5054
5055impl wkt::message::Message for CreateLinkRequest {
5056 fn typename() -> &'static str {
5057 "type.googleapis.com/google.logging.v2.CreateLinkRequest"
5058 }
5059}
5060
5061/// The parameters to DeleteLink.
5062#[derive(Clone, Default, PartialEq)]
5063#[non_exhaustive]
5064pub struct DeleteLinkRequest {
5065 /// Required. The full resource name of the link to delete.
5066 ///
5067 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
5068 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
5069 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
5070 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
5071 pub name: std::string::String,
5072
5073 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5074}
5075
5076impl DeleteLinkRequest {
5077 pub fn new() -> Self {
5078 std::default::Default::default()
5079 }
5080
5081 /// Sets the value of [name][crate::model::DeleteLinkRequest::name].
5082 ///
5083 /// # Example
5084 /// ```ignore,no_run
5085 /// # use google_cloud_logging_v2::model::DeleteLinkRequest;
5086 /// let x = DeleteLinkRequest::new().set_name("example");
5087 /// ```
5088 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5089 self.name = v.into();
5090 self
5091 }
5092}
5093
5094impl wkt::message::Message for DeleteLinkRequest {
5095 fn typename() -> &'static str {
5096 "type.googleapis.com/google.logging.v2.DeleteLinkRequest"
5097 }
5098}
5099
5100/// The parameters to ListLinks.
5101#[derive(Clone, Default, PartialEq)]
5102#[non_exhaustive]
5103pub struct ListLinksRequest {
5104 /// Required. The parent resource whose links are to be listed:
5105 ///
5106 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/"
5107 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/"
5108 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/"
5109 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/
5110 pub parent: std::string::String,
5111
5112 /// Optional. If present, then retrieve the next batch of results from the
5113 /// preceding call to this method. `pageToken` must be the value of
5114 /// `nextPageToken` from the previous response.
5115 pub page_token: std::string::String,
5116
5117 /// Optional. The maximum number of results to return from this request.
5118 pub page_size: i32,
5119
5120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5121}
5122
5123impl ListLinksRequest {
5124 pub fn new() -> Self {
5125 std::default::Default::default()
5126 }
5127
5128 /// Sets the value of [parent][crate::model::ListLinksRequest::parent].
5129 ///
5130 /// # Example
5131 /// ```ignore,no_run
5132 /// # use google_cloud_logging_v2::model::ListLinksRequest;
5133 /// let x = ListLinksRequest::new().set_parent("example");
5134 /// ```
5135 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5136 self.parent = v.into();
5137 self
5138 }
5139
5140 /// Sets the value of [page_token][crate::model::ListLinksRequest::page_token].
5141 ///
5142 /// # Example
5143 /// ```ignore,no_run
5144 /// # use google_cloud_logging_v2::model::ListLinksRequest;
5145 /// let x = ListLinksRequest::new().set_page_token("example");
5146 /// ```
5147 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5148 self.page_token = v.into();
5149 self
5150 }
5151
5152 /// Sets the value of [page_size][crate::model::ListLinksRequest::page_size].
5153 ///
5154 /// # Example
5155 /// ```ignore,no_run
5156 /// # use google_cloud_logging_v2::model::ListLinksRequest;
5157 /// let x = ListLinksRequest::new().set_page_size(42);
5158 /// ```
5159 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5160 self.page_size = v.into();
5161 self
5162 }
5163}
5164
5165impl wkt::message::Message for ListLinksRequest {
5166 fn typename() -> &'static str {
5167 "type.googleapis.com/google.logging.v2.ListLinksRequest"
5168 }
5169}
5170
5171/// The response from ListLinks.
5172#[derive(Clone, Default, PartialEq)]
5173#[non_exhaustive]
5174pub struct ListLinksResponse {
5175 /// A list of links.
5176 pub links: std::vec::Vec<crate::model::Link>,
5177
5178 /// If there might be more results than those appearing in this response, then
5179 /// `nextPageToken` is included. To get the next set of results, call the same
5180 /// method again using the value of `nextPageToken` as `pageToken`.
5181 pub next_page_token: std::string::String,
5182
5183 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5184}
5185
5186impl ListLinksResponse {
5187 pub fn new() -> Self {
5188 std::default::Default::default()
5189 }
5190
5191 /// Sets the value of [links][crate::model::ListLinksResponse::links].
5192 ///
5193 /// # Example
5194 /// ```ignore,no_run
5195 /// # use google_cloud_logging_v2::model::ListLinksResponse;
5196 /// use google_cloud_logging_v2::model::Link;
5197 /// let x = ListLinksResponse::new()
5198 /// .set_links([
5199 /// Link::default()/* use setters */,
5200 /// Link::default()/* use (different) setters */,
5201 /// ]);
5202 /// ```
5203 pub fn set_links<T, V>(mut self, v: T) -> Self
5204 where
5205 T: std::iter::IntoIterator<Item = V>,
5206 V: std::convert::Into<crate::model::Link>,
5207 {
5208 use std::iter::Iterator;
5209 self.links = v.into_iter().map(|i| i.into()).collect();
5210 self
5211 }
5212
5213 /// Sets the value of [next_page_token][crate::model::ListLinksResponse::next_page_token].
5214 ///
5215 /// # Example
5216 /// ```ignore,no_run
5217 /// # use google_cloud_logging_v2::model::ListLinksResponse;
5218 /// let x = ListLinksResponse::new().set_next_page_token("example");
5219 /// ```
5220 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5221 self.next_page_token = v.into();
5222 self
5223 }
5224}
5225
5226impl wkt::message::Message for ListLinksResponse {
5227 fn typename() -> &'static str {
5228 "type.googleapis.com/google.logging.v2.ListLinksResponse"
5229 }
5230}
5231
5232#[doc(hidden)]
5233impl gax::paginator::internal::PageableResponse for ListLinksResponse {
5234 type PageItem = crate::model::Link;
5235
5236 fn items(self) -> std::vec::Vec<Self::PageItem> {
5237 self.links
5238 }
5239
5240 fn next_page_token(&self) -> std::string::String {
5241 use std::clone::Clone;
5242 self.next_page_token.clone()
5243 }
5244}
5245
5246/// The parameters to GetLink.
5247#[derive(Clone, Default, PartialEq)]
5248#[non_exhaustive]
5249pub struct GetLinkRequest {
5250 /// Required. The resource name of the link:
5251 ///
5252 /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
5253 /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
5254 /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
5255 /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]
5256 pub name: std::string::String,
5257
5258 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5259}
5260
5261impl GetLinkRequest {
5262 pub fn new() -> Self {
5263 std::default::Default::default()
5264 }
5265
5266 /// Sets the value of [name][crate::model::GetLinkRequest::name].
5267 ///
5268 /// # Example
5269 /// ```ignore,no_run
5270 /// # use google_cloud_logging_v2::model::GetLinkRequest;
5271 /// let x = GetLinkRequest::new().set_name("example");
5272 /// ```
5273 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5274 self.name = v.into();
5275 self
5276 }
5277}
5278
5279impl wkt::message::Message for GetLinkRequest {
5280 fn typename() -> &'static str {
5281 "type.googleapis.com/google.logging.v2.GetLinkRequest"
5282 }
5283}
5284
5285/// Specifies a set of log entries that are filtered out by a sink. If
5286/// your Google Cloud resource receives a large volume of log entries, you can
5287/// use exclusions to reduce your chargeable logs. Note that exclusions on
5288/// organization-level and folder-level sinks don't apply to child resources.
5289/// Note also that you cannot modify the _Required sink or exclude logs from it.
5290#[derive(Clone, Default, PartialEq)]
5291#[non_exhaustive]
5292pub struct LogExclusion {
5293 /// Required. A client-assigned identifier, such as
5294 /// `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and
5295 /// can include only letters, digits, underscores, hyphens, and periods. First
5296 /// character has to be alphanumeric.
5297 pub name: std::string::String,
5298
5299 /// Optional. A description of this exclusion.
5300 pub description: std::string::String,
5301
5302 /// Required. An [advanced logs
5303 /// filter](https://cloud.google.com/logging/docs/view/advanced-queries) that
5304 /// matches the log entries to be excluded. By using the [sample
5305 /// function](https://cloud.google.com/logging/docs/view/advanced-queries#sample),
5306 /// you can exclude less than 100% of the matching log entries.
5307 ///
5308 /// For example, the following query matches 99% of low-severity log entries
5309 /// from Google Cloud Storage buckets:
5310 ///
5311 /// `resource.type=gcs_bucket severity<ERROR sample(insertId, 0.99)`
5312 pub filter: std::string::String,
5313
5314 /// Optional. If set to True, then this exclusion is disabled and it does not
5315 /// exclude any log entries. You can [update an
5316 /// exclusion][google.logging.v2.ConfigServiceV2.UpdateExclusion] to change the
5317 /// value of this field.
5318 ///
5319 /// [google.logging.v2.ConfigServiceV2.UpdateExclusion]: crate::client::ConfigServiceV2::update_exclusion
5320 pub disabled: bool,
5321
5322 /// Output only. The creation timestamp of the exclusion.
5323 ///
5324 /// This field may not be present for older exclusions.
5325 pub create_time: std::option::Option<wkt::Timestamp>,
5326
5327 /// Output only. The last update timestamp of the exclusion.
5328 ///
5329 /// This field may not be present for older exclusions.
5330 pub update_time: std::option::Option<wkt::Timestamp>,
5331
5332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5333}
5334
5335impl LogExclusion {
5336 pub fn new() -> Self {
5337 std::default::Default::default()
5338 }
5339
5340 /// Sets the value of [name][crate::model::LogExclusion::name].
5341 ///
5342 /// # Example
5343 /// ```ignore,no_run
5344 /// # use google_cloud_logging_v2::model::LogExclusion;
5345 /// let x = LogExclusion::new().set_name("example");
5346 /// ```
5347 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5348 self.name = v.into();
5349 self
5350 }
5351
5352 /// Sets the value of [description][crate::model::LogExclusion::description].
5353 ///
5354 /// # Example
5355 /// ```ignore,no_run
5356 /// # use google_cloud_logging_v2::model::LogExclusion;
5357 /// let x = LogExclusion::new().set_description("example");
5358 /// ```
5359 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5360 self.description = v.into();
5361 self
5362 }
5363
5364 /// Sets the value of [filter][crate::model::LogExclusion::filter].
5365 ///
5366 /// # Example
5367 /// ```ignore,no_run
5368 /// # use google_cloud_logging_v2::model::LogExclusion;
5369 /// let x = LogExclusion::new().set_filter("example");
5370 /// ```
5371 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5372 self.filter = v.into();
5373 self
5374 }
5375
5376 /// Sets the value of [disabled][crate::model::LogExclusion::disabled].
5377 ///
5378 /// # Example
5379 /// ```ignore,no_run
5380 /// # use google_cloud_logging_v2::model::LogExclusion;
5381 /// let x = LogExclusion::new().set_disabled(true);
5382 /// ```
5383 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5384 self.disabled = v.into();
5385 self
5386 }
5387
5388 /// Sets the value of [create_time][crate::model::LogExclusion::create_time].
5389 ///
5390 /// # Example
5391 /// ```ignore,no_run
5392 /// # use google_cloud_logging_v2::model::LogExclusion;
5393 /// use wkt::Timestamp;
5394 /// let x = LogExclusion::new().set_create_time(Timestamp::default()/* use setters */);
5395 /// ```
5396 pub fn set_create_time<T>(mut self, v: T) -> Self
5397 where
5398 T: std::convert::Into<wkt::Timestamp>,
5399 {
5400 self.create_time = std::option::Option::Some(v.into());
5401 self
5402 }
5403
5404 /// Sets or clears the value of [create_time][crate::model::LogExclusion::create_time].
5405 ///
5406 /// # Example
5407 /// ```ignore,no_run
5408 /// # use google_cloud_logging_v2::model::LogExclusion;
5409 /// use wkt::Timestamp;
5410 /// let x = LogExclusion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5411 /// let x = LogExclusion::new().set_or_clear_create_time(None::<Timestamp>);
5412 /// ```
5413 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5414 where
5415 T: std::convert::Into<wkt::Timestamp>,
5416 {
5417 self.create_time = v.map(|x| x.into());
5418 self
5419 }
5420
5421 /// Sets the value of [update_time][crate::model::LogExclusion::update_time].
5422 ///
5423 /// # Example
5424 /// ```ignore,no_run
5425 /// # use google_cloud_logging_v2::model::LogExclusion;
5426 /// use wkt::Timestamp;
5427 /// let x = LogExclusion::new().set_update_time(Timestamp::default()/* use setters */);
5428 /// ```
5429 pub fn set_update_time<T>(mut self, v: T) -> Self
5430 where
5431 T: std::convert::Into<wkt::Timestamp>,
5432 {
5433 self.update_time = std::option::Option::Some(v.into());
5434 self
5435 }
5436
5437 /// Sets or clears the value of [update_time][crate::model::LogExclusion::update_time].
5438 ///
5439 /// # Example
5440 /// ```ignore,no_run
5441 /// # use google_cloud_logging_v2::model::LogExclusion;
5442 /// use wkt::Timestamp;
5443 /// let x = LogExclusion::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5444 /// let x = LogExclusion::new().set_or_clear_update_time(None::<Timestamp>);
5445 /// ```
5446 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5447 where
5448 T: std::convert::Into<wkt::Timestamp>,
5449 {
5450 self.update_time = v.map(|x| x.into());
5451 self
5452 }
5453}
5454
5455impl wkt::message::Message for LogExclusion {
5456 fn typename() -> &'static str {
5457 "type.googleapis.com/google.logging.v2.LogExclusion"
5458 }
5459}
5460
5461/// The parameters to `ListExclusions`.
5462#[derive(Clone, Default, PartialEq)]
5463#[non_exhaustive]
5464pub struct ListExclusionsRequest {
5465 /// Required. The parent resource whose exclusions are to be listed.
5466 ///
5467 /// ```norust
5468 /// "projects/[PROJECT_ID]"
5469 /// "organizations/[ORGANIZATION_ID]"
5470 /// "billingAccounts/[BILLING_ACCOUNT_ID]"
5471 /// "folders/[FOLDER_ID]"
5472 /// ```
5473 pub parent: std::string::String,
5474
5475 /// Optional. If present, then retrieve the next batch of results from the
5476 /// preceding call to this method. `pageToken` must be the value of
5477 /// `nextPageToken` from the previous response. The values of other method
5478 /// parameters should be identical to those in the previous call.
5479 pub page_token: std::string::String,
5480
5481 /// Optional. The maximum number of results to return from this request.
5482 /// Non-positive values are ignored. The presence of `nextPageToken` in the
5483 /// response indicates that more results might be available.
5484 pub page_size: i32,
5485
5486 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5487}
5488
5489impl ListExclusionsRequest {
5490 pub fn new() -> Self {
5491 std::default::Default::default()
5492 }
5493
5494 /// Sets the value of [parent][crate::model::ListExclusionsRequest::parent].
5495 ///
5496 /// # Example
5497 /// ```ignore,no_run
5498 /// # use google_cloud_logging_v2::model::ListExclusionsRequest;
5499 /// let x = ListExclusionsRequest::new().set_parent("example");
5500 /// ```
5501 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5502 self.parent = v.into();
5503 self
5504 }
5505
5506 /// Sets the value of [page_token][crate::model::ListExclusionsRequest::page_token].
5507 ///
5508 /// # Example
5509 /// ```ignore,no_run
5510 /// # use google_cloud_logging_v2::model::ListExclusionsRequest;
5511 /// let x = ListExclusionsRequest::new().set_page_token("example");
5512 /// ```
5513 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5514 self.page_token = v.into();
5515 self
5516 }
5517
5518 /// Sets the value of [page_size][crate::model::ListExclusionsRequest::page_size].
5519 ///
5520 /// # Example
5521 /// ```ignore,no_run
5522 /// # use google_cloud_logging_v2::model::ListExclusionsRequest;
5523 /// let x = ListExclusionsRequest::new().set_page_size(42);
5524 /// ```
5525 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5526 self.page_size = v.into();
5527 self
5528 }
5529}
5530
5531impl wkt::message::Message for ListExclusionsRequest {
5532 fn typename() -> &'static str {
5533 "type.googleapis.com/google.logging.v2.ListExclusionsRequest"
5534 }
5535}
5536
5537/// Result returned from `ListExclusions`.
5538#[derive(Clone, Default, PartialEq)]
5539#[non_exhaustive]
5540pub struct ListExclusionsResponse {
5541 /// A list of exclusions.
5542 pub exclusions: std::vec::Vec<crate::model::LogExclusion>,
5543
5544 /// If there might be more results than appear in this response, then
5545 /// `nextPageToken` is included. To get the next set of results, call the same
5546 /// method again using the value of `nextPageToken` as `pageToken`.
5547 pub next_page_token: std::string::String,
5548
5549 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5550}
5551
5552impl ListExclusionsResponse {
5553 pub fn new() -> Self {
5554 std::default::Default::default()
5555 }
5556
5557 /// Sets the value of [exclusions][crate::model::ListExclusionsResponse::exclusions].
5558 ///
5559 /// # Example
5560 /// ```ignore,no_run
5561 /// # use google_cloud_logging_v2::model::ListExclusionsResponse;
5562 /// use google_cloud_logging_v2::model::LogExclusion;
5563 /// let x = ListExclusionsResponse::new()
5564 /// .set_exclusions([
5565 /// LogExclusion::default()/* use setters */,
5566 /// LogExclusion::default()/* use (different) setters */,
5567 /// ]);
5568 /// ```
5569 pub fn set_exclusions<T, V>(mut self, v: T) -> Self
5570 where
5571 T: std::iter::IntoIterator<Item = V>,
5572 V: std::convert::Into<crate::model::LogExclusion>,
5573 {
5574 use std::iter::Iterator;
5575 self.exclusions = v.into_iter().map(|i| i.into()).collect();
5576 self
5577 }
5578
5579 /// Sets the value of [next_page_token][crate::model::ListExclusionsResponse::next_page_token].
5580 ///
5581 /// # Example
5582 /// ```ignore,no_run
5583 /// # use google_cloud_logging_v2::model::ListExclusionsResponse;
5584 /// let x = ListExclusionsResponse::new().set_next_page_token("example");
5585 /// ```
5586 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5587 self.next_page_token = v.into();
5588 self
5589 }
5590}
5591
5592impl wkt::message::Message for ListExclusionsResponse {
5593 fn typename() -> &'static str {
5594 "type.googleapis.com/google.logging.v2.ListExclusionsResponse"
5595 }
5596}
5597
5598#[doc(hidden)]
5599impl gax::paginator::internal::PageableResponse for ListExclusionsResponse {
5600 type PageItem = crate::model::LogExclusion;
5601
5602 fn items(self) -> std::vec::Vec<Self::PageItem> {
5603 self.exclusions
5604 }
5605
5606 fn next_page_token(&self) -> std::string::String {
5607 use std::clone::Clone;
5608 self.next_page_token.clone()
5609 }
5610}
5611
5612/// The parameters to `GetExclusion`.
5613#[derive(Clone, Default, PartialEq)]
5614#[non_exhaustive]
5615pub struct GetExclusionRequest {
5616 /// Required. The resource name of an existing exclusion:
5617 ///
5618 /// ```norust
5619 /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
5620 /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
5621 /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
5622 /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
5623 /// ```
5624 ///
5625 /// For example:
5626 ///
5627 /// `"projects/my-project/exclusions/my-exclusion"`
5628 pub name: std::string::String,
5629
5630 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5631}
5632
5633impl GetExclusionRequest {
5634 pub fn new() -> Self {
5635 std::default::Default::default()
5636 }
5637
5638 /// Sets the value of [name][crate::model::GetExclusionRequest::name].
5639 ///
5640 /// # Example
5641 /// ```ignore,no_run
5642 /// # use google_cloud_logging_v2::model::GetExclusionRequest;
5643 /// let x = GetExclusionRequest::new().set_name("example");
5644 /// ```
5645 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5646 self.name = v.into();
5647 self
5648 }
5649}
5650
5651impl wkt::message::Message for GetExclusionRequest {
5652 fn typename() -> &'static str {
5653 "type.googleapis.com/google.logging.v2.GetExclusionRequest"
5654 }
5655}
5656
5657/// The parameters to `CreateExclusion`.
5658#[derive(Clone, Default, PartialEq)]
5659#[non_exhaustive]
5660pub struct CreateExclusionRequest {
5661 /// Required. The parent resource in which to create the exclusion:
5662 ///
5663 /// ```norust
5664 /// "projects/[PROJECT_ID]"
5665 /// "organizations/[ORGANIZATION_ID]"
5666 /// "billingAccounts/[BILLING_ACCOUNT_ID]"
5667 /// "folders/[FOLDER_ID]"
5668 /// ```
5669 ///
5670 /// For examples:
5671 ///
5672 /// `"projects/my-logging-project"`
5673 /// `"organizations/123456789"`
5674 pub parent: std::string::String,
5675
5676 /// Required. The new exclusion, whose `name` parameter is an exclusion name
5677 /// that is not already used in the parent resource.
5678 pub exclusion: std::option::Option<crate::model::LogExclusion>,
5679
5680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5681}
5682
5683impl CreateExclusionRequest {
5684 pub fn new() -> Self {
5685 std::default::Default::default()
5686 }
5687
5688 /// Sets the value of [parent][crate::model::CreateExclusionRequest::parent].
5689 ///
5690 /// # Example
5691 /// ```ignore,no_run
5692 /// # use google_cloud_logging_v2::model::CreateExclusionRequest;
5693 /// let x = CreateExclusionRequest::new().set_parent("example");
5694 /// ```
5695 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5696 self.parent = v.into();
5697 self
5698 }
5699
5700 /// Sets the value of [exclusion][crate::model::CreateExclusionRequest::exclusion].
5701 ///
5702 /// # Example
5703 /// ```ignore,no_run
5704 /// # use google_cloud_logging_v2::model::CreateExclusionRequest;
5705 /// use google_cloud_logging_v2::model::LogExclusion;
5706 /// let x = CreateExclusionRequest::new().set_exclusion(LogExclusion::default()/* use setters */);
5707 /// ```
5708 pub fn set_exclusion<T>(mut self, v: T) -> Self
5709 where
5710 T: std::convert::Into<crate::model::LogExclusion>,
5711 {
5712 self.exclusion = std::option::Option::Some(v.into());
5713 self
5714 }
5715
5716 /// Sets or clears the value of [exclusion][crate::model::CreateExclusionRequest::exclusion].
5717 ///
5718 /// # Example
5719 /// ```ignore,no_run
5720 /// # use google_cloud_logging_v2::model::CreateExclusionRequest;
5721 /// use google_cloud_logging_v2::model::LogExclusion;
5722 /// let x = CreateExclusionRequest::new().set_or_clear_exclusion(Some(LogExclusion::default()/* use setters */));
5723 /// let x = CreateExclusionRequest::new().set_or_clear_exclusion(None::<LogExclusion>);
5724 /// ```
5725 pub fn set_or_clear_exclusion<T>(mut self, v: std::option::Option<T>) -> Self
5726 where
5727 T: std::convert::Into<crate::model::LogExclusion>,
5728 {
5729 self.exclusion = v.map(|x| x.into());
5730 self
5731 }
5732}
5733
5734impl wkt::message::Message for CreateExclusionRequest {
5735 fn typename() -> &'static str {
5736 "type.googleapis.com/google.logging.v2.CreateExclusionRequest"
5737 }
5738}
5739
5740/// The parameters to `UpdateExclusion`.
5741#[derive(Clone, Default, PartialEq)]
5742#[non_exhaustive]
5743pub struct UpdateExclusionRequest {
5744 /// Required. The resource name of the exclusion to update:
5745 ///
5746 /// ```norust
5747 /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
5748 /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
5749 /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
5750 /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
5751 /// ```
5752 ///
5753 /// For example:
5754 ///
5755 /// `"projects/my-project/exclusions/my-exclusion"`
5756 pub name: std::string::String,
5757
5758 /// Required. New values for the existing exclusion. Only the fields specified
5759 /// in `update_mask` are relevant.
5760 pub exclusion: std::option::Option<crate::model::LogExclusion>,
5761
5762 /// Required. A non-empty list of fields to change in the existing exclusion.
5763 /// New values for the fields are taken from the corresponding fields in the
5764 /// [LogExclusion][google.logging.v2.LogExclusion] included in this request.
5765 /// Fields not mentioned in `update_mask` are not changed and are ignored in
5766 /// the request.
5767 ///
5768 /// For example, to change the filter and description of an exclusion,
5769 /// specify an `update_mask` of `"filter,description"`.
5770 ///
5771 /// [google.logging.v2.LogExclusion]: crate::model::LogExclusion
5772 pub update_mask: std::option::Option<wkt::FieldMask>,
5773
5774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5775}
5776
5777impl UpdateExclusionRequest {
5778 pub fn new() -> Self {
5779 std::default::Default::default()
5780 }
5781
5782 /// Sets the value of [name][crate::model::UpdateExclusionRequest::name].
5783 ///
5784 /// # Example
5785 /// ```ignore,no_run
5786 /// # use google_cloud_logging_v2::model::UpdateExclusionRequest;
5787 /// let x = UpdateExclusionRequest::new().set_name("example");
5788 /// ```
5789 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5790 self.name = v.into();
5791 self
5792 }
5793
5794 /// Sets the value of [exclusion][crate::model::UpdateExclusionRequest::exclusion].
5795 ///
5796 /// # Example
5797 /// ```ignore,no_run
5798 /// # use google_cloud_logging_v2::model::UpdateExclusionRequest;
5799 /// use google_cloud_logging_v2::model::LogExclusion;
5800 /// let x = UpdateExclusionRequest::new().set_exclusion(LogExclusion::default()/* use setters */);
5801 /// ```
5802 pub fn set_exclusion<T>(mut self, v: T) -> Self
5803 where
5804 T: std::convert::Into<crate::model::LogExclusion>,
5805 {
5806 self.exclusion = std::option::Option::Some(v.into());
5807 self
5808 }
5809
5810 /// Sets or clears the value of [exclusion][crate::model::UpdateExclusionRequest::exclusion].
5811 ///
5812 /// # Example
5813 /// ```ignore,no_run
5814 /// # use google_cloud_logging_v2::model::UpdateExclusionRequest;
5815 /// use google_cloud_logging_v2::model::LogExclusion;
5816 /// let x = UpdateExclusionRequest::new().set_or_clear_exclusion(Some(LogExclusion::default()/* use setters */));
5817 /// let x = UpdateExclusionRequest::new().set_or_clear_exclusion(None::<LogExclusion>);
5818 /// ```
5819 pub fn set_or_clear_exclusion<T>(mut self, v: std::option::Option<T>) -> Self
5820 where
5821 T: std::convert::Into<crate::model::LogExclusion>,
5822 {
5823 self.exclusion = v.map(|x| x.into());
5824 self
5825 }
5826
5827 /// Sets the value of [update_mask][crate::model::UpdateExclusionRequest::update_mask].
5828 ///
5829 /// # Example
5830 /// ```ignore,no_run
5831 /// # use google_cloud_logging_v2::model::UpdateExclusionRequest;
5832 /// use wkt::FieldMask;
5833 /// let x = UpdateExclusionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5834 /// ```
5835 pub fn set_update_mask<T>(mut self, v: T) -> Self
5836 where
5837 T: std::convert::Into<wkt::FieldMask>,
5838 {
5839 self.update_mask = std::option::Option::Some(v.into());
5840 self
5841 }
5842
5843 /// Sets or clears the value of [update_mask][crate::model::UpdateExclusionRequest::update_mask].
5844 ///
5845 /// # Example
5846 /// ```ignore,no_run
5847 /// # use google_cloud_logging_v2::model::UpdateExclusionRequest;
5848 /// use wkt::FieldMask;
5849 /// let x = UpdateExclusionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5850 /// let x = UpdateExclusionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5851 /// ```
5852 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5853 where
5854 T: std::convert::Into<wkt::FieldMask>,
5855 {
5856 self.update_mask = v.map(|x| x.into());
5857 self
5858 }
5859}
5860
5861impl wkt::message::Message for UpdateExclusionRequest {
5862 fn typename() -> &'static str {
5863 "type.googleapis.com/google.logging.v2.UpdateExclusionRequest"
5864 }
5865}
5866
5867/// The parameters to `DeleteExclusion`.
5868#[derive(Clone, Default, PartialEq)]
5869#[non_exhaustive]
5870pub struct DeleteExclusionRequest {
5871 /// Required. The resource name of an existing exclusion to delete:
5872 ///
5873 /// ```norust
5874 /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
5875 /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
5876 /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
5877 /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
5878 /// ```
5879 ///
5880 /// For example:
5881 ///
5882 /// `"projects/my-project/exclusions/my-exclusion"`
5883 pub name: std::string::String,
5884
5885 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5886}
5887
5888impl DeleteExclusionRequest {
5889 pub fn new() -> Self {
5890 std::default::Default::default()
5891 }
5892
5893 /// Sets the value of [name][crate::model::DeleteExclusionRequest::name].
5894 ///
5895 /// # Example
5896 /// ```ignore,no_run
5897 /// # use google_cloud_logging_v2::model::DeleteExclusionRequest;
5898 /// let x = DeleteExclusionRequest::new().set_name("example");
5899 /// ```
5900 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5901 self.name = v.into();
5902 self
5903 }
5904}
5905
5906impl wkt::message::Message for DeleteExclusionRequest {
5907 fn typename() -> &'static str {
5908 "type.googleapis.com/google.logging.v2.DeleteExclusionRequest"
5909 }
5910}
5911
5912/// The parameters to
5913/// [GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings].
5914///
5915/// See [Enabling CMEK for Log
5916/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
5917/// more information.
5918///
5919/// [google.logging.v2.ConfigServiceV2.GetCmekSettings]: crate::client::ConfigServiceV2::get_cmek_settings
5920#[derive(Clone, Default, PartialEq)]
5921#[non_exhaustive]
5922pub struct GetCmekSettingsRequest {
5923 /// Required. The resource for which to retrieve CMEK settings.
5924 ///
5925 /// ```norust
5926 /// "projects/[PROJECT_ID]/cmekSettings"
5927 /// "organizations/[ORGANIZATION_ID]/cmekSettings"
5928 /// "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
5929 /// "folders/[FOLDER_ID]/cmekSettings"
5930 /// ```
5931 ///
5932 /// For example:
5933 ///
5934 /// `"organizations/12345/cmekSettings"`
5935 ///
5936 /// Note: CMEK for the Log Router can be configured for Google Cloud projects,
5937 /// folders, organizations and billing accounts. Once configured for an
5938 /// organization, it applies to all projects and folders in the Google Cloud
5939 /// organization.
5940 pub name: std::string::String,
5941
5942 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5943}
5944
5945impl GetCmekSettingsRequest {
5946 pub fn new() -> Self {
5947 std::default::Default::default()
5948 }
5949
5950 /// Sets the value of [name][crate::model::GetCmekSettingsRequest::name].
5951 ///
5952 /// # Example
5953 /// ```ignore,no_run
5954 /// # use google_cloud_logging_v2::model::GetCmekSettingsRequest;
5955 /// let x = GetCmekSettingsRequest::new().set_name("example");
5956 /// ```
5957 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5958 self.name = v.into();
5959 self
5960 }
5961}
5962
5963impl wkt::message::Message for GetCmekSettingsRequest {
5964 fn typename() -> &'static str {
5965 "type.googleapis.com/google.logging.v2.GetCmekSettingsRequest"
5966 }
5967}
5968
5969/// The parameters to
5970/// [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings].
5971///
5972/// See [Enabling CMEK for Log
5973/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
5974/// more information.
5975///
5976/// [google.logging.v2.ConfigServiceV2.UpdateCmekSettings]: crate::client::ConfigServiceV2::update_cmek_settings
5977#[derive(Clone, Default, PartialEq)]
5978#[non_exhaustive]
5979pub struct UpdateCmekSettingsRequest {
5980 /// Required. The resource name for the CMEK settings to update.
5981 ///
5982 /// ```norust
5983 /// "projects/[PROJECT_ID]/cmekSettings"
5984 /// "organizations/[ORGANIZATION_ID]/cmekSettings"
5985 /// "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
5986 /// "folders/[FOLDER_ID]/cmekSettings"
5987 /// ```
5988 ///
5989 /// For example:
5990 ///
5991 /// `"organizations/12345/cmekSettings"`
5992 ///
5993 /// Note: CMEK for the Log Router can currently only be configured for Google
5994 /// Cloud organizations. Once configured, it applies to all projects and
5995 /// folders in the Google Cloud organization.
5996 pub name: std::string::String,
5997
5998 /// Required. The CMEK settings to update.
5999 ///
6000 /// See [Enabling CMEK for Log
6001 /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
6002 /// for more information.
6003 pub cmek_settings: std::option::Option<crate::model::CmekSettings>,
6004
6005 /// Optional. Field mask identifying which fields from `cmek_settings` should
6006 /// be updated. A field will be overwritten if and only if it is in the update
6007 /// mask. Output only fields cannot be updated.
6008 ///
6009 /// See [FieldMask][google.protobuf.FieldMask] for more information.
6010 ///
6011 /// For example: `"updateMask=kmsKeyName"`
6012 ///
6013 /// [google.protobuf.FieldMask]: wkt::FieldMask
6014 pub update_mask: std::option::Option<wkt::FieldMask>,
6015
6016 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6017}
6018
6019impl UpdateCmekSettingsRequest {
6020 pub fn new() -> Self {
6021 std::default::Default::default()
6022 }
6023
6024 /// Sets the value of [name][crate::model::UpdateCmekSettingsRequest::name].
6025 ///
6026 /// # Example
6027 /// ```ignore,no_run
6028 /// # use google_cloud_logging_v2::model::UpdateCmekSettingsRequest;
6029 /// let x = UpdateCmekSettingsRequest::new().set_name("example");
6030 /// ```
6031 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6032 self.name = v.into();
6033 self
6034 }
6035
6036 /// Sets the value of [cmek_settings][crate::model::UpdateCmekSettingsRequest::cmek_settings].
6037 ///
6038 /// # Example
6039 /// ```ignore,no_run
6040 /// # use google_cloud_logging_v2::model::UpdateCmekSettingsRequest;
6041 /// use google_cloud_logging_v2::model::CmekSettings;
6042 /// let x = UpdateCmekSettingsRequest::new().set_cmek_settings(CmekSettings::default()/* use setters */);
6043 /// ```
6044 pub fn set_cmek_settings<T>(mut self, v: T) -> Self
6045 where
6046 T: std::convert::Into<crate::model::CmekSettings>,
6047 {
6048 self.cmek_settings = std::option::Option::Some(v.into());
6049 self
6050 }
6051
6052 /// Sets or clears the value of [cmek_settings][crate::model::UpdateCmekSettingsRequest::cmek_settings].
6053 ///
6054 /// # Example
6055 /// ```ignore,no_run
6056 /// # use google_cloud_logging_v2::model::UpdateCmekSettingsRequest;
6057 /// use google_cloud_logging_v2::model::CmekSettings;
6058 /// let x = UpdateCmekSettingsRequest::new().set_or_clear_cmek_settings(Some(CmekSettings::default()/* use setters */));
6059 /// let x = UpdateCmekSettingsRequest::new().set_or_clear_cmek_settings(None::<CmekSettings>);
6060 /// ```
6061 pub fn set_or_clear_cmek_settings<T>(mut self, v: std::option::Option<T>) -> Self
6062 where
6063 T: std::convert::Into<crate::model::CmekSettings>,
6064 {
6065 self.cmek_settings = v.map(|x| x.into());
6066 self
6067 }
6068
6069 /// Sets the value of [update_mask][crate::model::UpdateCmekSettingsRequest::update_mask].
6070 ///
6071 /// # Example
6072 /// ```ignore,no_run
6073 /// # use google_cloud_logging_v2::model::UpdateCmekSettingsRequest;
6074 /// use wkt::FieldMask;
6075 /// let x = UpdateCmekSettingsRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6076 /// ```
6077 pub fn set_update_mask<T>(mut self, v: T) -> Self
6078 where
6079 T: std::convert::Into<wkt::FieldMask>,
6080 {
6081 self.update_mask = std::option::Option::Some(v.into());
6082 self
6083 }
6084
6085 /// Sets or clears the value of [update_mask][crate::model::UpdateCmekSettingsRequest::update_mask].
6086 ///
6087 /// # Example
6088 /// ```ignore,no_run
6089 /// # use google_cloud_logging_v2::model::UpdateCmekSettingsRequest;
6090 /// use wkt::FieldMask;
6091 /// let x = UpdateCmekSettingsRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6092 /// let x = UpdateCmekSettingsRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6093 /// ```
6094 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6095 where
6096 T: std::convert::Into<wkt::FieldMask>,
6097 {
6098 self.update_mask = v.map(|x| x.into());
6099 self
6100 }
6101}
6102
6103impl wkt::message::Message for UpdateCmekSettingsRequest {
6104 fn typename() -> &'static str {
6105 "type.googleapis.com/google.logging.v2.UpdateCmekSettingsRequest"
6106 }
6107}
6108
6109/// Describes the customer-managed encryption key (CMEK) settings associated with
6110/// a project, folder, organization, billing account, or flexible resource.
6111///
6112/// Note: CMEK for the Log Router can currently only be configured for Google
6113/// Cloud organizations. Once configured, it applies to all projects and folders
6114/// in the Google Cloud organization.
6115///
6116/// See [Enabling CMEK for Log
6117/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
6118/// more information.
6119#[derive(Clone, Default, PartialEq)]
6120#[non_exhaustive]
6121pub struct CmekSettings {
6122 /// Output only. The resource name of the CMEK settings.
6123 pub name: std::string::String,
6124
6125 /// The resource name for the configured Cloud KMS key.
6126 ///
6127 /// KMS key name format:
6128 ///
6129 /// ```norust
6130 /// "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]"
6131 /// ```
6132 ///
6133 /// For example:
6134 ///
6135 /// `"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"`
6136 ///
6137 /// To enable CMEK for the Log Router, set this field to a valid
6138 /// `kms_key_name` for which the associated service account has the required
6139 /// cloudkms.cryptoKeyEncrypterDecrypter roles assigned for the key.
6140 ///
6141 /// The Cloud KMS key used by the Log Router can be updated by changing the
6142 /// `kms_key_name` to a new valid key name or disabled by setting the key name
6143 /// to an empty string. Encryption operations that are in progress will be
6144 /// completed with the key that was in use when they started. Decryption
6145 /// operations will be completed using the key that was used at the time of
6146 /// encryption unless access to that key has been revoked.
6147 ///
6148 /// To disable CMEK for the Log Router, set this field to an empty string.
6149 ///
6150 /// See [Enabling CMEK for Log
6151 /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
6152 /// for more information.
6153 pub kms_key_name: std::string::String,
6154
6155 /// The CryptoKeyVersion resource name for the configured Cloud KMS key.
6156 ///
6157 /// KMS key name format:
6158 ///
6159 /// ```norust
6160 /// "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]/cryptoKeyVersions/[VERSION]"
6161 /// ```
6162 ///
6163 /// For example:
6164 ///
6165 /// `"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key/cryptoKeyVersions/1"`
6166 ///
6167 /// This is a read-only field used to convey the specific configured
6168 /// CryptoKeyVersion of `kms_key` that has been configured. It will be
6169 /// populated in cases where the CMEK settings are bound to a single key
6170 /// version.
6171 ///
6172 /// If this field is populated, the `kms_key` is tied to a specific
6173 /// CryptoKeyVersion.
6174 pub kms_key_version_name: std::string::String,
6175
6176 /// Output only. The service account that will be used by the Log Router to
6177 /// access your Cloud KMS key.
6178 ///
6179 /// Before enabling CMEK for Log Router, you must first assign the
6180 /// cloudkms.cryptoKeyEncrypterDecrypter role to the service account that
6181 /// the Log Router will use to access your Cloud KMS key. Use
6182 /// [GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings] to
6183 /// obtain the service account ID.
6184 ///
6185 /// See [Enabling CMEK for Log
6186 /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
6187 /// for more information.
6188 ///
6189 /// [google.logging.v2.ConfigServiceV2.GetCmekSettings]: crate::client::ConfigServiceV2::get_cmek_settings
6190 pub service_account_id: std::string::String,
6191
6192 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6193}
6194
6195impl CmekSettings {
6196 pub fn new() -> Self {
6197 std::default::Default::default()
6198 }
6199
6200 /// Sets the value of [name][crate::model::CmekSettings::name].
6201 ///
6202 /// # Example
6203 /// ```ignore,no_run
6204 /// # use google_cloud_logging_v2::model::CmekSettings;
6205 /// let x = CmekSettings::new().set_name("example");
6206 /// ```
6207 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6208 self.name = v.into();
6209 self
6210 }
6211
6212 /// Sets the value of [kms_key_name][crate::model::CmekSettings::kms_key_name].
6213 ///
6214 /// # Example
6215 /// ```ignore,no_run
6216 /// # use google_cloud_logging_v2::model::CmekSettings;
6217 /// let x = CmekSettings::new().set_kms_key_name("example");
6218 /// ```
6219 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6220 self.kms_key_name = v.into();
6221 self
6222 }
6223
6224 /// Sets the value of [kms_key_version_name][crate::model::CmekSettings::kms_key_version_name].
6225 ///
6226 /// # Example
6227 /// ```ignore,no_run
6228 /// # use google_cloud_logging_v2::model::CmekSettings;
6229 /// let x = CmekSettings::new().set_kms_key_version_name("example");
6230 /// ```
6231 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
6232 mut self,
6233 v: T,
6234 ) -> Self {
6235 self.kms_key_version_name = v.into();
6236 self
6237 }
6238
6239 /// Sets the value of [service_account_id][crate::model::CmekSettings::service_account_id].
6240 ///
6241 /// # Example
6242 /// ```ignore,no_run
6243 /// # use google_cloud_logging_v2::model::CmekSettings;
6244 /// let x = CmekSettings::new().set_service_account_id("example");
6245 /// ```
6246 pub fn set_service_account_id<T: std::convert::Into<std::string::String>>(
6247 mut self,
6248 v: T,
6249 ) -> Self {
6250 self.service_account_id = v.into();
6251 self
6252 }
6253}
6254
6255impl wkt::message::Message for CmekSettings {
6256 fn typename() -> &'static str {
6257 "type.googleapis.com/google.logging.v2.CmekSettings"
6258 }
6259}
6260
6261/// The parameters to
6262/// [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings].
6263///
6264/// See [Enabling CMEK for Log
6265/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
6266/// more information.
6267///
6268/// [google.logging.v2.ConfigServiceV2.GetSettings]: crate::client::ConfigServiceV2::get_settings
6269#[derive(Clone, Default, PartialEq)]
6270#[non_exhaustive]
6271pub struct GetSettingsRequest {
6272 /// Required. The resource for which to retrieve settings.
6273 ///
6274 /// ```norust
6275 /// "projects/[PROJECT_ID]/settings"
6276 /// "organizations/[ORGANIZATION_ID]/settings"
6277 /// "billingAccounts/[BILLING_ACCOUNT_ID]/settings"
6278 /// "folders/[FOLDER_ID]/settings"
6279 /// ```
6280 ///
6281 /// For example:
6282 ///
6283 /// `"organizations/12345/settings"`
6284 ///
6285 /// Note: Settings for the Log Router can be get for Google Cloud projects,
6286 /// folders, organizations and billing accounts. Currently it can only be
6287 /// configured for organizations. Once configured for an organization, it
6288 /// applies to all projects and folders in the Google Cloud organization.
6289 pub name: std::string::String,
6290
6291 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6292}
6293
6294impl GetSettingsRequest {
6295 pub fn new() -> Self {
6296 std::default::Default::default()
6297 }
6298
6299 /// Sets the value of [name][crate::model::GetSettingsRequest::name].
6300 ///
6301 /// # Example
6302 /// ```ignore,no_run
6303 /// # use google_cloud_logging_v2::model::GetSettingsRequest;
6304 /// let x = GetSettingsRequest::new().set_name("example");
6305 /// ```
6306 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6307 self.name = v.into();
6308 self
6309 }
6310}
6311
6312impl wkt::message::Message for GetSettingsRequest {
6313 fn typename() -> &'static str {
6314 "type.googleapis.com/google.logging.v2.GetSettingsRequest"
6315 }
6316}
6317
6318/// The parameters to
6319/// [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings].
6320///
6321/// See [Enabling CMEK for Log
6322/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
6323/// more information.
6324///
6325/// [google.logging.v2.ConfigServiceV2.UpdateSettings]: crate::client::ConfigServiceV2::update_settings
6326#[derive(Clone, Default, PartialEq)]
6327#[non_exhaustive]
6328pub struct UpdateSettingsRequest {
6329 /// Required. The resource name for the settings to update.
6330 ///
6331 /// ```norust
6332 /// "organizations/[ORGANIZATION_ID]/settings"
6333 /// ```
6334 ///
6335 /// For example:
6336 ///
6337 /// `"organizations/12345/settings"`
6338 ///
6339 /// Note: Settings for the Log Router can currently only be configured for
6340 /// Google Cloud organizations. Once configured, it applies to all projects and
6341 /// folders in the Google Cloud organization.
6342 pub name: std::string::String,
6343
6344 /// Required. The settings to update.
6345 ///
6346 /// See [Enabling CMEK for Log
6347 /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
6348 /// for more information.
6349 pub settings: std::option::Option<crate::model::Settings>,
6350
6351 /// Optional. Field mask identifying which fields from `settings` should
6352 /// be updated. A field will be overwritten if and only if it is in the update
6353 /// mask. Output only fields cannot be updated.
6354 ///
6355 /// See [FieldMask][google.protobuf.FieldMask] for more information.
6356 ///
6357 /// For example: `"updateMask=kmsKeyName"`
6358 ///
6359 /// [google.protobuf.FieldMask]: wkt::FieldMask
6360 pub update_mask: std::option::Option<wkt::FieldMask>,
6361
6362 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6363}
6364
6365impl UpdateSettingsRequest {
6366 pub fn new() -> Self {
6367 std::default::Default::default()
6368 }
6369
6370 /// Sets the value of [name][crate::model::UpdateSettingsRequest::name].
6371 ///
6372 /// # Example
6373 /// ```ignore,no_run
6374 /// # use google_cloud_logging_v2::model::UpdateSettingsRequest;
6375 /// let x = UpdateSettingsRequest::new().set_name("example");
6376 /// ```
6377 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6378 self.name = v.into();
6379 self
6380 }
6381
6382 /// Sets the value of [settings][crate::model::UpdateSettingsRequest::settings].
6383 ///
6384 /// # Example
6385 /// ```ignore,no_run
6386 /// # use google_cloud_logging_v2::model::UpdateSettingsRequest;
6387 /// use google_cloud_logging_v2::model::Settings;
6388 /// let x = UpdateSettingsRequest::new().set_settings(Settings::default()/* use setters */);
6389 /// ```
6390 pub fn set_settings<T>(mut self, v: T) -> Self
6391 where
6392 T: std::convert::Into<crate::model::Settings>,
6393 {
6394 self.settings = std::option::Option::Some(v.into());
6395 self
6396 }
6397
6398 /// Sets or clears the value of [settings][crate::model::UpdateSettingsRequest::settings].
6399 ///
6400 /// # Example
6401 /// ```ignore,no_run
6402 /// # use google_cloud_logging_v2::model::UpdateSettingsRequest;
6403 /// use google_cloud_logging_v2::model::Settings;
6404 /// let x = UpdateSettingsRequest::new().set_or_clear_settings(Some(Settings::default()/* use setters */));
6405 /// let x = UpdateSettingsRequest::new().set_or_clear_settings(None::<Settings>);
6406 /// ```
6407 pub fn set_or_clear_settings<T>(mut self, v: std::option::Option<T>) -> Self
6408 where
6409 T: std::convert::Into<crate::model::Settings>,
6410 {
6411 self.settings = v.map(|x| x.into());
6412 self
6413 }
6414
6415 /// Sets the value of [update_mask][crate::model::UpdateSettingsRequest::update_mask].
6416 ///
6417 /// # Example
6418 /// ```ignore,no_run
6419 /// # use google_cloud_logging_v2::model::UpdateSettingsRequest;
6420 /// use wkt::FieldMask;
6421 /// let x = UpdateSettingsRequest::new().set_update_mask(FieldMask::default()/* use setters */);
6422 /// ```
6423 pub fn set_update_mask<T>(mut self, v: T) -> Self
6424 where
6425 T: std::convert::Into<wkt::FieldMask>,
6426 {
6427 self.update_mask = std::option::Option::Some(v.into());
6428 self
6429 }
6430
6431 /// Sets or clears the value of [update_mask][crate::model::UpdateSettingsRequest::update_mask].
6432 ///
6433 /// # Example
6434 /// ```ignore,no_run
6435 /// # use google_cloud_logging_v2::model::UpdateSettingsRequest;
6436 /// use wkt::FieldMask;
6437 /// let x = UpdateSettingsRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
6438 /// let x = UpdateSettingsRequest::new().set_or_clear_update_mask(None::<FieldMask>);
6439 /// ```
6440 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6441 where
6442 T: std::convert::Into<wkt::FieldMask>,
6443 {
6444 self.update_mask = v.map(|x| x.into());
6445 self
6446 }
6447}
6448
6449impl wkt::message::Message for UpdateSettingsRequest {
6450 fn typename() -> &'static str {
6451 "type.googleapis.com/google.logging.v2.UpdateSettingsRequest"
6452 }
6453}
6454
6455/// Describes the settings associated with a project, folder, organization,
6456/// billing account, or flexible resource.
6457#[derive(Clone, Default, PartialEq)]
6458#[non_exhaustive]
6459pub struct Settings {
6460 /// Output only. The resource name of the settings.
6461 pub name: std::string::String,
6462
6463 /// Optional. The resource name for the configured Cloud KMS key.
6464 ///
6465 /// KMS key name format:
6466 ///
6467 /// ```norust
6468 /// "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]"
6469 /// ```
6470 ///
6471 /// For example:
6472 ///
6473 /// `"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"`
6474 ///
6475 /// To enable CMEK for the Log Router, set this field to a valid
6476 /// `kms_key_name` for which the associated service account has the required
6477 /// `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key.
6478 ///
6479 /// The Cloud KMS key used by the Log Router can be updated by changing the
6480 /// `kms_key_name` to a new valid key name. Encryption operations that are in
6481 /// progress will be completed with the key that was in use when they started.
6482 /// Decryption operations will be completed using the key that was used at the
6483 /// time of encryption unless access to that key has been revoked.
6484 ///
6485 /// To disable CMEK for the Log Router, set this field to an empty string.
6486 ///
6487 /// See [Enabling CMEK for Log
6488 /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
6489 /// for more information.
6490 pub kms_key_name: std::string::String,
6491
6492 /// Output only. The service account that will be used by the Log Router to
6493 /// access your Cloud KMS key.
6494 ///
6495 /// Before enabling CMEK for Log Router, you must first assign the role
6496 /// `roles/cloudkms.cryptoKeyEncrypterDecrypter` to the service account that
6497 /// the Log Router will use to access your Cloud KMS key. Use
6498 /// [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings] to
6499 /// obtain the service account ID.
6500 ///
6501 /// See [Enabling CMEK for Log
6502 /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
6503 /// for more information.
6504 ///
6505 /// [google.logging.v2.ConfigServiceV2.GetSettings]: crate::client::ConfigServiceV2::get_settings
6506 pub kms_service_account_id: std::string::String,
6507
6508 /// Optional. The Cloud region that will be used for _Default and _Required log
6509 /// buckets for newly created projects and folders. For example `europe-west1`.
6510 /// This setting does not affect the location of custom log buckets.
6511 pub storage_location: std::string::String,
6512
6513 /// Optional. If set to true, the _Default sink in newly created projects and
6514 /// folders will created in a disabled state. This can be used to automatically
6515 /// disable log ingestion if there is already an aggregated sink configured in
6516 /// the hierarchy. The _Default sink can be re-enabled manually if needed.
6517 pub disable_default_sink: bool,
6518
6519 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6520}
6521
6522impl Settings {
6523 pub fn new() -> Self {
6524 std::default::Default::default()
6525 }
6526
6527 /// Sets the value of [name][crate::model::Settings::name].
6528 ///
6529 /// # Example
6530 /// ```ignore,no_run
6531 /// # use google_cloud_logging_v2::model::Settings;
6532 /// let x = Settings::new().set_name("example");
6533 /// ```
6534 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6535 self.name = v.into();
6536 self
6537 }
6538
6539 /// Sets the value of [kms_key_name][crate::model::Settings::kms_key_name].
6540 ///
6541 /// # Example
6542 /// ```ignore,no_run
6543 /// # use google_cloud_logging_v2::model::Settings;
6544 /// let x = Settings::new().set_kms_key_name("example");
6545 /// ```
6546 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6547 self.kms_key_name = v.into();
6548 self
6549 }
6550
6551 /// Sets the value of [kms_service_account_id][crate::model::Settings::kms_service_account_id].
6552 ///
6553 /// # Example
6554 /// ```ignore,no_run
6555 /// # use google_cloud_logging_v2::model::Settings;
6556 /// let x = Settings::new().set_kms_service_account_id("example");
6557 /// ```
6558 pub fn set_kms_service_account_id<T: std::convert::Into<std::string::String>>(
6559 mut self,
6560 v: T,
6561 ) -> Self {
6562 self.kms_service_account_id = v.into();
6563 self
6564 }
6565
6566 /// Sets the value of [storage_location][crate::model::Settings::storage_location].
6567 ///
6568 /// # Example
6569 /// ```ignore,no_run
6570 /// # use google_cloud_logging_v2::model::Settings;
6571 /// let x = Settings::new().set_storage_location("example");
6572 /// ```
6573 pub fn set_storage_location<T: std::convert::Into<std::string::String>>(
6574 mut self,
6575 v: T,
6576 ) -> Self {
6577 self.storage_location = v.into();
6578 self
6579 }
6580
6581 /// Sets the value of [disable_default_sink][crate::model::Settings::disable_default_sink].
6582 ///
6583 /// # Example
6584 /// ```ignore,no_run
6585 /// # use google_cloud_logging_v2::model::Settings;
6586 /// let x = Settings::new().set_disable_default_sink(true);
6587 /// ```
6588 pub fn set_disable_default_sink<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6589 self.disable_default_sink = v.into();
6590 self
6591 }
6592}
6593
6594impl wkt::message::Message for Settings {
6595 fn typename() -> &'static str {
6596 "type.googleapis.com/google.logging.v2.Settings"
6597 }
6598}
6599
6600/// The parameters to CopyLogEntries.
6601#[derive(Clone, Default, PartialEq)]
6602#[non_exhaustive]
6603pub struct CopyLogEntriesRequest {
6604 /// Required. Log bucket from which to copy log entries.
6605 ///
6606 /// For example:
6607 ///
6608 /// `"projects/my-project/locations/global/buckets/my-source-bucket"`
6609 pub name: std::string::String,
6610
6611 /// Optional. A filter specifying which log entries to copy. The filter must be
6612 /// no more than 20k characters. An empty filter matches all log entries.
6613 pub filter: std::string::String,
6614
6615 /// Required. Destination to which to copy log entries.
6616 pub destination: std::string::String,
6617
6618 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6619}
6620
6621impl CopyLogEntriesRequest {
6622 pub fn new() -> Self {
6623 std::default::Default::default()
6624 }
6625
6626 /// Sets the value of [name][crate::model::CopyLogEntriesRequest::name].
6627 ///
6628 /// # Example
6629 /// ```ignore,no_run
6630 /// # use google_cloud_logging_v2::model::CopyLogEntriesRequest;
6631 /// let x = CopyLogEntriesRequest::new().set_name("example");
6632 /// ```
6633 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6634 self.name = v.into();
6635 self
6636 }
6637
6638 /// Sets the value of [filter][crate::model::CopyLogEntriesRequest::filter].
6639 ///
6640 /// # Example
6641 /// ```ignore,no_run
6642 /// # use google_cloud_logging_v2::model::CopyLogEntriesRequest;
6643 /// let x = CopyLogEntriesRequest::new().set_filter("example");
6644 /// ```
6645 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6646 self.filter = v.into();
6647 self
6648 }
6649
6650 /// Sets the value of [destination][crate::model::CopyLogEntriesRequest::destination].
6651 ///
6652 /// # Example
6653 /// ```ignore,no_run
6654 /// # use google_cloud_logging_v2::model::CopyLogEntriesRequest;
6655 /// let x = CopyLogEntriesRequest::new().set_destination("example");
6656 /// ```
6657 pub fn set_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6658 self.destination = v.into();
6659 self
6660 }
6661}
6662
6663impl wkt::message::Message for CopyLogEntriesRequest {
6664 fn typename() -> &'static str {
6665 "type.googleapis.com/google.logging.v2.CopyLogEntriesRequest"
6666 }
6667}
6668
6669/// Metadata for CopyLogEntries long running operations.
6670#[derive(Clone, Default, PartialEq)]
6671#[non_exhaustive]
6672pub struct CopyLogEntriesMetadata {
6673 /// The create time of an operation.
6674 pub start_time: std::option::Option<wkt::Timestamp>,
6675
6676 /// The end time of an operation.
6677 pub end_time: std::option::Option<wkt::Timestamp>,
6678
6679 /// State of an operation.
6680 pub state: crate::model::OperationState,
6681
6682 /// Identifies whether the user has requested cancellation of the operation.
6683 pub cancellation_requested: bool,
6684
6685 /// CopyLogEntries RPC request.
6686 pub request: std::option::Option<crate::model::CopyLogEntriesRequest>,
6687
6688 /// Estimated progress of the operation (0 - 100%).
6689 pub progress: i32,
6690
6691 /// The IAM identity of a service account that must be granted access to the
6692 /// destination.
6693 ///
6694 /// If the service account is not granted permission to the destination within
6695 /// an hour, the operation will be cancelled.
6696 ///
6697 /// For example: `"serviceAccount:foo@bar.com"`
6698 pub writer_identity: std::string::String,
6699
6700 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6701}
6702
6703impl CopyLogEntriesMetadata {
6704 pub fn new() -> Self {
6705 std::default::Default::default()
6706 }
6707
6708 /// Sets the value of [start_time][crate::model::CopyLogEntriesMetadata::start_time].
6709 ///
6710 /// # Example
6711 /// ```ignore,no_run
6712 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6713 /// use wkt::Timestamp;
6714 /// let x = CopyLogEntriesMetadata::new().set_start_time(Timestamp::default()/* use setters */);
6715 /// ```
6716 pub fn set_start_time<T>(mut self, v: T) -> Self
6717 where
6718 T: std::convert::Into<wkt::Timestamp>,
6719 {
6720 self.start_time = std::option::Option::Some(v.into());
6721 self
6722 }
6723
6724 /// Sets or clears the value of [start_time][crate::model::CopyLogEntriesMetadata::start_time].
6725 ///
6726 /// # Example
6727 /// ```ignore,no_run
6728 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6729 /// use wkt::Timestamp;
6730 /// let x = CopyLogEntriesMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
6731 /// let x = CopyLogEntriesMetadata::new().set_or_clear_start_time(None::<Timestamp>);
6732 /// ```
6733 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6734 where
6735 T: std::convert::Into<wkt::Timestamp>,
6736 {
6737 self.start_time = v.map(|x| x.into());
6738 self
6739 }
6740
6741 /// Sets the value of [end_time][crate::model::CopyLogEntriesMetadata::end_time].
6742 ///
6743 /// # Example
6744 /// ```ignore,no_run
6745 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6746 /// use wkt::Timestamp;
6747 /// let x = CopyLogEntriesMetadata::new().set_end_time(Timestamp::default()/* use setters */);
6748 /// ```
6749 pub fn set_end_time<T>(mut self, v: T) -> Self
6750 where
6751 T: std::convert::Into<wkt::Timestamp>,
6752 {
6753 self.end_time = std::option::Option::Some(v.into());
6754 self
6755 }
6756
6757 /// Sets or clears the value of [end_time][crate::model::CopyLogEntriesMetadata::end_time].
6758 ///
6759 /// # Example
6760 /// ```ignore,no_run
6761 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6762 /// use wkt::Timestamp;
6763 /// let x = CopyLogEntriesMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
6764 /// let x = CopyLogEntriesMetadata::new().set_or_clear_end_time(None::<Timestamp>);
6765 /// ```
6766 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
6767 where
6768 T: std::convert::Into<wkt::Timestamp>,
6769 {
6770 self.end_time = v.map(|x| x.into());
6771 self
6772 }
6773
6774 /// Sets the value of [state][crate::model::CopyLogEntriesMetadata::state].
6775 ///
6776 /// # Example
6777 /// ```ignore,no_run
6778 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6779 /// use google_cloud_logging_v2::model::OperationState;
6780 /// let x0 = CopyLogEntriesMetadata::new().set_state(OperationState::Scheduled);
6781 /// let x1 = CopyLogEntriesMetadata::new().set_state(OperationState::WaitingForPermissions);
6782 /// let x2 = CopyLogEntriesMetadata::new().set_state(OperationState::Running);
6783 /// ```
6784 pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
6785 self.state = v.into();
6786 self
6787 }
6788
6789 /// Sets the value of [cancellation_requested][crate::model::CopyLogEntriesMetadata::cancellation_requested].
6790 ///
6791 /// # Example
6792 /// ```ignore,no_run
6793 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6794 /// let x = CopyLogEntriesMetadata::new().set_cancellation_requested(true);
6795 /// ```
6796 pub fn set_cancellation_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6797 self.cancellation_requested = v.into();
6798 self
6799 }
6800
6801 /// Sets the value of [request][crate::model::CopyLogEntriesMetadata::request].
6802 ///
6803 /// # Example
6804 /// ```ignore,no_run
6805 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6806 /// use google_cloud_logging_v2::model::CopyLogEntriesRequest;
6807 /// let x = CopyLogEntriesMetadata::new().set_request(CopyLogEntriesRequest::default()/* use setters */);
6808 /// ```
6809 pub fn set_request<T>(mut self, v: T) -> Self
6810 where
6811 T: std::convert::Into<crate::model::CopyLogEntriesRequest>,
6812 {
6813 self.request = std::option::Option::Some(v.into());
6814 self
6815 }
6816
6817 /// Sets or clears the value of [request][crate::model::CopyLogEntriesMetadata::request].
6818 ///
6819 /// # Example
6820 /// ```ignore,no_run
6821 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6822 /// use google_cloud_logging_v2::model::CopyLogEntriesRequest;
6823 /// let x = CopyLogEntriesMetadata::new().set_or_clear_request(Some(CopyLogEntriesRequest::default()/* use setters */));
6824 /// let x = CopyLogEntriesMetadata::new().set_or_clear_request(None::<CopyLogEntriesRequest>);
6825 /// ```
6826 pub fn set_or_clear_request<T>(mut self, v: std::option::Option<T>) -> Self
6827 where
6828 T: std::convert::Into<crate::model::CopyLogEntriesRequest>,
6829 {
6830 self.request = v.map(|x| x.into());
6831 self
6832 }
6833
6834 /// Sets the value of [progress][crate::model::CopyLogEntriesMetadata::progress].
6835 ///
6836 /// # Example
6837 /// ```ignore,no_run
6838 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6839 /// let x = CopyLogEntriesMetadata::new().set_progress(42);
6840 /// ```
6841 pub fn set_progress<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6842 self.progress = v.into();
6843 self
6844 }
6845
6846 /// Sets the value of [writer_identity][crate::model::CopyLogEntriesMetadata::writer_identity].
6847 ///
6848 /// # Example
6849 /// ```ignore,no_run
6850 /// # use google_cloud_logging_v2::model::CopyLogEntriesMetadata;
6851 /// let x = CopyLogEntriesMetadata::new().set_writer_identity("example");
6852 /// ```
6853 pub fn set_writer_identity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6854 self.writer_identity = v.into();
6855 self
6856 }
6857}
6858
6859impl wkt::message::Message for CopyLogEntriesMetadata {
6860 fn typename() -> &'static str {
6861 "type.googleapis.com/google.logging.v2.CopyLogEntriesMetadata"
6862 }
6863}
6864
6865/// Response type for CopyLogEntries long running operations.
6866#[derive(Clone, Default, PartialEq)]
6867#[non_exhaustive]
6868pub struct CopyLogEntriesResponse {
6869 /// Number of log entries copied.
6870 pub log_entries_copied_count: i64,
6871
6872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6873}
6874
6875impl CopyLogEntriesResponse {
6876 pub fn new() -> Self {
6877 std::default::Default::default()
6878 }
6879
6880 /// Sets the value of [log_entries_copied_count][crate::model::CopyLogEntriesResponse::log_entries_copied_count].
6881 ///
6882 /// # Example
6883 /// ```ignore,no_run
6884 /// # use google_cloud_logging_v2::model::CopyLogEntriesResponse;
6885 /// let x = CopyLogEntriesResponse::new().set_log_entries_copied_count(42);
6886 /// ```
6887 pub fn set_log_entries_copied_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6888 self.log_entries_copied_count = v.into();
6889 self
6890 }
6891}
6892
6893impl wkt::message::Message for CopyLogEntriesResponse {
6894 fn typename() -> &'static str {
6895 "type.googleapis.com/google.logging.v2.CopyLogEntriesResponse"
6896 }
6897}
6898
6899/// Metadata for LongRunningUpdateBucket Operations.
6900#[derive(Clone, Default, PartialEq)]
6901#[non_exhaustive]
6902pub struct BucketMetadata {
6903 /// The create time of an operation.
6904 pub start_time: std::option::Option<wkt::Timestamp>,
6905
6906 /// The end time of an operation.
6907 pub end_time: std::option::Option<wkt::Timestamp>,
6908
6909 /// State of an operation.
6910 pub state: crate::model::OperationState,
6911
6912 pub request: std::option::Option<crate::model::bucket_metadata::Request>,
6913
6914 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6915}
6916
6917impl BucketMetadata {
6918 pub fn new() -> Self {
6919 std::default::Default::default()
6920 }
6921
6922 /// Sets the value of [start_time][crate::model::BucketMetadata::start_time].
6923 ///
6924 /// # Example
6925 /// ```ignore,no_run
6926 /// # use google_cloud_logging_v2::model::BucketMetadata;
6927 /// use wkt::Timestamp;
6928 /// let x = BucketMetadata::new().set_start_time(Timestamp::default()/* use setters */);
6929 /// ```
6930 pub fn set_start_time<T>(mut self, v: T) -> Self
6931 where
6932 T: std::convert::Into<wkt::Timestamp>,
6933 {
6934 self.start_time = std::option::Option::Some(v.into());
6935 self
6936 }
6937
6938 /// Sets or clears the value of [start_time][crate::model::BucketMetadata::start_time].
6939 ///
6940 /// # Example
6941 /// ```ignore,no_run
6942 /// # use google_cloud_logging_v2::model::BucketMetadata;
6943 /// use wkt::Timestamp;
6944 /// let x = BucketMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
6945 /// let x = BucketMetadata::new().set_or_clear_start_time(None::<Timestamp>);
6946 /// ```
6947 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6948 where
6949 T: std::convert::Into<wkt::Timestamp>,
6950 {
6951 self.start_time = v.map(|x| x.into());
6952 self
6953 }
6954
6955 /// Sets the value of [end_time][crate::model::BucketMetadata::end_time].
6956 ///
6957 /// # Example
6958 /// ```ignore,no_run
6959 /// # use google_cloud_logging_v2::model::BucketMetadata;
6960 /// use wkt::Timestamp;
6961 /// let x = BucketMetadata::new().set_end_time(Timestamp::default()/* use setters */);
6962 /// ```
6963 pub fn set_end_time<T>(mut self, v: T) -> Self
6964 where
6965 T: std::convert::Into<wkt::Timestamp>,
6966 {
6967 self.end_time = std::option::Option::Some(v.into());
6968 self
6969 }
6970
6971 /// Sets or clears the value of [end_time][crate::model::BucketMetadata::end_time].
6972 ///
6973 /// # Example
6974 /// ```ignore,no_run
6975 /// # use google_cloud_logging_v2::model::BucketMetadata;
6976 /// use wkt::Timestamp;
6977 /// let x = BucketMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
6978 /// let x = BucketMetadata::new().set_or_clear_end_time(None::<Timestamp>);
6979 /// ```
6980 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
6981 where
6982 T: std::convert::Into<wkt::Timestamp>,
6983 {
6984 self.end_time = v.map(|x| x.into());
6985 self
6986 }
6987
6988 /// Sets the value of [state][crate::model::BucketMetadata::state].
6989 ///
6990 /// # Example
6991 /// ```ignore,no_run
6992 /// # use google_cloud_logging_v2::model::BucketMetadata;
6993 /// use google_cloud_logging_v2::model::OperationState;
6994 /// let x0 = BucketMetadata::new().set_state(OperationState::Scheduled);
6995 /// let x1 = BucketMetadata::new().set_state(OperationState::WaitingForPermissions);
6996 /// let x2 = BucketMetadata::new().set_state(OperationState::Running);
6997 /// ```
6998 pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
6999 self.state = v.into();
7000 self
7001 }
7002
7003 /// Sets the value of [request][crate::model::BucketMetadata::request].
7004 ///
7005 /// Note that all the setters affecting `request` are mutually
7006 /// exclusive.
7007 ///
7008 /// # Example
7009 /// ```ignore,no_run
7010 /// # use google_cloud_logging_v2::model::BucketMetadata;
7011 /// use google_cloud_logging_v2::model::CreateBucketRequest;
7012 /// let x = BucketMetadata::new().set_request(Some(
7013 /// google_cloud_logging_v2::model::bucket_metadata::Request::CreateBucketRequest(CreateBucketRequest::default().into())));
7014 /// ```
7015 pub fn set_request<
7016 T: std::convert::Into<std::option::Option<crate::model::bucket_metadata::Request>>,
7017 >(
7018 mut self,
7019 v: T,
7020 ) -> Self {
7021 self.request = v.into();
7022 self
7023 }
7024
7025 /// The value of [request][crate::model::BucketMetadata::request]
7026 /// if it holds a `CreateBucketRequest`, `None` if the field is not set or
7027 /// holds a different branch.
7028 pub fn create_bucket_request(
7029 &self,
7030 ) -> std::option::Option<&std::boxed::Box<crate::model::CreateBucketRequest>> {
7031 #[allow(unreachable_patterns)]
7032 self.request.as_ref().and_then(|v| match v {
7033 crate::model::bucket_metadata::Request::CreateBucketRequest(v) => {
7034 std::option::Option::Some(v)
7035 }
7036 _ => std::option::Option::None,
7037 })
7038 }
7039
7040 /// Sets the value of [request][crate::model::BucketMetadata::request]
7041 /// to hold a `CreateBucketRequest`.
7042 ///
7043 /// Note that all the setters affecting `request` are
7044 /// mutually exclusive.
7045 ///
7046 /// # Example
7047 /// ```ignore,no_run
7048 /// # use google_cloud_logging_v2::model::BucketMetadata;
7049 /// use google_cloud_logging_v2::model::CreateBucketRequest;
7050 /// let x = BucketMetadata::new().set_create_bucket_request(CreateBucketRequest::default()/* use setters */);
7051 /// assert!(x.create_bucket_request().is_some());
7052 /// assert!(x.update_bucket_request().is_none());
7053 /// ```
7054 pub fn set_create_bucket_request<
7055 T: std::convert::Into<std::boxed::Box<crate::model::CreateBucketRequest>>,
7056 >(
7057 mut self,
7058 v: T,
7059 ) -> Self {
7060 self.request = std::option::Option::Some(
7061 crate::model::bucket_metadata::Request::CreateBucketRequest(v.into()),
7062 );
7063 self
7064 }
7065
7066 /// The value of [request][crate::model::BucketMetadata::request]
7067 /// if it holds a `UpdateBucketRequest`, `None` if the field is not set or
7068 /// holds a different branch.
7069 pub fn update_bucket_request(
7070 &self,
7071 ) -> std::option::Option<&std::boxed::Box<crate::model::UpdateBucketRequest>> {
7072 #[allow(unreachable_patterns)]
7073 self.request.as_ref().and_then(|v| match v {
7074 crate::model::bucket_metadata::Request::UpdateBucketRequest(v) => {
7075 std::option::Option::Some(v)
7076 }
7077 _ => std::option::Option::None,
7078 })
7079 }
7080
7081 /// Sets the value of [request][crate::model::BucketMetadata::request]
7082 /// to hold a `UpdateBucketRequest`.
7083 ///
7084 /// Note that all the setters affecting `request` are
7085 /// mutually exclusive.
7086 ///
7087 /// # Example
7088 /// ```ignore,no_run
7089 /// # use google_cloud_logging_v2::model::BucketMetadata;
7090 /// use google_cloud_logging_v2::model::UpdateBucketRequest;
7091 /// let x = BucketMetadata::new().set_update_bucket_request(UpdateBucketRequest::default()/* use setters */);
7092 /// assert!(x.update_bucket_request().is_some());
7093 /// assert!(x.create_bucket_request().is_none());
7094 /// ```
7095 pub fn set_update_bucket_request<
7096 T: std::convert::Into<std::boxed::Box<crate::model::UpdateBucketRequest>>,
7097 >(
7098 mut self,
7099 v: T,
7100 ) -> Self {
7101 self.request = std::option::Option::Some(
7102 crate::model::bucket_metadata::Request::UpdateBucketRequest(v.into()),
7103 );
7104 self
7105 }
7106}
7107
7108impl wkt::message::Message for BucketMetadata {
7109 fn typename() -> &'static str {
7110 "type.googleapis.com/google.logging.v2.BucketMetadata"
7111 }
7112}
7113
7114/// Defines additional types related to [BucketMetadata].
7115pub mod bucket_metadata {
7116 #[allow(unused_imports)]
7117 use super::*;
7118
7119 #[derive(Clone, Debug, PartialEq)]
7120 #[non_exhaustive]
7121 pub enum Request {
7122 /// LongRunningCreateBucket RPC request.
7123 CreateBucketRequest(std::boxed::Box<crate::model::CreateBucketRequest>),
7124 /// LongRunningUpdateBucket RPC request.
7125 UpdateBucketRequest(std::boxed::Box<crate::model::UpdateBucketRequest>),
7126 }
7127}
7128
7129/// Metadata for long running Link operations.
7130#[derive(Clone, Default, PartialEq)]
7131#[non_exhaustive]
7132pub struct LinkMetadata {
7133 /// The start time of an operation.
7134 pub start_time: std::option::Option<wkt::Timestamp>,
7135
7136 /// The end time of an operation.
7137 pub end_time: std::option::Option<wkt::Timestamp>,
7138
7139 /// State of an operation.
7140 pub state: crate::model::OperationState,
7141
7142 pub request: std::option::Option<crate::model::link_metadata::Request>,
7143
7144 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7145}
7146
7147impl LinkMetadata {
7148 pub fn new() -> Self {
7149 std::default::Default::default()
7150 }
7151
7152 /// Sets the value of [start_time][crate::model::LinkMetadata::start_time].
7153 ///
7154 /// # Example
7155 /// ```ignore,no_run
7156 /// # use google_cloud_logging_v2::model::LinkMetadata;
7157 /// use wkt::Timestamp;
7158 /// let x = LinkMetadata::new().set_start_time(Timestamp::default()/* use setters */);
7159 /// ```
7160 pub fn set_start_time<T>(mut self, v: T) -> Self
7161 where
7162 T: std::convert::Into<wkt::Timestamp>,
7163 {
7164 self.start_time = std::option::Option::Some(v.into());
7165 self
7166 }
7167
7168 /// Sets or clears the value of [start_time][crate::model::LinkMetadata::start_time].
7169 ///
7170 /// # Example
7171 /// ```ignore,no_run
7172 /// # use google_cloud_logging_v2::model::LinkMetadata;
7173 /// use wkt::Timestamp;
7174 /// let x = LinkMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
7175 /// let x = LinkMetadata::new().set_or_clear_start_time(None::<Timestamp>);
7176 /// ```
7177 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
7178 where
7179 T: std::convert::Into<wkt::Timestamp>,
7180 {
7181 self.start_time = v.map(|x| x.into());
7182 self
7183 }
7184
7185 /// Sets the value of [end_time][crate::model::LinkMetadata::end_time].
7186 ///
7187 /// # Example
7188 /// ```ignore,no_run
7189 /// # use google_cloud_logging_v2::model::LinkMetadata;
7190 /// use wkt::Timestamp;
7191 /// let x = LinkMetadata::new().set_end_time(Timestamp::default()/* use setters */);
7192 /// ```
7193 pub fn set_end_time<T>(mut self, v: T) -> Self
7194 where
7195 T: std::convert::Into<wkt::Timestamp>,
7196 {
7197 self.end_time = std::option::Option::Some(v.into());
7198 self
7199 }
7200
7201 /// Sets or clears the value of [end_time][crate::model::LinkMetadata::end_time].
7202 ///
7203 /// # Example
7204 /// ```ignore,no_run
7205 /// # use google_cloud_logging_v2::model::LinkMetadata;
7206 /// use wkt::Timestamp;
7207 /// let x = LinkMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
7208 /// let x = LinkMetadata::new().set_or_clear_end_time(None::<Timestamp>);
7209 /// ```
7210 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
7211 where
7212 T: std::convert::Into<wkt::Timestamp>,
7213 {
7214 self.end_time = v.map(|x| x.into());
7215 self
7216 }
7217
7218 /// Sets the value of [state][crate::model::LinkMetadata::state].
7219 ///
7220 /// # Example
7221 /// ```ignore,no_run
7222 /// # use google_cloud_logging_v2::model::LinkMetadata;
7223 /// use google_cloud_logging_v2::model::OperationState;
7224 /// let x0 = LinkMetadata::new().set_state(OperationState::Scheduled);
7225 /// let x1 = LinkMetadata::new().set_state(OperationState::WaitingForPermissions);
7226 /// let x2 = LinkMetadata::new().set_state(OperationState::Running);
7227 /// ```
7228 pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
7229 self.state = v.into();
7230 self
7231 }
7232
7233 /// Sets the value of [request][crate::model::LinkMetadata::request].
7234 ///
7235 /// Note that all the setters affecting `request` are mutually
7236 /// exclusive.
7237 ///
7238 /// # Example
7239 /// ```ignore,no_run
7240 /// # use google_cloud_logging_v2::model::LinkMetadata;
7241 /// use google_cloud_logging_v2::model::CreateLinkRequest;
7242 /// let x = LinkMetadata::new().set_request(Some(
7243 /// google_cloud_logging_v2::model::link_metadata::Request::CreateLinkRequest(CreateLinkRequest::default().into())));
7244 /// ```
7245 pub fn set_request<
7246 T: std::convert::Into<std::option::Option<crate::model::link_metadata::Request>>,
7247 >(
7248 mut self,
7249 v: T,
7250 ) -> Self {
7251 self.request = v.into();
7252 self
7253 }
7254
7255 /// The value of [request][crate::model::LinkMetadata::request]
7256 /// if it holds a `CreateLinkRequest`, `None` if the field is not set or
7257 /// holds a different branch.
7258 pub fn create_link_request(
7259 &self,
7260 ) -> std::option::Option<&std::boxed::Box<crate::model::CreateLinkRequest>> {
7261 #[allow(unreachable_patterns)]
7262 self.request.as_ref().and_then(|v| match v {
7263 crate::model::link_metadata::Request::CreateLinkRequest(v) => {
7264 std::option::Option::Some(v)
7265 }
7266 _ => std::option::Option::None,
7267 })
7268 }
7269
7270 /// Sets the value of [request][crate::model::LinkMetadata::request]
7271 /// to hold a `CreateLinkRequest`.
7272 ///
7273 /// Note that all the setters affecting `request` are
7274 /// mutually exclusive.
7275 ///
7276 /// # Example
7277 /// ```ignore,no_run
7278 /// # use google_cloud_logging_v2::model::LinkMetadata;
7279 /// use google_cloud_logging_v2::model::CreateLinkRequest;
7280 /// let x = LinkMetadata::new().set_create_link_request(CreateLinkRequest::default()/* use setters */);
7281 /// assert!(x.create_link_request().is_some());
7282 /// assert!(x.delete_link_request().is_none());
7283 /// ```
7284 pub fn set_create_link_request<
7285 T: std::convert::Into<std::boxed::Box<crate::model::CreateLinkRequest>>,
7286 >(
7287 mut self,
7288 v: T,
7289 ) -> Self {
7290 self.request = std::option::Option::Some(
7291 crate::model::link_metadata::Request::CreateLinkRequest(v.into()),
7292 );
7293 self
7294 }
7295
7296 /// The value of [request][crate::model::LinkMetadata::request]
7297 /// if it holds a `DeleteLinkRequest`, `None` if the field is not set or
7298 /// holds a different branch.
7299 pub fn delete_link_request(
7300 &self,
7301 ) -> std::option::Option<&std::boxed::Box<crate::model::DeleteLinkRequest>> {
7302 #[allow(unreachable_patterns)]
7303 self.request.as_ref().and_then(|v| match v {
7304 crate::model::link_metadata::Request::DeleteLinkRequest(v) => {
7305 std::option::Option::Some(v)
7306 }
7307 _ => std::option::Option::None,
7308 })
7309 }
7310
7311 /// Sets the value of [request][crate::model::LinkMetadata::request]
7312 /// to hold a `DeleteLinkRequest`.
7313 ///
7314 /// Note that all the setters affecting `request` are
7315 /// mutually exclusive.
7316 ///
7317 /// # Example
7318 /// ```ignore,no_run
7319 /// # use google_cloud_logging_v2::model::LinkMetadata;
7320 /// use google_cloud_logging_v2::model::DeleteLinkRequest;
7321 /// let x = LinkMetadata::new().set_delete_link_request(DeleteLinkRequest::default()/* use setters */);
7322 /// assert!(x.delete_link_request().is_some());
7323 /// assert!(x.create_link_request().is_none());
7324 /// ```
7325 pub fn set_delete_link_request<
7326 T: std::convert::Into<std::boxed::Box<crate::model::DeleteLinkRequest>>,
7327 >(
7328 mut self,
7329 v: T,
7330 ) -> Self {
7331 self.request = std::option::Option::Some(
7332 crate::model::link_metadata::Request::DeleteLinkRequest(v.into()),
7333 );
7334 self
7335 }
7336}
7337
7338impl wkt::message::Message for LinkMetadata {
7339 fn typename() -> &'static str {
7340 "type.googleapis.com/google.logging.v2.LinkMetadata"
7341 }
7342}
7343
7344/// Defines additional types related to [LinkMetadata].
7345pub mod link_metadata {
7346 #[allow(unused_imports)]
7347 use super::*;
7348
7349 #[derive(Clone, Debug, PartialEq)]
7350 #[non_exhaustive]
7351 pub enum Request {
7352 /// CreateLink RPC request.
7353 CreateLinkRequest(std::boxed::Box<crate::model::CreateLinkRequest>),
7354 /// DeleteLink RPC request.
7355 DeleteLinkRequest(std::boxed::Box<crate::model::DeleteLinkRequest>),
7356 }
7357}
7358
7359/// Cloud Logging specific location metadata.
7360#[derive(Clone, Default, PartialEq)]
7361#[non_exhaustive]
7362pub struct LocationMetadata {
7363 /// Indicates whether or not Log Analytics features are supported in the given
7364 /// location.
7365 pub log_analytics_enabled: bool,
7366
7367 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7368}
7369
7370impl LocationMetadata {
7371 pub fn new() -> Self {
7372 std::default::Default::default()
7373 }
7374
7375 /// Sets the value of [log_analytics_enabled][crate::model::LocationMetadata::log_analytics_enabled].
7376 ///
7377 /// # Example
7378 /// ```ignore,no_run
7379 /// # use google_cloud_logging_v2::model::LocationMetadata;
7380 /// let x = LocationMetadata::new().set_log_analytics_enabled(true);
7381 /// ```
7382 pub fn set_log_analytics_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7383 self.log_analytics_enabled = v.into();
7384 self
7385 }
7386}
7387
7388impl wkt::message::Message for LocationMetadata {
7389 fn typename() -> &'static str {
7390 "type.googleapis.com/google.logging.v2.LocationMetadata"
7391 }
7392}
7393
7394/// Describes a logs-based metric. The value of the metric is the number of log
7395/// entries that match a logs filter in a given time interval.
7396///
7397/// Logs-based metrics can also be used to extract values from logs and create a
7398/// distribution of the values. The distribution records the statistics of the
7399/// extracted values along with an optional histogram of the values as specified
7400/// by the bucket options.
7401#[derive(Clone, Default, PartialEq)]
7402#[non_exhaustive]
7403pub struct LogMetric {
7404 /// Required. The client-assigned metric identifier.
7405 /// Examples: `"error_count"`, `"nginx/requests"`.
7406 ///
7407 /// Metric identifiers are limited to 100 characters and can include only the
7408 /// following characters: `A-Z`, `a-z`, `0-9`, and the special characters
7409 /// `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
7410 /// name pieces, and it cannot be the first character of the name.
7411 ///
7412 /// This field is the `[METRIC_ID]` part of a metric resource name in the
7413 /// format "projects/[PROJECT_ID]/metrics/[METRIC_ID]". Example: If the
7414 /// resource name of a metric is
7415 /// `"projects/my-project/metrics/nginx%2Frequests"`, this field's value is
7416 /// `"nginx/requests"`.
7417 pub name: std::string::String,
7418
7419 /// Optional. A description of this metric, which is used in documentation.
7420 /// The maximum length of the description is 8000 characters.
7421 pub description: std::string::String,
7422
7423 /// Required. An [advanced logs
7424 /// filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
7425 /// is used to match log entries. Example:
7426 ///
7427 /// ```norust
7428 /// "resource.type=gae_app AND severity>=ERROR"
7429 /// ```
7430 ///
7431 /// The maximum length of the filter is 20000 characters.
7432 pub filter: std::string::String,
7433
7434 /// Optional. The resource name of the Log Bucket that owns the Log Metric.
7435 /// Only Log Buckets in projects are supported. The bucket has to be in the
7436 /// same project as the metric.
7437 ///
7438 /// For example:
7439 ///
7440 /// `projects/my-project/locations/global/buckets/my-bucket`
7441 ///
7442 /// If empty, then the Log Metric is considered a non-Bucket Log Metric.
7443 pub bucket_name: std::string::String,
7444
7445 /// Optional. If set to True, then this metric is disabled and it does not
7446 /// generate any points.
7447 pub disabled: bool,
7448
7449 /// Optional. The metric descriptor associated with the logs-based metric.
7450 /// If unspecified, it uses a default metric descriptor with a DELTA metric
7451 /// kind, INT64 value type, with no labels and a unit of "1". Such a metric
7452 /// counts the number of log entries matching the `filter` expression.
7453 ///
7454 /// The `name`, `type`, and `description` fields in the `metric_descriptor`
7455 /// are output only, and is constructed using the `name` and `description`
7456 /// field in the LogMetric.
7457 ///
7458 /// To create a logs-based metric that records a distribution of log values, a
7459 /// DELTA metric kind with a DISTRIBUTION value type must be used along with
7460 /// a `value_extractor` expression in the LogMetric.
7461 ///
7462 /// Each label in the metric descriptor must have a matching label
7463 /// name as the key and an extractor expression as the value in the
7464 /// `label_extractors` map.
7465 ///
7466 /// The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
7467 /// be updated once initially configured. New labels can be added in the
7468 /// `metric_descriptor`, but existing labels cannot be modified except for
7469 /// their description.
7470 pub metric_descriptor: std::option::Option<api::model::MetricDescriptor>,
7471
7472 /// Optional. A `value_extractor` is required when using a distribution
7473 /// logs-based metric to extract the values to record from a log entry.
7474 /// Two functions are supported for value extraction: `EXTRACT(field)` or
7475 /// `REGEXP_EXTRACT(field, regex)`. The arguments are:
7476 ///
7477 /// 1. field: The name of the log entry field from which the value is to be
7478 /// extracted.
7479 /// 1. regex: A regular expression using the Google RE2 syntax
7480 /// (<https://github.com/google/re2/wiki/Syntax>) with a single capture
7481 /// group to extract data from the specified log entry field. The value
7482 /// of the field is converted to a string before applying the regex.
7483 /// It is an error to specify a regex that does not include exactly one
7484 /// capture group.
7485 ///
7486 /// The result of the extraction must be convertible to a double type, as the
7487 /// distribution always records double values. If either the extraction or
7488 /// the conversion to double fails, then those values are not recorded in the
7489 /// distribution.
7490 ///
7491 /// Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")`
7492 pub value_extractor: std::string::String,
7493
7494 /// Optional. A map from a label key string to an extractor expression which is
7495 /// used to extract data from a log entry field and assign as the label value.
7496 /// Each label key specified in the LabelDescriptor must have an associated
7497 /// extractor expression in this map. The syntax of the extractor expression
7498 /// is the same as for the `value_extractor` field.
7499 ///
7500 /// The extracted value is converted to the type defined in the label
7501 /// descriptor. If either the extraction or the type conversion fails,
7502 /// the label will have a default value. The default value for a string
7503 /// label is an empty string, for an integer label its 0, and for a boolean
7504 /// label its `false`.
7505 ///
7506 /// Note that there are upper bounds on the maximum number of labels and the
7507 /// number of active time series that are allowed in a project.
7508 pub label_extractors: std::collections::HashMap<std::string::String, std::string::String>,
7509
7510 /// Optional. The `bucket_options` are required when the logs-based metric is
7511 /// using a DISTRIBUTION value type and it describes the bucket boundaries
7512 /// used to create a histogram of the extracted values.
7513 pub bucket_options: std::option::Option<api::model::distribution::BucketOptions>,
7514
7515 /// Output only. The creation timestamp of the metric.
7516 ///
7517 /// This field may not be present for older metrics.
7518 pub create_time: std::option::Option<wkt::Timestamp>,
7519
7520 /// Output only. The last update timestamp of the metric.
7521 ///
7522 /// This field may not be present for older metrics.
7523 pub update_time: std::option::Option<wkt::Timestamp>,
7524
7525 /// Deprecated. The API version that created or updated this metric.
7526 /// The v2 format is used by default and cannot be changed.
7527 #[deprecated]
7528 pub version: crate::model::log_metric::ApiVersion,
7529
7530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7531}
7532
7533impl LogMetric {
7534 pub fn new() -> Self {
7535 std::default::Default::default()
7536 }
7537
7538 /// Sets the value of [name][crate::model::LogMetric::name].
7539 ///
7540 /// # Example
7541 /// ```ignore,no_run
7542 /// # use google_cloud_logging_v2::model::LogMetric;
7543 /// let x = LogMetric::new().set_name("example");
7544 /// ```
7545 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7546 self.name = v.into();
7547 self
7548 }
7549
7550 /// Sets the value of [description][crate::model::LogMetric::description].
7551 ///
7552 /// # Example
7553 /// ```ignore,no_run
7554 /// # use google_cloud_logging_v2::model::LogMetric;
7555 /// let x = LogMetric::new().set_description("example");
7556 /// ```
7557 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7558 self.description = v.into();
7559 self
7560 }
7561
7562 /// Sets the value of [filter][crate::model::LogMetric::filter].
7563 ///
7564 /// # Example
7565 /// ```ignore,no_run
7566 /// # use google_cloud_logging_v2::model::LogMetric;
7567 /// let x = LogMetric::new().set_filter("example");
7568 /// ```
7569 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7570 self.filter = v.into();
7571 self
7572 }
7573
7574 /// Sets the value of [bucket_name][crate::model::LogMetric::bucket_name].
7575 ///
7576 /// # Example
7577 /// ```ignore,no_run
7578 /// # use google_cloud_logging_v2::model::LogMetric;
7579 /// let x = LogMetric::new().set_bucket_name("example");
7580 /// ```
7581 pub fn set_bucket_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7582 self.bucket_name = v.into();
7583 self
7584 }
7585
7586 /// Sets the value of [disabled][crate::model::LogMetric::disabled].
7587 ///
7588 /// # Example
7589 /// ```ignore,no_run
7590 /// # use google_cloud_logging_v2::model::LogMetric;
7591 /// let x = LogMetric::new().set_disabled(true);
7592 /// ```
7593 pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7594 self.disabled = v.into();
7595 self
7596 }
7597
7598 /// Sets the value of [metric_descriptor][crate::model::LogMetric::metric_descriptor].
7599 ///
7600 /// # Example
7601 /// ```ignore,no_run
7602 /// # use google_cloud_logging_v2::model::LogMetric;
7603 /// use api::model::MetricDescriptor;
7604 /// let x = LogMetric::new().set_metric_descriptor(MetricDescriptor::default()/* use setters */);
7605 /// ```
7606 pub fn set_metric_descriptor<T>(mut self, v: T) -> Self
7607 where
7608 T: std::convert::Into<api::model::MetricDescriptor>,
7609 {
7610 self.metric_descriptor = std::option::Option::Some(v.into());
7611 self
7612 }
7613
7614 /// Sets or clears the value of [metric_descriptor][crate::model::LogMetric::metric_descriptor].
7615 ///
7616 /// # Example
7617 /// ```ignore,no_run
7618 /// # use google_cloud_logging_v2::model::LogMetric;
7619 /// use api::model::MetricDescriptor;
7620 /// let x = LogMetric::new().set_or_clear_metric_descriptor(Some(MetricDescriptor::default()/* use setters */));
7621 /// let x = LogMetric::new().set_or_clear_metric_descriptor(None::<MetricDescriptor>);
7622 /// ```
7623 pub fn set_or_clear_metric_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
7624 where
7625 T: std::convert::Into<api::model::MetricDescriptor>,
7626 {
7627 self.metric_descriptor = v.map(|x| x.into());
7628 self
7629 }
7630
7631 /// Sets the value of [value_extractor][crate::model::LogMetric::value_extractor].
7632 ///
7633 /// # Example
7634 /// ```ignore,no_run
7635 /// # use google_cloud_logging_v2::model::LogMetric;
7636 /// let x = LogMetric::new().set_value_extractor("example");
7637 /// ```
7638 pub fn set_value_extractor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7639 self.value_extractor = v.into();
7640 self
7641 }
7642
7643 /// Sets the value of [label_extractors][crate::model::LogMetric::label_extractors].
7644 ///
7645 /// # Example
7646 /// ```ignore,no_run
7647 /// # use google_cloud_logging_v2::model::LogMetric;
7648 /// let x = LogMetric::new().set_label_extractors([
7649 /// ("key0", "abc"),
7650 /// ("key1", "xyz"),
7651 /// ]);
7652 /// ```
7653 pub fn set_label_extractors<T, K, V>(mut self, v: T) -> Self
7654 where
7655 T: std::iter::IntoIterator<Item = (K, V)>,
7656 K: std::convert::Into<std::string::String>,
7657 V: std::convert::Into<std::string::String>,
7658 {
7659 use std::iter::Iterator;
7660 self.label_extractors = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7661 self
7662 }
7663
7664 /// Sets the value of [bucket_options][crate::model::LogMetric::bucket_options].
7665 ///
7666 /// # Example
7667 /// ```ignore,no_run
7668 /// # use google_cloud_logging_v2::model::LogMetric;
7669 /// use api::model::distribution::BucketOptions;
7670 /// let x = LogMetric::new().set_bucket_options(BucketOptions::default()/* use setters */);
7671 /// ```
7672 pub fn set_bucket_options<T>(mut self, v: T) -> Self
7673 where
7674 T: std::convert::Into<api::model::distribution::BucketOptions>,
7675 {
7676 self.bucket_options = std::option::Option::Some(v.into());
7677 self
7678 }
7679
7680 /// Sets or clears the value of [bucket_options][crate::model::LogMetric::bucket_options].
7681 ///
7682 /// # Example
7683 /// ```ignore,no_run
7684 /// # use google_cloud_logging_v2::model::LogMetric;
7685 /// use api::model::distribution::BucketOptions;
7686 /// let x = LogMetric::new().set_or_clear_bucket_options(Some(BucketOptions::default()/* use setters */));
7687 /// let x = LogMetric::new().set_or_clear_bucket_options(None::<BucketOptions>);
7688 /// ```
7689 pub fn set_or_clear_bucket_options<T>(mut self, v: std::option::Option<T>) -> Self
7690 where
7691 T: std::convert::Into<api::model::distribution::BucketOptions>,
7692 {
7693 self.bucket_options = v.map(|x| x.into());
7694 self
7695 }
7696
7697 /// Sets the value of [create_time][crate::model::LogMetric::create_time].
7698 ///
7699 /// # Example
7700 /// ```ignore,no_run
7701 /// # use google_cloud_logging_v2::model::LogMetric;
7702 /// use wkt::Timestamp;
7703 /// let x = LogMetric::new().set_create_time(Timestamp::default()/* use setters */);
7704 /// ```
7705 pub fn set_create_time<T>(mut self, v: T) -> Self
7706 where
7707 T: std::convert::Into<wkt::Timestamp>,
7708 {
7709 self.create_time = std::option::Option::Some(v.into());
7710 self
7711 }
7712
7713 /// Sets or clears the value of [create_time][crate::model::LogMetric::create_time].
7714 ///
7715 /// # Example
7716 /// ```ignore,no_run
7717 /// # use google_cloud_logging_v2::model::LogMetric;
7718 /// use wkt::Timestamp;
7719 /// let x = LogMetric::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7720 /// let x = LogMetric::new().set_or_clear_create_time(None::<Timestamp>);
7721 /// ```
7722 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7723 where
7724 T: std::convert::Into<wkt::Timestamp>,
7725 {
7726 self.create_time = v.map(|x| x.into());
7727 self
7728 }
7729
7730 /// Sets the value of [update_time][crate::model::LogMetric::update_time].
7731 ///
7732 /// # Example
7733 /// ```ignore,no_run
7734 /// # use google_cloud_logging_v2::model::LogMetric;
7735 /// use wkt::Timestamp;
7736 /// let x = LogMetric::new().set_update_time(Timestamp::default()/* use setters */);
7737 /// ```
7738 pub fn set_update_time<T>(mut self, v: T) -> Self
7739 where
7740 T: std::convert::Into<wkt::Timestamp>,
7741 {
7742 self.update_time = std::option::Option::Some(v.into());
7743 self
7744 }
7745
7746 /// Sets or clears the value of [update_time][crate::model::LogMetric::update_time].
7747 ///
7748 /// # Example
7749 /// ```ignore,no_run
7750 /// # use google_cloud_logging_v2::model::LogMetric;
7751 /// use wkt::Timestamp;
7752 /// let x = LogMetric::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
7753 /// let x = LogMetric::new().set_or_clear_update_time(None::<Timestamp>);
7754 /// ```
7755 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7756 where
7757 T: std::convert::Into<wkt::Timestamp>,
7758 {
7759 self.update_time = v.map(|x| x.into());
7760 self
7761 }
7762
7763 /// Sets the value of [version][crate::model::LogMetric::version].
7764 ///
7765 /// # Example
7766 /// ```ignore,no_run
7767 /// # use google_cloud_logging_v2::model::LogMetric;
7768 /// use google_cloud_logging_v2::model::log_metric::ApiVersion;
7769 /// let x0 = LogMetric::new().set_version(ApiVersion::V1);
7770 /// ```
7771 #[deprecated]
7772 pub fn set_version<T: std::convert::Into<crate::model::log_metric::ApiVersion>>(
7773 mut self,
7774 v: T,
7775 ) -> Self {
7776 self.version = v.into();
7777 self
7778 }
7779}
7780
7781impl wkt::message::Message for LogMetric {
7782 fn typename() -> &'static str {
7783 "type.googleapis.com/google.logging.v2.LogMetric"
7784 }
7785}
7786
7787/// Defines additional types related to [LogMetric].
7788pub mod log_metric {
7789 #[allow(unused_imports)]
7790 use super::*;
7791
7792 /// Logging API version.
7793 ///
7794 /// # Working with unknown values
7795 ///
7796 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7797 /// additional enum variants at any time. Adding new variants is not considered
7798 /// a breaking change. Applications should write their code in anticipation of:
7799 ///
7800 /// - New values appearing in future releases of the client library, **and**
7801 /// - New values received dynamically, without application changes.
7802 ///
7803 /// Please consult the [Working with enums] section in the user guide for some
7804 /// guidelines.
7805 ///
7806 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7807 #[derive(Clone, Debug, PartialEq)]
7808 #[non_exhaustive]
7809 pub enum ApiVersion {
7810 /// Logging API v2.
7811 V2,
7812 /// Logging API v1.
7813 V1,
7814 /// If set, the enum was initialized with an unknown value.
7815 ///
7816 /// Applications can examine the value using [ApiVersion::value] or
7817 /// [ApiVersion::name].
7818 UnknownValue(api_version::UnknownValue),
7819 }
7820
7821 #[doc(hidden)]
7822 pub mod api_version {
7823 #[allow(unused_imports)]
7824 use super::*;
7825 #[derive(Clone, Debug, PartialEq)]
7826 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7827 }
7828
7829 impl ApiVersion {
7830 /// Gets the enum value.
7831 ///
7832 /// Returns `None` if the enum contains an unknown value deserialized from
7833 /// the string representation of enums.
7834 pub fn value(&self) -> std::option::Option<i32> {
7835 match self {
7836 Self::V2 => std::option::Option::Some(0),
7837 Self::V1 => std::option::Option::Some(1),
7838 Self::UnknownValue(u) => u.0.value(),
7839 }
7840 }
7841
7842 /// Gets the enum value as a string.
7843 ///
7844 /// Returns `None` if the enum contains an unknown value deserialized from
7845 /// the integer representation of enums.
7846 pub fn name(&self) -> std::option::Option<&str> {
7847 match self {
7848 Self::V2 => std::option::Option::Some("V2"),
7849 Self::V1 => std::option::Option::Some("V1"),
7850 Self::UnknownValue(u) => u.0.name(),
7851 }
7852 }
7853 }
7854
7855 impl std::default::Default for ApiVersion {
7856 fn default() -> Self {
7857 use std::convert::From;
7858 Self::from(0)
7859 }
7860 }
7861
7862 impl std::fmt::Display for ApiVersion {
7863 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7864 wkt::internal::display_enum(f, self.name(), self.value())
7865 }
7866 }
7867
7868 impl std::convert::From<i32> for ApiVersion {
7869 fn from(value: i32) -> Self {
7870 match value {
7871 0 => Self::V2,
7872 1 => Self::V1,
7873 _ => Self::UnknownValue(api_version::UnknownValue(
7874 wkt::internal::UnknownEnumValue::Integer(value),
7875 )),
7876 }
7877 }
7878 }
7879
7880 impl std::convert::From<&str> for ApiVersion {
7881 fn from(value: &str) -> Self {
7882 use std::string::ToString;
7883 match value {
7884 "V2" => Self::V2,
7885 "V1" => Self::V1,
7886 _ => Self::UnknownValue(api_version::UnknownValue(
7887 wkt::internal::UnknownEnumValue::String(value.to_string()),
7888 )),
7889 }
7890 }
7891 }
7892
7893 impl serde::ser::Serialize for ApiVersion {
7894 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7895 where
7896 S: serde::Serializer,
7897 {
7898 match self {
7899 Self::V2 => serializer.serialize_i32(0),
7900 Self::V1 => serializer.serialize_i32(1),
7901 Self::UnknownValue(u) => u.0.serialize(serializer),
7902 }
7903 }
7904 }
7905
7906 impl<'de> serde::de::Deserialize<'de> for ApiVersion {
7907 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7908 where
7909 D: serde::Deserializer<'de>,
7910 {
7911 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ApiVersion>::new(
7912 ".google.logging.v2.LogMetric.ApiVersion",
7913 ))
7914 }
7915 }
7916}
7917
7918/// The parameters to ListLogMetrics.
7919#[derive(Clone, Default, PartialEq)]
7920#[non_exhaustive]
7921pub struct ListLogMetricsRequest {
7922 /// Required. The name of the project containing the metrics:
7923 ///
7924 /// ```norust
7925 /// "projects/[PROJECT_ID]"
7926 /// ```
7927 pub parent: std::string::String,
7928
7929 /// Optional. If present, then retrieve the next batch of results from the
7930 /// preceding call to this method. `pageToken` must be the value of
7931 /// `nextPageToken` from the previous response. The values of other method
7932 /// parameters should be identical to those in the previous call.
7933 pub page_token: std::string::String,
7934
7935 /// Optional. The maximum number of results to return from this request.
7936 /// Non-positive values are ignored. The presence of `nextPageToken` in the
7937 /// response indicates that more results might be available.
7938 pub page_size: i32,
7939
7940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7941}
7942
7943impl ListLogMetricsRequest {
7944 pub fn new() -> Self {
7945 std::default::Default::default()
7946 }
7947
7948 /// Sets the value of [parent][crate::model::ListLogMetricsRequest::parent].
7949 ///
7950 /// # Example
7951 /// ```ignore,no_run
7952 /// # use google_cloud_logging_v2::model::ListLogMetricsRequest;
7953 /// let x = ListLogMetricsRequest::new().set_parent("example");
7954 /// ```
7955 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7956 self.parent = v.into();
7957 self
7958 }
7959
7960 /// Sets the value of [page_token][crate::model::ListLogMetricsRequest::page_token].
7961 ///
7962 /// # Example
7963 /// ```ignore,no_run
7964 /// # use google_cloud_logging_v2::model::ListLogMetricsRequest;
7965 /// let x = ListLogMetricsRequest::new().set_page_token("example");
7966 /// ```
7967 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7968 self.page_token = v.into();
7969 self
7970 }
7971
7972 /// Sets the value of [page_size][crate::model::ListLogMetricsRequest::page_size].
7973 ///
7974 /// # Example
7975 /// ```ignore,no_run
7976 /// # use google_cloud_logging_v2::model::ListLogMetricsRequest;
7977 /// let x = ListLogMetricsRequest::new().set_page_size(42);
7978 /// ```
7979 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7980 self.page_size = v.into();
7981 self
7982 }
7983}
7984
7985impl wkt::message::Message for ListLogMetricsRequest {
7986 fn typename() -> &'static str {
7987 "type.googleapis.com/google.logging.v2.ListLogMetricsRequest"
7988 }
7989}
7990
7991/// Result returned from ListLogMetrics.
7992#[derive(Clone, Default, PartialEq)]
7993#[non_exhaustive]
7994pub struct ListLogMetricsResponse {
7995 /// A list of logs-based metrics.
7996 pub metrics: std::vec::Vec<crate::model::LogMetric>,
7997
7998 /// If there might be more results than appear in this response, then
7999 /// `nextPageToken` is included. To get the next set of results, call this
8000 /// method again using the value of `nextPageToken` as `pageToken`.
8001 pub next_page_token: std::string::String,
8002
8003 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8004}
8005
8006impl ListLogMetricsResponse {
8007 pub fn new() -> Self {
8008 std::default::Default::default()
8009 }
8010
8011 /// Sets the value of [metrics][crate::model::ListLogMetricsResponse::metrics].
8012 ///
8013 /// # Example
8014 /// ```ignore,no_run
8015 /// # use google_cloud_logging_v2::model::ListLogMetricsResponse;
8016 /// use google_cloud_logging_v2::model::LogMetric;
8017 /// let x = ListLogMetricsResponse::new()
8018 /// .set_metrics([
8019 /// LogMetric::default()/* use setters */,
8020 /// LogMetric::default()/* use (different) setters */,
8021 /// ]);
8022 /// ```
8023 pub fn set_metrics<T, V>(mut self, v: T) -> Self
8024 where
8025 T: std::iter::IntoIterator<Item = V>,
8026 V: std::convert::Into<crate::model::LogMetric>,
8027 {
8028 use std::iter::Iterator;
8029 self.metrics = v.into_iter().map(|i| i.into()).collect();
8030 self
8031 }
8032
8033 /// Sets the value of [next_page_token][crate::model::ListLogMetricsResponse::next_page_token].
8034 ///
8035 /// # Example
8036 /// ```ignore,no_run
8037 /// # use google_cloud_logging_v2::model::ListLogMetricsResponse;
8038 /// let x = ListLogMetricsResponse::new().set_next_page_token("example");
8039 /// ```
8040 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8041 self.next_page_token = v.into();
8042 self
8043 }
8044}
8045
8046impl wkt::message::Message for ListLogMetricsResponse {
8047 fn typename() -> &'static str {
8048 "type.googleapis.com/google.logging.v2.ListLogMetricsResponse"
8049 }
8050}
8051
8052#[doc(hidden)]
8053impl gax::paginator::internal::PageableResponse for ListLogMetricsResponse {
8054 type PageItem = crate::model::LogMetric;
8055
8056 fn items(self) -> std::vec::Vec<Self::PageItem> {
8057 self.metrics
8058 }
8059
8060 fn next_page_token(&self) -> std::string::String {
8061 use std::clone::Clone;
8062 self.next_page_token.clone()
8063 }
8064}
8065
8066/// The parameters to GetLogMetric.
8067#[derive(Clone, Default, PartialEq)]
8068#[non_exhaustive]
8069pub struct GetLogMetricRequest {
8070 /// Required. The resource name of the desired metric:
8071 ///
8072 /// ```norust
8073 /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
8074 /// ```
8075 pub metric_name: std::string::String,
8076
8077 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8078}
8079
8080impl GetLogMetricRequest {
8081 pub fn new() -> Self {
8082 std::default::Default::default()
8083 }
8084
8085 /// Sets the value of [metric_name][crate::model::GetLogMetricRequest::metric_name].
8086 ///
8087 /// # Example
8088 /// ```ignore,no_run
8089 /// # use google_cloud_logging_v2::model::GetLogMetricRequest;
8090 /// let x = GetLogMetricRequest::new().set_metric_name("example");
8091 /// ```
8092 pub fn set_metric_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8093 self.metric_name = v.into();
8094 self
8095 }
8096}
8097
8098impl wkt::message::Message for GetLogMetricRequest {
8099 fn typename() -> &'static str {
8100 "type.googleapis.com/google.logging.v2.GetLogMetricRequest"
8101 }
8102}
8103
8104/// The parameters to CreateLogMetric.
8105#[derive(Clone, Default, PartialEq)]
8106#[non_exhaustive]
8107pub struct CreateLogMetricRequest {
8108 /// Required. The resource name of the project in which to create the metric:
8109 ///
8110 /// ```norust
8111 /// "projects/[PROJECT_ID]"
8112 /// ```
8113 ///
8114 /// The new metric must be provided in the request.
8115 pub parent: std::string::String,
8116
8117 /// Required. The new logs-based metric, which must not have an identifier that
8118 /// already exists.
8119 pub metric: std::option::Option<crate::model::LogMetric>,
8120
8121 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8122}
8123
8124impl CreateLogMetricRequest {
8125 pub fn new() -> Self {
8126 std::default::Default::default()
8127 }
8128
8129 /// Sets the value of [parent][crate::model::CreateLogMetricRequest::parent].
8130 ///
8131 /// # Example
8132 /// ```ignore,no_run
8133 /// # use google_cloud_logging_v2::model::CreateLogMetricRequest;
8134 /// let x = CreateLogMetricRequest::new().set_parent("example");
8135 /// ```
8136 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8137 self.parent = v.into();
8138 self
8139 }
8140
8141 /// Sets the value of [metric][crate::model::CreateLogMetricRequest::metric].
8142 ///
8143 /// # Example
8144 /// ```ignore,no_run
8145 /// # use google_cloud_logging_v2::model::CreateLogMetricRequest;
8146 /// use google_cloud_logging_v2::model::LogMetric;
8147 /// let x = CreateLogMetricRequest::new().set_metric(LogMetric::default()/* use setters */);
8148 /// ```
8149 pub fn set_metric<T>(mut self, v: T) -> Self
8150 where
8151 T: std::convert::Into<crate::model::LogMetric>,
8152 {
8153 self.metric = std::option::Option::Some(v.into());
8154 self
8155 }
8156
8157 /// Sets or clears the value of [metric][crate::model::CreateLogMetricRequest::metric].
8158 ///
8159 /// # Example
8160 /// ```ignore,no_run
8161 /// # use google_cloud_logging_v2::model::CreateLogMetricRequest;
8162 /// use google_cloud_logging_v2::model::LogMetric;
8163 /// let x = CreateLogMetricRequest::new().set_or_clear_metric(Some(LogMetric::default()/* use setters */));
8164 /// let x = CreateLogMetricRequest::new().set_or_clear_metric(None::<LogMetric>);
8165 /// ```
8166 pub fn set_or_clear_metric<T>(mut self, v: std::option::Option<T>) -> Self
8167 where
8168 T: std::convert::Into<crate::model::LogMetric>,
8169 {
8170 self.metric = v.map(|x| x.into());
8171 self
8172 }
8173}
8174
8175impl wkt::message::Message for CreateLogMetricRequest {
8176 fn typename() -> &'static str {
8177 "type.googleapis.com/google.logging.v2.CreateLogMetricRequest"
8178 }
8179}
8180
8181/// The parameters to UpdateLogMetric.
8182#[derive(Clone, Default, PartialEq)]
8183#[non_exhaustive]
8184pub struct UpdateLogMetricRequest {
8185 /// Required. The resource name of the metric to update:
8186 ///
8187 /// ```norust
8188 /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
8189 /// ```
8190 ///
8191 /// The updated metric must be provided in the request and it's
8192 /// `name` field must be the same as `[METRIC_ID]` If the metric
8193 /// does not exist in `[PROJECT_ID]`, then a new metric is created.
8194 pub metric_name: std::string::String,
8195
8196 /// Required. The updated metric.
8197 pub metric: std::option::Option<crate::model::LogMetric>,
8198
8199 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8200}
8201
8202impl UpdateLogMetricRequest {
8203 pub fn new() -> Self {
8204 std::default::Default::default()
8205 }
8206
8207 /// Sets the value of [metric_name][crate::model::UpdateLogMetricRequest::metric_name].
8208 ///
8209 /// # Example
8210 /// ```ignore,no_run
8211 /// # use google_cloud_logging_v2::model::UpdateLogMetricRequest;
8212 /// let x = UpdateLogMetricRequest::new().set_metric_name("example");
8213 /// ```
8214 pub fn set_metric_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8215 self.metric_name = v.into();
8216 self
8217 }
8218
8219 /// Sets the value of [metric][crate::model::UpdateLogMetricRequest::metric].
8220 ///
8221 /// # Example
8222 /// ```ignore,no_run
8223 /// # use google_cloud_logging_v2::model::UpdateLogMetricRequest;
8224 /// use google_cloud_logging_v2::model::LogMetric;
8225 /// let x = UpdateLogMetricRequest::new().set_metric(LogMetric::default()/* use setters */);
8226 /// ```
8227 pub fn set_metric<T>(mut self, v: T) -> Self
8228 where
8229 T: std::convert::Into<crate::model::LogMetric>,
8230 {
8231 self.metric = std::option::Option::Some(v.into());
8232 self
8233 }
8234
8235 /// Sets or clears the value of [metric][crate::model::UpdateLogMetricRequest::metric].
8236 ///
8237 /// # Example
8238 /// ```ignore,no_run
8239 /// # use google_cloud_logging_v2::model::UpdateLogMetricRequest;
8240 /// use google_cloud_logging_v2::model::LogMetric;
8241 /// let x = UpdateLogMetricRequest::new().set_or_clear_metric(Some(LogMetric::default()/* use setters */));
8242 /// let x = UpdateLogMetricRequest::new().set_or_clear_metric(None::<LogMetric>);
8243 /// ```
8244 pub fn set_or_clear_metric<T>(mut self, v: std::option::Option<T>) -> Self
8245 where
8246 T: std::convert::Into<crate::model::LogMetric>,
8247 {
8248 self.metric = v.map(|x| x.into());
8249 self
8250 }
8251}
8252
8253impl wkt::message::Message for UpdateLogMetricRequest {
8254 fn typename() -> &'static str {
8255 "type.googleapis.com/google.logging.v2.UpdateLogMetricRequest"
8256 }
8257}
8258
8259/// The parameters to DeleteLogMetric.
8260#[derive(Clone, Default, PartialEq)]
8261#[non_exhaustive]
8262pub struct DeleteLogMetricRequest {
8263 /// Required. The resource name of the metric to delete:
8264 ///
8265 /// ```norust
8266 /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
8267 /// ```
8268 pub metric_name: std::string::String,
8269
8270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8271}
8272
8273impl DeleteLogMetricRequest {
8274 pub fn new() -> Self {
8275 std::default::Default::default()
8276 }
8277
8278 /// Sets the value of [metric_name][crate::model::DeleteLogMetricRequest::metric_name].
8279 ///
8280 /// # Example
8281 /// ```ignore,no_run
8282 /// # use google_cloud_logging_v2::model::DeleteLogMetricRequest;
8283 /// let x = DeleteLogMetricRequest::new().set_metric_name("example");
8284 /// ```
8285 pub fn set_metric_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8286 self.metric_name = v.into();
8287 self
8288 }
8289}
8290
8291impl wkt::message::Message for DeleteLogMetricRequest {
8292 fn typename() -> &'static str {
8293 "type.googleapis.com/google.logging.v2.DeleteLogMetricRequest"
8294 }
8295}
8296
8297/// List of different operation states.
8298/// High level state of the operation. This is used to report the job's
8299/// current state to the user. Once a long running operation is created,
8300/// the current state of the operation can be queried even before the
8301/// operation is finished and the final result is available.
8302///
8303/// # Working with unknown values
8304///
8305/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8306/// additional enum variants at any time. Adding new variants is not considered
8307/// a breaking change. Applications should write their code in anticipation of:
8308///
8309/// - New values appearing in future releases of the client library, **and**
8310/// - New values received dynamically, without application changes.
8311///
8312/// Please consult the [Working with enums] section in the user guide for some
8313/// guidelines.
8314///
8315/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8316#[derive(Clone, Debug, PartialEq)]
8317#[non_exhaustive]
8318pub enum OperationState {
8319 /// Should not be used.
8320 Unspecified,
8321 /// The operation is scheduled.
8322 Scheduled,
8323 /// Waiting for necessary permissions.
8324 WaitingForPermissions,
8325 /// The operation is running.
8326 Running,
8327 /// The operation was completed successfully.
8328 Succeeded,
8329 /// The operation failed.
8330 Failed,
8331 /// The operation was cancelled by the user.
8332 Cancelled,
8333 /// If set, the enum was initialized with an unknown value.
8334 ///
8335 /// Applications can examine the value using [OperationState::value] or
8336 /// [OperationState::name].
8337 UnknownValue(operation_state::UnknownValue),
8338}
8339
8340#[doc(hidden)]
8341pub mod operation_state {
8342 #[allow(unused_imports)]
8343 use super::*;
8344 #[derive(Clone, Debug, PartialEq)]
8345 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8346}
8347
8348impl OperationState {
8349 /// Gets the enum value.
8350 ///
8351 /// Returns `None` if the enum contains an unknown value deserialized from
8352 /// the string representation of enums.
8353 pub fn value(&self) -> std::option::Option<i32> {
8354 match self {
8355 Self::Unspecified => std::option::Option::Some(0),
8356 Self::Scheduled => std::option::Option::Some(1),
8357 Self::WaitingForPermissions => std::option::Option::Some(2),
8358 Self::Running => std::option::Option::Some(3),
8359 Self::Succeeded => std::option::Option::Some(4),
8360 Self::Failed => std::option::Option::Some(5),
8361 Self::Cancelled => std::option::Option::Some(6),
8362 Self::UnknownValue(u) => u.0.value(),
8363 }
8364 }
8365
8366 /// Gets the enum value as a string.
8367 ///
8368 /// Returns `None` if the enum contains an unknown value deserialized from
8369 /// the integer representation of enums.
8370 pub fn name(&self) -> std::option::Option<&str> {
8371 match self {
8372 Self::Unspecified => std::option::Option::Some("OPERATION_STATE_UNSPECIFIED"),
8373 Self::Scheduled => std::option::Option::Some("OPERATION_STATE_SCHEDULED"),
8374 Self::WaitingForPermissions => {
8375 std::option::Option::Some("OPERATION_STATE_WAITING_FOR_PERMISSIONS")
8376 }
8377 Self::Running => std::option::Option::Some("OPERATION_STATE_RUNNING"),
8378 Self::Succeeded => std::option::Option::Some("OPERATION_STATE_SUCCEEDED"),
8379 Self::Failed => std::option::Option::Some("OPERATION_STATE_FAILED"),
8380 Self::Cancelled => std::option::Option::Some("OPERATION_STATE_CANCELLED"),
8381 Self::UnknownValue(u) => u.0.name(),
8382 }
8383 }
8384}
8385
8386impl std::default::Default for OperationState {
8387 fn default() -> Self {
8388 use std::convert::From;
8389 Self::from(0)
8390 }
8391}
8392
8393impl std::fmt::Display for OperationState {
8394 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8395 wkt::internal::display_enum(f, self.name(), self.value())
8396 }
8397}
8398
8399impl std::convert::From<i32> for OperationState {
8400 fn from(value: i32) -> Self {
8401 match value {
8402 0 => Self::Unspecified,
8403 1 => Self::Scheduled,
8404 2 => Self::WaitingForPermissions,
8405 3 => Self::Running,
8406 4 => Self::Succeeded,
8407 5 => Self::Failed,
8408 6 => Self::Cancelled,
8409 _ => Self::UnknownValue(operation_state::UnknownValue(
8410 wkt::internal::UnknownEnumValue::Integer(value),
8411 )),
8412 }
8413 }
8414}
8415
8416impl std::convert::From<&str> for OperationState {
8417 fn from(value: &str) -> Self {
8418 use std::string::ToString;
8419 match value {
8420 "OPERATION_STATE_UNSPECIFIED" => Self::Unspecified,
8421 "OPERATION_STATE_SCHEDULED" => Self::Scheduled,
8422 "OPERATION_STATE_WAITING_FOR_PERMISSIONS" => Self::WaitingForPermissions,
8423 "OPERATION_STATE_RUNNING" => Self::Running,
8424 "OPERATION_STATE_SUCCEEDED" => Self::Succeeded,
8425 "OPERATION_STATE_FAILED" => Self::Failed,
8426 "OPERATION_STATE_CANCELLED" => Self::Cancelled,
8427 _ => Self::UnknownValue(operation_state::UnknownValue(
8428 wkt::internal::UnknownEnumValue::String(value.to_string()),
8429 )),
8430 }
8431 }
8432}
8433
8434impl serde::ser::Serialize for OperationState {
8435 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8436 where
8437 S: serde::Serializer,
8438 {
8439 match self {
8440 Self::Unspecified => serializer.serialize_i32(0),
8441 Self::Scheduled => serializer.serialize_i32(1),
8442 Self::WaitingForPermissions => serializer.serialize_i32(2),
8443 Self::Running => serializer.serialize_i32(3),
8444 Self::Succeeded => serializer.serialize_i32(4),
8445 Self::Failed => serializer.serialize_i32(5),
8446 Self::Cancelled => serializer.serialize_i32(6),
8447 Self::UnknownValue(u) => u.0.serialize(serializer),
8448 }
8449 }
8450}
8451
8452impl<'de> serde::de::Deserialize<'de> for OperationState {
8453 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8454 where
8455 D: serde::Deserializer<'de>,
8456 {
8457 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationState>::new(
8458 ".google.logging.v2.OperationState",
8459 ))
8460 }
8461}
8462
8463/// LogBucket lifecycle states.
8464///
8465/// # Working with unknown values
8466///
8467/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8468/// additional enum variants at any time. Adding new variants is not considered
8469/// a breaking change. Applications should write their code in anticipation of:
8470///
8471/// - New values appearing in future releases of the client library, **and**
8472/// - New values received dynamically, without application changes.
8473///
8474/// Please consult the [Working with enums] section in the user guide for some
8475/// guidelines.
8476///
8477/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8478#[derive(Clone, Debug, PartialEq)]
8479#[non_exhaustive]
8480pub enum LifecycleState {
8481 /// Unspecified state. This is only used/useful for distinguishing unset
8482 /// values.
8483 Unspecified,
8484 /// The normal and active state.
8485 Active,
8486 /// The resource has been marked for deletion by the user. For some resources
8487 /// (e.g. buckets), this can be reversed by an un-delete operation.
8488 DeleteRequested,
8489 /// The resource has been marked for an update by the user. It will remain in
8490 /// this state until the update is complete.
8491 Updating,
8492 /// The resource has been marked for creation by the user. It will remain in
8493 /// this state until the creation is complete.
8494 Creating,
8495 /// The resource is in an INTERNAL error state.
8496 Failed,
8497 /// If set, the enum was initialized with an unknown value.
8498 ///
8499 /// Applications can examine the value using [LifecycleState::value] or
8500 /// [LifecycleState::name].
8501 UnknownValue(lifecycle_state::UnknownValue),
8502}
8503
8504#[doc(hidden)]
8505pub mod lifecycle_state {
8506 #[allow(unused_imports)]
8507 use super::*;
8508 #[derive(Clone, Debug, PartialEq)]
8509 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8510}
8511
8512impl LifecycleState {
8513 /// Gets the enum value.
8514 ///
8515 /// Returns `None` if the enum contains an unknown value deserialized from
8516 /// the string representation of enums.
8517 pub fn value(&self) -> std::option::Option<i32> {
8518 match self {
8519 Self::Unspecified => std::option::Option::Some(0),
8520 Self::Active => std::option::Option::Some(1),
8521 Self::DeleteRequested => std::option::Option::Some(2),
8522 Self::Updating => std::option::Option::Some(3),
8523 Self::Creating => std::option::Option::Some(4),
8524 Self::Failed => std::option::Option::Some(5),
8525 Self::UnknownValue(u) => u.0.value(),
8526 }
8527 }
8528
8529 /// Gets the enum value as a string.
8530 ///
8531 /// Returns `None` if the enum contains an unknown value deserialized from
8532 /// the integer representation of enums.
8533 pub fn name(&self) -> std::option::Option<&str> {
8534 match self {
8535 Self::Unspecified => std::option::Option::Some("LIFECYCLE_STATE_UNSPECIFIED"),
8536 Self::Active => std::option::Option::Some("ACTIVE"),
8537 Self::DeleteRequested => std::option::Option::Some("DELETE_REQUESTED"),
8538 Self::Updating => std::option::Option::Some("UPDATING"),
8539 Self::Creating => std::option::Option::Some("CREATING"),
8540 Self::Failed => std::option::Option::Some("FAILED"),
8541 Self::UnknownValue(u) => u.0.name(),
8542 }
8543 }
8544}
8545
8546impl std::default::Default for LifecycleState {
8547 fn default() -> Self {
8548 use std::convert::From;
8549 Self::from(0)
8550 }
8551}
8552
8553impl std::fmt::Display for LifecycleState {
8554 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8555 wkt::internal::display_enum(f, self.name(), self.value())
8556 }
8557}
8558
8559impl std::convert::From<i32> for LifecycleState {
8560 fn from(value: i32) -> Self {
8561 match value {
8562 0 => Self::Unspecified,
8563 1 => Self::Active,
8564 2 => Self::DeleteRequested,
8565 3 => Self::Updating,
8566 4 => Self::Creating,
8567 5 => Self::Failed,
8568 _ => Self::UnknownValue(lifecycle_state::UnknownValue(
8569 wkt::internal::UnknownEnumValue::Integer(value),
8570 )),
8571 }
8572 }
8573}
8574
8575impl std::convert::From<&str> for LifecycleState {
8576 fn from(value: &str) -> Self {
8577 use std::string::ToString;
8578 match value {
8579 "LIFECYCLE_STATE_UNSPECIFIED" => Self::Unspecified,
8580 "ACTIVE" => Self::Active,
8581 "DELETE_REQUESTED" => Self::DeleteRequested,
8582 "UPDATING" => Self::Updating,
8583 "CREATING" => Self::Creating,
8584 "FAILED" => Self::Failed,
8585 _ => Self::UnknownValue(lifecycle_state::UnknownValue(
8586 wkt::internal::UnknownEnumValue::String(value.to_string()),
8587 )),
8588 }
8589 }
8590}
8591
8592impl serde::ser::Serialize for LifecycleState {
8593 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8594 where
8595 S: serde::Serializer,
8596 {
8597 match self {
8598 Self::Unspecified => serializer.serialize_i32(0),
8599 Self::Active => serializer.serialize_i32(1),
8600 Self::DeleteRequested => serializer.serialize_i32(2),
8601 Self::Updating => serializer.serialize_i32(3),
8602 Self::Creating => serializer.serialize_i32(4),
8603 Self::Failed => serializer.serialize_i32(5),
8604 Self::UnknownValue(u) => u.0.serialize(serializer),
8605 }
8606 }
8607}
8608
8609impl<'de> serde::de::Deserialize<'de> for LifecycleState {
8610 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8611 where
8612 D: serde::Deserializer<'de>,
8613 {
8614 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LifecycleState>::new(
8615 ".google.logging.v2.LifecycleState",
8616 ))
8617 }
8618}
8619
8620/// IndexType is used for custom indexing. It describes the type of an indexed
8621/// field.
8622///
8623/// # Working with unknown values
8624///
8625/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8626/// additional enum variants at any time. Adding new variants is not considered
8627/// a breaking change. Applications should write their code in anticipation of:
8628///
8629/// - New values appearing in future releases of the client library, **and**
8630/// - New values received dynamically, without application changes.
8631///
8632/// Please consult the [Working with enums] section in the user guide for some
8633/// guidelines.
8634///
8635/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8636#[derive(Clone, Debug, PartialEq)]
8637#[non_exhaustive]
8638pub enum IndexType {
8639 /// The index's type is unspecified.
8640 Unspecified,
8641 /// The index is a string-type index.
8642 String,
8643 /// The index is a integer-type index.
8644 Integer,
8645 /// If set, the enum was initialized with an unknown value.
8646 ///
8647 /// Applications can examine the value using [IndexType::value] or
8648 /// [IndexType::name].
8649 UnknownValue(index_type::UnknownValue),
8650}
8651
8652#[doc(hidden)]
8653pub mod index_type {
8654 #[allow(unused_imports)]
8655 use super::*;
8656 #[derive(Clone, Debug, PartialEq)]
8657 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8658}
8659
8660impl IndexType {
8661 /// Gets the enum value.
8662 ///
8663 /// Returns `None` if the enum contains an unknown value deserialized from
8664 /// the string representation of enums.
8665 pub fn value(&self) -> std::option::Option<i32> {
8666 match self {
8667 Self::Unspecified => std::option::Option::Some(0),
8668 Self::String => std::option::Option::Some(1),
8669 Self::Integer => std::option::Option::Some(2),
8670 Self::UnknownValue(u) => u.0.value(),
8671 }
8672 }
8673
8674 /// Gets the enum value as a string.
8675 ///
8676 /// Returns `None` if the enum contains an unknown value deserialized from
8677 /// the integer representation of enums.
8678 pub fn name(&self) -> std::option::Option<&str> {
8679 match self {
8680 Self::Unspecified => std::option::Option::Some("INDEX_TYPE_UNSPECIFIED"),
8681 Self::String => std::option::Option::Some("INDEX_TYPE_STRING"),
8682 Self::Integer => std::option::Option::Some("INDEX_TYPE_INTEGER"),
8683 Self::UnknownValue(u) => u.0.name(),
8684 }
8685 }
8686}
8687
8688impl std::default::Default for IndexType {
8689 fn default() -> Self {
8690 use std::convert::From;
8691 Self::from(0)
8692 }
8693}
8694
8695impl std::fmt::Display for IndexType {
8696 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8697 wkt::internal::display_enum(f, self.name(), self.value())
8698 }
8699}
8700
8701impl std::convert::From<i32> for IndexType {
8702 fn from(value: i32) -> Self {
8703 match value {
8704 0 => Self::Unspecified,
8705 1 => Self::String,
8706 2 => Self::Integer,
8707 _ => Self::UnknownValue(index_type::UnknownValue(
8708 wkt::internal::UnknownEnumValue::Integer(value),
8709 )),
8710 }
8711 }
8712}
8713
8714impl std::convert::From<&str> for IndexType {
8715 fn from(value: &str) -> Self {
8716 use std::string::ToString;
8717 match value {
8718 "INDEX_TYPE_UNSPECIFIED" => Self::Unspecified,
8719 "INDEX_TYPE_STRING" => Self::String,
8720 "INDEX_TYPE_INTEGER" => Self::Integer,
8721 _ => Self::UnknownValue(index_type::UnknownValue(
8722 wkt::internal::UnknownEnumValue::String(value.to_string()),
8723 )),
8724 }
8725 }
8726}
8727
8728impl serde::ser::Serialize for IndexType {
8729 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8730 where
8731 S: serde::Serializer,
8732 {
8733 match self {
8734 Self::Unspecified => serializer.serialize_i32(0),
8735 Self::String => serializer.serialize_i32(1),
8736 Self::Integer => serializer.serialize_i32(2),
8737 Self::UnknownValue(u) => u.0.serialize(serializer),
8738 }
8739 }
8740}
8741
8742impl<'de> serde::de::Deserialize<'de> for IndexType {
8743 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8744 where
8745 D: serde::Deserializer<'de>,
8746 {
8747 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexType>::new(
8748 ".google.logging.v2.IndexType",
8749 ))
8750 }
8751}