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