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