Skip to main content

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