google_cloud_logging_v2/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate lazy_static;
26extern crate logging_type;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate rpc;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38/// An individual entry in a log.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct LogEntry {
42    /// Required. The resource name of the log to which this log entry belongs:
43    ///
44    /// ```norust
45    /// "projects/[PROJECT_ID]/logs/[LOG_ID]"
46    /// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
47    /// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
48    /// "folders/[FOLDER_ID]/logs/[LOG_ID]"
49    /// ```
50    ///
51    /// A project number may be used in place of PROJECT_ID. The project number is
52    /// translated to its corresponding PROJECT_ID internally and the `log_name`
53    /// field will contain PROJECT_ID in queries and exports.
54    ///
55    /// `[LOG_ID]` must be URL-encoded within `log_name`. Example:
56    /// `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
57    ///
58    /// `[LOG_ID]` must be less than 512 characters long and can only include the
59    /// following characters: upper and lower case alphanumeric characters,
60    /// forward-slash, underscore, hyphen, and period.
61    ///
62    /// For backward compatibility, if `log_name` begins with a forward-slash, such
63    /// as `/projects/...`, then the log entry is ingested as usual, but the
64    /// forward-slash is removed. Listing the log entry will not show the leading
65    /// slash and filtering for a log name with a leading slash will never return
66    /// any results.
67    pub log_name: std::string::String,
68
69    /// Required. The monitored resource that produced this log entry.
70    ///
71    /// Example: a log entry that reports a database error would be associated with
72    /// the monitored resource designating the particular database that reported
73    /// the error.
74    pub resource: std::option::Option<api::model::MonitoredResource>,
75
76    /// Optional. The time the event described by the log entry occurred. This time
77    /// is used to compute the log entry's age and to enforce the logs retention
78    /// period. If this field is omitted in a new log entry, then Logging assigns
79    /// it the current time. Timestamps have nanosecond accuracy, but trailing
80    /// zeros in the fractional seconds might be omitted when the timestamp is
81    /// displayed.
82    ///
83    /// Incoming log entries must have timestamps that don't exceed the
84    /// [logs retention
85    /// period](https://cloud.google.com/logging/quotas#logs_retention_periods) in
86    /// the past, and that don't exceed 24 hours in the future. Log entries outside
87    /// those time boundaries aren't ingested by Logging.
88    pub timestamp: std::option::Option<wkt::Timestamp>,
89
90    /// Output only. The time the log entry was received by Logging.
91    pub receive_timestamp: std::option::Option<wkt::Timestamp>,
92
93    /// Optional. The severity of the log entry. The default value is
94    /// `LogSeverity.DEFAULT`.
95    pub severity: logging_type::model::LogSeverity,
96
97    /// Optional. A unique identifier for the log entry. If you provide a value,
98    /// then Logging considers other log entries in the same project, with the same
99    /// `timestamp`, and with the same `insert_id` to be duplicates which are
100    /// removed in a single query result. However, there are no guarantees of
101    /// de-duplication in the export of logs.
102    ///
103    /// If the `insert_id` is omitted when writing a log entry, the Logging API
104    /// assigns its own unique identifier in this field.
105    ///
106    /// In queries, the `insert_id` is also used to order log entries that have
107    /// the same `log_name` and `timestamp` values.
108    pub insert_id: std::string::String,
109
110    /// Optional. Information about the HTTP request associated with this log
111    /// entry, if applicable.
112    pub http_request: std::option::Option<logging_type::model::HttpRequest>,
113
114    /// Optional. A map of key, value pairs that provides additional information
115    /// about the log entry. The labels can be user-defined or system-defined.
116    ///
117    /// User-defined labels are arbitrary key, value pairs that you can use to
118    /// classify logs.
119    ///
120    /// System-defined labels are defined by GCP services for platform logs.
121    /// They have two components - a service namespace component and the
122    /// attribute name. For example: `compute.googleapis.com/resource_name`.
123    ///
124    /// Cloud Logging truncates label keys that exceed 512 B and label
125    /// values that exceed 64 KB upon their associated log entry being
126    /// written. The truncation is indicated by an ellipsis at the
127    /// end of the character string.
128    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
129
130    /// Optional. Information about an operation associated with the log entry, if
131    /// applicable.
132    pub operation: std::option::Option<crate::model::LogEntryOperation>,
133
134    /// Optional. The REST resource name of the trace being written to
135    /// [Cloud Trace](https://cloud.google.com/trace) in
136    /// association with this log entry. For example, if your trace data is stored
137    /// in the Cloud project "my-trace-project" and if the service that is creating
138    /// the log entry receives a trace header that includes the trace ID "12345",
139    /// then the service should use "projects/my-tracing-project/traces/12345".
140    ///
141    /// The `trace` field provides the link between logs and traces. By using
142    /// this field, you can navigate from a log entry to a trace.
143    pub trace: std::string::String,
144
145    /// Optional. The ID of the [Cloud Trace](https://cloud.google.com/trace) span
146    /// associated with the current operation in which the log is being written.
147    /// For example, if a span has the REST resource name of
148    /// "projects/some-project/traces/some-trace/spans/some-span-id", then the
149    /// `span_id` field is "some-span-id".
150    ///
151    /// A
152    /// [Span](https://cloud.google.com/trace/docs/reference/v2/rest/v2/projects.traces/batchWrite#Span)
153    /// represents a single operation within a trace. Whereas a trace may involve
154    /// multiple different microservices running on multiple different machines,
155    /// a span generally corresponds to a single logical operation being performed
156    /// in a single instance of a microservice on one specific machine. Spans
157    /// are the nodes within the tree that is a trace.
158    ///
159    /// Applications that are [instrumented for
160    /// tracing](https://cloud.google.com/trace/docs/setup) will generally assign a
161    /// new, unique span ID on each incoming request. It is also common to create
162    /// and record additional spans corresponding to internal processing elements
163    /// as well as issuing requests to dependencies.
164    ///
165    /// The span ID is expected to be a 16-character, hexadecimal encoding of an
166    /// 8-byte array and should not be zero. It should be unique within the trace
167    /// and should, ideally, be generated in a manner that is uniformly random.
168    ///
169    /// Example values:
170    ///
171    /// - `000000000000004a`
172    /// - `7a2190356c3fc94b`
173    /// - `0000f00300090021`
174    /// - `d39223e101960076`
175    pub span_id: std::string::String,
176
177    /// Optional. The sampling decision of the trace associated with the log entry.
178    ///
179    /// True means that the trace resource name in the `trace` field was sampled
180    /// for storage in a trace backend. False means that the trace was not sampled
181    /// for storage when this log entry was written, or the sampling decision was
182    /// unknown at the time. A non-sampled `trace` value is still useful as a
183    /// request correlation identifier. The default is False.
184    pub trace_sampled: bool,
185
186    /// Optional. Source code location information associated with the log entry,
187    /// if any.
188    pub source_location: std::option::Option<crate::model::LogEntrySourceLocation>,
189
190    /// Optional. Information indicating this LogEntry is part of a sequence of
191    /// multiple log entries split from a single LogEntry.
192    pub split: std::option::Option<crate::model::LogSplit>,
193
194    /// The log entry payload, which can be one of multiple types.
195    pub payload: std::option::Option<crate::model::log_entry::Payload>,
196
197    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
198}
199
200impl LogEntry {
201    pub fn new() -> Self {
202        std::default::Default::default()
203    }
204
205    /// Sets the value of [log_name][crate::model::LogEntry::log_name].
206    pub fn set_log_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
207        self.log_name = v.into();
208        self
209    }
210
211    /// Sets the value of [resource][crate::model::LogEntry::resource].
212    pub fn set_resource<T>(mut self, v: T) -> Self
213    where
214        T: std::convert::Into<api::model::MonitoredResource>,
215    {
216        self.resource = std::option::Option::Some(v.into());
217        self
218    }
219
220    /// Sets or clears the value of [resource][crate::model::LogEntry::resource].
221    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
222    where
223        T: std::convert::Into<api::model::MonitoredResource>,
224    {
225        self.resource = v.map(|x| x.into());
226        self
227    }
228
229    /// Sets the value of [timestamp][crate::model::LogEntry::timestamp].
230    pub fn set_timestamp<T>(mut self, v: T) -> Self
231    where
232        T: std::convert::Into<wkt::Timestamp>,
233    {
234        self.timestamp = std::option::Option::Some(v.into());
235        self
236    }
237
238    /// Sets or clears the value of [timestamp][crate::model::LogEntry::timestamp].
239    pub fn set_or_clear_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
240    where
241        T: std::convert::Into<wkt::Timestamp>,
242    {
243        self.timestamp = v.map(|x| x.into());
244        self
245    }
246
247    /// Sets the value of [receive_timestamp][crate::model::LogEntry::receive_timestamp].
248    pub fn set_receive_timestamp<T>(mut self, v: T) -> Self
249    where
250        T: std::convert::Into<wkt::Timestamp>,
251    {
252        self.receive_timestamp = std::option::Option::Some(v.into());
253        self
254    }
255
256    /// Sets or clears the value of [receive_timestamp][crate::model::LogEntry::receive_timestamp].
257    pub fn set_or_clear_receive_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
258    where
259        T: std::convert::Into<wkt::Timestamp>,
260    {
261        self.receive_timestamp = v.map(|x| x.into());
262        self
263    }
264
265    /// Sets the value of [severity][crate::model::LogEntry::severity].
266    pub fn set_severity<T: std::convert::Into<logging_type::model::LogSeverity>>(
267        mut self,
268        v: T,
269    ) -> Self {
270        self.severity = v.into();
271        self
272    }
273
274    /// Sets the value of [insert_id][crate::model::LogEntry::insert_id].
275    pub fn set_insert_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
276        self.insert_id = v.into();
277        self
278    }
279
280    /// Sets the value of [http_request][crate::model::LogEntry::http_request].
281    pub fn set_http_request<T>(mut self, v: T) -> Self
282    where
283        T: std::convert::Into<logging_type::model::HttpRequest>,
284    {
285        self.http_request = std::option::Option::Some(v.into());
286        self
287    }
288
289    /// Sets or clears the value of [http_request][crate::model::LogEntry::http_request].
290    pub fn set_or_clear_http_request<T>(mut self, v: std::option::Option<T>) -> Self
291    where
292        T: std::convert::Into<logging_type::model::HttpRequest>,
293    {
294        self.http_request = v.map(|x| x.into());
295        self
296    }
297
298    /// Sets the value of [labels][crate::model::LogEntry::labels].
299    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
300    where
301        T: std::iter::IntoIterator<Item = (K, V)>,
302        K: std::convert::Into<std::string::String>,
303        V: std::convert::Into<std::string::String>,
304    {
305        use std::iter::Iterator;
306        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
307        self
308    }
309
310    /// Sets the value of [operation][crate::model::LogEntry::operation].
311    pub fn set_operation<T>(mut self, v: T) -> Self
312    where
313        T: std::convert::Into<crate::model::LogEntryOperation>,
314    {
315        self.operation = std::option::Option::Some(v.into());
316        self
317    }
318
319    /// Sets or clears the value of [operation][crate::model::LogEntry::operation].
320    pub fn set_or_clear_operation<T>(mut self, v: std::option::Option<T>) -> Self
321    where
322        T: std::convert::Into<crate::model::LogEntryOperation>,
323    {
324        self.operation = v.map(|x| x.into());
325        self
326    }
327
328    /// Sets the value of [trace][crate::model::LogEntry::trace].
329    pub fn set_trace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
330        self.trace = v.into();
331        self
332    }
333
334    /// Sets the value of [span_id][crate::model::LogEntry::span_id].
335    pub fn set_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
336        self.span_id = v.into();
337        self
338    }
339
340    /// Sets the value of [trace_sampled][crate::model::LogEntry::trace_sampled].
341    pub fn set_trace_sampled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
342        self.trace_sampled = v.into();
343        self
344    }
345
346    /// Sets the value of [source_location][crate::model::LogEntry::source_location].
347    pub fn set_source_location<T>(mut self, v: T) -> Self
348    where
349        T: std::convert::Into<crate::model::LogEntrySourceLocation>,
350    {
351        self.source_location = std::option::Option::Some(v.into());
352        self
353    }
354
355    /// Sets or clears the value of [source_location][crate::model::LogEntry::source_location].
356    pub fn set_or_clear_source_location<T>(mut self, v: std::option::Option<T>) -> Self
357    where
358        T: std::convert::Into<crate::model::LogEntrySourceLocation>,
359    {
360        self.source_location = v.map(|x| x.into());
361        self
362    }
363
364    /// Sets the value of [split][crate::model::LogEntry::split].
365    pub fn set_split<T>(mut self, v: T) -> Self
366    where
367        T: std::convert::Into<crate::model::LogSplit>,
368    {
369        self.split = std::option::Option::Some(v.into());
370        self
371    }
372
373    /// Sets or clears the value of [split][crate::model::LogEntry::split].
374    pub fn set_or_clear_split<T>(mut self, v: std::option::Option<T>) -> Self
375    where
376        T: std::convert::Into<crate::model::LogSplit>,
377    {
378        self.split = v.map(|x| x.into());
379        self
380    }
381
382    /// Sets the value of [payload][crate::model::LogEntry::payload].
383    ///
384    /// Note that all the setters affecting `payload` are mutually
385    /// exclusive.
386    pub fn set_payload<
387        T: std::convert::Into<std::option::Option<crate::model::log_entry::Payload>>,
388    >(
389        mut self,
390        v: T,
391    ) -> Self {
392        self.payload = v.into();
393        self
394    }
395
396    /// The value of [payload][crate::model::LogEntry::payload]
397    /// if it holds a `ProtoPayload`, `None` if the field is not set or
398    /// holds a different branch.
399    pub fn proto_payload(&self) -> std::option::Option<&std::boxed::Box<wkt::Any>> {
400        #[allow(unreachable_patterns)]
401        self.payload.as_ref().and_then(|v| match v {
402            crate::model::log_entry::Payload::ProtoPayload(v) => std::option::Option::Some(v),
403            _ => std::option::Option::None,
404        })
405    }
406
407    /// Sets the value of [payload][crate::model::LogEntry::payload]
408    /// to hold a `ProtoPayload`.
409    ///
410    /// Note that all the setters affecting `payload` are
411    /// mutually exclusive.
412    pub fn set_proto_payload<T: std::convert::Into<std::boxed::Box<wkt::Any>>>(
413        mut self,
414        v: T,
415    ) -> Self {
416        self.payload =
417            std::option::Option::Some(crate::model::log_entry::Payload::ProtoPayload(v.into()));
418        self
419    }
420
421    /// The value of [payload][crate::model::LogEntry::payload]
422    /// if it holds a `TextPayload`, `None` if the field is not set or
423    /// holds a different branch.
424    pub fn text_payload(&self) -> std::option::Option<&std::string::String> {
425        #[allow(unreachable_patterns)]
426        self.payload.as_ref().and_then(|v| match v {
427            crate::model::log_entry::Payload::TextPayload(v) => std::option::Option::Some(v),
428            _ => std::option::Option::None,
429        })
430    }
431
432    /// Sets the value of [payload][crate::model::LogEntry::payload]
433    /// to hold a `TextPayload`.
434    ///
435    /// Note that all the setters affecting `payload` are
436    /// mutually exclusive.
437    pub fn set_text_payload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
438        self.payload =
439            std::option::Option::Some(crate::model::log_entry::Payload::TextPayload(v.into()));
440        self
441    }
442
443    /// The value of [payload][crate::model::LogEntry::payload]
444    /// if it holds a `JsonPayload`, `None` if the field is not set or
445    /// holds a different branch.
446    pub fn json_payload(&self) -> std::option::Option<&std::boxed::Box<wkt::Struct>> {
447        #[allow(unreachable_patterns)]
448        self.payload.as_ref().and_then(|v| match v {
449            crate::model::log_entry::Payload::JsonPayload(v) => std::option::Option::Some(v),
450            _ => std::option::Option::None,
451        })
452    }
453
454    /// Sets the value of [payload][crate::model::LogEntry::payload]
455    /// to hold a `JsonPayload`.
456    ///
457    /// Note that all the setters affecting `payload` are
458    /// mutually exclusive.
459    pub fn set_json_payload<T: std::convert::Into<std::boxed::Box<wkt::Struct>>>(
460        mut self,
461        v: T,
462    ) -> Self {
463        self.payload =
464            std::option::Option::Some(crate::model::log_entry::Payload::JsonPayload(v.into()));
465        self
466    }
467}
468
469impl wkt::message::Message for LogEntry {
470    fn typename() -> &'static str {
471        "type.googleapis.com/google.logging.v2.LogEntry"
472    }
473}
474
475#[doc(hidden)]
476impl<'de> serde::de::Deserialize<'de> for LogEntry {
477    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
478    where
479        D: serde::Deserializer<'de>,
480    {
481        #[allow(non_camel_case_types)]
482        #[doc(hidden)]
483        #[derive(PartialEq, Eq, Hash)]
484        enum __FieldTag {
485            __log_name,
486            __resource,
487            __proto_payload,
488            __text_payload,
489            __json_payload,
490            __timestamp,
491            __receive_timestamp,
492            __severity,
493            __insert_id,
494            __http_request,
495            __labels,
496            __operation,
497            __trace,
498            __span_id,
499            __trace_sampled,
500            __source_location,
501            __split,
502            Unknown(std::string::String),
503        }
504        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
505            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
506            where
507                D: serde::Deserializer<'de>,
508            {
509                struct Visitor;
510                impl<'de> serde::de::Visitor<'de> for Visitor {
511                    type Value = __FieldTag;
512                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
513                        formatter.write_str("a field name for LogEntry")
514                    }
515                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
516                    where
517                        E: serde::de::Error,
518                    {
519                        use std::result::Result::Ok;
520                        use std::string::ToString;
521                        match value {
522                            "logName" => Ok(__FieldTag::__log_name),
523                            "log_name" => Ok(__FieldTag::__log_name),
524                            "resource" => Ok(__FieldTag::__resource),
525                            "protoPayload" => Ok(__FieldTag::__proto_payload),
526                            "proto_payload" => Ok(__FieldTag::__proto_payload),
527                            "textPayload" => Ok(__FieldTag::__text_payload),
528                            "text_payload" => Ok(__FieldTag::__text_payload),
529                            "jsonPayload" => Ok(__FieldTag::__json_payload),
530                            "json_payload" => Ok(__FieldTag::__json_payload),
531                            "timestamp" => Ok(__FieldTag::__timestamp),
532                            "receiveTimestamp" => Ok(__FieldTag::__receive_timestamp),
533                            "receive_timestamp" => Ok(__FieldTag::__receive_timestamp),
534                            "severity" => Ok(__FieldTag::__severity),
535                            "insertId" => Ok(__FieldTag::__insert_id),
536                            "insert_id" => Ok(__FieldTag::__insert_id),
537                            "httpRequest" => Ok(__FieldTag::__http_request),
538                            "http_request" => Ok(__FieldTag::__http_request),
539                            "labels" => Ok(__FieldTag::__labels),
540                            "operation" => Ok(__FieldTag::__operation),
541                            "trace" => Ok(__FieldTag::__trace),
542                            "spanId" => Ok(__FieldTag::__span_id),
543                            "span_id" => Ok(__FieldTag::__span_id),
544                            "traceSampled" => Ok(__FieldTag::__trace_sampled),
545                            "trace_sampled" => Ok(__FieldTag::__trace_sampled),
546                            "sourceLocation" => Ok(__FieldTag::__source_location),
547                            "source_location" => Ok(__FieldTag::__source_location),
548                            "split" => Ok(__FieldTag::__split),
549                            _ => Ok(__FieldTag::Unknown(value.to_string())),
550                        }
551                    }
552                }
553                deserializer.deserialize_identifier(Visitor)
554            }
555        }
556        struct Visitor;
557        impl<'de> serde::de::Visitor<'de> for Visitor {
558            type Value = LogEntry;
559            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
560                formatter.write_str("struct LogEntry")
561            }
562            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
563            where
564                A: serde::de::MapAccess<'de>,
565            {
566                #[allow(unused_imports)]
567                use serde::de::Error;
568                use std::option::Option::Some;
569                let mut fields = std::collections::HashSet::new();
570                let mut result = Self::Value::new();
571                while let Some(tag) = map.next_key::<__FieldTag>()? {
572                    #[allow(clippy::match_single_binding)]
573                    match tag {
574                        __FieldTag::__log_name => {
575                            if !fields.insert(__FieldTag::__log_name) {
576                                return std::result::Result::Err(A::Error::duplicate_field(
577                                    "multiple values for log_name",
578                                ));
579                            }
580                            result.log_name = map
581                                .next_value::<std::option::Option<std::string::String>>()?
582                                .unwrap_or_default();
583                        }
584                        __FieldTag::__resource => {
585                            if !fields.insert(__FieldTag::__resource) {
586                                return std::result::Result::Err(A::Error::duplicate_field(
587                                    "multiple values for resource",
588                                ));
589                            }
590                            result.resource = map
591                                .next_value::<std::option::Option<api::model::MonitoredResource>>(
592                                )?;
593                        }
594                        __FieldTag::__proto_payload => {
595                            if !fields.insert(__FieldTag::__proto_payload) {
596                                return std::result::Result::Err(A::Error::duplicate_field(
597                                    "multiple values for proto_payload",
598                                ));
599                            }
600                            if result.payload.is_some() {
601                                return std::result::Result::Err(A::Error::duplicate_field(
602                                    "multiple values for `payload`, a oneof with full ID .google.logging.v2.LogEntry.proto_payload, latest field was protoPayload",
603                                ));
604                            }
605                            result.payload = std::option::Option::Some(
606                                crate::model::log_entry::Payload::ProtoPayload(
607                                    map.next_value::<std::option::Option<std::boxed::Box<wkt::Any>>>()?.unwrap_or_default()
608                                ),
609                            );
610                        }
611                        __FieldTag::__text_payload => {
612                            if !fields.insert(__FieldTag::__text_payload) {
613                                return std::result::Result::Err(A::Error::duplicate_field(
614                                    "multiple values for text_payload",
615                                ));
616                            }
617                            if result.payload.is_some() {
618                                return std::result::Result::Err(A::Error::duplicate_field(
619                                    "multiple values for `payload`, a oneof with full ID .google.logging.v2.LogEntry.text_payload, latest field was textPayload",
620                                ));
621                            }
622                            result.payload = std::option::Option::Some(
623                                crate::model::log_entry::Payload::TextPayload(
624                                    map.next_value::<std::option::Option<std::string::String>>()?
625                                        .unwrap_or_default(),
626                                ),
627                            );
628                        }
629                        __FieldTag::__json_payload => {
630                            if !fields.insert(__FieldTag::__json_payload) {
631                                return std::result::Result::Err(A::Error::duplicate_field(
632                                    "multiple values for json_payload",
633                                ));
634                            }
635                            if result.payload.is_some() {
636                                return std::result::Result::Err(A::Error::duplicate_field(
637                                    "multiple values for `payload`, a oneof with full ID .google.logging.v2.LogEntry.json_payload, latest field was jsonPayload",
638                                ));
639                            }
640                            result.payload = std::option::Option::Some(
641                                crate::model::log_entry::Payload::JsonPayload(
642                                    map.next_value::<std::option::Option<std::boxed::Box<wkt::Struct>>>()?.unwrap_or_default()
643                                ),
644                            );
645                        }
646                        __FieldTag::__timestamp => {
647                            if !fields.insert(__FieldTag::__timestamp) {
648                                return std::result::Result::Err(A::Error::duplicate_field(
649                                    "multiple values for timestamp",
650                                ));
651                            }
652                            result.timestamp =
653                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
654                        }
655                        __FieldTag::__receive_timestamp => {
656                            if !fields.insert(__FieldTag::__receive_timestamp) {
657                                return std::result::Result::Err(A::Error::duplicate_field(
658                                    "multiple values for receive_timestamp",
659                                ));
660                            }
661                            result.receive_timestamp =
662                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
663                        }
664                        __FieldTag::__severity => {
665                            if !fields.insert(__FieldTag::__severity) {
666                                return std::result::Result::Err(A::Error::duplicate_field(
667                                    "multiple values for severity",
668                                ));
669                            }
670                            result.severity = map.next_value::<std::option::Option<logging_type::model::LogSeverity>>()?.unwrap_or_default();
671                        }
672                        __FieldTag::__insert_id => {
673                            if !fields.insert(__FieldTag::__insert_id) {
674                                return std::result::Result::Err(A::Error::duplicate_field(
675                                    "multiple values for insert_id",
676                                ));
677                            }
678                            result.insert_id = map
679                                .next_value::<std::option::Option<std::string::String>>()?
680                                .unwrap_or_default();
681                        }
682                        __FieldTag::__http_request => {
683                            if !fields.insert(__FieldTag::__http_request) {
684                                return std::result::Result::Err(A::Error::duplicate_field(
685                                    "multiple values for http_request",
686                                ));
687                            }
688                            result.http_request = map.next_value::<std::option::Option<logging_type::model::HttpRequest>>()?
689                                ;
690                        }
691                        __FieldTag::__labels => {
692                            if !fields.insert(__FieldTag::__labels) {
693                                return std::result::Result::Err(A::Error::duplicate_field(
694                                    "multiple values for labels",
695                                ));
696                            }
697                            result.labels = map
698                                .next_value::<std::option::Option<
699                                    std::collections::HashMap<
700                                        std::string::String,
701                                        std::string::String,
702                                    >,
703                                >>()?
704                                .unwrap_or_default();
705                        }
706                        __FieldTag::__operation => {
707                            if !fields.insert(__FieldTag::__operation) {
708                                return std::result::Result::Err(A::Error::duplicate_field(
709                                    "multiple values for operation",
710                                ));
711                            }
712                            result.operation = map
713                                .next_value::<std::option::Option<crate::model::LogEntryOperation>>(
714                                )?;
715                        }
716                        __FieldTag::__trace => {
717                            if !fields.insert(__FieldTag::__trace) {
718                                return std::result::Result::Err(A::Error::duplicate_field(
719                                    "multiple values for trace",
720                                ));
721                            }
722                            result.trace = map
723                                .next_value::<std::option::Option<std::string::String>>()?
724                                .unwrap_or_default();
725                        }
726                        __FieldTag::__span_id => {
727                            if !fields.insert(__FieldTag::__span_id) {
728                                return std::result::Result::Err(A::Error::duplicate_field(
729                                    "multiple values for span_id",
730                                ));
731                            }
732                            result.span_id = map
733                                .next_value::<std::option::Option<std::string::String>>()?
734                                .unwrap_or_default();
735                        }
736                        __FieldTag::__trace_sampled => {
737                            if !fields.insert(__FieldTag::__trace_sampled) {
738                                return std::result::Result::Err(A::Error::duplicate_field(
739                                    "multiple values for trace_sampled",
740                                ));
741                            }
742                            result.trace_sampled = map
743                                .next_value::<std::option::Option<bool>>()?
744                                .unwrap_or_default();
745                        }
746                        __FieldTag::__source_location => {
747                            if !fields.insert(__FieldTag::__source_location) {
748                                return std::result::Result::Err(A::Error::duplicate_field(
749                                    "multiple values for source_location",
750                                ));
751                            }
752                            result.source_location = map.next_value::<std::option::Option<crate::model::LogEntrySourceLocation>>()?
753                                ;
754                        }
755                        __FieldTag::__split => {
756                            if !fields.insert(__FieldTag::__split) {
757                                return std::result::Result::Err(A::Error::duplicate_field(
758                                    "multiple values for split",
759                                ));
760                            }
761                            result.split =
762                                map.next_value::<std::option::Option<crate::model::LogSplit>>()?;
763                        }
764                        __FieldTag::Unknown(key) => {
765                            let value = map.next_value::<serde_json::Value>()?;
766                            result._unknown_fields.insert(key, value);
767                        }
768                    }
769                }
770                std::result::Result::Ok(result)
771            }
772        }
773        deserializer.deserialize_any(Visitor)
774    }
775}
776
777#[doc(hidden)]
778impl serde::ser::Serialize for LogEntry {
779    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
780    where
781        S: serde::ser::Serializer,
782    {
783        use serde::ser::SerializeMap;
784        #[allow(unused_imports)]
785        use std::option::Option::Some;
786        let mut state = serializer.serialize_map(std::option::Option::None)?;
787        if !self.log_name.is_empty() {
788            state.serialize_entry("logName", &self.log_name)?;
789        }
790        if self.resource.is_some() {
791            state.serialize_entry("resource", &self.resource)?;
792        }
793        if let Some(value) = self.proto_payload() {
794            state.serialize_entry("protoPayload", value)?;
795        }
796        if let Some(value) = self.text_payload() {
797            state.serialize_entry("textPayload", value)?;
798        }
799        if let Some(value) = self.json_payload() {
800            state.serialize_entry("jsonPayload", value)?;
801        }
802        if self.timestamp.is_some() {
803            state.serialize_entry("timestamp", &self.timestamp)?;
804        }
805        if self.receive_timestamp.is_some() {
806            state.serialize_entry("receiveTimestamp", &self.receive_timestamp)?;
807        }
808        if !wkt::internal::is_default(&self.severity) {
809            state.serialize_entry("severity", &self.severity)?;
810        }
811        if !self.insert_id.is_empty() {
812            state.serialize_entry("insertId", &self.insert_id)?;
813        }
814        if self.http_request.is_some() {
815            state.serialize_entry("httpRequest", &self.http_request)?;
816        }
817        if !self.labels.is_empty() {
818            state.serialize_entry("labels", &self.labels)?;
819        }
820        if self.operation.is_some() {
821            state.serialize_entry("operation", &self.operation)?;
822        }
823        if !self.trace.is_empty() {
824            state.serialize_entry("trace", &self.trace)?;
825        }
826        if !self.span_id.is_empty() {
827            state.serialize_entry("spanId", &self.span_id)?;
828        }
829        if !wkt::internal::is_default(&self.trace_sampled) {
830            state.serialize_entry("traceSampled", &self.trace_sampled)?;
831        }
832        if self.source_location.is_some() {
833            state.serialize_entry("sourceLocation", &self.source_location)?;
834        }
835        if self.split.is_some() {
836            state.serialize_entry("split", &self.split)?;
837        }
838        if !self._unknown_fields.is_empty() {
839            for (key, value) in self._unknown_fields.iter() {
840                state.serialize_entry(key, &value)?;
841            }
842        }
843        state.end()
844    }
845}
846
847impl std::fmt::Debug for LogEntry {
848    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
849        let mut debug_struct = f.debug_struct("LogEntry");
850        debug_struct.field("log_name", &self.log_name);
851        debug_struct.field("resource", &self.resource);
852        debug_struct.field("timestamp", &self.timestamp);
853        debug_struct.field("receive_timestamp", &self.receive_timestamp);
854        debug_struct.field("severity", &self.severity);
855        debug_struct.field("insert_id", &self.insert_id);
856        debug_struct.field("http_request", &self.http_request);
857        debug_struct.field("labels", &self.labels);
858        debug_struct.field("operation", &self.operation);
859        debug_struct.field("trace", &self.trace);
860        debug_struct.field("span_id", &self.span_id);
861        debug_struct.field("trace_sampled", &self.trace_sampled);
862        debug_struct.field("source_location", &self.source_location);
863        debug_struct.field("split", &self.split);
864        debug_struct.field("payload", &self.payload);
865        if !self._unknown_fields.is_empty() {
866            debug_struct.field("_unknown_fields", &self._unknown_fields);
867        }
868        debug_struct.finish()
869    }
870}
871
872/// Defines additional types related to [LogEntry].
873pub mod log_entry {
874    #[allow(unused_imports)]
875    use super::*;
876
877    /// The log entry payload, which can be one of multiple types.
878    #[derive(Clone, Debug, PartialEq)]
879    #[non_exhaustive]
880    pub enum Payload {
881        /// The log entry payload, represented as a protocol buffer. Some Google
882        /// Cloud Platform services use this field for their log entry payloads.
883        ///
884        /// The following protocol buffer types are supported; user-defined types
885        /// are not supported:
886        ///
887        /// "type.googleapis.com/google.cloud.audit.AuditLog"
888        /// "type.googleapis.com/google.appengine.logging.v1.RequestLog"
889        ProtoPayload(std::boxed::Box<wkt::Any>),
890        /// The log entry payload, represented as a Unicode string (UTF-8).
891        TextPayload(std::string::String),
892        /// The log entry payload, represented as a structure that is
893        /// expressed as a JSON object.
894        JsonPayload(std::boxed::Box<wkt::Struct>),
895    }
896}
897
898/// Additional information about a potentially long-running operation with which
899/// a log entry is associated.
900#[derive(Clone, Default, PartialEq)]
901#[non_exhaustive]
902pub struct LogEntryOperation {
903    /// Optional. An arbitrary operation identifier. Log entries with the same
904    /// identifier are assumed to be part of the same operation.
905    pub id: std::string::String,
906
907    /// Optional. An arbitrary producer identifier. The combination of `id` and
908    /// `producer` must be globally unique. Examples for `producer`:
909    /// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
910    pub producer: std::string::String,
911
912    /// Optional. Set this to True if this is the first log entry in the operation.
913    pub first: bool,
914
915    /// Optional. Set this to True if this is the last log entry in the operation.
916    pub last: bool,
917
918    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
919}
920
921impl LogEntryOperation {
922    pub fn new() -> Self {
923        std::default::Default::default()
924    }
925
926    /// Sets the value of [id][crate::model::LogEntryOperation::id].
927    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
928        self.id = v.into();
929        self
930    }
931
932    /// Sets the value of [producer][crate::model::LogEntryOperation::producer].
933    pub fn set_producer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
934        self.producer = v.into();
935        self
936    }
937
938    /// Sets the value of [first][crate::model::LogEntryOperation::first].
939    pub fn set_first<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
940        self.first = v.into();
941        self
942    }
943
944    /// Sets the value of [last][crate::model::LogEntryOperation::last].
945    pub fn set_last<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
946        self.last = v.into();
947        self
948    }
949}
950
951impl wkt::message::Message for LogEntryOperation {
952    fn typename() -> &'static str {
953        "type.googleapis.com/google.logging.v2.LogEntryOperation"
954    }
955}
956
957#[doc(hidden)]
958impl<'de> serde::de::Deserialize<'de> for LogEntryOperation {
959    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
960    where
961        D: serde::Deserializer<'de>,
962    {
963        #[allow(non_camel_case_types)]
964        #[doc(hidden)]
965        #[derive(PartialEq, Eq, Hash)]
966        enum __FieldTag {
967            __id,
968            __producer,
969            __first,
970            __last,
971            Unknown(std::string::String),
972        }
973        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
974            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
975            where
976                D: serde::Deserializer<'de>,
977            {
978                struct Visitor;
979                impl<'de> serde::de::Visitor<'de> for Visitor {
980                    type Value = __FieldTag;
981                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
982                        formatter.write_str("a field name for LogEntryOperation")
983                    }
984                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
985                    where
986                        E: serde::de::Error,
987                    {
988                        use std::result::Result::Ok;
989                        use std::string::ToString;
990                        match value {
991                            "id" => Ok(__FieldTag::__id),
992                            "producer" => Ok(__FieldTag::__producer),
993                            "first" => Ok(__FieldTag::__first),
994                            "last" => Ok(__FieldTag::__last),
995                            _ => Ok(__FieldTag::Unknown(value.to_string())),
996                        }
997                    }
998                }
999                deserializer.deserialize_identifier(Visitor)
1000            }
1001        }
1002        struct Visitor;
1003        impl<'de> serde::de::Visitor<'de> for Visitor {
1004            type Value = LogEntryOperation;
1005            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1006                formatter.write_str("struct LogEntryOperation")
1007            }
1008            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1009            where
1010                A: serde::de::MapAccess<'de>,
1011            {
1012                #[allow(unused_imports)]
1013                use serde::de::Error;
1014                use std::option::Option::Some;
1015                let mut fields = std::collections::HashSet::new();
1016                let mut result = Self::Value::new();
1017                while let Some(tag) = map.next_key::<__FieldTag>()? {
1018                    #[allow(clippy::match_single_binding)]
1019                    match tag {
1020                        __FieldTag::__id => {
1021                            if !fields.insert(__FieldTag::__id) {
1022                                return std::result::Result::Err(A::Error::duplicate_field(
1023                                    "multiple values for id",
1024                                ));
1025                            }
1026                            result.id = map
1027                                .next_value::<std::option::Option<std::string::String>>()?
1028                                .unwrap_or_default();
1029                        }
1030                        __FieldTag::__producer => {
1031                            if !fields.insert(__FieldTag::__producer) {
1032                                return std::result::Result::Err(A::Error::duplicate_field(
1033                                    "multiple values for producer",
1034                                ));
1035                            }
1036                            result.producer = map
1037                                .next_value::<std::option::Option<std::string::String>>()?
1038                                .unwrap_or_default();
1039                        }
1040                        __FieldTag::__first => {
1041                            if !fields.insert(__FieldTag::__first) {
1042                                return std::result::Result::Err(A::Error::duplicate_field(
1043                                    "multiple values for first",
1044                                ));
1045                            }
1046                            result.first = map
1047                                .next_value::<std::option::Option<bool>>()?
1048                                .unwrap_or_default();
1049                        }
1050                        __FieldTag::__last => {
1051                            if !fields.insert(__FieldTag::__last) {
1052                                return std::result::Result::Err(A::Error::duplicate_field(
1053                                    "multiple values for last",
1054                                ));
1055                            }
1056                            result.last = map
1057                                .next_value::<std::option::Option<bool>>()?
1058                                .unwrap_or_default();
1059                        }
1060                        __FieldTag::Unknown(key) => {
1061                            let value = map.next_value::<serde_json::Value>()?;
1062                            result._unknown_fields.insert(key, value);
1063                        }
1064                    }
1065                }
1066                std::result::Result::Ok(result)
1067            }
1068        }
1069        deserializer.deserialize_any(Visitor)
1070    }
1071}
1072
1073#[doc(hidden)]
1074impl serde::ser::Serialize for LogEntryOperation {
1075    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1076    where
1077        S: serde::ser::Serializer,
1078    {
1079        use serde::ser::SerializeMap;
1080        #[allow(unused_imports)]
1081        use std::option::Option::Some;
1082        let mut state = serializer.serialize_map(std::option::Option::None)?;
1083        if !self.id.is_empty() {
1084            state.serialize_entry("id", &self.id)?;
1085        }
1086        if !self.producer.is_empty() {
1087            state.serialize_entry("producer", &self.producer)?;
1088        }
1089        if !wkt::internal::is_default(&self.first) {
1090            state.serialize_entry("first", &self.first)?;
1091        }
1092        if !wkt::internal::is_default(&self.last) {
1093            state.serialize_entry("last", &self.last)?;
1094        }
1095        if !self._unknown_fields.is_empty() {
1096            for (key, value) in self._unknown_fields.iter() {
1097                state.serialize_entry(key, &value)?;
1098            }
1099        }
1100        state.end()
1101    }
1102}
1103
1104impl std::fmt::Debug for LogEntryOperation {
1105    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1106        let mut debug_struct = f.debug_struct("LogEntryOperation");
1107        debug_struct.field("id", &self.id);
1108        debug_struct.field("producer", &self.producer);
1109        debug_struct.field("first", &self.first);
1110        debug_struct.field("last", &self.last);
1111        if !self._unknown_fields.is_empty() {
1112            debug_struct.field("_unknown_fields", &self._unknown_fields);
1113        }
1114        debug_struct.finish()
1115    }
1116}
1117
1118/// Additional information about the source code location that produced the log
1119/// entry.
1120#[derive(Clone, Default, PartialEq)]
1121#[non_exhaustive]
1122pub struct LogEntrySourceLocation {
1123    /// Optional. Source file name. Depending on the runtime environment, this
1124    /// might be a simple name or a fully-qualified name.
1125    pub file: std::string::String,
1126
1127    /// Optional. Line within the source file. 1-based; 0 indicates no line number
1128    /// available.
1129    pub line: i64,
1130
1131    /// Optional. Human-readable name of the function or method being invoked, with
1132    /// optional context such as the class or package name. This information may be
1133    /// used in contexts such as the logs viewer, where a file and line number are
1134    /// less meaningful. The format can vary by language. For example:
1135    /// `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
1136    /// (Python).
1137    pub function: std::string::String,
1138
1139    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1140}
1141
1142impl LogEntrySourceLocation {
1143    pub fn new() -> Self {
1144        std::default::Default::default()
1145    }
1146
1147    /// Sets the value of [file][crate::model::LogEntrySourceLocation::file].
1148    pub fn set_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1149        self.file = v.into();
1150        self
1151    }
1152
1153    /// Sets the value of [line][crate::model::LogEntrySourceLocation::line].
1154    pub fn set_line<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1155        self.line = v.into();
1156        self
1157    }
1158
1159    /// Sets the value of [function][crate::model::LogEntrySourceLocation::function].
1160    pub fn set_function<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1161        self.function = v.into();
1162        self
1163    }
1164}
1165
1166impl wkt::message::Message for LogEntrySourceLocation {
1167    fn typename() -> &'static str {
1168        "type.googleapis.com/google.logging.v2.LogEntrySourceLocation"
1169    }
1170}
1171
1172#[doc(hidden)]
1173impl<'de> serde::de::Deserialize<'de> for LogEntrySourceLocation {
1174    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1175    where
1176        D: serde::Deserializer<'de>,
1177    {
1178        #[allow(non_camel_case_types)]
1179        #[doc(hidden)]
1180        #[derive(PartialEq, Eq, Hash)]
1181        enum __FieldTag {
1182            __file,
1183            __line,
1184            __function,
1185            Unknown(std::string::String),
1186        }
1187        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1188            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1189            where
1190                D: serde::Deserializer<'de>,
1191            {
1192                struct Visitor;
1193                impl<'de> serde::de::Visitor<'de> for Visitor {
1194                    type Value = __FieldTag;
1195                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1196                        formatter.write_str("a field name for LogEntrySourceLocation")
1197                    }
1198                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1199                    where
1200                        E: serde::de::Error,
1201                    {
1202                        use std::result::Result::Ok;
1203                        use std::string::ToString;
1204                        match value {
1205                            "file" => Ok(__FieldTag::__file),
1206                            "line" => Ok(__FieldTag::__line),
1207                            "function" => Ok(__FieldTag::__function),
1208                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1209                        }
1210                    }
1211                }
1212                deserializer.deserialize_identifier(Visitor)
1213            }
1214        }
1215        struct Visitor;
1216        impl<'de> serde::de::Visitor<'de> for Visitor {
1217            type Value = LogEntrySourceLocation;
1218            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1219                formatter.write_str("struct LogEntrySourceLocation")
1220            }
1221            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1222            where
1223                A: serde::de::MapAccess<'de>,
1224            {
1225                #[allow(unused_imports)]
1226                use serde::de::Error;
1227                use std::option::Option::Some;
1228                let mut fields = std::collections::HashSet::new();
1229                let mut result = Self::Value::new();
1230                while let Some(tag) = map.next_key::<__FieldTag>()? {
1231                    #[allow(clippy::match_single_binding)]
1232                    match tag {
1233                        __FieldTag::__file => {
1234                            if !fields.insert(__FieldTag::__file) {
1235                                return std::result::Result::Err(A::Error::duplicate_field(
1236                                    "multiple values for file",
1237                                ));
1238                            }
1239                            result.file = map
1240                                .next_value::<std::option::Option<std::string::String>>()?
1241                                .unwrap_or_default();
1242                        }
1243                        __FieldTag::__line => {
1244                            if !fields.insert(__FieldTag::__line) {
1245                                return std::result::Result::Err(A::Error::duplicate_field(
1246                                    "multiple values for line",
1247                                ));
1248                            }
1249                            struct __With(std::option::Option<i64>);
1250                            impl<'de> serde::de::Deserialize<'de> for __With {
1251                                fn deserialize<D>(
1252                                    deserializer: D,
1253                                ) -> std::result::Result<Self, D::Error>
1254                                where
1255                                    D: serde::de::Deserializer<'de>,
1256                                {
1257                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
1258                                }
1259                            }
1260                            result.line = map.next_value::<__With>()?.0.unwrap_or_default();
1261                        }
1262                        __FieldTag::__function => {
1263                            if !fields.insert(__FieldTag::__function) {
1264                                return std::result::Result::Err(A::Error::duplicate_field(
1265                                    "multiple values for function",
1266                                ));
1267                            }
1268                            result.function = map
1269                                .next_value::<std::option::Option<std::string::String>>()?
1270                                .unwrap_or_default();
1271                        }
1272                        __FieldTag::Unknown(key) => {
1273                            let value = map.next_value::<serde_json::Value>()?;
1274                            result._unknown_fields.insert(key, value);
1275                        }
1276                    }
1277                }
1278                std::result::Result::Ok(result)
1279            }
1280        }
1281        deserializer.deserialize_any(Visitor)
1282    }
1283}
1284
1285#[doc(hidden)]
1286impl serde::ser::Serialize for LogEntrySourceLocation {
1287    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1288    where
1289        S: serde::ser::Serializer,
1290    {
1291        use serde::ser::SerializeMap;
1292        #[allow(unused_imports)]
1293        use std::option::Option::Some;
1294        let mut state = serializer.serialize_map(std::option::Option::None)?;
1295        if !self.file.is_empty() {
1296            state.serialize_entry("file", &self.file)?;
1297        }
1298        if !wkt::internal::is_default(&self.line) {
1299            struct __With<'a>(&'a i64);
1300            impl<'a> serde::ser::Serialize for __With<'a> {
1301                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1302                where
1303                    S: serde::ser::Serializer,
1304                {
1305                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1306                }
1307            }
1308            state.serialize_entry("line", &__With(&self.line))?;
1309        }
1310        if !self.function.is_empty() {
1311            state.serialize_entry("function", &self.function)?;
1312        }
1313        if !self._unknown_fields.is_empty() {
1314            for (key, value) in self._unknown_fields.iter() {
1315                state.serialize_entry(key, &value)?;
1316            }
1317        }
1318        state.end()
1319    }
1320}
1321
1322impl std::fmt::Debug for LogEntrySourceLocation {
1323    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1324        let mut debug_struct = f.debug_struct("LogEntrySourceLocation");
1325        debug_struct.field("file", &self.file);
1326        debug_struct.field("line", &self.line);
1327        debug_struct.field("function", &self.function);
1328        if !self._unknown_fields.is_empty() {
1329            debug_struct.field("_unknown_fields", &self._unknown_fields);
1330        }
1331        debug_struct.finish()
1332    }
1333}
1334
1335/// Additional information used to correlate multiple log entries. Used when a
1336/// single LogEntry would exceed the Google Cloud Logging size limit and is
1337/// split across multiple log entries.
1338#[derive(Clone, Default, PartialEq)]
1339#[non_exhaustive]
1340pub struct LogSplit {
1341    /// A globally unique identifier for all log entries in a sequence of split log
1342    /// entries. All log entries with the same |LogSplit.uid| are assumed to be
1343    /// part of the same sequence of split log entries.
1344    pub uid: std::string::String,
1345
1346    /// The index of this LogEntry in the sequence of split log entries. Log
1347    /// entries are given |index| values 0, 1, ..., n-1 for a sequence of n log
1348    /// entries.
1349    pub index: i32,
1350
1351    /// The total number of log entries that the original LogEntry was split into.
1352    pub total_splits: i32,
1353
1354    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1355}
1356
1357impl LogSplit {
1358    pub fn new() -> Self {
1359        std::default::Default::default()
1360    }
1361
1362    /// Sets the value of [uid][crate::model::LogSplit::uid].
1363    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1364        self.uid = v.into();
1365        self
1366    }
1367
1368    /// Sets the value of [index][crate::model::LogSplit::index].
1369    pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1370        self.index = v.into();
1371        self
1372    }
1373
1374    /// Sets the value of [total_splits][crate::model::LogSplit::total_splits].
1375    pub fn set_total_splits<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1376        self.total_splits = v.into();
1377        self
1378    }
1379}
1380
1381impl wkt::message::Message for LogSplit {
1382    fn typename() -> &'static str {
1383        "type.googleapis.com/google.logging.v2.LogSplit"
1384    }
1385}
1386
1387#[doc(hidden)]
1388impl<'de> serde::de::Deserialize<'de> for LogSplit {
1389    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1390    where
1391        D: serde::Deserializer<'de>,
1392    {
1393        #[allow(non_camel_case_types)]
1394        #[doc(hidden)]
1395        #[derive(PartialEq, Eq, Hash)]
1396        enum __FieldTag {
1397            __uid,
1398            __index,
1399            __total_splits,
1400            Unknown(std::string::String),
1401        }
1402        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1403            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1404            where
1405                D: serde::Deserializer<'de>,
1406            {
1407                struct Visitor;
1408                impl<'de> serde::de::Visitor<'de> for Visitor {
1409                    type Value = __FieldTag;
1410                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1411                        formatter.write_str("a field name for LogSplit")
1412                    }
1413                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1414                    where
1415                        E: serde::de::Error,
1416                    {
1417                        use std::result::Result::Ok;
1418                        use std::string::ToString;
1419                        match value {
1420                            "uid" => Ok(__FieldTag::__uid),
1421                            "index" => Ok(__FieldTag::__index),
1422                            "totalSplits" => Ok(__FieldTag::__total_splits),
1423                            "total_splits" => Ok(__FieldTag::__total_splits),
1424                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1425                        }
1426                    }
1427                }
1428                deserializer.deserialize_identifier(Visitor)
1429            }
1430        }
1431        struct Visitor;
1432        impl<'de> serde::de::Visitor<'de> for Visitor {
1433            type Value = LogSplit;
1434            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1435                formatter.write_str("struct LogSplit")
1436            }
1437            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1438            where
1439                A: serde::de::MapAccess<'de>,
1440            {
1441                #[allow(unused_imports)]
1442                use serde::de::Error;
1443                use std::option::Option::Some;
1444                let mut fields = std::collections::HashSet::new();
1445                let mut result = Self::Value::new();
1446                while let Some(tag) = map.next_key::<__FieldTag>()? {
1447                    #[allow(clippy::match_single_binding)]
1448                    match tag {
1449                        __FieldTag::__uid => {
1450                            if !fields.insert(__FieldTag::__uid) {
1451                                return std::result::Result::Err(A::Error::duplicate_field(
1452                                    "multiple values for uid",
1453                                ));
1454                            }
1455                            result.uid = map
1456                                .next_value::<std::option::Option<std::string::String>>()?
1457                                .unwrap_or_default();
1458                        }
1459                        __FieldTag::__index => {
1460                            if !fields.insert(__FieldTag::__index) {
1461                                return std::result::Result::Err(A::Error::duplicate_field(
1462                                    "multiple values for index",
1463                                ));
1464                            }
1465                            struct __With(std::option::Option<i32>);
1466                            impl<'de> serde::de::Deserialize<'de> for __With {
1467                                fn deserialize<D>(
1468                                    deserializer: D,
1469                                ) -> std::result::Result<Self, D::Error>
1470                                where
1471                                    D: serde::de::Deserializer<'de>,
1472                                {
1473                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1474                                }
1475                            }
1476                            result.index = map.next_value::<__With>()?.0.unwrap_or_default();
1477                        }
1478                        __FieldTag::__total_splits => {
1479                            if !fields.insert(__FieldTag::__total_splits) {
1480                                return std::result::Result::Err(A::Error::duplicate_field(
1481                                    "multiple values for total_splits",
1482                                ));
1483                            }
1484                            struct __With(std::option::Option<i32>);
1485                            impl<'de> serde::de::Deserialize<'de> for __With {
1486                                fn deserialize<D>(
1487                                    deserializer: D,
1488                                ) -> std::result::Result<Self, D::Error>
1489                                where
1490                                    D: serde::de::Deserializer<'de>,
1491                                {
1492                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1493                                }
1494                            }
1495                            result.total_splits = map.next_value::<__With>()?.0.unwrap_or_default();
1496                        }
1497                        __FieldTag::Unknown(key) => {
1498                            let value = map.next_value::<serde_json::Value>()?;
1499                            result._unknown_fields.insert(key, value);
1500                        }
1501                    }
1502                }
1503                std::result::Result::Ok(result)
1504            }
1505        }
1506        deserializer.deserialize_any(Visitor)
1507    }
1508}
1509
1510#[doc(hidden)]
1511impl serde::ser::Serialize for LogSplit {
1512    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1513    where
1514        S: serde::ser::Serializer,
1515    {
1516        use serde::ser::SerializeMap;
1517        #[allow(unused_imports)]
1518        use std::option::Option::Some;
1519        let mut state = serializer.serialize_map(std::option::Option::None)?;
1520        if !self.uid.is_empty() {
1521            state.serialize_entry("uid", &self.uid)?;
1522        }
1523        if !wkt::internal::is_default(&self.index) {
1524            struct __With<'a>(&'a i32);
1525            impl<'a> serde::ser::Serialize for __With<'a> {
1526                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1527                where
1528                    S: serde::ser::Serializer,
1529                {
1530                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1531                }
1532            }
1533            state.serialize_entry("index", &__With(&self.index))?;
1534        }
1535        if !wkt::internal::is_default(&self.total_splits) {
1536            struct __With<'a>(&'a i32);
1537            impl<'a> serde::ser::Serialize for __With<'a> {
1538                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1539                where
1540                    S: serde::ser::Serializer,
1541                {
1542                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1543                }
1544            }
1545            state.serialize_entry("totalSplits", &__With(&self.total_splits))?;
1546        }
1547        if !self._unknown_fields.is_empty() {
1548            for (key, value) in self._unknown_fields.iter() {
1549                state.serialize_entry(key, &value)?;
1550            }
1551        }
1552        state.end()
1553    }
1554}
1555
1556impl std::fmt::Debug for LogSplit {
1557    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1558        let mut debug_struct = f.debug_struct("LogSplit");
1559        debug_struct.field("uid", &self.uid);
1560        debug_struct.field("index", &self.index);
1561        debug_struct.field("total_splits", &self.total_splits);
1562        if !self._unknown_fields.is_empty() {
1563            debug_struct.field("_unknown_fields", &self._unknown_fields);
1564        }
1565        debug_struct.finish()
1566    }
1567}
1568
1569/// The parameters to DeleteLog.
1570#[derive(Clone, Default, PartialEq)]
1571#[non_exhaustive]
1572pub struct DeleteLogRequest {
1573    /// Required. The resource name of the log to delete:
1574    ///
1575    /// * `projects/[PROJECT_ID]/logs/[LOG_ID]`
1576    /// * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]`
1577    /// * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]`
1578    /// * `folders/[FOLDER_ID]/logs/[LOG_ID]`
1579    ///
1580    /// `[LOG_ID]` must be URL-encoded. For example,
1581    /// `"projects/my-project-id/logs/syslog"`,
1582    /// `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`.
1583    ///
1584    /// For more information about log names, see
1585    /// [LogEntry][google.logging.v2.LogEntry].
1586    ///
1587    /// [google.logging.v2.LogEntry]: crate::model::LogEntry
1588    pub log_name: std::string::String,
1589
1590    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1591}
1592
1593impl DeleteLogRequest {
1594    pub fn new() -> Self {
1595        std::default::Default::default()
1596    }
1597
1598    /// Sets the value of [log_name][crate::model::DeleteLogRequest::log_name].
1599    pub fn set_log_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1600        self.log_name = v.into();
1601        self
1602    }
1603}
1604
1605impl wkt::message::Message for DeleteLogRequest {
1606    fn typename() -> &'static str {
1607        "type.googleapis.com/google.logging.v2.DeleteLogRequest"
1608    }
1609}
1610
1611#[doc(hidden)]
1612impl<'de> serde::de::Deserialize<'de> for DeleteLogRequest {
1613    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1614    where
1615        D: serde::Deserializer<'de>,
1616    {
1617        #[allow(non_camel_case_types)]
1618        #[doc(hidden)]
1619        #[derive(PartialEq, Eq, Hash)]
1620        enum __FieldTag {
1621            __log_name,
1622            Unknown(std::string::String),
1623        }
1624        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1625            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1626            where
1627                D: serde::Deserializer<'de>,
1628            {
1629                struct Visitor;
1630                impl<'de> serde::de::Visitor<'de> for Visitor {
1631                    type Value = __FieldTag;
1632                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1633                        formatter.write_str("a field name for DeleteLogRequest")
1634                    }
1635                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1636                    where
1637                        E: serde::de::Error,
1638                    {
1639                        use std::result::Result::Ok;
1640                        use std::string::ToString;
1641                        match value {
1642                            "logName" => Ok(__FieldTag::__log_name),
1643                            "log_name" => Ok(__FieldTag::__log_name),
1644                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1645                        }
1646                    }
1647                }
1648                deserializer.deserialize_identifier(Visitor)
1649            }
1650        }
1651        struct Visitor;
1652        impl<'de> serde::de::Visitor<'de> for Visitor {
1653            type Value = DeleteLogRequest;
1654            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1655                formatter.write_str("struct DeleteLogRequest")
1656            }
1657            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1658            where
1659                A: serde::de::MapAccess<'de>,
1660            {
1661                #[allow(unused_imports)]
1662                use serde::de::Error;
1663                use std::option::Option::Some;
1664                let mut fields = std::collections::HashSet::new();
1665                let mut result = Self::Value::new();
1666                while let Some(tag) = map.next_key::<__FieldTag>()? {
1667                    #[allow(clippy::match_single_binding)]
1668                    match tag {
1669                        __FieldTag::__log_name => {
1670                            if !fields.insert(__FieldTag::__log_name) {
1671                                return std::result::Result::Err(A::Error::duplicate_field(
1672                                    "multiple values for log_name",
1673                                ));
1674                            }
1675                            result.log_name = map
1676                                .next_value::<std::option::Option<std::string::String>>()?
1677                                .unwrap_or_default();
1678                        }
1679                        __FieldTag::Unknown(key) => {
1680                            let value = map.next_value::<serde_json::Value>()?;
1681                            result._unknown_fields.insert(key, value);
1682                        }
1683                    }
1684                }
1685                std::result::Result::Ok(result)
1686            }
1687        }
1688        deserializer.deserialize_any(Visitor)
1689    }
1690}
1691
1692#[doc(hidden)]
1693impl serde::ser::Serialize for DeleteLogRequest {
1694    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1695    where
1696        S: serde::ser::Serializer,
1697    {
1698        use serde::ser::SerializeMap;
1699        #[allow(unused_imports)]
1700        use std::option::Option::Some;
1701        let mut state = serializer.serialize_map(std::option::Option::None)?;
1702        if !self.log_name.is_empty() {
1703            state.serialize_entry("logName", &self.log_name)?;
1704        }
1705        if !self._unknown_fields.is_empty() {
1706            for (key, value) in self._unknown_fields.iter() {
1707                state.serialize_entry(key, &value)?;
1708            }
1709        }
1710        state.end()
1711    }
1712}
1713
1714impl std::fmt::Debug for DeleteLogRequest {
1715    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1716        let mut debug_struct = f.debug_struct("DeleteLogRequest");
1717        debug_struct.field("log_name", &self.log_name);
1718        if !self._unknown_fields.is_empty() {
1719            debug_struct.field("_unknown_fields", &self._unknown_fields);
1720        }
1721        debug_struct.finish()
1722    }
1723}
1724
1725/// The parameters to WriteLogEntries.
1726#[derive(Clone, Default, PartialEq)]
1727#[non_exhaustive]
1728pub struct WriteLogEntriesRequest {
1729    /// Optional. A default log resource name that is assigned to all log entries
1730    /// in `entries` that do not specify a value for `log_name`:
1731    ///
1732    /// * `projects/[PROJECT_ID]/logs/[LOG_ID]`
1733    /// * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]`
1734    /// * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]`
1735    /// * `folders/[FOLDER_ID]/logs/[LOG_ID]`
1736    ///
1737    /// `[LOG_ID]` must be URL-encoded. For example:
1738    ///
1739    /// ```norust
1740    /// "projects/my-project-id/logs/syslog"
1741    /// "organizations/123/logs/cloudaudit.googleapis.com%2Factivity"
1742    /// ```
1743    ///
1744    /// The permission `logging.logEntries.create` is needed on each project,
1745    /// organization, billing account, or folder that is receiving new log
1746    /// entries, whether the resource is specified in `logName` or in an
1747    /// individual log entry.
1748    pub log_name: std::string::String,
1749
1750    /// Optional. A default monitored resource object that is assigned to all log
1751    /// entries in `entries` that do not specify a value for `resource`. Example:
1752    ///
1753    /// ```norust
1754    /// { "type": "gce_instance",
1755    ///   "labels": {
1756    ///     "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
1757    /// ```
1758    ///
1759    /// See [LogEntry][google.logging.v2.LogEntry].
1760    ///
1761    /// [google.logging.v2.LogEntry]: crate::model::LogEntry
1762    pub resource: std::option::Option<api::model::MonitoredResource>,
1763
1764    /// Optional. Default labels that are added to the `labels` field of all log
1765    /// entries in `entries`. If a log entry already has a label with the same key
1766    /// as a label in this parameter, then the log entry's label is not changed.
1767    /// See [LogEntry][google.logging.v2.LogEntry].
1768    ///
1769    /// [google.logging.v2.LogEntry]: crate::model::LogEntry
1770    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1771
1772    /// Required. The log entries to send to Logging. The order of log
1773    /// entries in this list does not matter. Values supplied in this method's
1774    /// `log_name`, `resource`, and `labels` fields are copied into those log
1775    /// entries in this list that do not include values for their corresponding
1776    /// fields. For more information, see the
1777    /// [LogEntry][google.logging.v2.LogEntry] type.
1778    ///
1779    /// If the `timestamp` or `insert_id` fields are missing in log entries, then
1780    /// this method supplies the current time or a unique identifier, respectively.
1781    /// The supplied values are chosen so that, among the log entries that did not
1782    /// supply their own values, the entries earlier in the list will sort before
1783    /// the entries later in the list. See the `entries.list` method.
1784    ///
1785    /// Log entries with timestamps that are more than the
1786    /// [logs retention period](https://cloud.google.com/logging/quotas) in
1787    /// the past or more than 24 hours in the future will not be available when
1788    /// calling `entries.list`. However, those log entries can still be [exported
1789    /// with
1790    /// LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
1791    ///
1792    /// To improve throughput and to avoid exceeding the
1793    /// [quota limit](https://cloud.google.com/logging/quotas) for calls to
1794    /// `entries.write`, you should try to include several log entries in this
1795    /// list, rather than calling this method for each individual log entry.
1796    ///
1797    /// [google.logging.v2.LogEntry]: crate::model::LogEntry
1798    pub entries: std::vec::Vec<crate::model::LogEntry>,
1799
1800    /// Optional. Whether a batch's valid entries should be written even if some
1801    /// other entry failed due to a permanent error such as INVALID_ARGUMENT or
1802    /// PERMISSION_DENIED. If any entry failed, then the response status is the
1803    /// response status of one of the failed entries. The response will include
1804    /// error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by
1805    /// the entries' zero-based index in the `entries`. Failed requests for which
1806    /// no entries are written will not include per-entry errors.
1807    pub partial_success: bool,
1808
1809    /// Optional. If true, the request should expect normal response, but the
1810    /// entries won't be persisted nor exported. Useful for checking whether the
1811    /// logging API endpoints are working properly before sending valuable data.
1812    pub dry_run: bool,
1813
1814    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1815}
1816
1817impl WriteLogEntriesRequest {
1818    pub fn new() -> Self {
1819        std::default::Default::default()
1820    }
1821
1822    /// Sets the value of [log_name][crate::model::WriteLogEntriesRequest::log_name].
1823    pub fn set_log_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1824        self.log_name = v.into();
1825        self
1826    }
1827
1828    /// Sets the value of [resource][crate::model::WriteLogEntriesRequest::resource].
1829    pub fn set_resource<T>(mut self, v: T) -> Self
1830    where
1831        T: std::convert::Into<api::model::MonitoredResource>,
1832    {
1833        self.resource = std::option::Option::Some(v.into());
1834        self
1835    }
1836
1837    /// Sets or clears the value of [resource][crate::model::WriteLogEntriesRequest::resource].
1838    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
1839    where
1840        T: std::convert::Into<api::model::MonitoredResource>,
1841    {
1842        self.resource = v.map(|x| x.into());
1843        self
1844    }
1845
1846    /// Sets the value of [labels][crate::model::WriteLogEntriesRequest::labels].
1847    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1848    where
1849        T: std::iter::IntoIterator<Item = (K, V)>,
1850        K: std::convert::Into<std::string::String>,
1851        V: std::convert::Into<std::string::String>,
1852    {
1853        use std::iter::Iterator;
1854        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1855        self
1856    }
1857
1858    /// Sets the value of [entries][crate::model::WriteLogEntriesRequest::entries].
1859    pub fn set_entries<T, V>(mut self, v: T) -> Self
1860    where
1861        T: std::iter::IntoIterator<Item = V>,
1862        V: std::convert::Into<crate::model::LogEntry>,
1863    {
1864        use std::iter::Iterator;
1865        self.entries = v.into_iter().map(|i| i.into()).collect();
1866        self
1867    }
1868
1869    /// Sets the value of [partial_success][crate::model::WriteLogEntriesRequest::partial_success].
1870    pub fn set_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1871        self.partial_success = v.into();
1872        self
1873    }
1874
1875    /// Sets the value of [dry_run][crate::model::WriteLogEntriesRequest::dry_run].
1876    pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1877        self.dry_run = v.into();
1878        self
1879    }
1880}
1881
1882impl wkt::message::Message for WriteLogEntriesRequest {
1883    fn typename() -> &'static str {
1884        "type.googleapis.com/google.logging.v2.WriteLogEntriesRequest"
1885    }
1886}
1887
1888#[doc(hidden)]
1889impl<'de> serde::de::Deserialize<'de> for WriteLogEntriesRequest {
1890    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1891    where
1892        D: serde::Deserializer<'de>,
1893    {
1894        #[allow(non_camel_case_types)]
1895        #[doc(hidden)]
1896        #[derive(PartialEq, Eq, Hash)]
1897        enum __FieldTag {
1898            __log_name,
1899            __resource,
1900            __labels,
1901            __entries,
1902            __partial_success,
1903            __dry_run,
1904            Unknown(std::string::String),
1905        }
1906        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1907            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1908            where
1909                D: serde::Deserializer<'de>,
1910            {
1911                struct Visitor;
1912                impl<'de> serde::de::Visitor<'de> for Visitor {
1913                    type Value = __FieldTag;
1914                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1915                        formatter.write_str("a field name for WriteLogEntriesRequest")
1916                    }
1917                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1918                    where
1919                        E: serde::de::Error,
1920                    {
1921                        use std::result::Result::Ok;
1922                        use std::string::ToString;
1923                        match value {
1924                            "logName" => Ok(__FieldTag::__log_name),
1925                            "log_name" => Ok(__FieldTag::__log_name),
1926                            "resource" => Ok(__FieldTag::__resource),
1927                            "labels" => Ok(__FieldTag::__labels),
1928                            "entries" => Ok(__FieldTag::__entries),
1929                            "partialSuccess" => Ok(__FieldTag::__partial_success),
1930                            "partial_success" => Ok(__FieldTag::__partial_success),
1931                            "dryRun" => Ok(__FieldTag::__dry_run),
1932                            "dry_run" => Ok(__FieldTag::__dry_run),
1933                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1934                        }
1935                    }
1936                }
1937                deserializer.deserialize_identifier(Visitor)
1938            }
1939        }
1940        struct Visitor;
1941        impl<'de> serde::de::Visitor<'de> for Visitor {
1942            type Value = WriteLogEntriesRequest;
1943            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1944                formatter.write_str("struct WriteLogEntriesRequest")
1945            }
1946            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1947            where
1948                A: serde::de::MapAccess<'de>,
1949            {
1950                #[allow(unused_imports)]
1951                use serde::de::Error;
1952                use std::option::Option::Some;
1953                let mut fields = std::collections::HashSet::new();
1954                let mut result = Self::Value::new();
1955                while let Some(tag) = map.next_key::<__FieldTag>()? {
1956                    #[allow(clippy::match_single_binding)]
1957                    match tag {
1958                        __FieldTag::__log_name => {
1959                            if !fields.insert(__FieldTag::__log_name) {
1960                                return std::result::Result::Err(A::Error::duplicate_field(
1961                                    "multiple values for log_name",
1962                                ));
1963                            }
1964                            result.log_name = map
1965                                .next_value::<std::option::Option<std::string::String>>()?
1966                                .unwrap_or_default();
1967                        }
1968                        __FieldTag::__resource => {
1969                            if !fields.insert(__FieldTag::__resource) {
1970                                return std::result::Result::Err(A::Error::duplicate_field(
1971                                    "multiple values for resource",
1972                                ));
1973                            }
1974                            result.resource = map
1975                                .next_value::<std::option::Option<api::model::MonitoredResource>>(
1976                                )?;
1977                        }
1978                        __FieldTag::__labels => {
1979                            if !fields.insert(__FieldTag::__labels) {
1980                                return std::result::Result::Err(A::Error::duplicate_field(
1981                                    "multiple values for labels",
1982                                ));
1983                            }
1984                            result.labels = map
1985                                .next_value::<std::option::Option<
1986                                    std::collections::HashMap<
1987                                        std::string::String,
1988                                        std::string::String,
1989                                    >,
1990                                >>()?
1991                                .unwrap_or_default();
1992                        }
1993                        __FieldTag::__entries => {
1994                            if !fields.insert(__FieldTag::__entries) {
1995                                return std::result::Result::Err(A::Error::duplicate_field(
1996                                    "multiple values for entries",
1997                                ));
1998                            }
1999                            result.entries = map.next_value::<std::option::Option<std::vec::Vec<crate::model::LogEntry>>>()?.unwrap_or_default();
2000                        }
2001                        __FieldTag::__partial_success => {
2002                            if !fields.insert(__FieldTag::__partial_success) {
2003                                return std::result::Result::Err(A::Error::duplicate_field(
2004                                    "multiple values for partial_success",
2005                                ));
2006                            }
2007                            result.partial_success = map
2008                                .next_value::<std::option::Option<bool>>()?
2009                                .unwrap_or_default();
2010                        }
2011                        __FieldTag::__dry_run => {
2012                            if !fields.insert(__FieldTag::__dry_run) {
2013                                return std::result::Result::Err(A::Error::duplicate_field(
2014                                    "multiple values for dry_run",
2015                                ));
2016                            }
2017                            result.dry_run = map
2018                                .next_value::<std::option::Option<bool>>()?
2019                                .unwrap_or_default();
2020                        }
2021                        __FieldTag::Unknown(key) => {
2022                            let value = map.next_value::<serde_json::Value>()?;
2023                            result._unknown_fields.insert(key, value);
2024                        }
2025                    }
2026                }
2027                std::result::Result::Ok(result)
2028            }
2029        }
2030        deserializer.deserialize_any(Visitor)
2031    }
2032}
2033
2034#[doc(hidden)]
2035impl serde::ser::Serialize for WriteLogEntriesRequest {
2036    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2037    where
2038        S: serde::ser::Serializer,
2039    {
2040        use serde::ser::SerializeMap;
2041        #[allow(unused_imports)]
2042        use std::option::Option::Some;
2043        let mut state = serializer.serialize_map(std::option::Option::None)?;
2044        if !self.log_name.is_empty() {
2045            state.serialize_entry("logName", &self.log_name)?;
2046        }
2047        if self.resource.is_some() {
2048            state.serialize_entry("resource", &self.resource)?;
2049        }
2050        if !self.labels.is_empty() {
2051            state.serialize_entry("labels", &self.labels)?;
2052        }
2053        if !self.entries.is_empty() {
2054            state.serialize_entry("entries", &self.entries)?;
2055        }
2056        if !wkt::internal::is_default(&self.partial_success) {
2057            state.serialize_entry("partialSuccess", &self.partial_success)?;
2058        }
2059        if !wkt::internal::is_default(&self.dry_run) {
2060            state.serialize_entry("dryRun", &self.dry_run)?;
2061        }
2062        if !self._unknown_fields.is_empty() {
2063            for (key, value) in self._unknown_fields.iter() {
2064                state.serialize_entry(key, &value)?;
2065            }
2066        }
2067        state.end()
2068    }
2069}
2070
2071impl std::fmt::Debug for WriteLogEntriesRequest {
2072    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2073        let mut debug_struct = f.debug_struct("WriteLogEntriesRequest");
2074        debug_struct.field("log_name", &self.log_name);
2075        debug_struct.field("resource", &self.resource);
2076        debug_struct.field("labels", &self.labels);
2077        debug_struct.field("entries", &self.entries);
2078        debug_struct.field("partial_success", &self.partial_success);
2079        debug_struct.field("dry_run", &self.dry_run);
2080        if !self._unknown_fields.is_empty() {
2081            debug_struct.field("_unknown_fields", &self._unknown_fields);
2082        }
2083        debug_struct.finish()
2084    }
2085}
2086
2087/// Result returned from WriteLogEntries.
2088#[derive(Clone, Default, PartialEq)]
2089#[non_exhaustive]
2090pub struct WriteLogEntriesResponse {
2091    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2092}
2093
2094impl WriteLogEntriesResponse {
2095    pub fn new() -> Self {
2096        std::default::Default::default()
2097    }
2098}
2099
2100impl wkt::message::Message for WriteLogEntriesResponse {
2101    fn typename() -> &'static str {
2102        "type.googleapis.com/google.logging.v2.WriteLogEntriesResponse"
2103    }
2104}
2105
2106#[doc(hidden)]
2107impl<'de> serde::de::Deserialize<'de> for WriteLogEntriesResponse {
2108    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2109    where
2110        D: serde::Deserializer<'de>,
2111    {
2112        #[allow(non_camel_case_types)]
2113        #[doc(hidden)]
2114        #[derive(PartialEq, Eq, Hash)]
2115        enum __FieldTag {
2116            Unknown(std::string::String),
2117        }
2118        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2119            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2120            where
2121                D: serde::Deserializer<'de>,
2122            {
2123                struct Visitor;
2124                impl<'de> serde::de::Visitor<'de> for Visitor {
2125                    type Value = __FieldTag;
2126                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2127                        formatter.write_str("a field name for WriteLogEntriesResponse")
2128                    }
2129                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2130                    where
2131                        E: serde::de::Error,
2132                    {
2133                        use std::result::Result::Ok;
2134                        use std::string::ToString;
2135                        Ok(__FieldTag::Unknown(value.to_string()))
2136                    }
2137                }
2138                deserializer.deserialize_identifier(Visitor)
2139            }
2140        }
2141        struct Visitor;
2142        impl<'de> serde::de::Visitor<'de> for Visitor {
2143            type Value = WriteLogEntriesResponse;
2144            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2145                formatter.write_str("struct WriteLogEntriesResponse")
2146            }
2147            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2148            where
2149                A: serde::de::MapAccess<'de>,
2150            {
2151                #[allow(unused_imports)]
2152                use serde::de::Error;
2153                use std::option::Option::Some;
2154                let mut result = Self::Value::new();
2155                while let Some(tag) = map.next_key::<__FieldTag>()? {
2156                    #[allow(clippy::match_single_binding)]
2157                    match tag {
2158                        __FieldTag::Unknown(key) => {
2159                            let value = map.next_value::<serde_json::Value>()?;
2160                            result._unknown_fields.insert(key, value);
2161                        }
2162                    }
2163                }
2164                std::result::Result::Ok(result)
2165            }
2166        }
2167        deserializer.deserialize_any(Visitor)
2168    }
2169}
2170
2171#[doc(hidden)]
2172impl serde::ser::Serialize for WriteLogEntriesResponse {
2173    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2174    where
2175        S: serde::ser::Serializer,
2176    {
2177        use serde::ser::SerializeMap;
2178        #[allow(unused_imports)]
2179        use std::option::Option::Some;
2180        let mut state = serializer.serialize_map(std::option::Option::None)?;
2181        if !self._unknown_fields.is_empty() {
2182            for (key, value) in self._unknown_fields.iter() {
2183                state.serialize_entry(key, &value)?;
2184            }
2185        }
2186        state.end()
2187    }
2188}
2189
2190impl std::fmt::Debug for WriteLogEntriesResponse {
2191    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2192        let mut debug_struct = f.debug_struct("WriteLogEntriesResponse");
2193        if !self._unknown_fields.is_empty() {
2194            debug_struct.field("_unknown_fields", &self._unknown_fields);
2195        }
2196        debug_struct.finish()
2197    }
2198}
2199
2200/// Error details for WriteLogEntries with partial success.
2201#[derive(Clone, Default, PartialEq)]
2202#[non_exhaustive]
2203pub struct WriteLogEntriesPartialErrors {
2204    /// When `WriteLogEntriesRequest.partial_success` is true, records the error
2205    /// status for entries that were not written due to a permanent error, keyed
2206    /// by the entry's zero-based index in `WriteLogEntriesRequest.entries`.
2207    ///
2208    /// Failed requests for which no entries are written will not include
2209    /// per-entry errors.
2210    pub log_entry_errors: std::collections::HashMap<i32, rpc::model::Status>,
2211
2212    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2213}
2214
2215impl WriteLogEntriesPartialErrors {
2216    pub fn new() -> Self {
2217        std::default::Default::default()
2218    }
2219
2220    /// Sets the value of [log_entry_errors][crate::model::WriteLogEntriesPartialErrors::log_entry_errors].
2221    pub fn set_log_entry_errors<T, K, V>(mut self, v: T) -> Self
2222    where
2223        T: std::iter::IntoIterator<Item = (K, V)>,
2224        K: std::convert::Into<i32>,
2225        V: std::convert::Into<rpc::model::Status>,
2226    {
2227        use std::iter::Iterator;
2228        self.log_entry_errors = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2229        self
2230    }
2231}
2232
2233impl wkt::message::Message for WriteLogEntriesPartialErrors {
2234    fn typename() -> &'static str {
2235        "type.googleapis.com/google.logging.v2.WriteLogEntriesPartialErrors"
2236    }
2237}
2238
2239#[doc(hidden)]
2240impl<'de> serde::de::Deserialize<'de> for WriteLogEntriesPartialErrors {
2241    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2242    where
2243        D: serde::Deserializer<'de>,
2244    {
2245        #[allow(non_camel_case_types)]
2246        #[doc(hidden)]
2247        #[derive(PartialEq, Eq, Hash)]
2248        enum __FieldTag {
2249            __log_entry_errors,
2250            Unknown(std::string::String),
2251        }
2252        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2253            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2254            where
2255                D: serde::Deserializer<'de>,
2256            {
2257                struct Visitor;
2258                impl<'de> serde::de::Visitor<'de> for Visitor {
2259                    type Value = __FieldTag;
2260                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2261                        formatter.write_str("a field name for WriteLogEntriesPartialErrors")
2262                    }
2263                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2264                    where
2265                        E: serde::de::Error,
2266                    {
2267                        use std::result::Result::Ok;
2268                        use std::string::ToString;
2269                        match value {
2270                            "logEntryErrors" => Ok(__FieldTag::__log_entry_errors),
2271                            "log_entry_errors" => Ok(__FieldTag::__log_entry_errors),
2272                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2273                        }
2274                    }
2275                }
2276                deserializer.deserialize_identifier(Visitor)
2277            }
2278        }
2279        struct Visitor;
2280        impl<'de> serde::de::Visitor<'de> for Visitor {
2281            type Value = WriteLogEntriesPartialErrors;
2282            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2283                formatter.write_str("struct WriteLogEntriesPartialErrors")
2284            }
2285            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2286            where
2287                A: serde::de::MapAccess<'de>,
2288            {
2289                #[allow(unused_imports)]
2290                use serde::de::Error;
2291                use std::option::Option::Some;
2292                let mut fields = std::collections::HashSet::new();
2293                let mut result = Self::Value::new();
2294                while let Some(tag) = map.next_key::<__FieldTag>()? {
2295                    #[allow(clippy::match_single_binding)]
2296                    match tag {
2297                        __FieldTag::__log_entry_errors => {
2298                            if !fields.insert(__FieldTag::__log_entry_errors) {
2299                                return std::result::Result::Err(A::Error::duplicate_field(
2300                                    "multiple values for log_entry_errors",
2301                                ));
2302                            }
2303                            struct __With(
2304                                std::option::Option<
2305                                    std::collections::HashMap<i32, rpc::model::Status>,
2306                                >,
2307                            );
2308                            impl<'de> serde::de::Deserialize<'de> for __With {
2309                                fn deserialize<D>(
2310                                    deserializer: D,
2311                                ) -> std::result::Result<Self, D::Error>
2312                                where
2313                                    D: serde::de::Deserializer<'de>,
2314                                {
2315                                    serde_with::As::<
2316                                        std::option::Option<
2317                                            std::collections::HashMap<
2318                                                wkt::internal::I32,
2319                                                serde_with::Same,
2320                                            >,
2321                                        >,
2322                                    >::deserialize(deserializer)
2323                                    .map(__With)
2324                                }
2325                            }
2326                            result.log_entry_errors =
2327                                map.next_value::<__With>()?.0.unwrap_or_default();
2328                        }
2329                        __FieldTag::Unknown(key) => {
2330                            let value = map.next_value::<serde_json::Value>()?;
2331                            result._unknown_fields.insert(key, value);
2332                        }
2333                    }
2334                }
2335                std::result::Result::Ok(result)
2336            }
2337        }
2338        deserializer.deserialize_any(Visitor)
2339    }
2340}
2341
2342#[doc(hidden)]
2343impl serde::ser::Serialize for WriteLogEntriesPartialErrors {
2344    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2345    where
2346        S: serde::ser::Serializer,
2347    {
2348        use serde::ser::SerializeMap;
2349        #[allow(unused_imports)]
2350        use std::option::Option::Some;
2351        let mut state = serializer.serialize_map(std::option::Option::None)?;
2352        if !self.log_entry_errors.is_empty() {
2353            struct __With<'a>(&'a std::collections::HashMap<i32, rpc::model::Status>);
2354            impl<'a> serde::ser::Serialize for __With<'a> {
2355                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2356                where
2357                    S: serde::ser::Serializer,
2358                {
2359                    serde_with::As::< std::collections::HashMap<wkt::internal::I32, serde_with::Same> >::serialize(self.0, serializer)
2360                }
2361            }
2362            state.serialize_entry("logEntryErrors", &__With(&self.log_entry_errors))?;
2363        }
2364        if !self._unknown_fields.is_empty() {
2365            for (key, value) in self._unknown_fields.iter() {
2366                state.serialize_entry(key, &value)?;
2367            }
2368        }
2369        state.end()
2370    }
2371}
2372
2373impl std::fmt::Debug for WriteLogEntriesPartialErrors {
2374    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2375        let mut debug_struct = f.debug_struct("WriteLogEntriesPartialErrors");
2376        debug_struct.field("log_entry_errors", &self.log_entry_errors);
2377        if !self._unknown_fields.is_empty() {
2378            debug_struct.field("_unknown_fields", &self._unknown_fields);
2379        }
2380        debug_struct.finish()
2381    }
2382}
2383
2384/// The parameters to `ListLogEntries`.
2385#[derive(Clone, Default, PartialEq)]
2386#[non_exhaustive]
2387pub struct ListLogEntriesRequest {
2388    /// Required. Names of one or more parent resources from which to
2389    /// retrieve log entries:
2390    ///
2391    /// * `projects/[PROJECT_ID]`
2392    /// * `organizations/[ORGANIZATION_ID]`
2393    /// * `billingAccounts/[BILLING_ACCOUNT_ID]`
2394    /// * `folders/[FOLDER_ID]`
2395    ///
2396    /// May alternatively be one or more views:
2397    ///
2398    /// * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
2399    /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
2400    /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
2401    /// * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
2402    ///
2403    /// Projects listed in the `project_ids` field are added to this list.
2404    /// A maximum of 100 resources may be specified in a single request.
2405    pub resource_names: std::vec::Vec<std::string::String>,
2406
2407    /// Optional. Only log entries that match the filter are returned.  An empty
2408    /// filter matches all log entries in the resources listed in `resource_names`.
2409    /// Referencing a parent resource that is not listed in `resource_names` will
2410    /// cause the filter to return no results. The maximum length of a filter is
2411    /// 20,000 characters.
2412    pub filter: std::string::String,
2413
2414    /// Optional. How the results should be sorted.  Presently, the only permitted
2415    /// values are `"timestamp asc"` (default) and `"timestamp desc"`. The first
2416    /// option returns entries in order of increasing values of
2417    /// `LogEntry.timestamp` (oldest first), and the second option returns entries
2418    /// in order of decreasing timestamps (newest first).  Entries with equal
2419    /// timestamps are returned in order of their `insert_id` values.
2420    pub order_by: std::string::String,
2421
2422    /// Optional. The maximum number of results to return from this request.
2423    /// Default is 50. If the value is negative or exceeds 1000, the request is
2424    /// rejected. The presence of `next_page_token` in the response indicates that
2425    /// more results might be available.
2426    pub page_size: i32,
2427
2428    /// Optional. If present, then retrieve the next batch of results from the
2429    /// preceding call to this method.  `page_token` must be the value of
2430    /// `next_page_token` from the previous response.  The values of other method
2431    /// parameters should be identical to those in the previous call.
2432    pub page_token: std::string::String,
2433
2434    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2435}
2436
2437impl ListLogEntriesRequest {
2438    pub fn new() -> Self {
2439        std::default::Default::default()
2440    }
2441
2442    /// Sets the value of [resource_names][crate::model::ListLogEntriesRequest::resource_names].
2443    pub fn set_resource_names<T, V>(mut self, v: T) -> Self
2444    where
2445        T: std::iter::IntoIterator<Item = V>,
2446        V: std::convert::Into<std::string::String>,
2447    {
2448        use std::iter::Iterator;
2449        self.resource_names = v.into_iter().map(|i| i.into()).collect();
2450        self
2451    }
2452
2453    /// Sets the value of [filter][crate::model::ListLogEntriesRequest::filter].
2454    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2455        self.filter = v.into();
2456        self
2457    }
2458
2459    /// Sets the value of [order_by][crate::model::ListLogEntriesRequest::order_by].
2460    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2461        self.order_by = v.into();
2462        self
2463    }
2464
2465    /// Sets the value of [page_size][crate::model::ListLogEntriesRequest::page_size].
2466    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2467        self.page_size = v.into();
2468        self
2469    }
2470
2471    /// Sets the value of [page_token][crate::model::ListLogEntriesRequest::page_token].
2472    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2473        self.page_token = v.into();
2474        self
2475    }
2476}
2477
2478impl wkt::message::Message for ListLogEntriesRequest {
2479    fn typename() -> &'static str {
2480        "type.googleapis.com/google.logging.v2.ListLogEntriesRequest"
2481    }
2482}
2483
2484#[doc(hidden)]
2485impl<'de> serde::de::Deserialize<'de> for ListLogEntriesRequest {
2486    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2487    where
2488        D: serde::Deserializer<'de>,
2489    {
2490        #[allow(non_camel_case_types)]
2491        #[doc(hidden)]
2492        #[derive(PartialEq, Eq, Hash)]
2493        enum __FieldTag {
2494            __resource_names,
2495            __filter,
2496            __order_by,
2497            __page_size,
2498            __page_token,
2499            Unknown(std::string::String),
2500        }
2501        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2502            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2503            where
2504                D: serde::Deserializer<'de>,
2505            {
2506                struct Visitor;
2507                impl<'de> serde::de::Visitor<'de> for Visitor {
2508                    type Value = __FieldTag;
2509                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2510                        formatter.write_str("a field name for ListLogEntriesRequest")
2511                    }
2512                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2513                    where
2514                        E: serde::de::Error,
2515                    {
2516                        use std::result::Result::Ok;
2517                        use std::string::ToString;
2518                        match value {
2519                            "resourceNames" => Ok(__FieldTag::__resource_names),
2520                            "resource_names" => Ok(__FieldTag::__resource_names),
2521                            "filter" => Ok(__FieldTag::__filter),
2522                            "orderBy" => Ok(__FieldTag::__order_by),
2523                            "order_by" => Ok(__FieldTag::__order_by),
2524                            "pageSize" => Ok(__FieldTag::__page_size),
2525                            "page_size" => Ok(__FieldTag::__page_size),
2526                            "pageToken" => Ok(__FieldTag::__page_token),
2527                            "page_token" => Ok(__FieldTag::__page_token),
2528                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2529                        }
2530                    }
2531                }
2532                deserializer.deserialize_identifier(Visitor)
2533            }
2534        }
2535        struct Visitor;
2536        impl<'de> serde::de::Visitor<'de> for Visitor {
2537            type Value = ListLogEntriesRequest;
2538            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2539                formatter.write_str("struct ListLogEntriesRequest")
2540            }
2541            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2542            where
2543                A: serde::de::MapAccess<'de>,
2544            {
2545                #[allow(unused_imports)]
2546                use serde::de::Error;
2547                use std::option::Option::Some;
2548                let mut fields = std::collections::HashSet::new();
2549                let mut result = Self::Value::new();
2550                while let Some(tag) = map.next_key::<__FieldTag>()? {
2551                    #[allow(clippy::match_single_binding)]
2552                    match tag {
2553                        __FieldTag::__resource_names => {
2554                            if !fields.insert(__FieldTag::__resource_names) {
2555                                return std::result::Result::Err(A::Error::duplicate_field(
2556                                    "multiple values for resource_names",
2557                                ));
2558                            }
2559                            result.resource_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
2560                        }
2561                        __FieldTag::__filter => {
2562                            if !fields.insert(__FieldTag::__filter) {
2563                                return std::result::Result::Err(A::Error::duplicate_field(
2564                                    "multiple values for filter",
2565                                ));
2566                            }
2567                            result.filter = map
2568                                .next_value::<std::option::Option<std::string::String>>()?
2569                                .unwrap_or_default();
2570                        }
2571                        __FieldTag::__order_by => {
2572                            if !fields.insert(__FieldTag::__order_by) {
2573                                return std::result::Result::Err(A::Error::duplicate_field(
2574                                    "multiple values for order_by",
2575                                ));
2576                            }
2577                            result.order_by = map
2578                                .next_value::<std::option::Option<std::string::String>>()?
2579                                .unwrap_or_default();
2580                        }
2581                        __FieldTag::__page_size => {
2582                            if !fields.insert(__FieldTag::__page_size) {
2583                                return std::result::Result::Err(A::Error::duplicate_field(
2584                                    "multiple values for page_size",
2585                                ));
2586                            }
2587                            struct __With(std::option::Option<i32>);
2588                            impl<'de> serde::de::Deserialize<'de> for __With {
2589                                fn deserialize<D>(
2590                                    deserializer: D,
2591                                ) -> std::result::Result<Self, D::Error>
2592                                where
2593                                    D: serde::de::Deserializer<'de>,
2594                                {
2595                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2596                                }
2597                            }
2598                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2599                        }
2600                        __FieldTag::__page_token => {
2601                            if !fields.insert(__FieldTag::__page_token) {
2602                                return std::result::Result::Err(A::Error::duplicate_field(
2603                                    "multiple values for page_token",
2604                                ));
2605                            }
2606                            result.page_token = map
2607                                .next_value::<std::option::Option<std::string::String>>()?
2608                                .unwrap_or_default();
2609                        }
2610                        __FieldTag::Unknown(key) => {
2611                            let value = map.next_value::<serde_json::Value>()?;
2612                            result._unknown_fields.insert(key, value);
2613                        }
2614                    }
2615                }
2616                std::result::Result::Ok(result)
2617            }
2618        }
2619        deserializer.deserialize_any(Visitor)
2620    }
2621}
2622
2623#[doc(hidden)]
2624impl serde::ser::Serialize for ListLogEntriesRequest {
2625    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2626    where
2627        S: serde::ser::Serializer,
2628    {
2629        use serde::ser::SerializeMap;
2630        #[allow(unused_imports)]
2631        use std::option::Option::Some;
2632        let mut state = serializer.serialize_map(std::option::Option::None)?;
2633        if !self.resource_names.is_empty() {
2634            state.serialize_entry("resourceNames", &self.resource_names)?;
2635        }
2636        if !self.filter.is_empty() {
2637            state.serialize_entry("filter", &self.filter)?;
2638        }
2639        if !self.order_by.is_empty() {
2640            state.serialize_entry("orderBy", &self.order_by)?;
2641        }
2642        if !wkt::internal::is_default(&self.page_size) {
2643            struct __With<'a>(&'a i32);
2644            impl<'a> serde::ser::Serialize for __With<'a> {
2645                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2646                where
2647                    S: serde::ser::Serializer,
2648                {
2649                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2650                }
2651            }
2652            state.serialize_entry("pageSize", &__With(&self.page_size))?;
2653        }
2654        if !self.page_token.is_empty() {
2655            state.serialize_entry("pageToken", &self.page_token)?;
2656        }
2657        if !self._unknown_fields.is_empty() {
2658            for (key, value) in self._unknown_fields.iter() {
2659                state.serialize_entry(key, &value)?;
2660            }
2661        }
2662        state.end()
2663    }
2664}
2665
2666impl std::fmt::Debug for ListLogEntriesRequest {
2667    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2668        let mut debug_struct = f.debug_struct("ListLogEntriesRequest");
2669        debug_struct.field("resource_names", &self.resource_names);
2670        debug_struct.field("filter", &self.filter);
2671        debug_struct.field("order_by", &self.order_by);
2672        debug_struct.field("page_size", &self.page_size);
2673        debug_struct.field("page_token", &self.page_token);
2674        if !self._unknown_fields.is_empty() {
2675            debug_struct.field("_unknown_fields", &self._unknown_fields);
2676        }
2677        debug_struct.finish()
2678    }
2679}
2680
2681/// Result returned from `ListLogEntries`.
2682#[derive(Clone, Default, PartialEq)]
2683#[non_exhaustive]
2684pub struct ListLogEntriesResponse {
2685    /// A list of log entries.  If `entries` is empty, `nextPageToken` may still be
2686    /// returned, indicating that more entries may exist.  See `nextPageToken` for
2687    /// more information.
2688    pub entries: std::vec::Vec<crate::model::LogEntry>,
2689
2690    /// If there might be more results than those appearing in this response, then
2691    /// `nextPageToken` is included.  To get the next set of results, call this
2692    /// method again using the value of `nextPageToken` as `pageToken`.
2693    ///
2694    /// If a value for `next_page_token` appears and the `entries` field is empty,
2695    /// it means that the search found no log entries so far but it did not have
2696    /// time to search all the possible log entries.  Retry the method with this
2697    /// value for `page_token` to continue the search.  Alternatively, consider
2698    /// speeding up the search by changing your filter to specify a single log name
2699    /// or resource type, or to narrow the time range of the search.
2700    pub next_page_token: std::string::String,
2701
2702    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2703}
2704
2705impl ListLogEntriesResponse {
2706    pub fn new() -> Self {
2707        std::default::Default::default()
2708    }
2709
2710    /// Sets the value of [entries][crate::model::ListLogEntriesResponse::entries].
2711    pub fn set_entries<T, V>(mut self, v: T) -> Self
2712    where
2713        T: std::iter::IntoIterator<Item = V>,
2714        V: std::convert::Into<crate::model::LogEntry>,
2715    {
2716        use std::iter::Iterator;
2717        self.entries = v.into_iter().map(|i| i.into()).collect();
2718        self
2719    }
2720
2721    /// Sets the value of [next_page_token][crate::model::ListLogEntriesResponse::next_page_token].
2722    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2723        self.next_page_token = v.into();
2724        self
2725    }
2726}
2727
2728impl wkt::message::Message for ListLogEntriesResponse {
2729    fn typename() -> &'static str {
2730        "type.googleapis.com/google.logging.v2.ListLogEntriesResponse"
2731    }
2732}
2733
2734#[doc(hidden)]
2735impl gax::paginator::internal::PageableResponse for ListLogEntriesResponse {
2736    type PageItem = crate::model::LogEntry;
2737
2738    fn items(self) -> std::vec::Vec<Self::PageItem> {
2739        self.entries
2740    }
2741
2742    fn next_page_token(&self) -> std::string::String {
2743        use std::clone::Clone;
2744        self.next_page_token.clone()
2745    }
2746}
2747
2748#[doc(hidden)]
2749impl<'de> serde::de::Deserialize<'de> for ListLogEntriesResponse {
2750    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2751    where
2752        D: serde::Deserializer<'de>,
2753    {
2754        #[allow(non_camel_case_types)]
2755        #[doc(hidden)]
2756        #[derive(PartialEq, Eq, Hash)]
2757        enum __FieldTag {
2758            __entries,
2759            __next_page_token,
2760            Unknown(std::string::String),
2761        }
2762        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2763            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2764            where
2765                D: serde::Deserializer<'de>,
2766            {
2767                struct Visitor;
2768                impl<'de> serde::de::Visitor<'de> for Visitor {
2769                    type Value = __FieldTag;
2770                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2771                        formatter.write_str("a field name for ListLogEntriesResponse")
2772                    }
2773                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2774                    where
2775                        E: serde::de::Error,
2776                    {
2777                        use std::result::Result::Ok;
2778                        use std::string::ToString;
2779                        match value {
2780                            "entries" => Ok(__FieldTag::__entries),
2781                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
2782                            "next_page_token" => Ok(__FieldTag::__next_page_token),
2783                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2784                        }
2785                    }
2786                }
2787                deserializer.deserialize_identifier(Visitor)
2788            }
2789        }
2790        struct Visitor;
2791        impl<'de> serde::de::Visitor<'de> for Visitor {
2792            type Value = ListLogEntriesResponse;
2793            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2794                formatter.write_str("struct ListLogEntriesResponse")
2795            }
2796            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2797            where
2798                A: serde::de::MapAccess<'de>,
2799            {
2800                #[allow(unused_imports)]
2801                use serde::de::Error;
2802                use std::option::Option::Some;
2803                let mut fields = std::collections::HashSet::new();
2804                let mut result = Self::Value::new();
2805                while let Some(tag) = map.next_key::<__FieldTag>()? {
2806                    #[allow(clippy::match_single_binding)]
2807                    match tag {
2808                        __FieldTag::__entries => {
2809                            if !fields.insert(__FieldTag::__entries) {
2810                                return std::result::Result::Err(A::Error::duplicate_field(
2811                                    "multiple values for entries",
2812                                ));
2813                            }
2814                            result.entries = map.next_value::<std::option::Option<std::vec::Vec<crate::model::LogEntry>>>()?.unwrap_or_default();
2815                        }
2816                        __FieldTag::__next_page_token => {
2817                            if !fields.insert(__FieldTag::__next_page_token) {
2818                                return std::result::Result::Err(A::Error::duplicate_field(
2819                                    "multiple values for next_page_token",
2820                                ));
2821                            }
2822                            result.next_page_token = map
2823                                .next_value::<std::option::Option<std::string::String>>()?
2824                                .unwrap_or_default();
2825                        }
2826                        __FieldTag::Unknown(key) => {
2827                            let value = map.next_value::<serde_json::Value>()?;
2828                            result._unknown_fields.insert(key, value);
2829                        }
2830                    }
2831                }
2832                std::result::Result::Ok(result)
2833            }
2834        }
2835        deserializer.deserialize_any(Visitor)
2836    }
2837}
2838
2839#[doc(hidden)]
2840impl serde::ser::Serialize for ListLogEntriesResponse {
2841    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2842    where
2843        S: serde::ser::Serializer,
2844    {
2845        use serde::ser::SerializeMap;
2846        #[allow(unused_imports)]
2847        use std::option::Option::Some;
2848        let mut state = serializer.serialize_map(std::option::Option::None)?;
2849        if !self.entries.is_empty() {
2850            state.serialize_entry("entries", &self.entries)?;
2851        }
2852        if !self.next_page_token.is_empty() {
2853            state.serialize_entry("nextPageToken", &self.next_page_token)?;
2854        }
2855        if !self._unknown_fields.is_empty() {
2856            for (key, value) in self._unknown_fields.iter() {
2857                state.serialize_entry(key, &value)?;
2858            }
2859        }
2860        state.end()
2861    }
2862}
2863
2864impl std::fmt::Debug for ListLogEntriesResponse {
2865    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2866        let mut debug_struct = f.debug_struct("ListLogEntriesResponse");
2867        debug_struct.field("entries", &self.entries);
2868        debug_struct.field("next_page_token", &self.next_page_token);
2869        if !self._unknown_fields.is_empty() {
2870            debug_struct.field("_unknown_fields", &self._unknown_fields);
2871        }
2872        debug_struct.finish()
2873    }
2874}
2875
2876/// The parameters to ListMonitoredResourceDescriptors
2877#[derive(Clone, Default, PartialEq)]
2878#[non_exhaustive]
2879pub struct ListMonitoredResourceDescriptorsRequest {
2880    /// Optional. The maximum number of results to return from this request.
2881    /// Non-positive values are ignored.  The presence of `nextPageToken` in the
2882    /// response indicates that more results might be available.
2883    pub page_size: i32,
2884
2885    /// Optional. If present, then retrieve the next batch of results from the
2886    /// preceding call to this method.  `pageToken` must be the value of
2887    /// `nextPageToken` from the previous response.  The values of other method
2888    /// parameters should be identical to those in the previous call.
2889    pub page_token: std::string::String,
2890
2891    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2892}
2893
2894impl ListMonitoredResourceDescriptorsRequest {
2895    pub fn new() -> Self {
2896        std::default::Default::default()
2897    }
2898
2899    /// Sets the value of [page_size][crate::model::ListMonitoredResourceDescriptorsRequest::page_size].
2900    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2901        self.page_size = v.into();
2902        self
2903    }
2904
2905    /// Sets the value of [page_token][crate::model::ListMonitoredResourceDescriptorsRequest::page_token].
2906    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2907        self.page_token = v.into();
2908        self
2909    }
2910}
2911
2912impl wkt::message::Message for ListMonitoredResourceDescriptorsRequest {
2913    fn typename() -> &'static str {
2914        "type.googleapis.com/google.logging.v2.ListMonitoredResourceDescriptorsRequest"
2915    }
2916}
2917
2918#[doc(hidden)]
2919impl<'de> serde::de::Deserialize<'de> for ListMonitoredResourceDescriptorsRequest {
2920    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2921    where
2922        D: serde::Deserializer<'de>,
2923    {
2924        #[allow(non_camel_case_types)]
2925        #[doc(hidden)]
2926        #[derive(PartialEq, Eq, Hash)]
2927        enum __FieldTag {
2928            __page_size,
2929            __page_token,
2930            Unknown(std::string::String),
2931        }
2932        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2933            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2934            where
2935                D: serde::Deserializer<'de>,
2936            {
2937                struct Visitor;
2938                impl<'de> serde::de::Visitor<'de> for Visitor {
2939                    type Value = __FieldTag;
2940                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2941                        formatter
2942                            .write_str("a field name for ListMonitoredResourceDescriptorsRequest")
2943                    }
2944                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2945                    where
2946                        E: serde::de::Error,
2947                    {
2948                        use std::result::Result::Ok;
2949                        use std::string::ToString;
2950                        match value {
2951                            "pageSize" => Ok(__FieldTag::__page_size),
2952                            "page_size" => Ok(__FieldTag::__page_size),
2953                            "pageToken" => Ok(__FieldTag::__page_token),
2954                            "page_token" => Ok(__FieldTag::__page_token),
2955                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2956                        }
2957                    }
2958                }
2959                deserializer.deserialize_identifier(Visitor)
2960            }
2961        }
2962        struct Visitor;
2963        impl<'de> serde::de::Visitor<'de> for Visitor {
2964            type Value = ListMonitoredResourceDescriptorsRequest;
2965            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2966                formatter.write_str("struct ListMonitoredResourceDescriptorsRequest")
2967            }
2968            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2969            where
2970                A: serde::de::MapAccess<'de>,
2971            {
2972                #[allow(unused_imports)]
2973                use serde::de::Error;
2974                use std::option::Option::Some;
2975                let mut fields = std::collections::HashSet::new();
2976                let mut result = Self::Value::new();
2977                while let Some(tag) = map.next_key::<__FieldTag>()? {
2978                    #[allow(clippy::match_single_binding)]
2979                    match tag {
2980                        __FieldTag::__page_size => {
2981                            if !fields.insert(__FieldTag::__page_size) {
2982                                return std::result::Result::Err(A::Error::duplicate_field(
2983                                    "multiple values for page_size",
2984                                ));
2985                            }
2986                            struct __With(std::option::Option<i32>);
2987                            impl<'de> serde::de::Deserialize<'de> for __With {
2988                                fn deserialize<D>(
2989                                    deserializer: D,
2990                                ) -> std::result::Result<Self, D::Error>
2991                                where
2992                                    D: serde::de::Deserializer<'de>,
2993                                {
2994                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2995                                }
2996                            }
2997                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
2998                        }
2999                        __FieldTag::__page_token => {
3000                            if !fields.insert(__FieldTag::__page_token) {
3001                                return std::result::Result::Err(A::Error::duplicate_field(
3002                                    "multiple values for page_token",
3003                                ));
3004                            }
3005                            result.page_token = map
3006                                .next_value::<std::option::Option<std::string::String>>()?
3007                                .unwrap_or_default();
3008                        }
3009                        __FieldTag::Unknown(key) => {
3010                            let value = map.next_value::<serde_json::Value>()?;
3011                            result._unknown_fields.insert(key, value);
3012                        }
3013                    }
3014                }
3015                std::result::Result::Ok(result)
3016            }
3017        }
3018        deserializer.deserialize_any(Visitor)
3019    }
3020}
3021
3022#[doc(hidden)]
3023impl serde::ser::Serialize for ListMonitoredResourceDescriptorsRequest {
3024    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3025    where
3026        S: serde::ser::Serializer,
3027    {
3028        use serde::ser::SerializeMap;
3029        #[allow(unused_imports)]
3030        use std::option::Option::Some;
3031        let mut state = serializer.serialize_map(std::option::Option::None)?;
3032        if !wkt::internal::is_default(&self.page_size) {
3033            struct __With<'a>(&'a i32);
3034            impl<'a> serde::ser::Serialize for __With<'a> {
3035                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3036                where
3037                    S: serde::ser::Serializer,
3038                {
3039                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3040                }
3041            }
3042            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3043        }
3044        if !self.page_token.is_empty() {
3045            state.serialize_entry("pageToken", &self.page_token)?;
3046        }
3047        if !self._unknown_fields.is_empty() {
3048            for (key, value) in self._unknown_fields.iter() {
3049                state.serialize_entry(key, &value)?;
3050            }
3051        }
3052        state.end()
3053    }
3054}
3055
3056impl std::fmt::Debug for ListMonitoredResourceDescriptorsRequest {
3057    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3058        let mut debug_struct = f.debug_struct("ListMonitoredResourceDescriptorsRequest");
3059        debug_struct.field("page_size", &self.page_size);
3060        debug_struct.field("page_token", &self.page_token);
3061        if !self._unknown_fields.is_empty() {
3062            debug_struct.field("_unknown_fields", &self._unknown_fields);
3063        }
3064        debug_struct.finish()
3065    }
3066}
3067
3068/// Result returned from ListMonitoredResourceDescriptors.
3069#[derive(Clone, Default, PartialEq)]
3070#[non_exhaustive]
3071pub struct ListMonitoredResourceDescriptorsResponse {
3072    /// A list of resource descriptors.
3073    pub resource_descriptors: std::vec::Vec<api::model::MonitoredResourceDescriptor>,
3074
3075    /// If there might be more results than those appearing in this response, then
3076    /// `nextPageToken` is included.  To get the next set of results, call this
3077    /// method again using the value of `nextPageToken` as `pageToken`.
3078    pub next_page_token: std::string::String,
3079
3080    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3081}
3082
3083impl ListMonitoredResourceDescriptorsResponse {
3084    pub fn new() -> Self {
3085        std::default::Default::default()
3086    }
3087
3088    /// Sets the value of [resource_descriptors][crate::model::ListMonitoredResourceDescriptorsResponse::resource_descriptors].
3089    pub fn set_resource_descriptors<T, V>(mut self, v: T) -> Self
3090    where
3091        T: std::iter::IntoIterator<Item = V>,
3092        V: std::convert::Into<api::model::MonitoredResourceDescriptor>,
3093    {
3094        use std::iter::Iterator;
3095        self.resource_descriptors = v.into_iter().map(|i| i.into()).collect();
3096        self
3097    }
3098
3099    /// Sets the value of [next_page_token][crate::model::ListMonitoredResourceDescriptorsResponse::next_page_token].
3100    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3101        self.next_page_token = v.into();
3102        self
3103    }
3104}
3105
3106impl wkt::message::Message for ListMonitoredResourceDescriptorsResponse {
3107    fn typename() -> &'static str {
3108        "type.googleapis.com/google.logging.v2.ListMonitoredResourceDescriptorsResponse"
3109    }
3110}
3111
3112#[doc(hidden)]
3113impl gax::paginator::internal::PageableResponse for ListMonitoredResourceDescriptorsResponse {
3114    type PageItem = api::model::MonitoredResourceDescriptor;
3115
3116    fn items(self) -> std::vec::Vec<Self::PageItem> {
3117        self.resource_descriptors
3118    }
3119
3120    fn next_page_token(&self) -> std::string::String {
3121        use std::clone::Clone;
3122        self.next_page_token.clone()
3123    }
3124}
3125
3126#[doc(hidden)]
3127impl<'de> serde::de::Deserialize<'de> for ListMonitoredResourceDescriptorsResponse {
3128    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3129    where
3130        D: serde::Deserializer<'de>,
3131    {
3132        #[allow(non_camel_case_types)]
3133        #[doc(hidden)]
3134        #[derive(PartialEq, Eq, Hash)]
3135        enum __FieldTag {
3136            __resource_descriptors,
3137            __next_page_token,
3138            Unknown(std::string::String),
3139        }
3140        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3141            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3142            where
3143                D: serde::Deserializer<'de>,
3144            {
3145                struct Visitor;
3146                impl<'de> serde::de::Visitor<'de> for Visitor {
3147                    type Value = __FieldTag;
3148                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3149                        formatter
3150                            .write_str("a field name for ListMonitoredResourceDescriptorsResponse")
3151                    }
3152                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3153                    where
3154                        E: serde::de::Error,
3155                    {
3156                        use std::result::Result::Ok;
3157                        use std::string::ToString;
3158                        match value {
3159                            "resourceDescriptors" => Ok(__FieldTag::__resource_descriptors),
3160                            "resource_descriptors" => Ok(__FieldTag::__resource_descriptors),
3161                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3162                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3163                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3164                        }
3165                    }
3166                }
3167                deserializer.deserialize_identifier(Visitor)
3168            }
3169        }
3170        struct Visitor;
3171        impl<'de> serde::de::Visitor<'de> for Visitor {
3172            type Value = ListMonitoredResourceDescriptorsResponse;
3173            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3174                formatter.write_str("struct ListMonitoredResourceDescriptorsResponse")
3175            }
3176            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3177            where
3178                A: serde::de::MapAccess<'de>,
3179            {
3180                #[allow(unused_imports)]
3181                use serde::de::Error;
3182                use std::option::Option::Some;
3183                let mut fields = std::collections::HashSet::new();
3184                let mut result = Self::Value::new();
3185                while let Some(tag) = map.next_key::<__FieldTag>()? {
3186                    #[allow(clippy::match_single_binding)]
3187                    match tag {
3188                        __FieldTag::__resource_descriptors => {
3189                            if !fields.insert(__FieldTag::__resource_descriptors) {
3190                                return std::result::Result::Err(A::Error::duplicate_field(
3191                                    "multiple values for resource_descriptors",
3192                                ));
3193                            }
3194                            result.resource_descriptors = map
3195                                .next_value::<std::option::Option<
3196                                    std::vec::Vec<api::model::MonitoredResourceDescriptor>,
3197                                >>()?
3198                                .unwrap_or_default();
3199                        }
3200                        __FieldTag::__next_page_token => {
3201                            if !fields.insert(__FieldTag::__next_page_token) {
3202                                return std::result::Result::Err(A::Error::duplicate_field(
3203                                    "multiple values for next_page_token",
3204                                ));
3205                            }
3206                            result.next_page_token = map
3207                                .next_value::<std::option::Option<std::string::String>>()?
3208                                .unwrap_or_default();
3209                        }
3210                        __FieldTag::Unknown(key) => {
3211                            let value = map.next_value::<serde_json::Value>()?;
3212                            result._unknown_fields.insert(key, value);
3213                        }
3214                    }
3215                }
3216                std::result::Result::Ok(result)
3217            }
3218        }
3219        deserializer.deserialize_any(Visitor)
3220    }
3221}
3222
3223#[doc(hidden)]
3224impl serde::ser::Serialize for ListMonitoredResourceDescriptorsResponse {
3225    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3226    where
3227        S: serde::ser::Serializer,
3228    {
3229        use serde::ser::SerializeMap;
3230        #[allow(unused_imports)]
3231        use std::option::Option::Some;
3232        let mut state = serializer.serialize_map(std::option::Option::None)?;
3233        if !self.resource_descriptors.is_empty() {
3234            state.serialize_entry("resourceDescriptors", &self.resource_descriptors)?;
3235        }
3236        if !self.next_page_token.is_empty() {
3237            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3238        }
3239        if !self._unknown_fields.is_empty() {
3240            for (key, value) in self._unknown_fields.iter() {
3241                state.serialize_entry(key, &value)?;
3242            }
3243        }
3244        state.end()
3245    }
3246}
3247
3248impl std::fmt::Debug for ListMonitoredResourceDescriptorsResponse {
3249    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3250        let mut debug_struct = f.debug_struct("ListMonitoredResourceDescriptorsResponse");
3251        debug_struct.field("resource_descriptors", &self.resource_descriptors);
3252        debug_struct.field("next_page_token", &self.next_page_token);
3253        if !self._unknown_fields.is_empty() {
3254            debug_struct.field("_unknown_fields", &self._unknown_fields);
3255        }
3256        debug_struct.finish()
3257    }
3258}
3259
3260/// The parameters to ListLogs.
3261#[derive(Clone, Default, PartialEq)]
3262#[non_exhaustive]
3263pub struct ListLogsRequest {
3264    /// Required. The resource name to list logs for:
3265    ///
3266    /// * `projects/[PROJECT_ID]`
3267    /// * `organizations/[ORGANIZATION_ID]`
3268    /// * `billingAccounts/[BILLING_ACCOUNT_ID]`
3269    /// * `folders/[FOLDER_ID]`
3270    pub parent: std::string::String,
3271
3272    /// Optional. List of resource names to list logs for:
3273    ///
3274    /// * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
3275    /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
3276    /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
3277    /// * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
3278    ///
3279    /// To support legacy queries, it could also be:
3280    ///
3281    /// * `projects/[PROJECT_ID]`
3282    /// * `organizations/[ORGANIZATION_ID]`
3283    /// * `billingAccounts/[BILLING_ACCOUNT_ID]`
3284    /// * `folders/[FOLDER_ID]`
3285    ///
3286    /// The resource name in the `parent` field is added to this list.
3287    pub resource_names: std::vec::Vec<std::string::String>,
3288
3289    /// Optional. The maximum number of results to return from this request.
3290    /// Non-positive values are ignored.  The presence of `nextPageToken` in the
3291    /// response indicates that more results might be available.
3292    pub page_size: i32,
3293
3294    /// Optional. If present, then retrieve the next batch of results from the
3295    /// preceding call to this method.  `pageToken` must be the value of
3296    /// `nextPageToken` from the previous response.  The values of other method
3297    /// parameters should be identical to those in the previous call.
3298    pub page_token: std::string::String,
3299
3300    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3301}
3302
3303impl ListLogsRequest {
3304    pub fn new() -> Self {
3305        std::default::Default::default()
3306    }
3307
3308    /// Sets the value of [parent][crate::model::ListLogsRequest::parent].
3309    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3310        self.parent = v.into();
3311        self
3312    }
3313
3314    /// Sets the value of [resource_names][crate::model::ListLogsRequest::resource_names].
3315    pub fn set_resource_names<T, V>(mut self, v: T) -> Self
3316    where
3317        T: std::iter::IntoIterator<Item = V>,
3318        V: std::convert::Into<std::string::String>,
3319    {
3320        use std::iter::Iterator;
3321        self.resource_names = v.into_iter().map(|i| i.into()).collect();
3322        self
3323    }
3324
3325    /// Sets the value of [page_size][crate::model::ListLogsRequest::page_size].
3326    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3327        self.page_size = v.into();
3328        self
3329    }
3330
3331    /// Sets the value of [page_token][crate::model::ListLogsRequest::page_token].
3332    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3333        self.page_token = v.into();
3334        self
3335    }
3336}
3337
3338impl wkt::message::Message for ListLogsRequest {
3339    fn typename() -> &'static str {
3340        "type.googleapis.com/google.logging.v2.ListLogsRequest"
3341    }
3342}
3343
3344#[doc(hidden)]
3345impl<'de> serde::de::Deserialize<'de> for ListLogsRequest {
3346    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3347    where
3348        D: serde::Deserializer<'de>,
3349    {
3350        #[allow(non_camel_case_types)]
3351        #[doc(hidden)]
3352        #[derive(PartialEq, Eq, Hash)]
3353        enum __FieldTag {
3354            __parent,
3355            __resource_names,
3356            __page_size,
3357            __page_token,
3358            Unknown(std::string::String),
3359        }
3360        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3361            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3362            where
3363                D: serde::Deserializer<'de>,
3364            {
3365                struct Visitor;
3366                impl<'de> serde::de::Visitor<'de> for Visitor {
3367                    type Value = __FieldTag;
3368                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3369                        formatter.write_str("a field name for ListLogsRequest")
3370                    }
3371                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3372                    where
3373                        E: serde::de::Error,
3374                    {
3375                        use std::result::Result::Ok;
3376                        use std::string::ToString;
3377                        match value {
3378                            "parent" => Ok(__FieldTag::__parent),
3379                            "resourceNames" => Ok(__FieldTag::__resource_names),
3380                            "resource_names" => Ok(__FieldTag::__resource_names),
3381                            "pageSize" => Ok(__FieldTag::__page_size),
3382                            "page_size" => Ok(__FieldTag::__page_size),
3383                            "pageToken" => Ok(__FieldTag::__page_token),
3384                            "page_token" => Ok(__FieldTag::__page_token),
3385                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3386                        }
3387                    }
3388                }
3389                deserializer.deserialize_identifier(Visitor)
3390            }
3391        }
3392        struct Visitor;
3393        impl<'de> serde::de::Visitor<'de> for Visitor {
3394            type Value = ListLogsRequest;
3395            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3396                formatter.write_str("struct ListLogsRequest")
3397            }
3398            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3399            where
3400                A: serde::de::MapAccess<'de>,
3401            {
3402                #[allow(unused_imports)]
3403                use serde::de::Error;
3404                use std::option::Option::Some;
3405                let mut fields = std::collections::HashSet::new();
3406                let mut result = Self::Value::new();
3407                while let Some(tag) = map.next_key::<__FieldTag>()? {
3408                    #[allow(clippy::match_single_binding)]
3409                    match tag {
3410                        __FieldTag::__parent => {
3411                            if !fields.insert(__FieldTag::__parent) {
3412                                return std::result::Result::Err(A::Error::duplicate_field(
3413                                    "multiple values for parent",
3414                                ));
3415                            }
3416                            result.parent = map
3417                                .next_value::<std::option::Option<std::string::String>>()?
3418                                .unwrap_or_default();
3419                        }
3420                        __FieldTag::__resource_names => {
3421                            if !fields.insert(__FieldTag::__resource_names) {
3422                                return std::result::Result::Err(A::Error::duplicate_field(
3423                                    "multiple values for resource_names",
3424                                ));
3425                            }
3426                            result.resource_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
3427                        }
3428                        __FieldTag::__page_size => {
3429                            if !fields.insert(__FieldTag::__page_size) {
3430                                return std::result::Result::Err(A::Error::duplicate_field(
3431                                    "multiple values for page_size",
3432                                ));
3433                            }
3434                            struct __With(std::option::Option<i32>);
3435                            impl<'de> serde::de::Deserialize<'de> for __With {
3436                                fn deserialize<D>(
3437                                    deserializer: D,
3438                                ) -> std::result::Result<Self, D::Error>
3439                                where
3440                                    D: serde::de::Deserializer<'de>,
3441                                {
3442                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3443                                }
3444                            }
3445                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
3446                        }
3447                        __FieldTag::__page_token => {
3448                            if !fields.insert(__FieldTag::__page_token) {
3449                                return std::result::Result::Err(A::Error::duplicate_field(
3450                                    "multiple values for page_token",
3451                                ));
3452                            }
3453                            result.page_token = map
3454                                .next_value::<std::option::Option<std::string::String>>()?
3455                                .unwrap_or_default();
3456                        }
3457                        __FieldTag::Unknown(key) => {
3458                            let value = map.next_value::<serde_json::Value>()?;
3459                            result._unknown_fields.insert(key, value);
3460                        }
3461                    }
3462                }
3463                std::result::Result::Ok(result)
3464            }
3465        }
3466        deserializer.deserialize_any(Visitor)
3467    }
3468}
3469
3470#[doc(hidden)]
3471impl serde::ser::Serialize for ListLogsRequest {
3472    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3473    where
3474        S: serde::ser::Serializer,
3475    {
3476        use serde::ser::SerializeMap;
3477        #[allow(unused_imports)]
3478        use std::option::Option::Some;
3479        let mut state = serializer.serialize_map(std::option::Option::None)?;
3480        if !self.parent.is_empty() {
3481            state.serialize_entry("parent", &self.parent)?;
3482        }
3483        if !self.resource_names.is_empty() {
3484            state.serialize_entry("resourceNames", &self.resource_names)?;
3485        }
3486        if !wkt::internal::is_default(&self.page_size) {
3487            struct __With<'a>(&'a i32);
3488            impl<'a> serde::ser::Serialize for __With<'a> {
3489                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3490                where
3491                    S: serde::ser::Serializer,
3492                {
3493                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3494                }
3495            }
3496            state.serialize_entry("pageSize", &__With(&self.page_size))?;
3497        }
3498        if !self.page_token.is_empty() {
3499            state.serialize_entry("pageToken", &self.page_token)?;
3500        }
3501        if !self._unknown_fields.is_empty() {
3502            for (key, value) in self._unknown_fields.iter() {
3503                state.serialize_entry(key, &value)?;
3504            }
3505        }
3506        state.end()
3507    }
3508}
3509
3510impl std::fmt::Debug for ListLogsRequest {
3511    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3512        let mut debug_struct = f.debug_struct("ListLogsRequest");
3513        debug_struct.field("parent", &self.parent);
3514        debug_struct.field("resource_names", &self.resource_names);
3515        debug_struct.field("page_size", &self.page_size);
3516        debug_struct.field("page_token", &self.page_token);
3517        if !self._unknown_fields.is_empty() {
3518            debug_struct.field("_unknown_fields", &self._unknown_fields);
3519        }
3520        debug_struct.finish()
3521    }
3522}
3523
3524/// Result returned from ListLogs.
3525#[derive(Clone, Default, PartialEq)]
3526#[non_exhaustive]
3527pub struct ListLogsResponse {
3528    /// A list of log names. For example,
3529    /// `"projects/my-project/logs/syslog"` or
3530    /// `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
3531    pub log_names: std::vec::Vec<std::string::String>,
3532
3533    /// If there might be more results than those appearing in this response, then
3534    /// `nextPageToken` is included.  To get the next set of results, call this
3535    /// method again using the value of `nextPageToken` as `pageToken`.
3536    pub next_page_token: std::string::String,
3537
3538    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3539}
3540
3541impl ListLogsResponse {
3542    pub fn new() -> Self {
3543        std::default::Default::default()
3544    }
3545
3546    /// Sets the value of [log_names][crate::model::ListLogsResponse::log_names].
3547    pub fn set_log_names<T, V>(mut self, v: T) -> Self
3548    where
3549        T: std::iter::IntoIterator<Item = V>,
3550        V: std::convert::Into<std::string::String>,
3551    {
3552        use std::iter::Iterator;
3553        self.log_names = v.into_iter().map(|i| i.into()).collect();
3554        self
3555    }
3556
3557    /// Sets the value of [next_page_token][crate::model::ListLogsResponse::next_page_token].
3558    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3559        self.next_page_token = v.into();
3560        self
3561    }
3562}
3563
3564impl wkt::message::Message for ListLogsResponse {
3565    fn typename() -> &'static str {
3566        "type.googleapis.com/google.logging.v2.ListLogsResponse"
3567    }
3568}
3569
3570#[doc(hidden)]
3571impl<'de> serde::de::Deserialize<'de> for ListLogsResponse {
3572    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3573    where
3574        D: serde::Deserializer<'de>,
3575    {
3576        #[allow(non_camel_case_types)]
3577        #[doc(hidden)]
3578        #[derive(PartialEq, Eq, Hash)]
3579        enum __FieldTag {
3580            __log_names,
3581            __next_page_token,
3582            Unknown(std::string::String),
3583        }
3584        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3585            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3586            where
3587                D: serde::Deserializer<'de>,
3588            {
3589                struct Visitor;
3590                impl<'de> serde::de::Visitor<'de> for Visitor {
3591                    type Value = __FieldTag;
3592                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3593                        formatter.write_str("a field name for ListLogsResponse")
3594                    }
3595                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3596                    where
3597                        E: serde::de::Error,
3598                    {
3599                        use std::result::Result::Ok;
3600                        use std::string::ToString;
3601                        match value {
3602                            "logNames" => Ok(__FieldTag::__log_names),
3603                            "log_names" => Ok(__FieldTag::__log_names),
3604                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
3605                            "next_page_token" => Ok(__FieldTag::__next_page_token),
3606                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3607                        }
3608                    }
3609                }
3610                deserializer.deserialize_identifier(Visitor)
3611            }
3612        }
3613        struct Visitor;
3614        impl<'de> serde::de::Visitor<'de> for Visitor {
3615            type Value = ListLogsResponse;
3616            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3617                formatter.write_str("struct ListLogsResponse")
3618            }
3619            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3620            where
3621                A: serde::de::MapAccess<'de>,
3622            {
3623                #[allow(unused_imports)]
3624                use serde::de::Error;
3625                use std::option::Option::Some;
3626                let mut fields = std::collections::HashSet::new();
3627                let mut result = Self::Value::new();
3628                while let Some(tag) = map.next_key::<__FieldTag>()? {
3629                    #[allow(clippy::match_single_binding)]
3630                    match tag {
3631                        __FieldTag::__log_names => {
3632                            if !fields.insert(__FieldTag::__log_names) {
3633                                return std::result::Result::Err(A::Error::duplicate_field(
3634                                    "multiple values for log_names",
3635                                ));
3636                            }
3637                            result.log_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
3638                        }
3639                        __FieldTag::__next_page_token => {
3640                            if !fields.insert(__FieldTag::__next_page_token) {
3641                                return std::result::Result::Err(A::Error::duplicate_field(
3642                                    "multiple values for next_page_token",
3643                                ));
3644                            }
3645                            result.next_page_token = map
3646                                .next_value::<std::option::Option<std::string::String>>()?
3647                                .unwrap_or_default();
3648                        }
3649                        __FieldTag::Unknown(key) => {
3650                            let value = map.next_value::<serde_json::Value>()?;
3651                            result._unknown_fields.insert(key, value);
3652                        }
3653                    }
3654                }
3655                std::result::Result::Ok(result)
3656            }
3657        }
3658        deserializer.deserialize_any(Visitor)
3659    }
3660}
3661
3662#[doc(hidden)]
3663impl serde::ser::Serialize for ListLogsResponse {
3664    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3665    where
3666        S: serde::ser::Serializer,
3667    {
3668        use serde::ser::SerializeMap;
3669        #[allow(unused_imports)]
3670        use std::option::Option::Some;
3671        let mut state = serializer.serialize_map(std::option::Option::None)?;
3672        if !self.log_names.is_empty() {
3673            state.serialize_entry("logNames", &self.log_names)?;
3674        }
3675        if !self.next_page_token.is_empty() {
3676            state.serialize_entry("nextPageToken", &self.next_page_token)?;
3677        }
3678        if !self._unknown_fields.is_empty() {
3679            for (key, value) in self._unknown_fields.iter() {
3680                state.serialize_entry(key, &value)?;
3681            }
3682        }
3683        state.end()
3684    }
3685}
3686
3687impl std::fmt::Debug for ListLogsResponse {
3688    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3689        let mut debug_struct = f.debug_struct("ListLogsResponse");
3690        debug_struct.field("log_names", &self.log_names);
3691        debug_struct.field("next_page_token", &self.next_page_token);
3692        if !self._unknown_fields.is_empty() {
3693            debug_struct.field("_unknown_fields", &self._unknown_fields);
3694        }
3695        debug_struct.finish()
3696    }
3697}
3698
3699/// The parameters to `TailLogEntries`.
3700#[derive(Clone, Default, PartialEq)]
3701#[non_exhaustive]
3702pub struct TailLogEntriesRequest {
3703    /// Required. Name of a parent resource from which to retrieve log entries:
3704    ///
3705    /// * `projects/[PROJECT_ID]`
3706    /// * `organizations/[ORGANIZATION_ID]`
3707    /// * `billingAccounts/[BILLING_ACCOUNT_ID]`
3708    /// * `folders/[FOLDER_ID]`
3709    ///
3710    /// May alternatively be one or more views:
3711    ///
3712    /// * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
3713    /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
3714    /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
3715    /// * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]`
3716    pub resource_names: std::vec::Vec<std::string::String>,
3717
3718    /// Optional. Only log entries that match the filter are returned.  An empty
3719    /// filter matches all log entries in the resources listed in `resource_names`.
3720    /// Referencing a parent resource that is not listed in `resource_names` will
3721    /// cause the filter to return no results. The maximum length of a filter is
3722    /// 20,000 characters.
3723    pub filter: std::string::String,
3724
3725    /// Optional. The amount of time to buffer log entries at the server before
3726    /// being returned to prevent out of order results due to late arriving log
3727    /// entries. Valid values are between 0-60000 milliseconds. Defaults to 2000
3728    /// milliseconds.
3729    pub buffer_window: std::option::Option<wkt::Duration>,
3730
3731    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3732}
3733
3734impl TailLogEntriesRequest {
3735    pub fn new() -> Self {
3736        std::default::Default::default()
3737    }
3738
3739    /// Sets the value of [resource_names][crate::model::TailLogEntriesRequest::resource_names].
3740    pub fn set_resource_names<T, V>(mut self, v: T) -> Self
3741    where
3742        T: std::iter::IntoIterator<Item = V>,
3743        V: std::convert::Into<std::string::String>,
3744    {
3745        use std::iter::Iterator;
3746        self.resource_names = v.into_iter().map(|i| i.into()).collect();
3747        self
3748    }
3749
3750    /// Sets the value of [filter][crate::model::TailLogEntriesRequest::filter].
3751    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3752        self.filter = v.into();
3753        self
3754    }
3755
3756    /// Sets the value of [buffer_window][crate::model::TailLogEntriesRequest::buffer_window].
3757    pub fn set_buffer_window<T>(mut self, v: T) -> Self
3758    where
3759        T: std::convert::Into<wkt::Duration>,
3760    {
3761        self.buffer_window = std::option::Option::Some(v.into());
3762        self
3763    }
3764
3765    /// Sets or clears the value of [buffer_window][crate::model::TailLogEntriesRequest::buffer_window].
3766    pub fn set_or_clear_buffer_window<T>(mut self, v: std::option::Option<T>) -> Self
3767    where
3768        T: std::convert::Into<wkt::Duration>,
3769    {
3770        self.buffer_window = v.map(|x| x.into());
3771        self
3772    }
3773}
3774
3775impl wkt::message::Message for TailLogEntriesRequest {
3776    fn typename() -> &'static str {
3777        "type.googleapis.com/google.logging.v2.TailLogEntriesRequest"
3778    }
3779}
3780
3781#[doc(hidden)]
3782impl<'de> serde::de::Deserialize<'de> for TailLogEntriesRequest {
3783    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3784    where
3785        D: serde::Deserializer<'de>,
3786    {
3787        #[allow(non_camel_case_types)]
3788        #[doc(hidden)]
3789        #[derive(PartialEq, Eq, Hash)]
3790        enum __FieldTag {
3791            __resource_names,
3792            __filter,
3793            __buffer_window,
3794            Unknown(std::string::String),
3795        }
3796        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3797            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3798            where
3799                D: serde::Deserializer<'de>,
3800            {
3801                struct Visitor;
3802                impl<'de> serde::de::Visitor<'de> for Visitor {
3803                    type Value = __FieldTag;
3804                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3805                        formatter.write_str("a field name for TailLogEntriesRequest")
3806                    }
3807                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3808                    where
3809                        E: serde::de::Error,
3810                    {
3811                        use std::result::Result::Ok;
3812                        use std::string::ToString;
3813                        match value {
3814                            "resourceNames" => Ok(__FieldTag::__resource_names),
3815                            "resource_names" => Ok(__FieldTag::__resource_names),
3816                            "filter" => Ok(__FieldTag::__filter),
3817                            "bufferWindow" => Ok(__FieldTag::__buffer_window),
3818                            "buffer_window" => Ok(__FieldTag::__buffer_window),
3819                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3820                        }
3821                    }
3822                }
3823                deserializer.deserialize_identifier(Visitor)
3824            }
3825        }
3826        struct Visitor;
3827        impl<'de> serde::de::Visitor<'de> for Visitor {
3828            type Value = TailLogEntriesRequest;
3829            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3830                formatter.write_str("struct TailLogEntriesRequest")
3831            }
3832            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3833            where
3834                A: serde::de::MapAccess<'de>,
3835            {
3836                #[allow(unused_imports)]
3837                use serde::de::Error;
3838                use std::option::Option::Some;
3839                let mut fields = std::collections::HashSet::new();
3840                let mut result = Self::Value::new();
3841                while let Some(tag) = map.next_key::<__FieldTag>()? {
3842                    #[allow(clippy::match_single_binding)]
3843                    match tag {
3844                        __FieldTag::__resource_names => {
3845                            if !fields.insert(__FieldTag::__resource_names) {
3846                                return std::result::Result::Err(A::Error::duplicate_field(
3847                                    "multiple values for resource_names",
3848                                ));
3849                            }
3850                            result.resource_names = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
3851                        }
3852                        __FieldTag::__filter => {
3853                            if !fields.insert(__FieldTag::__filter) {
3854                                return std::result::Result::Err(A::Error::duplicate_field(
3855                                    "multiple values for filter",
3856                                ));
3857                            }
3858                            result.filter = map
3859                                .next_value::<std::option::Option<std::string::String>>()?
3860                                .unwrap_or_default();
3861                        }
3862                        __FieldTag::__buffer_window => {
3863                            if !fields.insert(__FieldTag::__buffer_window) {
3864                                return std::result::Result::Err(A::Error::duplicate_field(
3865                                    "multiple values for buffer_window",
3866                                ));
3867                            }
3868                            result.buffer_window =
3869                                map.next_value::<std::option::Option<wkt::Duration>>()?;
3870                        }
3871                        __FieldTag::Unknown(key) => {
3872                            let value = map.next_value::<serde_json::Value>()?;
3873                            result._unknown_fields.insert(key, value);
3874                        }
3875                    }
3876                }
3877                std::result::Result::Ok(result)
3878            }
3879        }
3880        deserializer.deserialize_any(Visitor)
3881    }
3882}
3883
3884#[doc(hidden)]
3885impl serde::ser::Serialize for TailLogEntriesRequest {
3886    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3887    where
3888        S: serde::ser::Serializer,
3889    {
3890        use serde::ser::SerializeMap;
3891        #[allow(unused_imports)]
3892        use std::option::Option::Some;
3893        let mut state = serializer.serialize_map(std::option::Option::None)?;
3894        if !self.resource_names.is_empty() {
3895            state.serialize_entry("resourceNames", &self.resource_names)?;
3896        }
3897        if !self.filter.is_empty() {
3898            state.serialize_entry("filter", &self.filter)?;
3899        }
3900        if self.buffer_window.is_some() {
3901            state.serialize_entry("bufferWindow", &self.buffer_window)?;
3902        }
3903        if !self._unknown_fields.is_empty() {
3904            for (key, value) in self._unknown_fields.iter() {
3905                state.serialize_entry(key, &value)?;
3906            }
3907        }
3908        state.end()
3909    }
3910}
3911
3912impl std::fmt::Debug for TailLogEntriesRequest {
3913    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3914        let mut debug_struct = f.debug_struct("TailLogEntriesRequest");
3915        debug_struct.field("resource_names", &self.resource_names);
3916        debug_struct.field("filter", &self.filter);
3917        debug_struct.field("buffer_window", &self.buffer_window);
3918        if !self._unknown_fields.is_empty() {
3919            debug_struct.field("_unknown_fields", &self._unknown_fields);
3920        }
3921        debug_struct.finish()
3922    }
3923}
3924
3925/// Result returned from `TailLogEntries`.
3926#[derive(Clone, Default, PartialEq)]
3927#[non_exhaustive]
3928pub struct TailLogEntriesResponse {
3929    /// A list of log entries. Each response in the stream will order entries with
3930    /// increasing values of `LogEntry.timestamp`. Ordering is not guaranteed
3931    /// between separate responses.
3932    pub entries: std::vec::Vec<crate::model::LogEntry>,
3933
3934    /// If entries that otherwise would have been included in the session were not
3935    /// sent back to the client, counts of relevant entries omitted from the
3936    /// session with the reason that they were not included. There will be at most
3937    /// one of each reason per response. The counts represent the number of
3938    /// suppressed entries since the last streamed response.
3939    pub suppression_info: std::vec::Vec<crate::model::tail_log_entries_response::SuppressionInfo>,
3940
3941    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3942}
3943
3944impl TailLogEntriesResponse {
3945    pub fn new() -> Self {
3946        std::default::Default::default()
3947    }
3948
3949    /// Sets the value of [entries][crate::model::TailLogEntriesResponse::entries].
3950    pub fn set_entries<T, V>(mut self, v: T) -> Self
3951    where
3952        T: std::iter::IntoIterator<Item = V>,
3953        V: std::convert::Into<crate::model::LogEntry>,
3954    {
3955        use std::iter::Iterator;
3956        self.entries = v.into_iter().map(|i| i.into()).collect();
3957        self
3958    }
3959
3960    /// Sets the value of [suppression_info][crate::model::TailLogEntriesResponse::suppression_info].
3961    pub fn set_suppression_info<T, V>(mut self, v: T) -> Self
3962    where
3963        T: std::iter::IntoIterator<Item = V>,
3964        V: std::convert::Into<crate::model::tail_log_entries_response::SuppressionInfo>,
3965    {
3966        use std::iter::Iterator;
3967        self.suppression_info = v.into_iter().map(|i| i.into()).collect();
3968        self
3969    }
3970}
3971
3972impl wkt::message::Message for TailLogEntriesResponse {
3973    fn typename() -> &'static str {
3974        "type.googleapis.com/google.logging.v2.TailLogEntriesResponse"
3975    }
3976}
3977
3978#[doc(hidden)]
3979impl<'de> serde::de::Deserialize<'de> for TailLogEntriesResponse {
3980    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3981    where
3982        D: serde::Deserializer<'de>,
3983    {
3984        #[allow(non_camel_case_types)]
3985        #[doc(hidden)]
3986        #[derive(PartialEq, Eq, Hash)]
3987        enum __FieldTag {
3988            __entries,
3989            __suppression_info,
3990            Unknown(std::string::String),
3991        }
3992        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3993            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3994            where
3995                D: serde::Deserializer<'de>,
3996            {
3997                struct Visitor;
3998                impl<'de> serde::de::Visitor<'de> for Visitor {
3999                    type Value = __FieldTag;
4000                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4001                        formatter.write_str("a field name for TailLogEntriesResponse")
4002                    }
4003                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4004                    where
4005                        E: serde::de::Error,
4006                    {
4007                        use std::result::Result::Ok;
4008                        use std::string::ToString;
4009                        match value {
4010                            "entries" => Ok(__FieldTag::__entries),
4011                            "suppressionInfo" => Ok(__FieldTag::__suppression_info),
4012                            "suppression_info" => Ok(__FieldTag::__suppression_info),
4013                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4014                        }
4015                    }
4016                }
4017                deserializer.deserialize_identifier(Visitor)
4018            }
4019        }
4020        struct Visitor;
4021        impl<'de> serde::de::Visitor<'de> for Visitor {
4022            type Value = TailLogEntriesResponse;
4023            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4024                formatter.write_str("struct TailLogEntriesResponse")
4025            }
4026            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4027            where
4028                A: serde::de::MapAccess<'de>,
4029            {
4030                #[allow(unused_imports)]
4031                use serde::de::Error;
4032                use std::option::Option::Some;
4033                let mut fields = std::collections::HashSet::new();
4034                let mut result = Self::Value::new();
4035                while let Some(tag) = map.next_key::<__FieldTag>()? {
4036                    #[allow(clippy::match_single_binding)]
4037                    match tag {
4038                        __FieldTag::__entries => {
4039                            if !fields.insert(__FieldTag::__entries) {
4040                                return std::result::Result::Err(A::Error::duplicate_field(
4041                                    "multiple values for entries",
4042                                ));
4043                            }
4044                            result.entries = map.next_value::<std::option::Option<std::vec::Vec<crate::model::LogEntry>>>()?.unwrap_or_default();
4045                        }
4046                        __FieldTag::__suppression_info => {
4047                            if !fields.insert(__FieldTag::__suppression_info) {
4048                                return std::result::Result::Err(A::Error::duplicate_field(
4049                                    "multiple values for suppression_info",
4050                                ));
4051                            }
4052                            result.suppression_info = map
4053                                .next_value::<std::option::Option<
4054                                    std::vec::Vec<
4055                                        crate::model::tail_log_entries_response::SuppressionInfo,
4056                                    >,
4057                                >>()?
4058                                .unwrap_or_default();
4059                        }
4060                        __FieldTag::Unknown(key) => {
4061                            let value = map.next_value::<serde_json::Value>()?;
4062                            result._unknown_fields.insert(key, value);
4063                        }
4064                    }
4065                }
4066                std::result::Result::Ok(result)
4067            }
4068        }
4069        deserializer.deserialize_any(Visitor)
4070    }
4071}
4072
4073#[doc(hidden)]
4074impl serde::ser::Serialize for TailLogEntriesResponse {
4075    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4076    where
4077        S: serde::ser::Serializer,
4078    {
4079        use serde::ser::SerializeMap;
4080        #[allow(unused_imports)]
4081        use std::option::Option::Some;
4082        let mut state = serializer.serialize_map(std::option::Option::None)?;
4083        if !self.entries.is_empty() {
4084            state.serialize_entry("entries", &self.entries)?;
4085        }
4086        if !self.suppression_info.is_empty() {
4087            state.serialize_entry("suppressionInfo", &self.suppression_info)?;
4088        }
4089        if !self._unknown_fields.is_empty() {
4090            for (key, value) in self._unknown_fields.iter() {
4091                state.serialize_entry(key, &value)?;
4092            }
4093        }
4094        state.end()
4095    }
4096}
4097
4098impl std::fmt::Debug for TailLogEntriesResponse {
4099    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4100        let mut debug_struct = f.debug_struct("TailLogEntriesResponse");
4101        debug_struct.field("entries", &self.entries);
4102        debug_struct.field("suppression_info", &self.suppression_info);
4103        if !self._unknown_fields.is_empty() {
4104            debug_struct.field("_unknown_fields", &self._unknown_fields);
4105        }
4106        debug_struct.finish()
4107    }
4108}
4109
4110/// Defines additional types related to [TailLogEntriesResponse].
4111pub mod tail_log_entries_response {
4112    #[allow(unused_imports)]
4113    use super::*;
4114
4115    /// Information about entries that were omitted from the session.
4116    #[derive(Clone, Default, PartialEq)]
4117    #[non_exhaustive]
4118    pub struct SuppressionInfo {
4119        /// The reason that entries were omitted from the session.
4120        pub reason: crate::model::tail_log_entries_response::suppression_info::Reason,
4121
4122        /// A lower bound on the count of entries omitted due to `reason`.
4123        pub suppressed_count: i32,
4124
4125        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4126    }
4127
4128    impl SuppressionInfo {
4129        pub fn new() -> Self {
4130            std::default::Default::default()
4131        }
4132
4133        /// Sets the value of [reason][crate::model::tail_log_entries_response::SuppressionInfo::reason].
4134        pub fn set_reason<
4135            T: std::convert::Into<crate::model::tail_log_entries_response::suppression_info::Reason>,
4136        >(
4137            mut self,
4138            v: T,
4139        ) -> Self {
4140            self.reason = v.into();
4141            self
4142        }
4143
4144        /// Sets the value of [suppressed_count][crate::model::tail_log_entries_response::SuppressionInfo::suppressed_count].
4145        pub fn set_suppressed_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4146            self.suppressed_count = v.into();
4147            self
4148        }
4149    }
4150
4151    impl wkt::message::Message for SuppressionInfo {
4152        fn typename() -> &'static str {
4153            "type.googleapis.com/google.logging.v2.TailLogEntriesResponse.SuppressionInfo"
4154        }
4155    }
4156
4157    #[doc(hidden)]
4158    impl<'de> serde::de::Deserialize<'de> for SuppressionInfo {
4159        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4160        where
4161            D: serde::Deserializer<'de>,
4162        {
4163            #[allow(non_camel_case_types)]
4164            #[doc(hidden)]
4165            #[derive(PartialEq, Eq, Hash)]
4166            enum __FieldTag {
4167                __reason,
4168                __suppressed_count,
4169                Unknown(std::string::String),
4170            }
4171            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4172                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4173                where
4174                    D: serde::Deserializer<'de>,
4175                {
4176                    struct Visitor;
4177                    impl<'de> serde::de::Visitor<'de> for Visitor {
4178                        type Value = __FieldTag;
4179                        fn expecting(
4180                            &self,
4181                            formatter: &mut std::fmt::Formatter,
4182                        ) -> std::fmt::Result {
4183                            formatter.write_str("a field name for SuppressionInfo")
4184                        }
4185                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4186                        where
4187                            E: serde::de::Error,
4188                        {
4189                            use std::result::Result::Ok;
4190                            use std::string::ToString;
4191                            match value {
4192                                "reason" => Ok(__FieldTag::__reason),
4193                                "suppressedCount" => Ok(__FieldTag::__suppressed_count),
4194                                "suppressed_count" => Ok(__FieldTag::__suppressed_count),
4195                                _ => Ok(__FieldTag::Unknown(value.to_string())),
4196                            }
4197                        }
4198                    }
4199                    deserializer.deserialize_identifier(Visitor)
4200                }
4201            }
4202            struct Visitor;
4203            impl<'de> serde::de::Visitor<'de> for Visitor {
4204                type Value = SuppressionInfo;
4205                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4206                    formatter.write_str("struct SuppressionInfo")
4207                }
4208                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4209                where
4210                    A: serde::de::MapAccess<'de>,
4211                {
4212                    #[allow(unused_imports)]
4213                    use serde::de::Error;
4214                    use std::option::Option::Some;
4215                    let mut fields = std::collections::HashSet::new();
4216                    let mut result = Self::Value::new();
4217                    while let Some(tag) = map.next_key::<__FieldTag>()? {
4218                        #[allow(clippy::match_single_binding)]
4219                        match tag {
4220                            __FieldTag::__reason => {
4221                                if !fields.insert(__FieldTag::__reason) {
4222                                    return std::result::Result::Err(A::Error::duplicate_field(
4223                                        "multiple values for reason",
4224                                    ));
4225                                }
4226                                result.reason = map.next_value::<std::option::Option<crate::model::tail_log_entries_response::suppression_info::Reason>>()?.unwrap_or_default();
4227                            }
4228                            __FieldTag::__suppressed_count => {
4229                                if !fields.insert(__FieldTag::__suppressed_count) {
4230                                    return std::result::Result::Err(A::Error::duplicate_field(
4231                                        "multiple values for suppressed_count",
4232                                    ));
4233                                }
4234                                struct __With(std::option::Option<i32>);
4235                                impl<'de> serde::de::Deserialize<'de> for __With {
4236                                    fn deserialize<D>(
4237                                        deserializer: D,
4238                                    ) -> std::result::Result<Self, D::Error>
4239                                    where
4240                                        D: serde::de::Deserializer<'de>,
4241                                    {
4242                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4243                                    }
4244                                }
4245                                result.suppressed_count =
4246                                    map.next_value::<__With>()?.0.unwrap_or_default();
4247                            }
4248                            __FieldTag::Unknown(key) => {
4249                                let value = map.next_value::<serde_json::Value>()?;
4250                                result._unknown_fields.insert(key, value);
4251                            }
4252                        }
4253                    }
4254                    std::result::Result::Ok(result)
4255                }
4256            }
4257            deserializer.deserialize_any(Visitor)
4258        }
4259    }
4260
4261    #[doc(hidden)]
4262    impl serde::ser::Serialize for SuppressionInfo {
4263        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4264        where
4265            S: serde::ser::Serializer,
4266        {
4267            use serde::ser::SerializeMap;
4268            #[allow(unused_imports)]
4269            use std::option::Option::Some;
4270            let mut state = serializer.serialize_map(std::option::Option::None)?;
4271            if !wkt::internal::is_default(&self.reason) {
4272                state.serialize_entry("reason", &self.reason)?;
4273            }
4274            if !wkt::internal::is_default(&self.suppressed_count) {
4275                struct __With<'a>(&'a i32);
4276                impl<'a> serde::ser::Serialize for __With<'a> {
4277                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4278                    where
4279                        S: serde::ser::Serializer,
4280                    {
4281                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4282                    }
4283                }
4284                state.serialize_entry("suppressedCount", &__With(&self.suppressed_count))?;
4285            }
4286            if !self._unknown_fields.is_empty() {
4287                for (key, value) in self._unknown_fields.iter() {
4288                    state.serialize_entry(key, &value)?;
4289                }
4290            }
4291            state.end()
4292        }
4293    }
4294
4295    impl std::fmt::Debug for SuppressionInfo {
4296        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4297            let mut debug_struct = f.debug_struct("SuppressionInfo");
4298            debug_struct.field("reason", &self.reason);
4299            debug_struct.field("suppressed_count", &self.suppressed_count);
4300            if !self._unknown_fields.is_empty() {
4301                debug_struct.field("_unknown_fields", &self._unknown_fields);
4302            }
4303            debug_struct.finish()
4304        }
4305    }
4306
4307    /// Defines additional types related to [SuppressionInfo].
4308    pub mod suppression_info {
4309        #[allow(unused_imports)]
4310        use super::*;
4311
4312        /// An indicator of why entries were omitted.
4313        ///
4314        /// # Working with unknown values
4315        ///
4316        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4317        /// additional enum variants at any time. Adding new variants is not considered
4318        /// a breaking change. Applications should write their code in anticipation of:
4319        ///
4320        /// - New values appearing in future releases of the client library, **and**
4321        /// - New values received dynamically, without application changes.
4322        ///
4323        /// Please consult the [Working with enums] section in the user guide for some
4324        /// guidelines.
4325        ///
4326        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4327        #[derive(Clone, Debug, PartialEq)]
4328        #[non_exhaustive]
4329        pub enum Reason {
4330            /// Unexpected default.
4331            Unspecified,
4332            /// Indicates suppression occurred due to relevant entries being
4333            /// received in excess of rate limits. For quotas and limits, see
4334            /// [Logging API quotas and
4335            /// limits](https://cloud.google.com/logging/quotas#api-limits).
4336            RateLimit,
4337            /// Indicates suppression occurred due to the client not consuming
4338            /// responses quickly enough.
4339            NotConsumed,
4340            /// If set, the enum was initialized with an unknown value.
4341            ///
4342            /// Applications can examine the value using [Reason::value] or
4343            /// [Reason::name].
4344            UnknownValue(reason::UnknownValue),
4345        }
4346
4347        #[doc(hidden)]
4348        pub mod reason {
4349            #[allow(unused_imports)]
4350            use super::*;
4351            #[derive(Clone, Debug, PartialEq)]
4352            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4353        }
4354
4355        impl Reason {
4356            /// Gets the enum value.
4357            ///
4358            /// Returns `None` if the enum contains an unknown value deserialized from
4359            /// the string representation of enums.
4360            pub fn value(&self) -> std::option::Option<i32> {
4361                match self {
4362                    Self::Unspecified => std::option::Option::Some(0),
4363                    Self::RateLimit => std::option::Option::Some(1),
4364                    Self::NotConsumed => std::option::Option::Some(2),
4365                    Self::UnknownValue(u) => u.0.value(),
4366                }
4367            }
4368
4369            /// Gets the enum value as a string.
4370            ///
4371            /// Returns `None` if the enum contains an unknown value deserialized from
4372            /// the integer representation of enums.
4373            pub fn name(&self) -> std::option::Option<&str> {
4374                match self {
4375                    Self::Unspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
4376                    Self::RateLimit => std::option::Option::Some("RATE_LIMIT"),
4377                    Self::NotConsumed => std::option::Option::Some("NOT_CONSUMED"),
4378                    Self::UnknownValue(u) => u.0.name(),
4379                }
4380            }
4381        }
4382
4383        impl std::default::Default for Reason {
4384            fn default() -> Self {
4385                use std::convert::From;
4386                Self::from(0)
4387            }
4388        }
4389
4390        impl std::fmt::Display for Reason {
4391            fn fmt(
4392                &self,
4393                f: &mut std::fmt::Formatter<'_>,
4394            ) -> std::result::Result<(), std::fmt::Error> {
4395                wkt::internal::display_enum(f, self.name(), self.value())
4396            }
4397        }
4398
4399        impl std::convert::From<i32> for Reason {
4400            fn from(value: i32) -> Self {
4401                match value {
4402                    0 => Self::Unspecified,
4403                    1 => Self::RateLimit,
4404                    2 => Self::NotConsumed,
4405                    _ => Self::UnknownValue(reason::UnknownValue(
4406                        wkt::internal::UnknownEnumValue::Integer(value),
4407                    )),
4408                }
4409            }
4410        }
4411
4412        impl std::convert::From<&str> for Reason {
4413            fn from(value: &str) -> Self {
4414                use std::string::ToString;
4415                match value {
4416                    "REASON_UNSPECIFIED" => Self::Unspecified,
4417                    "RATE_LIMIT" => Self::RateLimit,
4418                    "NOT_CONSUMED" => Self::NotConsumed,
4419                    _ => Self::UnknownValue(reason::UnknownValue(
4420                        wkt::internal::UnknownEnumValue::String(value.to_string()),
4421                    )),
4422                }
4423            }
4424        }
4425
4426        impl serde::ser::Serialize for Reason {
4427            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4428            where
4429                S: serde::Serializer,
4430            {
4431                match self {
4432                    Self::Unspecified => serializer.serialize_i32(0),
4433                    Self::RateLimit => serializer.serialize_i32(1),
4434                    Self::NotConsumed => serializer.serialize_i32(2),
4435                    Self::UnknownValue(u) => u.0.serialize(serializer),
4436                }
4437            }
4438        }
4439
4440        impl<'de> serde::de::Deserialize<'de> for Reason {
4441            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4442            where
4443                D: serde::Deserializer<'de>,
4444            {
4445                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Reason>::new(
4446                    ".google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason",
4447                ))
4448            }
4449        }
4450    }
4451}
4452
4453/// Configuration for an indexed field.
4454#[derive(Clone, Default, PartialEq)]
4455#[non_exhaustive]
4456pub struct IndexConfig {
4457    /// Required. The LogEntry field path to index.
4458    ///
4459    /// Note that some paths are automatically indexed, and other paths are not
4460    /// eligible for indexing. See [indexing documentation](
4461    /// <https://cloud.google.com/logging/docs/view/advanced-queries#indexed-fields>)
4462    /// for details.
4463    ///
4464    /// For example: `jsonPayload.request.status`
4465    pub field_path: std::string::String,
4466
4467    /// Required. The type of data in this index.
4468    pub r#type: crate::model::IndexType,
4469
4470    /// Output only. The timestamp when the index was last modified.
4471    ///
4472    /// This is used to return the timestamp, and will be ignored if supplied
4473    /// during update.
4474    pub create_time: std::option::Option<wkt::Timestamp>,
4475
4476    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4477}
4478
4479impl IndexConfig {
4480    pub fn new() -> Self {
4481        std::default::Default::default()
4482    }
4483
4484    /// Sets the value of [field_path][crate::model::IndexConfig::field_path].
4485    pub fn set_field_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4486        self.field_path = v.into();
4487        self
4488    }
4489
4490    /// Sets the value of [r#type][crate::model::IndexConfig::type].
4491    pub fn set_type<T: std::convert::Into<crate::model::IndexType>>(mut self, v: T) -> Self {
4492        self.r#type = v.into();
4493        self
4494    }
4495
4496    /// Sets the value of [create_time][crate::model::IndexConfig::create_time].
4497    pub fn set_create_time<T>(mut self, v: T) -> Self
4498    where
4499        T: std::convert::Into<wkt::Timestamp>,
4500    {
4501        self.create_time = std::option::Option::Some(v.into());
4502        self
4503    }
4504
4505    /// Sets or clears the value of [create_time][crate::model::IndexConfig::create_time].
4506    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4507    where
4508        T: std::convert::Into<wkt::Timestamp>,
4509    {
4510        self.create_time = v.map(|x| x.into());
4511        self
4512    }
4513}
4514
4515impl wkt::message::Message for IndexConfig {
4516    fn typename() -> &'static str {
4517        "type.googleapis.com/google.logging.v2.IndexConfig"
4518    }
4519}
4520
4521#[doc(hidden)]
4522impl<'de> serde::de::Deserialize<'de> for IndexConfig {
4523    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4524    where
4525        D: serde::Deserializer<'de>,
4526    {
4527        #[allow(non_camel_case_types)]
4528        #[doc(hidden)]
4529        #[derive(PartialEq, Eq, Hash)]
4530        enum __FieldTag {
4531            __field_path,
4532            __type,
4533            __create_time,
4534            Unknown(std::string::String),
4535        }
4536        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4537            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4538            where
4539                D: serde::Deserializer<'de>,
4540            {
4541                struct Visitor;
4542                impl<'de> serde::de::Visitor<'de> for Visitor {
4543                    type Value = __FieldTag;
4544                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4545                        formatter.write_str("a field name for IndexConfig")
4546                    }
4547                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4548                    where
4549                        E: serde::de::Error,
4550                    {
4551                        use std::result::Result::Ok;
4552                        use std::string::ToString;
4553                        match value {
4554                            "fieldPath" => Ok(__FieldTag::__field_path),
4555                            "field_path" => Ok(__FieldTag::__field_path),
4556                            "type" => Ok(__FieldTag::__type),
4557                            "createTime" => Ok(__FieldTag::__create_time),
4558                            "create_time" => Ok(__FieldTag::__create_time),
4559                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4560                        }
4561                    }
4562                }
4563                deserializer.deserialize_identifier(Visitor)
4564            }
4565        }
4566        struct Visitor;
4567        impl<'de> serde::de::Visitor<'de> for Visitor {
4568            type Value = IndexConfig;
4569            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4570                formatter.write_str("struct IndexConfig")
4571            }
4572            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4573            where
4574                A: serde::de::MapAccess<'de>,
4575            {
4576                #[allow(unused_imports)]
4577                use serde::de::Error;
4578                use std::option::Option::Some;
4579                let mut fields = std::collections::HashSet::new();
4580                let mut result = Self::Value::new();
4581                while let Some(tag) = map.next_key::<__FieldTag>()? {
4582                    #[allow(clippy::match_single_binding)]
4583                    match tag {
4584                        __FieldTag::__field_path => {
4585                            if !fields.insert(__FieldTag::__field_path) {
4586                                return std::result::Result::Err(A::Error::duplicate_field(
4587                                    "multiple values for field_path",
4588                                ));
4589                            }
4590                            result.field_path = map
4591                                .next_value::<std::option::Option<std::string::String>>()?
4592                                .unwrap_or_default();
4593                        }
4594                        __FieldTag::__type => {
4595                            if !fields.insert(__FieldTag::__type) {
4596                                return std::result::Result::Err(A::Error::duplicate_field(
4597                                    "multiple values for type",
4598                                ));
4599                            }
4600                            result.r#type = map
4601                                .next_value::<std::option::Option<crate::model::IndexType>>()?
4602                                .unwrap_or_default();
4603                        }
4604                        __FieldTag::__create_time => {
4605                            if !fields.insert(__FieldTag::__create_time) {
4606                                return std::result::Result::Err(A::Error::duplicate_field(
4607                                    "multiple values for create_time",
4608                                ));
4609                            }
4610                            result.create_time =
4611                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4612                        }
4613                        __FieldTag::Unknown(key) => {
4614                            let value = map.next_value::<serde_json::Value>()?;
4615                            result._unknown_fields.insert(key, value);
4616                        }
4617                    }
4618                }
4619                std::result::Result::Ok(result)
4620            }
4621        }
4622        deserializer.deserialize_any(Visitor)
4623    }
4624}
4625
4626#[doc(hidden)]
4627impl serde::ser::Serialize for IndexConfig {
4628    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4629    where
4630        S: serde::ser::Serializer,
4631    {
4632        use serde::ser::SerializeMap;
4633        #[allow(unused_imports)]
4634        use std::option::Option::Some;
4635        let mut state = serializer.serialize_map(std::option::Option::None)?;
4636        if !self.field_path.is_empty() {
4637            state.serialize_entry("fieldPath", &self.field_path)?;
4638        }
4639        if !wkt::internal::is_default(&self.r#type) {
4640            state.serialize_entry("type", &self.r#type)?;
4641        }
4642        if self.create_time.is_some() {
4643            state.serialize_entry("createTime", &self.create_time)?;
4644        }
4645        if !self._unknown_fields.is_empty() {
4646            for (key, value) in self._unknown_fields.iter() {
4647                state.serialize_entry(key, &value)?;
4648            }
4649        }
4650        state.end()
4651    }
4652}
4653
4654impl std::fmt::Debug for IndexConfig {
4655    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4656        let mut debug_struct = f.debug_struct("IndexConfig");
4657        debug_struct.field("field_path", &self.field_path);
4658        debug_struct.field("r#type", &self.r#type);
4659        debug_struct.field("create_time", &self.create_time);
4660        if !self._unknown_fields.is_empty() {
4661            debug_struct.field("_unknown_fields", &self._unknown_fields);
4662        }
4663        debug_struct.finish()
4664    }
4665}
4666
4667/// Describes a repository in which log entries are stored.
4668#[derive(Clone, Default, PartialEq)]
4669#[non_exhaustive]
4670pub struct LogBucket {
4671    /// Output only. The resource name of the bucket.
4672    ///
4673    /// For example:
4674    ///
4675    /// `projects/my-project/locations/global/buckets/my-bucket`
4676    ///
4677    /// For a list of supported locations, see [Supported
4678    /// Regions](https://cloud.google.com/logging/docs/region-support)
4679    ///
4680    /// For the location of `global` it is unspecified where log entries are
4681    /// actually stored.
4682    ///
4683    /// After a bucket has been created, the location cannot be changed.
4684    pub name: std::string::String,
4685
4686    /// Describes this bucket.
4687    pub description: std::string::String,
4688
4689    /// Output only. The creation timestamp of the bucket. This is not set for any
4690    /// of the default buckets.
4691    pub create_time: std::option::Option<wkt::Timestamp>,
4692
4693    /// Output only. The last update timestamp of the bucket.
4694    pub update_time: std::option::Option<wkt::Timestamp>,
4695
4696    /// Logs will be retained by default for this amount of time, after which they
4697    /// will automatically be deleted. The minimum retention period is 1 day. If
4698    /// this value is set to zero at bucket creation time, the default time of 30
4699    /// days will be used.
4700    pub retention_days: i32,
4701
4702    /// Whether the bucket is locked.
4703    ///
4704    /// The retention period on a locked bucket cannot be changed. Locked buckets
4705    /// may only be deleted if they are empty.
4706    pub locked: bool,
4707
4708    /// Output only. The bucket lifecycle state.
4709    pub lifecycle_state: crate::model::LifecycleState,
4710
4711    /// Whether log analytics is enabled for this bucket.
4712    ///
4713    /// Once enabled, log analytics features cannot be disabled.
4714    pub analytics_enabled: bool,
4715
4716    /// Log entry field paths that are denied access in this bucket.
4717    ///
4718    /// The following fields and their children are eligible: `textPayload`,
4719    /// `jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`.
4720    ///
4721    /// Restricting a repeated field will restrict all values. Adding a parent will
4722    /// block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`)
4723    pub restricted_fields: std::vec::Vec<std::string::String>,
4724
4725    /// A list of indexed fields and related configuration data.
4726    pub index_configs: std::vec::Vec<crate::model::IndexConfig>,
4727
4728    /// The CMEK settings of the log bucket. If present, new log entries written to
4729    /// this log bucket are encrypted using the CMEK key provided in this
4730    /// configuration. If a log bucket has CMEK settings, the CMEK settings cannot
4731    /// be disabled later by updating the log bucket. Changing the KMS key is
4732    /// allowed.
4733    pub cmek_settings: std::option::Option<crate::model::CmekSettings>,
4734
4735    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4736}
4737
4738impl LogBucket {
4739    pub fn new() -> Self {
4740        std::default::Default::default()
4741    }
4742
4743    /// Sets the value of [name][crate::model::LogBucket::name].
4744    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4745        self.name = v.into();
4746        self
4747    }
4748
4749    /// Sets the value of [description][crate::model::LogBucket::description].
4750    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4751        self.description = v.into();
4752        self
4753    }
4754
4755    /// Sets the value of [create_time][crate::model::LogBucket::create_time].
4756    pub fn set_create_time<T>(mut self, v: T) -> Self
4757    where
4758        T: std::convert::Into<wkt::Timestamp>,
4759    {
4760        self.create_time = std::option::Option::Some(v.into());
4761        self
4762    }
4763
4764    /// Sets or clears the value of [create_time][crate::model::LogBucket::create_time].
4765    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4766    where
4767        T: std::convert::Into<wkt::Timestamp>,
4768    {
4769        self.create_time = v.map(|x| x.into());
4770        self
4771    }
4772
4773    /// Sets the value of [update_time][crate::model::LogBucket::update_time].
4774    pub fn set_update_time<T>(mut self, v: T) -> Self
4775    where
4776        T: std::convert::Into<wkt::Timestamp>,
4777    {
4778        self.update_time = std::option::Option::Some(v.into());
4779        self
4780    }
4781
4782    /// Sets or clears the value of [update_time][crate::model::LogBucket::update_time].
4783    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4784    where
4785        T: std::convert::Into<wkt::Timestamp>,
4786    {
4787        self.update_time = v.map(|x| x.into());
4788        self
4789    }
4790
4791    /// Sets the value of [retention_days][crate::model::LogBucket::retention_days].
4792    pub fn set_retention_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4793        self.retention_days = v.into();
4794        self
4795    }
4796
4797    /// Sets the value of [locked][crate::model::LogBucket::locked].
4798    pub fn set_locked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4799        self.locked = v.into();
4800        self
4801    }
4802
4803    /// Sets the value of [lifecycle_state][crate::model::LogBucket::lifecycle_state].
4804    pub fn set_lifecycle_state<T: std::convert::Into<crate::model::LifecycleState>>(
4805        mut self,
4806        v: T,
4807    ) -> Self {
4808        self.lifecycle_state = v.into();
4809        self
4810    }
4811
4812    /// Sets the value of [analytics_enabled][crate::model::LogBucket::analytics_enabled].
4813    pub fn set_analytics_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4814        self.analytics_enabled = v.into();
4815        self
4816    }
4817
4818    /// Sets the value of [restricted_fields][crate::model::LogBucket::restricted_fields].
4819    pub fn set_restricted_fields<T, V>(mut self, v: T) -> Self
4820    where
4821        T: std::iter::IntoIterator<Item = V>,
4822        V: std::convert::Into<std::string::String>,
4823    {
4824        use std::iter::Iterator;
4825        self.restricted_fields = v.into_iter().map(|i| i.into()).collect();
4826        self
4827    }
4828
4829    /// Sets the value of [index_configs][crate::model::LogBucket::index_configs].
4830    pub fn set_index_configs<T, V>(mut self, v: T) -> Self
4831    where
4832        T: std::iter::IntoIterator<Item = V>,
4833        V: std::convert::Into<crate::model::IndexConfig>,
4834    {
4835        use std::iter::Iterator;
4836        self.index_configs = v.into_iter().map(|i| i.into()).collect();
4837        self
4838    }
4839
4840    /// Sets the value of [cmek_settings][crate::model::LogBucket::cmek_settings].
4841    pub fn set_cmek_settings<T>(mut self, v: T) -> Self
4842    where
4843        T: std::convert::Into<crate::model::CmekSettings>,
4844    {
4845        self.cmek_settings = std::option::Option::Some(v.into());
4846        self
4847    }
4848
4849    /// Sets or clears the value of [cmek_settings][crate::model::LogBucket::cmek_settings].
4850    pub fn set_or_clear_cmek_settings<T>(mut self, v: std::option::Option<T>) -> Self
4851    where
4852        T: std::convert::Into<crate::model::CmekSettings>,
4853    {
4854        self.cmek_settings = v.map(|x| x.into());
4855        self
4856    }
4857}
4858
4859impl wkt::message::Message for LogBucket {
4860    fn typename() -> &'static str {
4861        "type.googleapis.com/google.logging.v2.LogBucket"
4862    }
4863}
4864
4865#[doc(hidden)]
4866impl<'de> serde::de::Deserialize<'de> for LogBucket {
4867    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4868    where
4869        D: serde::Deserializer<'de>,
4870    {
4871        #[allow(non_camel_case_types)]
4872        #[doc(hidden)]
4873        #[derive(PartialEq, Eq, Hash)]
4874        enum __FieldTag {
4875            __name,
4876            __description,
4877            __create_time,
4878            __update_time,
4879            __retention_days,
4880            __locked,
4881            __lifecycle_state,
4882            __analytics_enabled,
4883            __restricted_fields,
4884            __index_configs,
4885            __cmek_settings,
4886            Unknown(std::string::String),
4887        }
4888        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4889            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4890            where
4891                D: serde::Deserializer<'de>,
4892            {
4893                struct Visitor;
4894                impl<'de> serde::de::Visitor<'de> for Visitor {
4895                    type Value = __FieldTag;
4896                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4897                        formatter.write_str("a field name for LogBucket")
4898                    }
4899                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4900                    where
4901                        E: serde::de::Error,
4902                    {
4903                        use std::result::Result::Ok;
4904                        use std::string::ToString;
4905                        match value {
4906                            "name" => Ok(__FieldTag::__name),
4907                            "description" => Ok(__FieldTag::__description),
4908                            "createTime" => Ok(__FieldTag::__create_time),
4909                            "create_time" => Ok(__FieldTag::__create_time),
4910                            "updateTime" => Ok(__FieldTag::__update_time),
4911                            "update_time" => Ok(__FieldTag::__update_time),
4912                            "retentionDays" => Ok(__FieldTag::__retention_days),
4913                            "retention_days" => Ok(__FieldTag::__retention_days),
4914                            "locked" => Ok(__FieldTag::__locked),
4915                            "lifecycleState" => Ok(__FieldTag::__lifecycle_state),
4916                            "lifecycle_state" => Ok(__FieldTag::__lifecycle_state),
4917                            "analyticsEnabled" => Ok(__FieldTag::__analytics_enabled),
4918                            "analytics_enabled" => Ok(__FieldTag::__analytics_enabled),
4919                            "restrictedFields" => Ok(__FieldTag::__restricted_fields),
4920                            "restricted_fields" => Ok(__FieldTag::__restricted_fields),
4921                            "indexConfigs" => Ok(__FieldTag::__index_configs),
4922                            "index_configs" => Ok(__FieldTag::__index_configs),
4923                            "cmekSettings" => Ok(__FieldTag::__cmek_settings),
4924                            "cmek_settings" => Ok(__FieldTag::__cmek_settings),
4925                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4926                        }
4927                    }
4928                }
4929                deserializer.deserialize_identifier(Visitor)
4930            }
4931        }
4932        struct Visitor;
4933        impl<'de> serde::de::Visitor<'de> for Visitor {
4934            type Value = LogBucket;
4935            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4936                formatter.write_str("struct LogBucket")
4937            }
4938            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4939            where
4940                A: serde::de::MapAccess<'de>,
4941            {
4942                #[allow(unused_imports)]
4943                use serde::de::Error;
4944                use std::option::Option::Some;
4945                let mut fields = std::collections::HashSet::new();
4946                let mut result = Self::Value::new();
4947                while let Some(tag) = map.next_key::<__FieldTag>()? {
4948                    #[allow(clippy::match_single_binding)]
4949                    match tag {
4950                        __FieldTag::__name => {
4951                            if !fields.insert(__FieldTag::__name) {
4952                                return std::result::Result::Err(A::Error::duplicate_field(
4953                                    "multiple values for name",
4954                                ));
4955                            }
4956                            result.name = map
4957                                .next_value::<std::option::Option<std::string::String>>()?
4958                                .unwrap_or_default();
4959                        }
4960                        __FieldTag::__description => {
4961                            if !fields.insert(__FieldTag::__description) {
4962                                return std::result::Result::Err(A::Error::duplicate_field(
4963                                    "multiple values for description",
4964                                ));
4965                            }
4966                            result.description = map
4967                                .next_value::<std::option::Option<std::string::String>>()?
4968                                .unwrap_or_default();
4969                        }
4970                        __FieldTag::__create_time => {
4971                            if !fields.insert(__FieldTag::__create_time) {
4972                                return std::result::Result::Err(A::Error::duplicate_field(
4973                                    "multiple values for create_time",
4974                                ));
4975                            }
4976                            result.create_time =
4977                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4978                        }
4979                        __FieldTag::__update_time => {
4980                            if !fields.insert(__FieldTag::__update_time) {
4981                                return std::result::Result::Err(A::Error::duplicate_field(
4982                                    "multiple values for update_time",
4983                                ));
4984                            }
4985                            result.update_time =
4986                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
4987                        }
4988                        __FieldTag::__retention_days => {
4989                            if !fields.insert(__FieldTag::__retention_days) {
4990                                return std::result::Result::Err(A::Error::duplicate_field(
4991                                    "multiple values for retention_days",
4992                                ));
4993                            }
4994                            struct __With(std::option::Option<i32>);
4995                            impl<'de> serde::de::Deserialize<'de> for __With {
4996                                fn deserialize<D>(
4997                                    deserializer: D,
4998                                ) -> std::result::Result<Self, D::Error>
4999                                where
5000                                    D: serde::de::Deserializer<'de>,
5001                                {
5002                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
5003                                }
5004                            }
5005                            result.retention_days =
5006                                map.next_value::<__With>()?.0.unwrap_or_default();
5007                        }
5008                        __FieldTag::__locked => {
5009                            if !fields.insert(__FieldTag::__locked) {
5010                                return std::result::Result::Err(A::Error::duplicate_field(
5011                                    "multiple values for locked",
5012                                ));
5013                            }
5014                            result.locked = map
5015                                .next_value::<std::option::Option<bool>>()?
5016                                .unwrap_or_default();
5017                        }
5018                        __FieldTag::__lifecycle_state => {
5019                            if !fields.insert(__FieldTag::__lifecycle_state) {
5020                                return std::result::Result::Err(A::Error::duplicate_field(
5021                                    "multiple values for lifecycle_state",
5022                                ));
5023                            }
5024                            result.lifecycle_state = map
5025                                .next_value::<std::option::Option<crate::model::LifecycleState>>()?
5026                                .unwrap_or_default();
5027                        }
5028                        __FieldTag::__analytics_enabled => {
5029                            if !fields.insert(__FieldTag::__analytics_enabled) {
5030                                return std::result::Result::Err(A::Error::duplicate_field(
5031                                    "multiple values for analytics_enabled",
5032                                ));
5033                            }
5034                            result.analytics_enabled = map
5035                                .next_value::<std::option::Option<bool>>()?
5036                                .unwrap_or_default();
5037                        }
5038                        __FieldTag::__restricted_fields => {
5039                            if !fields.insert(__FieldTag::__restricted_fields) {
5040                                return std::result::Result::Err(A::Error::duplicate_field(
5041                                    "multiple values for restricted_fields",
5042                                ));
5043                            }
5044                            result.restricted_fields = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
5045                        }
5046                        __FieldTag::__index_configs => {
5047                            if !fields.insert(__FieldTag::__index_configs) {
5048                                return std::result::Result::Err(A::Error::duplicate_field(
5049                                    "multiple values for index_configs",
5050                                ));
5051                            }
5052                            result.index_configs = map.next_value::<std::option::Option<std::vec::Vec<crate::model::IndexConfig>>>()?.unwrap_or_default();
5053                        }
5054                        __FieldTag::__cmek_settings => {
5055                            if !fields.insert(__FieldTag::__cmek_settings) {
5056                                return std::result::Result::Err(A::Error::duplicate_field(
5057                                    "multiple values for cmek_settings",
5058                                ));
5059                            }
5060                            result.cmek_settings = map
5061                                .next_value::<std::option::Option<crate::model::CmekSettings>>()?;
5062                        }
5063                        __FieldTag::Unknown(key) => {
5064                            let value = map.next_value::<serde_json::Value>()?;
5065                            result._unknown_fields.insert(key, value);
5066                        }
5067                    }
5068                }
5069                std::result::Result::Ok(result)
5070            }
5071        }
5072        deserializer.deserialize_any(Visitor)
5073    }
5074}
5075
5076#[doc(hidden)]
5077impl serde::ser::Serialize for LogBucket {
5078    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5079    where
5080        S: serde::ser::Serializer,
5081    {
5082        use serde::ser::SerializeMap;
5083        #[allow(unused_imports)]
5084        use std::option::Option::Some;
5085        let mut state = serializer.serialize_map(std::option::Option::None)?;
5086        if !self.name.is_empty() {
5087            state.serialize_entry("name", &self.name)?;
5088        }
5089        if !self.description.is_empty() {
5090            state.serialize_entry("description", &self.description)?;
5091        }
5092        if self.create_time.is_some() {
5093            state.serialize_entry("createTime", &self.create_time)?;
5094        }
5095        if self.update_time.is_some() {
5096            state.serialize_entry("updateTime", &self.update_time)?;
5097        }
5098        if !wkt::internal::is_default(&self.retention_days) {
5099            struct __With<'a>(&'a i32);
5100            impl<'a> serde::ser::Serialize for __With<'a> {
5101                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5102                where
5103                    S: serde::ser::Serializer,
5104                {
5105                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
5106                }
5107            }
5108            state.serialize_entry("retentionDays", &__With(&self.retention_days))?;
5109        }
5110        if !wkt::internal::is_default(&self.locked) {
5111            state.serialize_entry("locked", &self.locked)?;
5112        }
5113        if !wkt::internal::is_default(&self.lifecycle_state) {
5114            state.serialize_entry("lifecycleState", &self.lifecycle_state)?;
5115        }
5116        if !wkt::internal::is_default(&self.analytics_enabled) {
5117            state.serialize_entry("analyticsEnabled", &self.analytics_enabled)?;
5118        }
5119        if !self.restricted_fields.is_empty() {
5120            state.serialize_entry("restrictedFields", &self.restricted_fields)?;
5121        }
5122        if !self.index_configs.is_empty() {
5123            state.serialize_entry("indexConfigs", &self.index_configs)?;
5124        }
5125        if self.cmek_settings.is_some() {
5126            state.serialize_entry("cmekSettings", &self.cmek_settings)?;
5127        }
5128        if !self._unknown_fields.is_empty() {
5129            for (key, value) in self._unknown_fields.iter() {
5130                state.serialize_entry(key, &value)?;
5131            }
5132        }
5133        state.end()
5134    }
5135}
5136
5137impl std::fmt::Debug for LogBucket {
5138    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5139        let mut debug_struct = f.debug_struct("LogBucket");
5140        debug_struct.field("name", &self.name);
5141        debug_struct.field("description", &self.description);
5142        debug_struct.field("create_time", &self.create_time);
5143        debug_struct.field("update_time", &self.update_time);
5144        debug_struct.field("retention_days", &self.retention_days);
5145        debug_struct.field("locked", &self.locked);
5146        debug_struct.field("lifecycle_state", &self.lifecycle_state);
5147        debug_struct.field("analytics_enabled", &self.analytics_enabled);
5148        debug_struct.field("restricted_fields", &self.restricted_fields);
5149        debug_struct.field("index_configs", &self.index_configs);
5150        debug_struct.field("cmek_settings", &self.cmek_settings);
5151        if !self._unknown_fields.is_empty() {
5152            debug_struct.field("_unknown_fields", &self._unknown_fields);
5153        }
5154        debug_struct.finish()
5155    }
5156}
5157
5158/// Describes a view over log entries in a bucket.
5159#[derive(Clone, Default, PartialEq)]
5160#[non_exhaustive]
5161pub struct LogView {
5162    /// The resource name of the view.
5163    ///
5164    /// For example:
5165    ///
5166    /// `projects/my-project/locations/global/buckets/my-bucket/views/my-view`
5167    pub name: std::string::String,
5168
5169    /// Describes this view.
5170    pub description: std::string::String,
5171
5172    /// Output only. The creation timestamp of the view.
5173    pub create_time: std::option::Option<wkt::Timestamp>,
5174
5175    /// Output only. The last update timestamp of the view.
5176    pub update_time: std::option::Option<wkt::Timestamp>,
5177
5178    /// Filter that restricts which log entries in a bucket are visible in this
5179    /// view.
5180    ///
5181    /// Filters are restricted to be a logical AND of ==/!= of any of the
5182    /// following:
5183    ///
5184    /// - originating project/folder/organization/billing account.
5185    /// - resource type
5186    /// - log id
5187    ///
5188    /// For example:
5189    ///
5190    /// SOURCE("projects/myproject") AND resource.type = "gce_instance"
5191    /// AND LOG_ID("stdout")
5192    pub filter: std::string::String,
5193
5194    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5195}
5196
5197impl LogView {
5198    pub fn new() -> Self {
5199        std::default::Default::default()
5200    }
5201
5202    /// Sets the value of [name][crate::model::LogView::name].
5203    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5204        self.name = v.into();
5205        self
5206    }
5207
5208    /// Sets the value of [description][crate::model::LogView::description].
5209    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5210        self.description = v.into();
5211        self
5212    }
5213
5214    /// Sets the value of [create_time][crate::model::LogView::create_time].
5215    pub fn set_create_time<T>(mut self, v: T) -> Self
5216    where
5217        T: std::convert::Into<wkt::Timestamp>,
5218    {
5219        self.create_time = std::option::Option::Some(v.into());
5220        self
5221    }
5222
5223    /// Sets or clears the value of [create_time][crate::model::LogView::create_time].
5224    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5225    where
5226        T: std::convert::Into<wkt::Timestamp>,
5227    {
5228        self.create_time = v.map(|x| x.into());
5229        self
5230    }
5231
5232    /// Sets the value of [update_time][crate::model::LogView::update_time].
5233    pub fn set_update_time<T>(mut self, v: T) -> Self
5234    where
5235        T: std::convert::Into<wkt::Timestamp>,
5236    {
5237        self.update_time = std::option::Option::Some(v.into());
5238        self
5239    }
5240
5241    /// Sets or clears the value of [update_time][crate::model::LogView::update_time].
5242    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5243    where
5244        T: std::convert::Into<wkt::Timestamp>,
5245    {
5246        self.update_time = v.map(|x| x.into());
5247        self
5248    }
5249
5250    /// Sets the value of [filter][crate::model::LogView::filter].
5251    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5252        self.filter = v.into();
5253        self
5254    }
5255}
5256
5257impl wkt::message::Message for LogView {
5258    fn typename() -> &'static str {
5259        "type.googleapis.com/google.logging.v2.LogView"
5260    }
5261}
5262
5263#[doc(hidden)]
5264impl<'de> serde::de::Deserialize<'de> for LogView {
5265    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5266    where
5267        D: serde::Deserializer<'de>,
5268    {
5269        #[allow(non_camel_case_types)]
5270        #[doc(hidden)]
5271        #[derive(PartialEq, Eq, Hash)]
5272        enum __FieldTag {
5273            __name,
5274            __description,
5275            __create_time,
5276            __update_time,
5277            __filter,
5278            Unknown(std::string::String),
5279        }
5280        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5281            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5282            where
5283                D: serde::Deserializer<'de>,
5284            {
5285                struct Visitor;
5286                impl<'de> serde::de::Visitor<'de> for Visitor {
5287                    type Value = __FieldTag;
5288                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5289                        formatter.write_str("a field name for LogView")
5290                    }
5291                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5292                    where
5293                        E: serde::de::Error,
5294                    {
5295                        use std::result::Result::Ok;
5296                        use std::string::ToString;
5297                        match value {
5298                            "name" => Ok(__FieldTag::__name),
5299                            "description" => Ok(__FieldTag::__description),
5300                            "createTime" => Ok(__FieldTag::__create_time),
5301                            "create_time" => Ok(__FieldTag::__create_time),
5302                            "updateTime" => Ok(__FieldTag::__update_time),
5303                            "update_time" => Ok(__FieldTag::__update_time),
5304                            "filter" => Ok(__FieldTag::__filter),
5305                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5306                        }
5307                    }
5308                }
5309                deserializer.deserialize_identifier(Visitor)
5310            }
5311        }
5312        struct Visitor;
5313        impl<'de> serde::de::Visitor<'de> for Visitor {
5314            type Value = LogView;
5315            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5316                formatter.write_str("struct LogView")
5317            }
5318            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5319            where
5320                A: serde::de::MapAccess<'de>,
5321            {
5322                #[allow(unused_imports)]
5323                use serde::de::Error;
5324                use std::option::Option::Some;
5325                let mut fields = std::collections::HashSet::new();
5326                let mut result = Self::Value::new();
5327                while let Some(tag) = map.next_key::<__FieldTag>()? {
5328                    #[allow(clippy::match_single_binding)]
5329                    match tag {
5330                        __FieldTag::__name => {
5331                            if !fields.insert(__FieldTag::__name) {
5332                                return std::result::Result::Err(A::Error::duplicate_field(
5333                                    "multiple values for name",
5334                                ));
5335                            }
5336                            result.name = map
5337                                .next_value::<std::option::Option<std::string::String>>()?
5338                                .unwrap_or_default();
5339                        }
5340                        __FieldTag::__description => {
5341                            if !fields.insert(__FieldTag::__description) {
5342                                return std::result::Result::Err(A::Error::duplicate_field(
5343                                    "multiple values for description",
5344                                ));
5345                            }
5346                            result.description = map
5347                                .next_value::<std::option::Option<std::string::String>>()?
5348                                .unwrap_or_default();
5349                        }
5350                        __FieldTag::__create_time => {
5351                            if !fields.insert(__FieldTag::__create_time) {
5352                                return std::result::Result::Err(A::Error::duplicate_field(
5353                                    "multiple values for create_time",
5354                                ));
5355                            }
5356                            result.create_time =
5357                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5358                        }
5359                        __FieldTag::__update_time => {
5360                            if !fields.insert(__FieldTag::__update_time) {
5361                                return std::result::Result::Err(A::Error::duplicate_field(
5362                                    "multiple values for update_time",
5363                                ));
5364                            }
5365                            result.update_time =
5366                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5367                        }
5368                        __FieldTag::__filter => {
5369                            if !fields.insert(__FieldTag::__filter) {
5370                                return std::result::Result::Err(A::Error::duplicate_field(
5371                                    "multiple values for filter",
5372                                ));
5373                            }
5374                            result.filter = map
5375                                .next_value::<std::option::Option<std::string::String>>()?
5376                                .unwrap_or_default();
5377                        }
5378                        __FieldTag::Unknown(key) => {
5379                            let value = map.next_value::<serde_json::Value>()?;
5380                            result._unknown_fields.insert(key, value);
5381                        }
5382                    }
5383                }
5384                std::result::Result::Ok(result)
5385            }
5386        }
5387        deserializer.deserialize_any(Visitor)
5388    }
5389}
5390
5391#[doc(hidden)]
5392impl serde::ser::Serialize for LogView {
5393    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5394    where
5395        S: serde::ser::Serializer,
5396    {
5397        use serde::ser::SerializeMap;
5398        #[allow(unused_imports)]
5399        use std::option::Option::Some;
5400        let mut state = serializer.serialize_map(std::option::Option::None)?;
5401        if !self.name.is_empty() {
5402            state.serialize_entry("name", &self.name)?;
5403        }
5404        if !self.description.is_empty() {
5405            state.serialize_entry("description", &self.description)?;
5406        }
5407        if self.create_time.is_some() {
5408            state.serialize_entry("createTime", &self.create_time)?;
5409        }
5410        if self.update_time.is_some() {
5411            state.serialize_entry("updateTime", &self.update_time)?;
5412        }
5413        if !self.filter.is_empty() {
5414            state.serialize_entry("filter", &self.filter)?;
5415        }
5416        if !self._unknown_fields.is_empty() {
5417            for (key, value) in self._unknown_fields.iter() {
5418                state.serialize_entry(key, &value)?;
5419            }
5420        }
5421        state.end()
5422    }
5423}
5424
5425impl std::fmt::Debug for LogView {
5426    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5427        let mut debug_struct = f.debug_struct("LogView");
5428        debug_struct.field("name", &self.name);
5429        debug_struct.field("description", &self.description);
5430        debug_struct.field("create_time", &self.create_time);
5431        debug_struct.field("update_time", &self.update_time);
5432        debug_struct.field("filter", &self.filter);
5433        if !self._unknown_fields.is_empty() {
5434            debug_struct.field("_unknown_fields", &self._unknown_fields);
5435        }
5436        debug_struct.finish()
5437    }
5438}
5439
5440/// Describes a sink used to export log entries to one of the following
5441/// destinations in any project: a Cloud Storage bucket, a BigQuery dataset, a
5442/// Pub/Sub topic or a Cloud Logging log bucket. A logs filter controls which log
5443/// entries are exported. The sink must be created within a project,
5444/// organization, billing account, or folder.
5445#[derive(Clone, Default, PartialEq)]
5446#[non_exhaustive]
5447pub struct LogSink {
5448    /// Required. The client-assigned sink identifier, unique within the project.
5449    ///
5450    /// For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited
5451    /// to 100 characters and can include only the following characters: upper and
5452    /// lower-case alphanumeric characters, underscores, hyphens, and periods.
5453    /// First character has to be alphanumeric.
5454    pub name: std::string::String,
5455
5456    /// Required. The export destination:
5457    ///
5458    /// ```norust
5459    /// "storage.googleapis.com/[GCS_BUCKET]"
5460    /// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
5461    /// "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
5462    /// ```
5463    ///
5464    /// The sink's `writer_identity`, set when the sink is created, must have
5465    /// permission to write to the destination or else the log entries are not
5466    /// exported. For more information, see
5467    /// [Exporting Logs with
5468    /// Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
5469    pub destination: std::string::String,
5470
5471    /// Optional. An [advanced logs
5472    /// filter](https://cloud.google.com/logging/docs/view/advanced-queries). The
5473    /// only exported log entries are those that are in the resource owning the
5474    /// sink and that match the filter.
5475    ///
5476    /// For example:
5477    ///
5478    /// `logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR`
5479    pub filter: std::string::String,
5480
5481    /// Optional. A description of this sink.
5482    ///
5483    /// The maximum length of the description is 8000 characters.
5484    pub description: std::string::String,
5485
5486    /// Optional. If set to true, then this sink is disabled and it does not export
5487    /// any log entries.
5488    pub disabled: bool,
5489
5490    /// Optional. Log entries that match any of these exclusion filters will not be
5491    /// exported.
5492    ///
5493    /// If a log entry is matched by both `filter` and one of `exclusion_filters`
5494    /// it will not be exported.
5495    pub exclusions: std::vec::Vec<crate::model::LogExclusion>,
5496
5497    /// Deprecated. This field is unused.
5498    #[deprecated]
5499    pub output_version_format: crate::model::log_sink::VersionFormat,
5500
5501    /// Output only. An IAM identity&mdash;a service account or group&mdash;under
5502    /// which Cloud Logging writes the exported log entries to the sink's
5503    /// destination. This field is either set by specifying
5504    /// `custom_writer_identity` or set automatically by
5505    /// [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] and
5506    /// [sinks.update][google.logging.v2.ConfigServiceV2.UpdateSink] based on the
5507    /// value of `unique_writer_identity` in those methods.
5508    ///
5509    /// Until you grant this identity write-access to the destination, log entry
5510    /// exports from this sink will fail. For more information, see [Granting
5511    /// Access for a
5512    /// Resource](https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource).
5513    /// Consult the destination service's documentation to determine the
5514    /// appropriate IAM roles to assign to the identity.
5515    ///
5516    /// Sinks that have a destination that is a log bucket in the same project as
5517    /// the sink cannot have a writer_identity and no additional permissions are
5518    /// required.
5519    ///
5520    /// [google.logging.v2.ConfigServiceV2.CreateSink]: crate::client::ConfigServiceV2::create_sink
5521    /// [google.logging.v2.ConfigServiceV2.UpdateSink]: crate::client::ConfigServiceV2::update_sink
5522    pub writer_identity: std::string::String,
5523
5524    /// Optional. This field applies only to sinks owned by organizations and
5525    /// folders. If the field is false, the default, only the logs owned by the
5526    /// sink's parent resource are available for export. If the field is true, then
5527    /// log entries from all the projects, folders, and billing accounts contained
5528    /// in the sink's parent resource are also available for export. Whether a
5529    /// particular log entry from the children is exported depends on the sink's
5530    /// filter expression.
5531    ///
5532    /// For example, if this field is true, then the filter
5533    /// `resource.type=gce_instance` would export all Compute Engine VM instance
5534    /// log entries from all projects in the sink's parent.
5535    ///
5536    /// To only export entries from certain child projects, filter on the project
5537    /// part of the log name:
5538    ///
5539    /// logName:("projects/test-project1/" OR "projects/test-project2/") AND
5540    /// resource.type=gce_instance
5541    pub include_children: bool,
5542
5543    /// Output only. The creation timestamp of the sink.
5544    ///
5545    /// This field may not be present for older sinks.
5546    pub create_time: std::option::Option<wkt::Timestamp>,
5547
5548    /// Output only. The last update timestamp of the sink.
5549    ///
5550    /// This field may not be present for older sinks.
5551    pub update_time: std::option::Option<wkt::Timestamp>,
5552
5553    /// Destination dependent options.
5554    pub options: std::option::Option<crate::model::log_sink::Options>,
5555
5556    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5557}
5558
5559impl LogSink {
5560    pub fn new() -> Self {
5561        std::default::Default::default()
5562    }
5563
5564    /// Sets the value of [name][crate::model::LogSink::name].
5565    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5566        self.name = v.into();
5567        self
5568    }
5569
5570    /// Sets the value of [destination][crate::model::LogSink::destination].
5571    pub fn set_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5572        self.destination = v.into();
5573        self
5574    }
5575
5576    /// Sets the value of [filter][crate::model::LogSink::filter].
5577    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5578        self.filter = v.into();
5579        self
5580    }
5581
5582    /// Sets the value of [description][crate::model::LogSink::description].
5583    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5584        self.description = v.into();
5585        self
5586    }
5587
5588    /// Sets the value of [disabled][crate::model::LogSink::disabled].
5589    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5590        self.disabled = v.into();
5591        self
5592    }
5593
5594    /// Sets the value of [exclusions][crate::model::LogSink::exclusions].
5595    pub fn set_exclusions<T, V>(mut self, v: T) -> Self
5596    where
5597        T: std::iter::IntoIterator<Item = V>,
5598        V: std::convert::Into<crate::model::LogExclusion>,
5599    {
5600        use std::iter::Iterator;
5601        self.exclusions = v.into_iter().map(|i| i.into()).collect();
5602        self
5603    }
5604
5605    /// Sets the value of [output_version_format][crate::model::LogSink::output_version_format].
5606    #[deprecated]
5607    pub fn set_output_version_format<
5608        T: std::convert::Into<crate::model::log_sink::VersionFormat>,
5609    >(
5610        mut self,
5611        v: T,
5612    ) -> Self {
5613        self.output_version_format = v.into();
5614        self
5615    }
5616
5617    /// Sets the value of [writer_identity][crate::model::LogSink::writer_identity].
5618    pub fn set_writer_identity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5619        self.writer_identity = v.into();
5620        self
5621    }
5622
5623    /// Sets the value of [include_children][crate::model::LogSink::include_children].
5624    pub fn set_include_children<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5625        self.include_children = v.into();
5626        self
5627    }
5628
5629    /// Sets the value of [create_time][crate::model::LogSink::create_time].
5630    pub fn set_create_time<T>(mut self, v: T) -> Self
5631    where
5632        T: std::convert::Into<wkt::Timestamp>,
5633    {
5634        self.create_time = std::option::Option::Some(v.into());
5635        self
5636    }
5637
5638    /// Sets or clears the value of [create_time][crate::model::LogSink::create_time].
5639    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5640    where
5641        T: std::convert::Into<wkt::Timestamp>,
5642    {
5643        self.create_time = v.map(|x| x.into());
5644        self
5645    }
5646
5647    /// Sets the value of [update_time][crate::model::LogSink::update_time].
5648    pub fn set_update_time<T>(mut self, v: T) -> Self
5649    where
5650        T: std::convert::Into<wkt::Timestamp>,
5651    {
5652        self.update_time = std::option::Option::Some(v.into());
5653        self
5654    }
5655
5656    /// Sets or clears the value of [update_time][crate::model::LogSink::update_time].
5657    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5658    where
5659        T: std::convert::Into<wkt::Timestamp>,
5660    {
5661        self.update_time = v.map(|x| x.into());
5662        self
5663    }
5664
5665    /// Sets the value of [options][crate::model::LogSink::options].
5666    ///
5667    /// Note that all the setters affecting `options` are mutually
5668    /// exclusive.
5669    pub fn set_options<
5670        T: std::convert::Into<std::option::Option<crate::model::log_sink::Options>>,
5671    >(
5672        mut self,
5673        v: T,
5674    ) -> Self {
5675        self.options = v.into();
5676        self
5677    }
5678
5679    /// The value of [options][crate::model::LogSink::options]
5680    /// if it holds a `BigqueryOptions`, `None` if the field is not set or
5681    /// holds a different branch.
5682    pub fn bigquery_options(
5683        &self,
5684    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQueryOptions>> {
5685        #[allow(unreachable_patterns)]
5686        self.options.as_ref().and_then(|v| match v {
5687            crate::model::log_sink::Options::BigqueryOptions(v) => std::option::Option::Some(v),
5688            _ => std::option::Option::None,
5689        })
5690    }
5691
5692    /// Sets the value of [options][crate::model::LogSink::options]
5693    /// to hold a `BigqueryOptions`.
5694    ///
5695    /// Note that all the setters affecting `options` are
5696    /// mutually exclusive.
5697    pub fn set_bigquery_options<
5698        T: std::convert::Into<std::boxed::Box<crate::model::BigQueryOptions>>,
5699    >(
5700        mut self,
5701        v: T,
5702    ) -> Self {
5703        self.options =
5704            std::option::Option::Some(crate::model::log_sink::Options::BigqueryOptions(v.into()));
5705        self
5706    }
5707}
5708
5709impl wkt::message::Message for LogSink {
5710    fn typename() -> &'static str {
5711        "type.googleapis.com/google.logging.v2.LogSink"
5712    }
5713}
5714
5715#[doc(hidden)]
5716impl<'de> serde::de::Deserialize<'de> for LogSink {
5717    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5718    where
5719        D: serde::Deserializer<'de>,
5720    {
5721        #[allow(non_camel_case_types)]
5722        #[doc(hidden)]
5723        #[derive(PartialEq, Eq, Hash)]
5724        enum __FieldTag {
5725            __name,
5726            __destination,
5727            __filter,
5728            __description,
5729            __disabled,
5730            __exclusions,
5731            __output_version_format,
5732            __writer_identity,
5733            __include_children,
5734            __bigquery_options,
5735            __create_time,
5736            __update_time,
5737            Unknown(std::string::String),
5738        }
5739        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5740            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5741            where
5742                D: serde::Deserializer<'de>,
5743            {
5744                struct Visitor;
5745                impl<'de> serde::de::Visitor<'de> for Visitor {
5746                    type Value = __FieldTag;
5747                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5748                        formatter.write_str("a field name for LogSink")
5749                    }
5750                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5751                    where
5752                        E: serde::de::Error,
5753                    {
5754                        use std::result::Result::Ok;
5755                        use std::string::ToString;
5756                        match value {
5757                            "name" => Ok(__FieldTag::__name),
5758                            "destination" => Ok(__FieldTag::__destination),
5759                            "filter" => Ok(__FieldTag::__filter),
5760                            "description" => Ok(__FieldTag::__description),
5761                            "disabled" => Ok(__FieldTag::__disabled),
5762                            "exclusions" => Ok(__FieldTag::__exclusions),
5763                            "outputVersionFormat" => Ok(__FieldTag::__output_version_format),
5764                            "output_version_format" => Ok(__FieldTag::__output_version_format),
5765                            "writerIdentity" => Ok(__FieldTag::__writer_identity),
5766                            "writer_identity" => Ok(__FieldTag::__writer_identity),
5767                            "includeChildren" => Ok(__FieldTag::__include_children),
5768                            "include_children" => Ok(__FieldTag::__include_children),
5769                            "bigqueryOptions" => Ok(__FieldTag::__bigquery_options),
5770                            "bigquery_options" => Ok(__FieldTag::__bigquery_options),
5771                            "createTime" => Ok(__FieldTag::__create_time),
5772                            "create_time" => Ok(__FieldTag::__create_time),
5773                            "updateTime" => Ok(__FieldTag::__update_time),
5774                            "update_time" => Ok(__FieldTag::__update_time),
5775                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5776                        }
5777                    }
5778                }
5779                deserializer.deserialize_identifier(Visitor)
5780            }
5781        }
5782        struct Visitor;
5783        impl<'de> serde::de::Visitor<'de> for Visitor {
5784            type Value = LogSink;
5785            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5786                formatter.write_str("struct LogSink")
5787            }
5788            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5789            where
5790                A: serde::de::MapAccess<'de>,
5791            {
5792                #[allow(unused_imports)]
5793                use serde::de::Error;
5794                use std::option::Option::Some;
5795                let mut fields = std::collections::HashSet::new();
5796                let mut result = Self::Value::new();
5797                while let Some(tag) = map.next_key::<__FieldTag>()? {
5798                    #[allow(clippy::match_single_binding)]
5799                    match tag {
5800                        __FieldTag::__name => {
5801                            if !fields.insert(__FieldTag::__name) {
5802                                return std::result::Result::Err(A::Error::duplicate_field(
5803                                    "multiple values for name",
5804                                ));
5805                            }
5806                            result.name = map
5807                                .next_value::<std::option::Option<std::string::String>>()?
5808                                .unwrap_or_default();
5809                        }
5810                        __FieldTag::__destination => {
5811                            if !fields.insert(__FieldTag::__destination) {
5812                                return std::result::Result::Err(A::Error::duplicate_field(
5813                                    "multiple values for destination",
5814                                ));
5815                            }
5816                            result.destination = map
5817                                .next_value::<std::option::Option<std::string::String>>()?
5818                                .unwrap_or_default();
5819                        }
5820                        __FieldTag::__filter => {
5821                            if !fields.insert(__FieldTag::__filter) {
5822                                return std::result::Result::Err(A::Error::duplicate_field(
5823                                    "multiple values for filter",
5824                                ));
5825                            }
5826                            result.filter = map
5827                                .next_value::<std::option::Option<std::string::String>>()?
5828                                .unwrap_or_default();
5829                        }
5830                        __FieldTag::__description => {
5831                            if !fields.insert(__FieldTag::__description) {
5832                                return std::result::Result::Err(A::Error::duplicate_field(
5833                                    "multiple values for description",
5834                                ));
5835                            }
5836                            result.description = map
5837                                .next_value::<std::option::Option<std::string::String>>()?
5838                                .unwrap_or_default();
5839                        }
5840                        __FieldTag::__disabled => {
5841                            if !fields.insert(__FieldTag::__disabled) {
5842                                return std::result::Result::Err(A::Error::duplicate_field(
5843                                    "multiple values for disabled",
5844                                ));
5845                            }
5846                            result.disabled = map
5847                                .next_value::<std::option::Option<bool>>()?
5848                                .unwrap_or_default();
5849                        }
5850                        __FieldTag::__exclusions => {
5851                            if !fields.insert(__FieldTag::__exclusions) {
5852                                return std::result::Result::Err(A::Error::duplicate_field(
5853                                    "multiple values for exclusions",
5854                                ));
5855                            }
5856                            result.exclusions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::LogExclusion>>>()?.unwrap_or_default();
5857                        }
5858                        __FieldTag::__output_version_format => {
5859                            if !fields.insert(__FieldTag::__output_version_format) {
5860                                return std::result::Result::Err(A::Error::duplicate_field(
5861                                    "multiple values for output_version_format",
5862                                ));
5863                            }
5864                            result.output_version_format = map.next_value::<std::option::Option<crate::model::log_sink::VersionFormat>>()?.unwrap_or_default();
5865                        }
5866                        __FieldTag::__writer_identity => {
5867                            if !fields.insert(__FieldTag::__writer_identity) {
5868                                return std::result::Result::Err(A::Error::duplicate_field(
5869                                    "multiple values for writer_identity",
5870                                ));
5871                            }
5872                            result.writer_identity = map
5873                                .next_value::<std::option::Option<std::string::String>>()?
5874                                .unwrap_or_default();
5875                        }
5876                        __FieldTag::__include_children => {
5877                            if !fields.insert(__FieldTag::__include_children) {
5878                                return std::result::Result::Err(A::Error::duplicate_field(
5879                                    "multiple values for include_children",
5880                                ));
5881                            }
5882                            result.include_children = map
5883                                .next_value::<std::option::Option<bool>>()?
5884                                .unwrap_or_default();
5885                        }
5886                        __FieldTag::__bigquery_options => {
5887                            if !fields.insert(__FieldTag::__bigquery_options) {
5888                                return std::result::Result::Err(A::Error::duplicate_field(
5889                                    "multiple values for bigquery_options",
5890                                ));
5891                            }
5892                            if result.options.is_some() {
5893                                return std::result::Result::Err(A::Error::duplicate_field(
5894                                    "multiple values for `options`, a oneof with full ID .google.logging.v2.LogSink.bigquery_options, latest field was bigqueryOptions",
5895                                ));
5896                            }
5897                            result.options = std::option::Option::Some(
5898                                crate::model::log_sink::Options::BigqueryOptions(
5899                                    map.next_value::<std::option::Option<
5900                                        std::boxed::Box<crate::model::BigQueryOptions>,
5901                                    >>()?
5902                                    .unwrap_or_default(),
5903                                ),
5904                            );
5905                        }
5906                        __FieldTag::__create_time => {
5907                            if !fields.insert(__FieldTag::__create_time) {
5908                                return std::result::Result::Err(A::Error::duplicate_field(
5909                                    "multiple values for create_time",
5910                                ));
5911                            }
5912                            result.create_time =
5913                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5914                        }
5915                        __FieldTag::__update_time => {
5916                            if !fields.insert(__FieldTag::__update_time) {
5917                                return std::result::Result::Err(A::Error::duplicate_field(
5918                                    "multiple values for update_time",
5919                                ));
5920                            }
5921                            result.update_time =
5922                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
5923                        }
5924                        __FieldTag::Unknown(key) => {
5925                            let value = map.next_value::<serde_json::Value>()?;
5926                            result._unknown_fields.insert(key, value);
5927                        }
5928                    }
5929                }
5930                std::result::Result::Ok(result)
5931            }
5932        }
5933        deserializer.deserialize_any(Visitor)
5934    }
5935}
5936
5937#[doc(hidden)]
5938impl serde::ser::Serialize for LogSink {
5939    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5940    where
5941        S: serde::ser::Serializer,
5942    {
5943        use serde::ser::SerializeMap;
5944        #[allow(unused_imports)]
5945        use std::option::Option::Some;
5946        let mut state = serializer.serialize_map(std::option::Option::None)?;
5947        if !self.name.is_empty() {
5948            state.serialize_entry("name", &self.name)?;
5949        }
5950        if !self.destination.is_empty() {
5951            state.serialize_entry("destination", &self.destination)?;
5952        }
5953        if !self.filter.is_empty() {
5954            state.serialize_entry("filter", &self.filter)?;
5955        }
5956        if !self.description.is_empty() {
5957            state.serialize_entry("description", &self.description)?;
5958        }
5959        if !wkt::internal::is_default(&self.disabled) {
5960            state.serialize_entry("disabled", &self.disabled)?;
5961        }
5962        if !self.exclusions.is_empty() {
5963            state.serialize_entry("exclusions", &self.exclusions)?;
5964        }
5965        if !wkt::internal::is_default(&self.output_version_format) {
5966            state.serialize_entry("outputVersionFormat", &self.output_version_format)?;
5967        }
5968        if !self.writer_identity.is_empty() {
5969            state.serialize_entry("writerIdentity", &self.writer_identity)?;
5970        }
5971        if !wkt::internal::is_default(&self.include_children) {
5972            state.serialize_entry("includeChildren", &self.include_children)?;
5973        }
5974        if let Some(value) = self.bigquery_options() {
5975            state.serialize_entry("bigqueryOptions", value)?;
5976        }
5977        if self.create_time.is_some() {
5978            state.serialize_entry("createTime", &self.create_time)?;
5979        }
5980        if self.update_time.is_some() {
5981            state.serialize_entry("updateTime", &self.update_time)?;
5982        }
5983        if !self._unknown_fields.is_empty() {
5984            for (key, value) in self._unknown_fields.iter() {
5985                state.serialize_entry(key, &value)?;
5986            }
5987        }
5988        state.end()
5989    }
5990}
5991
5992impl std::fmt::Debug for LogSink {
5993    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5994        let mut debug_struct = f.debug_struct("LogSink");
5995        debug_struct.field("name", &self.name);
5996        debug_struct.field("destination", &self.destination);
5997        debug_struct.field("filter", &self.filter);
5998        debug_struct.field("description", &self.description);
5999        debug_struct.field("disabled", &self.disabled);
6000        debug_struct.field("exclusions", &self.exclusions);
6001        debug_struct.field("output_version_format", &self.output_version_format);
6002        debug_struct.field("writer_identity", &self.writer_identity);
6003        debug_struct.field("include_children", &self.include_children);
6004        debug_struct.field("create_time", &self.create_time);
6005        debug_struct.field("update_time", &self.update_time);
6006        debug_struct.field("options", &self.options);
6007        if !self._unknown_fields.is_empty() {
6008            debug_struct.field("_unknown_fields", &self._unknown_fields);
6009        }
6010        debug_struct.finish()
6011    }
6012}
6013
6014/// Defines additional types related to [LogSink].
6015pub mod log_sink {
6016    #[allow(unused_imports)]
6017    use super::*;
6018
6019    /// Deprecated. This is unused.
6020    ///
6021    /// # Working with unknown values
6022    ///
6023    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6024    /// additional enum variants at any time. Adding new variants is not considered
6025    /// a breaking change. Applications should write their code in anticipation of:
6026    ///
6027    /// - New values appearing in future releases of the client library, **and**
6028    /// - New values received dynamically, without application changes.
6029    ///
6030    /// Please consult the [Working with enums] section in the user guide for some
6031    /// guidelines.
6032    ///
6033    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6034    #[derive(Clone, Debug, PartialEq)]
6035    #[non_exhaustive]
6036    pub enum VersionFormat {
6037        /// An unspecified format version that will default to V2.
6038        Unspecified,
6039        /// `LogEntry` version 2 format.
6040        V2,
6041        /// `LogEntry` version 1 format.
6042        V1,
6043        /// If set, the enum was initialized with an unknown value.
6044        ///
6045        /// Applications can examine the value using [VersionFormat::value] or
6046        /// [VersionFormat::name].
6047        UnknownValue(version_format::UnknownValue),
6048    }
6049
6050    #[doc(hidden)]
6051    pub mod version_format {
6052        #[allow(unused_imports)]
6053        use super::*;
6054        #[derive(Clone, Debug, PartialEq)]
6055        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6056    }
6057
6058    impl VersionFormat {
6059        /// Gets the enum value.
6060        ///
6061        /// Returns `None` if the enum contains an unknown value deserialized from
6062        /// the string representation of enums.
6063        pub fn value(&self) -> std::option::Option<i32> {
6064            match self {
6065                Self::Unspecified => std::option::Option::Some(0),
6066                Self::V2 => std::option::Option::Some(1),
6067                Self::V1 => std::option::Option::Some(2),
6068                Self::UnknownValue(u) => u.0.value(),
6069            }
6070        }
6071
6072        /// Gets the enum value as a string.
6073        ///
6074        /// Returns `None` if the enum contains an unknown value deserialized from
6075        /// the integer representation of enums.
6076        pub fn name(&self) -> std::option::Option<&str> {
6077            match self {
6078                Self::Unspecified => std::option::Option::Some("VERSION_FORMAT_UNSPECIFIED"),
6079                Self::V2 => std::option::Option::Some("V2"),
6080                Self::V1 => std::option::Option::Some("V1"),
6081                Self::UnknownValue(u) => u.0.name(),
6082            }
6083        }
6084    }
6085
6086    impl std::default::Default for VersionFormat {
6087        fn default() -> Self {
6088            use std::convert::From;
6089            Self::from(0)
6090        }
6091    }
6092
6093    impl std::fmt::Display for VersionFormat {
6094        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6095            wkt::internal::display_enum(f, self.name(), self.value())
6096        }
6097    }
6098
6099    impl std::convert::From<i32> for VersionFormat {
6100        fn from(value: i32) -> Self {
6101            match value {
6102                0 => Self::Unspecified,
6103                1 => Self::V2,
6104                2 => Self::V1,
6105                _ => Self::UnknownValue(version_format::UnknownValue(
6106                    wkt::internal::UnknownEnumValue::Integer(value),
6107                )),
6108            }
6109        }
6110    }
6111
6112    impl std::convert::From<&str> for VersionFormat {
6113        fn from(value: &str) -> Self {
6114            use std::string::ToString;
6115            match value {
6116                "VERSION_FORMAT_UNSPECIFIED" => Self::Unspecified,
6117                "V2" => Self::V2,
6118                "V1" => Self::V1,
6119                _ => Self::UnknownValue(version_format::UnknownValue(
6120                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6121                )),
6122            }
6123        }
6124    }
6125
6126    impl serde::ser::Serialize for VersionFormat {
6127        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6128        where
6129            S: serde::Serializer,
6130        {
6131            match self {
6132                Self::Unspecified => serializer.serialize_i32(0),
6133                Self::V2 => serializer.serialize_i32(1),
6134                Self::V1 => serializer.serialize_i32(2),
6135                Self::UnknownValue(u) => u.0.serialize(serializer),
6136            }
6137        }
6138    }
6139
6140    impl<'de> serde::de::Deserialize<'de> for VersionFormat {
6141        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6142        where
6143            D: serde::Deserializer<'de>,
6144        {
6145            deserializer.deserialize_any(wkt::internal::EnumVisitor::<VersionFormat>::new(
6146                ".google.logging.v2.LogSink.VersionFormat",
6147            ))
6148        }
6149    }
6150
6151    /// Destination dependent options.
6152    #[derive(Clone, Debug, PartialEq)]
6153    #[non_exhaustive]
6154    pub enum Options {
6155        /// Optional. Options that affect sinks exporting data to BigQuery.
6156        BigqueryOptions(std::boxed::Box<crate::model::BigQueryOptions>),
6157    }
6158}
6159
6160/// Describes a BigQuery dataset that was created by a link.
6161#[derive(Clone, Default, PartialEq)]
6162#[non_exhaustive]
6163pub struct BigQueryDataset {
6164    /// Output only. The full resource name of the BigQuery dataset. The DATASET_ID
6165    /// will match the ID of the link, so the link must match the naming
6166    /// restrictions of BigQuery datasets (alphanumeric characters and underscores
6167    /// only).
6168    ///
6169    /// The dataset will have a resource path of
6170    /// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET_ID]"
6171    pub dataset_id: std::string::String,
6172
6173    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6174}
6175
6176impl BigQueryDataset {
6177    pub fn new() -> Self {
6178        std::default::Default::default()
6179    }
6180
6181    /// Sets the value of [dataset_id][crate::model::BigQueryDataset::dataset_id].
6182    pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6183        self.dataset_id = v.into();
6184        self
6185    }
6186}
6187
6188impl wkt::message::Message for BigQueryDataset {
6189    fn typename() -> &'static str {
6190        "type.googleapis.com/google.logging.v2.BigQueryDataset"
6191    }
6192}
6193
6194#[doc(hidden)]
6195impl<'de> serde::de::Deserialize<'de> for BigQueryDataset {
6196    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6197    where
6198        D: serde::Deserializer<'de>,
6199    {
6200        #[allow(non_camel_case_types)]
6201        #[doc(hidden)]
6202        #[derive(PartialEq, Eq, Hash)]
6203        enum __FieldTag {
6204            __dataset_id,
6205            Unknown(std::string::String),
6206        }
6207        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6208            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6209            where
6210                D: serde::Deserializer<'de>,
6211            {
6212                struct Visitor;
6213                impl<'de> serde::de::Visitor<'de> for Visitor {
6214                    type Value = __FieldTag;
6215                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6216                        formatter.write_str("a field name for BigQueryDataset")
6217                    }
6218                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6219                    where
6220                        E: serde::de::Error,
6221                    {
6222                        use std::result::Result::Ok;
6223                        use std::string::ToString;
6224                        match value {
6225                            "datasetId" => Ok(__FieldTag::__dataset_id),
6226                            "dataset_id" => Ok(__FieldTag::__dataset_id),
6227                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6228                        }
6229                    }
6230                }
6231                deserializer.deserialize_identifier(Visitor)
6232            }
6233        }
6234        struct Visitor;
6235        impl<'de> serde::de::Visitor<'de> for Visitor {
6236            type Value = BigQueryDataset;
6237            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6238                formatter.write_str("struct BigQueryDataset")
6239            }
6240            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6241            where
6242                A: serde::de::MapAccess<'de>,
6243            {
6244                #[allow(unused_imports)]
6245                use serde::de::Error;
6246                use std::option::Option::Some;
6247                let mut fields = std::collections::HashSet::new();
6248                let mut result = Self::Value::new();
6249                while let Some(tag) = map.next_key::<__FieldTag>()? {
6250                    #[allow(clippy::match_single_binding)]
6251                    match tag {
6252                        __FieldTag::__dataset_id => {
6253                            if !fields.insert(__FieldTag::__dataset_id) {
6254                                return std::result::Result::Err(A::Error::duplicate_field(
6255                                    "multiple values for dataset_id",
6256                                ));
6257                            }
6258                            result.dataset_id = map
6259                                .next_value::<std::option::Option<std::string::String>>()?
6260                                .unwrap_or_default();
6261                        }
6262                        __FieldTag::Unknown(key) => {
6263                            let value = map.next_value::<serde_json::Value>()?;
6264                            result._unknown_fields.insert(key, value);
6265                        }
6266                    }
6267                }
6268                std::result::Result::Ok(result)
6269            }
6270        }
6271        deserializer.deserialize_any(Visitor)
6272    }
6273}
6274
6275#[doc(hidden)]
6276impl serde::ser::Serialize for BigQueryDataset {
6277    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6278    where
6279        S: serde::ser::Serializer,
6280    {
6281        use serde::ser::SerializeMap;
6282        #[allow(unused_imports)]
6283        use std::option::Option::Some;
6284        let mut state = serializer.serialize_map(std::option::Option::None)?;
6285        if !self.dataset_id.is_empty() {
6286            state.serialize_entry("datasetId", &self.dataset_id)?;
6287        }
6288        if !self._unknown_fields.is_empty() {
6289            for (key, value) in self._unknown_fields.iter() {
6290                state.serialize_entry(key, &value)?;
6291            }
6292        }
6293        state.end()
6294    }
6295}
6296
6297impl std::fmt::Debug for BigQueryDataset {
6298    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6299        let mut debug_struct = f.debug_struct("BigQueryDataset");
6300        debug_struct.field("dataset_id", &self.dataset_id);
6301        if !self._unknown_fields.is_empty() {
6302            debug_struct.field("_unknown_fields", &self._unknown_fields);
6303        }
6304        debug_struct.finish()
6305    }
6306}
6307
6308/// Describes a link connected to an analytics enabled bucket.
6309#[derive(Clone, Default, PartialEq)]
6310#[non_exhaustive]
6311pub struct Link {
6312    /// The resource name of the link. The name can have up to 100 characters.
6313    /// A valid link id (at the end of the link name) must only have alphanumeric
6314    /// characters and underscores within it.
6315    ///
6316    /// ```norust
6317    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
6318    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
6319    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
6320    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
6321    /// ```
6322    ///
6323    /// For example:
6324    ///
6325    /// `projects/my-project/locations/global/buckets/my-bucket/links/my_link
6326    pub name: std::string::String,
6327
6328    /// Describes this link.
6329    ///
6330    /// The maximum length of the description is 8000 characters.
6331    pub description: std::string::String,
6332
6333    /// Output only. The creation timestamp of the link.
6334    pub create_time: std::option::Option<wkt::Timestamp>,
6335
6336    /// Output only. The resource lifecycle state.
6337    pub lifecycle_state: crate::model::LifecycleState,
6338
6339    /// The information of a BigQuery Dataset. When a link is created, a BigQuery
6340    /// dataset is created along with it, in the same project as the LogBucket it's
6341    /// linked to. This dataset will also have BigQuery Views corresponding to the
6342    /// LogViews in the bucket.
6343    pub bigquery_dataset: std::option::Option<crate::model::BigQueryDataset>,
6344
6345    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6346}
6347
6348impl Link {
6349    pub fn new() -> Self {
6350        std::default::Default::default()
6351    }
6352
6353    /// Sets the value of [name][crate::model::Link::name].
6354    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6355        self.name = v.into();
6356        self
6357    }
6358
6359    /// Sets the value of [description][crate::model::Link::description].
6360    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6361        self.description = v.into();
6362        self
6363    }
6364
6365    /// Sets the value of [create_time][crate::model::Link::create_time].
6366    pub fn set_create_time<T>(mut self, v: T) -> Self
6367    where
6368        T: std::convert::Into<wkt::Timestamp>,
6369    {
6370        self.create_time = std::option::Option::Some(v.into());
6371        self
6372    }
6373
6374    /// Sets or clears the value of [create_time][crate::model::Link::create_time].
6375    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6376    where
6377        T: std::convert::Into<wkt::Timestamp>,
6378    {
6379        self.create_time = v.map(|x| x.into());
6380        self
6381    }
6382
6383    /// Sets the value of [lifecycle_state][crate::model::Link::lifecycle_state].
6384    pub fn set_lifecycle_state<T: std::convert::Into<crate::model::LifecycleState>>(
6385        mut self,
6386        v: T,
6387    ) -> Self {
6388        self.lifecycle_state = v.into();
6389        self
6390    }
6391
6392    /// Sets the value of [bigquery_dataset][crate::model::Link::bigquery_dataset].
6393    pub fn set_bigquery_dataset<T>(mut self, v: T) -> Self
6394    where
6395        T: std::convert::Into<crate::model::BigQueryDataset>,
6396    {
6397        self.bigquery_dataset = std::option::Option::Some(v.into());
6398        self
6399    }
6400
6401    /// Sets or clears the value of [bigquery_dataset][crate::model::Link::bigquery_dataset].
6402    pub fn set_or_clear_bigquery_dataset<T>(mut self, v: std::option::Option<T>) -> Self
6403    where
6404        T: std::convert::Into<crate::model::BigQueryDataset>,
6405    {
6406        self.bigquery_dataset = v.map(|x| x.into());
6407        self
6408    }
6409}
6410
6411impl wkt::message::Message for Link {
6412    fn typename() -> &'static str {
6413        "type.googleapis.com/google.logging.v2.Link"
6414    }
6415}
6416
6417#[doc(hidden)]
6418impl<'de> serde::de::Deserialize<'de> for Link {
6419    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6420    where
6421        D: serde::Deserializer<'de>,
6422    {
6423        #[allow(non_camel_case_types)]
6424        #[doc(hidden)]
6425        #[derive(PartialEq, Eq, Hash)]
6426        enum __FieldTag {
6427            __name,
6428            __description,
6429            __create_time,
6430            __lifecycle_state,
6431            __bigquery_dataset,
6432            Unknown(std::string::String),
6433        }
6434        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6435            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6436            where
6437                D: serde::Deserializer<'de>,
6438            {
6439                struct Visitor;
6440                impl<'de> serde::de::Visitor<'de> for Visitor {
6441                    type Value = __FieldTag;
6442                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6443                        formatter.write_str("a field name for Link")
6444                    }
6445                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6446                    where
6447                        E: serde::de::Error,
6448                    {
6449                        use std::result::Result::Ok;
6450                        use std::string::ToString;
6451                        match value {
6452                            "name" => Ok(__FieldTag::__name),
6453                            "description" => Ok(__FieldTag::__description),
6454                            "createTime" => Ok(__FieldTag::__create_time),
6455                            "create_time" => Ok(__FieldTag::__create_time),
6456                            "lifecycleState" => Ok(__FieldTag::__lifecycle_state),
6457                            "lifecycle_state" => Ok(__FieldTag::__lifecycle_state),
6458                            "bigqueryDataset" => Ok(__FieldTag::__bigquery_dataset),
6459                            "bigquery_dataset" => Ok(__FieldTag::__bigquery_dataset),
6460                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6461                        }
6462                    }
6463                }
6464                deserializer.deserialize_identifier(Visitor)
6465            }
6466        }
6467        struct Visitor;
6468        impl<'de> serde::de::Visitor<'de> for Visitor {
6469            type Value = Link;
6470            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6471                formatter.write_str("struct Link")
6472            }
6473            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6474            where
6475                A: serde::de::MapAccess<'de>,
6476            {
6477                #[allow(unused_imports)]
6478                use serde::de::Error;
6479                use std::option::Option::Some;
6480                let mut fields = std::collections::HashSet::new();
6481                let mut result = Self::Value::new();
6482                while let Some(tag) = map.next_key::<__FieldTag>()? {
6483                    #[allow(clippy::match_single_binding)]
6484                    match tag {
6485                        __FieldTag::__name => {
6486                            if !fields.insert(__FieldTag::__name) {
6487                                return std::result::Result::Err(A::Error::duplicate_field(
6488                                    "multiple values for name",
6489                                ));
6490                            }
6491                            result.name = map
6492                                .next_value::<std::option::Option<std::string::String>>()?
6493                                .unwrap_or_default();
6494                        }
6495                        __FieldTag::__description => {
6496                            if !fields.insert(__FieldTag::__description) {
6497                                return std::result::Result::Err(A::Error::duplicate_field(
6498                                    "multiple values for description",
6499                                ));
6500                            }
6501                            result.description = map
6502                                .next_value::<std::option::Option<std::string::String>>()?
6503                                .unwrap_or_default();
6504                        }
6505                        __FieldTag::__create_time => {
6506                            if !fields.insert(__FieldTag::__create_time) {
6507                                return std::result::Result::Err(A::Error::duplicate_field(
6508                                    "multiple values for create_time",
6509                                ));
6510                            }
6511                            result.create_time =
6512                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
6513                        }
6514                        __FieldTag::__lifecycle_state => {
6515                            if !fields.insert(__FieldTag::__lifecycle_state) {
6516                                return std::result::Result::Err(A::Error::duplicate_field(
6517                                    "multiple values for lifecycle_state",
6518                                ));
6519                            }
6520                            result.lifecycle_state = map
6521                                .next_value::<std::option::Option<crate::model::LifecycleState>>()?
6522                                .unwrap_or_default();
6523                        }
6524                        __FieldTag::__bigquery_dataset => {
6525                            if !fields.insert(__FieldTag::__bigquery_dataset) {
6526                                return std::result::Result::Err(A::Error::duplicate_field(
6527                                    "multiple values for bigquery_dataset",
6528                                ));
6529                            }
6530                            result.bigquery_dataset = map
6531                                .next_value::<std::option::Option<crate::model::BigQueryDataset>>(
6532                                )?;
6533                        }
6534                        __FieldTag::Unknown(key) => {
6535                            let value = map.next_value::<serde_json::Value>()?;
6536                            result._unknown_fields.insert(key, value);
6537                        }
6538                    }
6539                }
6540                std::result::Result::Ok(result)
6541            }
6542        }
6543        deserializer.deserialize_any(Visitor)
6544    }
6545}
6546
6547#[doc(hidden)]
6548impl serde::ser::Serialize for Link {
6549    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6550    where
6551        S: serde::ser::Serializer,
6552    {
6553        use serde::ser::SerializeMap;
6554        #[allow(unused_imports)]
6555        use std::option::Option::Some;
6556        let mut state = serializer.serialize_map(std::option::Option::None)?;
6557        if !self.name.is_empty() {
6558            state.serialize_entry("name", &self.name)?;
6559        }
6560        if !self.description.is_empty() {
6561            state.serialize_entry("description", &self.description)?;
6562        }
6563        if self.create_time.is_some() {
6564            state.serialize_entry("createTime", &self.create_time)?;
6565        }
6566        if !wkt::internal::is_default(&self.lifecycle_state) {
6567            state.serialize_entry("lifecycleState", &self.lifecycle_state)?;
6568        }
6569        if self.bigquery_dataset.is_some() {
6570            state.serialize_entry("bigqueryDataset", &self.bigquery_dataset)?;
6571        }
6572        if !self._unknown_fields.is_empty() {
6573            for (key, value) in self._unknown_fields.iter() {
6574                state.serialize_entry(key, &value)?;
6575            }
6576        }
6577        state.end()
6578    }
6579}
6580
6581impl std::fmt::Debug for Link {
6582    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6583        let mut debug_struct = f.debug_struct("Link");
6584        debug_struct.field("name", &self.name);
6585        debug_struct.field("description", &self.description);
6586        debug_struct.field("create_time", &self.create_time);
6587        debug_struct.field("lifecycle_state", &self.lifecycle_state);
6588        debug_struct.field("bigquery_dataset", &self.bigquery_dataset);
6589        if !self._unknown_fields.is_empty() {
6590            debug_struct.field("_unknown_fields", &self._unknown_fields);
6591        }
6592        debug_struct.finish()
6593    }
6594}
6595
6596/// Options that change functionality of a sink exporting data to BigQuery.
6597#[derive(Clone, Default, PartialEq)]
6598#[non_exhaustive]
6599pub struct BigQueryOptions {
6600    /// Optional. Whether to use [BigQuery's partition
6601    /// tables](https://cloud.google.com/bigquery/docs/partitioned-tables). By
6602    /// default, Cloud Logging creates dated tables based on the log entries'
6603    /// timestamps, e.g. syslog_20170523. With partitioned tables the date suffix
6604    /// is no longer present and [special query
6605    /// syntax](https://cloud.google.com/bigquery/docs/querying-partitioned-tables)
6606    /// has to be used instead. In both cases, tables are sharded based on UTC
6607    /// timezone.
6608    pub use_partitioned_tables: bool,
6609
6610    /// Output only. True if new timestamp column based partitioning is in use,
6611    /// false if legacy ingestion-time partitioning is in use.
6612    ///
6613    /// All new sinks will have this field set true and will use timestamp column
6614    /// based partitioning. If use_partitioned_tables is false, this value has no
6615    /// meaning and will be false. Legacy sinks using partitioned tables will have
6616    /// this field set to false.
6617    pub uses_timestamp_column_partitioning: bool,
6618
6619    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6620}
6621
6622impl BigQueryOptions {
6623    pub fn new() -> Self {
6624        std::default::Default::default()
6625    }
6626
6627    /// Sets the value of [use_partitioned_tables][crate::model::BigQueryOptions::use_partitioned_tables].
6628    pub fn set_use_partitioned_tables<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6629        self.use_partitioned_tables = v.into();
6630        self
6631    }
6632
6633    /// Sets the value of [uses_timestamp_column_partitioning][crate::model::BigQueryOptions::uses_timestamp_column_partitioning].
6634    pub fn set_uses_timestamp_column_partitioning<T: std::convert::Into<bool>>(
6635        mut self,
6636        v: T,
6637    ) -> Self {
6638        self.uses_timestamp_column_partitioning = v.into();
6639        self
6640    }
6641}
6642
6643impl wkt::message::Message for BigQueryOptions {
6644    fn typename() -> &'static str {
6645        "type.googleapis.com/google.logging.v2.BigQueryOptions"
6646    }
6647}
6648
6649#[doc(hidden)]
6650impl<'de> serde::de::Deserialize<'de> for BigQueryOptions {
6651    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6652    where
6653        D: serde::Deserializer<'de>,
6654    {
6655        #[allow(non_camel_case_types)]
6656        #[doc(hidden)]
6657        #[derive(PartialEq, Eq, Hash)]
6658        enum __FieldTag {
6659            __use_partitioned_tables,
6660            __uses_timestamp_column_partitioning,
6661            Unknown(std::string::String),
6662        }
6663        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6664            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6665            where
6666                D: serde::Deserializer<'de>,
6667            {
6668                struct Visitor;
6669                impl<'de> serde::de::Visitor<'de> for Visitor {
6670                    type Value = __FieldTag;
6671                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6672                        formatter.write_str("a field name for BigQueryOptions")
6673                    }
6674                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6675                    where
6676                        E: serde::de::Error,
6677                    {
6678                        use std::result::Result::Ok;
6679                        use std::string::ToString;
6680                        match value {
6681                            "usePartitionedTables" => Ok(__FieldTag::__use_partitioned_tables),
6682                            "use_partitioned_tables" => Ok(__FieldTag::__use_partitioned_tables),
6683                            "usesTimestampColumnPartitioning" => {
6684                                Ok(__FieldTag::__uses_timestamp_column_partitioning)
6685                            }
6686                            "uses_timestamp_column_partitioning" => {
6687                                Ok(__FieldTag::__uses_timestamp_column_partitioning)
6688                            }
6689                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6690                        }
6691                    }
6692                }
6693                deserializer.deserialize_identifier(Visitor)
6694            }
6695        }
6696        struct Visitor;
6697        impl<'de> serde::de::Visitor<'de> for Visitor {
6698            type Value = BigQueryOptions;
6699            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6700                formatter.write_str("struct BigQueryOptions")
6701            }
6702            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6703            where
6704                A: serde::de::MapAccess<'de>,
6705            {
6706                #[allow(unused_imports)]
6707                use serde::de::Error;
6708                use std::option::Option::Some;
6709                let mut fields = std::collections::HashSet::new();
6710                let mut result = Self::Value::new();
6711                while let Some(tag) = map.next_key::<__FieldTag>()? {
6712                    #[allow(clippy::match_single_binding)]
6713                    match tag {
6714                        __FieldTag::__use_partitioned_tables => {
6715                            if !fields.insert(__FieldTag::__use_partitioned_tables) {
6716                                return std::result::Result::Err(A::Error::duplicate_field(
6717                                    "multiple values for use_partitioned_tables",
6718                                ));
6719                            }
6720                            result.use_partitioned_tables = map
6721                                .next_value::<std::option::Option<bool>>()?
6722                                .unwrap_or_default();
6723                        }
6724                        __FieldTag::__uses_timestamp_column_partitioning => {
6725                            if !fields.insert(__FieldTag::__uses_timestamp_column_partitioning) {
6726                                return std::result::Result::Err(A::Error::duplicate_field(
6727                                    "multiple values for uses_timestamp_column_partitioning",
6728                                ));
6729                            }
6730                            result.uses_timestamp_column_partitioning = map
6731                                .next_value::<std::option::Option<bool>>()?
6732                                .unwrap_or_default();
6733                        }
6734                        __FieldTag::Unknown(key) => {
6735                            let value = map.next_value::<serde_json::Value>()?;
6736                            result._unknown_fields.insert(key, value);
6737                        }
6738                    }
6739                }
6740                std::result::Result::Ok(result)
6741            }
6742        }
6743        deserializer.deserialize_any(Visitor)
6744    }
6745}
6746
6747#[doc(hidden)]
6748impl serde::ser::Serialize for BigQueryOptions {
6749    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6750    where
6751        S: serde::ser::Serializer,
6752    {
6753        use serde::ser::SerializeMap;
6754        #[allow(unused_imports)]
6755        use std::option::Option::Some;
6756        let mut state = serializer.serialize_map(std::option::Option::None)?;
6757        if !wkt::internal::is_default(&self.use_partitioned_tables) {
6758            state.serialize_entry("usePartitionedTables", &self.use_partitioned_tables)?;
6759        }
6760        if !wkt::internal::is_default(&self.uses_timestamp_column_partitioning) {
6761            state.serialize_entry(
6762                "usesTimestampColumnPartitioning",
6763                &self.uses_timestamp_column_partitioning,
6764            )?;
6765        }
6766        if !self._unknown_fields.is_empty() {
6767            for (key, value) in self._unknown_fields.iter() {
6768                state.serialize_entry(key, &value)?;
6769            }
6770        }
6771        state.end()
6772    }
6773}
6774
6775impl std::fmt::Debug for BigQueryOptions {
6776    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6777        let mut debug_struct = f.debug_struct("BigQueryOptions");
6778        debug_struct.field("use_partitioned_tables", &self.use_partitioned_tables);
6779        debug_struct.field(
6780            "uses_timestamp_column_partitioning",
6781            &self.uses_timestamp_column_partitioning,
6782        );
6783        if !self._unknown_fields.is_empty() {
6784            debug_struct.field("_unknown_fields", &self._unknown_fields);
6785        }
6786        debug_struct.finish()
6787    }
6788}
6789
6790/// The parameters to `ListBuckets`.
6791#[derive(Clone, Default, PartialEq)]
6792#[non_exhaustive]
6793pub struct ListBucketsRequest {
6794    /// Required. The parent resource whose buckets are to be listed:
6795    ///
6796    /// ```norust
6797    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
6798    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]"
6799    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]"
6800    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]"
6801    /// ```
6802    ///
6803    /// Note: The locations portion of the resource must be specified, but
6804    /// supplying the character `-` in place of [LOCATION_ID] will return all
6805    /// buckets.
6806    pub parent: std::string::String,
6807
6808    /// Optional. If present, then retrieve the next batch of results from the
6809    /// preceding call to this method. `pageToken` must be the value of
6810    /// `nextPageToken` from the previous response. The values of other method
6811    /// parameters should be identical to those in the previous call.
6812    pub page_token: std::string::String,
6813
6814    /// Optional. The maximum number of results to return from this request.
6815    /// Non-positive values are ignored. The presence of `nextPageToken` in the
6816    /// response indicates that more results might be available.
6817    pub page_size: i32,
6818
6819    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6820}
6821
6822impl ListBucketsRequest {
6823    pub fn new() -> Self {
6824        std::default::Default::default()
6825    }
6826
6827    /// Sets the value of [parent][crate::model::ListBucketsRequest::parent].
6828    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6829        self.parent = v.into();
6830        self
6831    }
6832
6833    /// Sets the value of [page_token][crate::model::ListBucketsRequest::page_token].
6834    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6835        self.page_token = v.into();
6836        self
6837    }
6838
6839    /// Sets the value of [page_size][crate::model::ListBucketsRequest::page_size].
6840    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6841        self.page_size = v.into();
6842        self
6843    }
6844}
6845
6846impl wkt::message::Message for ListBucketsRequest {
6847    fn typename() -> &'static str {
6848        "type.googleapis.com/google.logging.v2.ListBucketsRequest"
6849    }
6850}
6851
6852#[doc(hidden)]
6853impl<'de> serde::de::Deserialize<'de> for ListBucketsRequest {
6854    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6855    where
6856        D: serde::Deserializer<'de>,
6857    {
6858        #[allow(non_camel_case_types)]
6859        #[doc(hidden)]
6860        #[derive(PartialEq, Eq, Hash)]
6861        enum __FieldTag {
6862            __parent,
6863            __page_token,
6864            __page_size,
6865            Unknown(std::string::String),
6866        }
6867        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6868            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6869            where
6870                D: serde::Deserializer<'de>,
6871            {
6872                struct Visitor;
6873                impl<'de> serde::de::Visitor<'de> for Visitor {
6874                    type Value = __FieldTag;
6875                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6876                        formatter.write_str("a field name for ListBucketsRequest")
6877                    }
6878                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6879                    where
6880                        E: serde::de::Error,
6881                    {
6882                        use std::result::Result::Ok;
6883                        use std::string::ToString;
6884                        match value {
6885                            "parent" => Ok(__FieldTag::__parent),
6886                            "pageToken" => Ok(__FieldTag::__page_token),
6887                            "page_token" => Ok(__FieldTag::__page_token),
6888                            "pageSize" => Ok(__FieldTag::__page_size),
6889                            "page_size" => Ok(__FieldTag::__page_size),
6890                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6891                        }
6892                    }
6893                }
6894                deserializer.deserialize_identifier(Visitor)
6895            }
6896        }
6897        struct Visitor;
6898        impl<'de> serde::de::Visitor<'de> for Visitor {
6899            type Value = ListBucketsRequest;
6900            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6901                formatter.write_str("struct ListBucketsRequest")
6902            }
6903            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6904            where
6905                A: serde::de::MapAccess<'de>,
6906            {
6907                #[allow(unused_imports)]
6908                use serde::de::Error;
6909                use std::option::Option::Some;
6910                let mut fields = std::collections::HashSet::new();
6911                let mut result = Self::Value::new();
6912                while let Some(tag) = map.next_key::<__FieldTag>()? {
6913                    #[allow(clippy::match_single_binding)]
6914                    match tag {
6915                        __FieldTag::__parent => {
6916                            if !fields.insert(__FieldTag::__parent) {
6917                                return std::result::Result::Err(A::Error::duplicate_field(
6918                                    "multiple values for parent",
6919                                ));
6920                            }
6921                            result.parent = map
6922                                .next_value::<std::option::Option<std::string::String>>()?
6923                                .unwrap_or_default();
6924                        }
6925                        __FieldTag::__page_token => {
6926                            if !fields.insert(__FieldTag::__page_token) {
6927                                return std::result::Result::Err(A::Error::duplicate_field(
6928                                    "multiple values for page_token",
6929                                ));
6930                            }
6931                            result.page_token = map
6932                                .next_value::<std::option::Option<std::string::String>>()?
6933                                .unwrap_or_default();
6934                        }
6935                        __FieldTag::__page_size => {
6936                            if !fields.insert(__FieldTag::__page_size) {
6937                                return std::result::Result::Err(A::Error::duplicate_field(
6938                                    "multiple values for page_size",
6939                                ));
6940                            }
6941                            struct __With(std::option::Option<i32>);
6942                            impl<'de> serde::de::Deserialize<'de> for __With {
6943                                fn deserialize<D>(
6944                                    deserializer: D,
6945                                ) -> std::result::Result<Self, D::Error>
6946                                where
6947                                    D: serde::de::Deserializer<'de>,
6948                                {
6949                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
6950                                }
6951                            }
6952                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
6953                        }
6954                        __FieldTag::Unknown(key) => {
6955                            let value = map.next_value::<serde_json::Value>()?;
6956                            result._unknown_fields.insert(key, value);
6957                        }
6958                    }
6959                }
6960                std::result::Result::Ok(result)
6961            }
6962        }
6963        deserializer.deserialize_any(Visitor)
6964    }
6965}
6966
6967#[doc(hidden)]
6968impl serde::ser::Serialize for ListBucketsRequest {
6969    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6970    where
6971        S: serde::ser::Serializer,
6972    {
6973        use serde::ser::SerializeMap;
6974        #[allow(unused_imports)]
6975        use std::option::Option::Some;
6976        let mut state = serializer.serialize_map(std::option::Option::None)?;
6977        if !self.parent.is_empty() {
6978            state.serialize_entry("parent", &self.parent)?;
6979        }
6980        if !self.page_token.is_empty() {
6981            state.serialize_entry("pageToken", &self.page_token)?;
6982        }
6983        if !wkt::internal::is_default(&self.page_size) {
6984            struct __With<'a>(&'a i32);
6985            impl<'a> serde::ser::Serialize for __With<'a> {
6986                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6987                where
6988                    S: serde::ser::Serializer,
6989                {
6990                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
6991                }
6992            }
6993            state.serialize_entry("pageSize", &__With(&self.page_size))?;
6994        }
6995        if !self._unknown_fields.is_empty() {
6996            for (key, value) in self._unknown_fields.iter() {
6997                state.serialize_entry(key, &value)?;
6998            }
6999        }
7000        state.end()
7001    }
7002}
7003
7004impl std::fmt::Debug for ListBucketsRequest {
7005    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7006        let mut debug_struct = f.debug_struct("ListBucketsRequest");
7007        debug_struct.field("parent", &self.parent);
7008        debug_struct.field("page_token", &self.page_token);
7009        debug_struct.field("page_size", &self.page_size);
7010        if !self._unknown_fields.is_empty() {
7011            debug_struct.field("_unknown_fields", &self._unknown_fields);
7012        }
7013        debug_struct.finish()
7014    }
7015}
7016
7017/// The response from ListBuckets.
7018#[derive(Clone, Default, PartialEq)]
7019#[non_exhaustive]
7020pub struct ListBucketsResponse {
7021    /// A list of buckets.
7022    pub buckets: std::vec::Vec<crate::model::LogBucket>,
7023
7024    /// If there might be more results than appear in this response, then
7025    /// `nextPageToken` is included. To get the next set of results, call the same
7026    /// method again using the value of `nextPageToken` as `pageToken`.
7027    pub next_page_token: std::string::String,
7028
7029    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7030}
7031
7032impl ListBucketsResponse {
7033    pub fn new() -> Self {
7034        std::default::Default::default()
7035    }
7036
7037    /// Sets the value of [buckets][crate::model::ListBucketsResponse::buckets].
7038    pub fn set_buckets<T, V>(mut self, v: T) -> Self
7039    where
7040        T: std::iter::IntoIterator<Item = V>,
7041        V: std::convert::Into<crate::model::LogBucket>,
7042    {
7043        use std::iter::Iterator;
7044        self.buckets = v.into_iter().map(|i| i.into()).collect();
7045        self
7046    }
7047
7048    /// Sets the value of [next_page_token][crate::model::ListBucketsResponse::next_page_token].
7049    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7050        self.next_page_token = v.into();
7051        self
7052    }
7053}
7054
7055impl wkt::message::Message for ListBucketsResponse {
7056    fn typename() -> &'static str {
7057        "type.googleapis.com/google.logging.v2.ListBucketsResponse"
7058    }
7059}
7060
7061#[doc(hidden)]
7062impl gax::paginator::internal::PageableResponse for ListBucketsResponse {
7063    type PageItem = crate::model::LogBucket;
7064
7065    fn items(self) -> std::vec::Vec<Self::PageItem> {
7066        self.buckets
7067    }
7068
7069    fn next_page_token(&self) -> std::string::String {
7070        use std::clone::Clone;
7071        self.next_page_token.clone()
7072    }
7073}
7074
7075#[doc(hidden)]
7076impl<'de> serde::de::Deserialize<'de> for ListBucketsResponse {
7077    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7078    where
7079        D: serde::Deserializer<'de>,
7080    {
7081        #[allow(non_camel_case_types)]
7082        #[doc(hidden)]
7083        #[derive(PartialEq, Eq, Hash)]
7084        enum __FieldTag {
7085            __buckets,
7086            __next_page_token,
7087            Unknown(std::string::String),
7088        }
7089        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7090            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7091            where
7092                D: serde::Deserializer<'de>,
7093            {
7094                struct Visitor;
7095                impl<'de> serde::de::Visitor<'de> for Visitor {
7096                    type Value = __FieldTag;
7097                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7098                        formatter.write_str("a field name for ListBucketsResponse")
7099                    }
7100                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7101                    where
7102                        E: serde::de::Error,
7103                    {
7104                        use std::result::Result::Ok;
7105                        use std::string::ToString;
7106                        match value {
7107                            "buckets" => Ok(__FieldTag::__buckets),
7108                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
7109                            "next_page_token" => Ok(__FieldTag::__next_page_token),
7110                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7111                        }
7112                    }
7113                }
7114                deserializer.deserialize_identifier(Visitor)
7115            }
7116        }
7117        struct Visitor;
7118        impl<'de> serde::de::Visitor<'de> for Visitor {
7119            type Value = ListBucketsResponse;
7120            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7121                formatter.write_str("struct ListBucketsResponse")
7122            }
7123            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7124            where
7125                A: serde::de::MapAccess<'de>,
7126            {
7127                #[allow(unused_imports)]
7128                use serde::de::Error;
7129                use std::option::Option::Some;
7130                let mut fields = std::collections::HashSet::new();
7131                let mut result = Self::Value::new();
7132                while let Some(tag) = map.next_key::<__FieldTag>()? {
7133                    #[allow(clippy::match_single_binding)]
7134                    match tag {
7135                        __FieldTag::__buckets => {
7136                            if !fields.insert(__FieldTag::__buckets) {
7137                                return std::result::Result::Err(A::Error::duplicate_field(
7138                                    "multiple values for buckets",
7139                                ));
7140                            }
7141                            result.buckets = map.next_value::<std::option::Option<std::vec::Vec<crate::model::LogBucket>>>()?.unwrap_or_default();
7142                        }
7143                        __FieldTag::__next_page_token => {
7144                            if !fields.insert(__FieldTag::__next_page_token) {
7145                                return std::result::Result::Err(A::Error::duplicate_field(
7146                                    "multiple values for next_page_token",
7147                                ));
7148                            }
7149                            result.next_page_token = map
7150                                .next_value::<std::option::Option<std::string::String>>()?
7151                                .unwrap_or_default();
7152                        }
7153                        __FieldTag::Unknown(key) => {
7154                            let value = map.next_value::<serde_json::Value>()?;
7155                            result._unknown_fields.insert(key, value);
7156                        }
7157                    }
7158                }
7159                std::result::Result::Ok(result)
7160            }
7161        }
7162        deserializer.deserialize_any(Visitor)
7163    }
7164}
7165
7166#[doc(hidden)]
7167impl serde::ser::Serialize for ListBucketsResponse {
7168    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7169    where
7170        S: serde::ser::Serializer,
7171    {
7172        use serde::ser::SerializeMap;
7173        #[allow(unused_imports)]
7174        use std::option::Option::Some;
7175        let mut state = serializer.serialize_map(std::option::Option::None)?;
7176        if !self.buckets.is_empty() {
7177            state.serialize_entry("buckets", &self.buckets)?;
7178        }
7179        if !self.next_page_token.is_empty() {
7180            state.serialize_entry("nextPageToken", &self.next_page_token)?;
7181        }
7182        if !self._unknown_fields.is_empty() {
7183            for (key, value) in self._unknown_fields.iter() {
7184                state.serialize_entry(key, &value)?;
7185            }
7186        }
7187        state.end()
7188    }
7189}
7190
7191impl std::fmt::Debug for ListBucketsResponse {
7192    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7193        let mut debug_struct = f.debug_struct("ListBucketsResponse");
7194        debug_struct.field("buckets", &self.buckets);
7195        debug_struct.field("next_page_token", &self.next_page_token);
7196        if !self._unknown_fields.is_empty() {
7197            debug_struct.field("_unknown_fields", &self._unknown_fields);
7198        }
7199        debug_struct.finish()
7200    }
7201}
7202
7203/// The parameters to `CreateBucket`.
7204#[derive(Clone, Default, PartialEq)]
7205#[non_exhaustive]
7206pub struct CreateBucketRequest {
7207    /// Required. The resource in which to create the log bucket:
7208    ///
7209    /// ```norust
7210    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
7211    /// ```
7212    ///
7213    /// For example:
7214    ///
7215    /// `"projects/my-project/locations/global"`
7216    pub parent: std::string::String,
7217
7218    /// Required. A client-assigned identifier such as `"my-bucket"`. Identifiers
7219    /// are limited to 100 characters and can include only letters, digits,
7220    /// underscores, hyphens, and periods.
7221    pub bucket_id: std::string::String,
7222
7223    /// Required. The new bucket. The region specified in the new bucket must be
7224    /// compliant with any Location Restriction Org Policy. The name field in the
7225    /// bucket is ignored.
7226    pub bucket: std::option::Option<crate::model::LogBucket>,
7227
7228    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7229}
7230
7231impl CreateBucketRequest {
7232    pub fn new() -> Self {
7233        std::default::Default::default()
7234    }
7235
7236    /// Sets the value of [parent][crate::model::CreateBucketRequest::parent].
7237    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7238        self.parent = v.into();
7239        self
7240    }
7241
7242    /// Sets the value of [bucket_id][crate::model::CreateBucketRequest::bucket_id].
7243    pub fn set_bucket_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7244        self.bucket_id = v.into();
7245        self
7246    }
7247
7248    /// Sets the value of [bucket][crate::model::CreateBucketRequest::bucket].
7249    pub fn set_bucket<T>(mut self, v: T) -> Self
7250    where
7251        T: std::convert::Into<crate::model::LogBucket>,
7252    {
7253        self.bucket = std::option::Option::Some(v.into());
7254        self
7255    }
7256
7257    /// Sets or clears the value of [bucket][crate::model::CreateBucketRequest::bucket].
7258    pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
7259    where
7260        T: std::convert::Into<crate::model::LogBucket>,
7261    {
7262        self.bucket = v.map(|x| x.into());
7263        self
7264    }
7265}
7266
7267impl wkt::message::Message for CreateBucketRequest {
7268    fn typename() -> &'static str {
7269        "type.googleapis.com/google.logging.v2.CreateBucketRequest"
7270    }
7271}
7272
7273#[doc(hidden)]
7274impl<'de> serde::de::Deserialize<'de> for CreateBucketRequest {
7275    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7276    where
7277        D: serde::Deserializer<'de>,
7278    {
7279        #[allow(non_camel_case_types)]
7280        #[doc(hidden)]
7281        #[derive(PartialEq, Eq, Hash)]
7282        enum __FieldTag {
7283            __parent,
7284            __bucket_id,
7285            __bucket,
7286            Unknown(std::string::String),
7287        }
7288        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7289            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7290            where
7291                D: serde::Deserializer<'de>,
7292            {
7293                struct Visitor;
7294                impl<'de> serde::de::Visitor<'de> for Visitor {
7295                    type Value = __FieldTag;
7296                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7297                        formatter.write_str("a field name for CreateBucketRequest")
7298                    }
7299                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7300                    where
7301                        E: serde::de::Error,
7302                    {
7303                        use std::result::Result::Ok;
7304                        use std::string::ToString;
7305                        match value {
7306                            "parent" => Ok(__FieldTag::__parent),
7307                            "bucketId" => Ok(__FieldTag::__bucket_id),
7308                            "bucket_id" => Ok(__FieldTag::__bucket_id),
7309                            "bucket" => Ok(__FieldTag::__bucket),
7310                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7311                        }
7312                    }
7313                }
7314                deserializer.deserialize_identifier(Visitor)
7315            }
7316        }
7317        struct Visitor;
7318        impl<'de> serde::de::Visitor<'de> for Visitor {
7319            type Value = CreateBucketRequest;
7320            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7321                formatter.write_str("struct CreateBucketRequest")
7322            }
7323            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7324            where
7325                A: serde::de::MapAccess<'de>,
7326            {
7327                #[allow(unused_imports)]
7328                use serde::de::Error;
7329                use std::option::Option::Some;
7330                let mut fields = std::collections::HashSet::new();
7331                let mut result = Self::Value::new();
7332                while let Some(tag) = map.next_key::<__FieldTag>()? {
7333                    #[allow(clippy::match_single_binding)]
7334                    match tag {
7335                        __FieldTag::__parent => {
7336                            if !fields.insert(__FieldTag::__parent) {
7337                                return std::result::Result::Err(A::Error::duplicate_field(
7338                                    "multiple values for parent",
7339                                ));
7340                            }
7341                            result.parent = map
7342                                .next_value::<std::option::Option<std::string::String>>()?
7343                                .unwrap_or_default();
7344                        }
7345                        __FieldTag::__bucket_id => {
7346                            if !fields.insert(__FieldTag::__bucket_id) {
7347                                return std::result::Result::Err(A::Error::duplicate_field(
7348                                    "multiple values for bucket_id",
7349                                ));
7350                            }
7351                            result.bucket_id = map
7352                                .next_value::<std::option::Option<std::string::String>>()?
7353                                .unwrap_or_default();
7354                        }
7355                        __FieldTag::__bucket => {
7356                            if !fields.insert(__FieldTag::__bucket) {
7357                                return std::result::Result::Err(A::Error::duplicate_field(
7358                                    "multiple values for bucket",
7359                                ));
7360                            }
7361                            result.bucket =
7362                                map.next_value::<std::option::Option<crate::model::LogBucket>>()?;
7363                        }
7364                        __FieldTag::Unknown(key) => {
7365                            let value = map.next_value::<serde_json::Value>()?;
7366                            result._unknown_fields.insert(key, value);
7367                        }
7368                    }
7369                }
7370                std::result::Result::Ok(result)
7371            }
7372        }
7373        deserializer.deserialize_any(Visitor)
7374    }
7375}
7376
7377#[doc(hidden)]
7378impl serde::ser::Serialize for CreateBucketRequest {
7379    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7380    where
7381        S: serde::ser::Serializer,
7382    {
7383        use serde::ser::SerializeMap;
7384        #[allow(unused_imports)]
7385        use std::option::Option::Some;
7386        let mut state = serializer.serialize_map(std::option::Option::None)?;
7387        if !self.parent.is_empty() {
7388            state.serialize_entry("parent", &self.parent)?;
7389        }
7390        if !self.bucket_id.is_empty() {
7391            state.serialize_entry("bucketId", &self.bucket_id)?;
7392        }
7393        if self.bucket.is_some() {
7394            state.serialize_entry("bucket", &self.bucket)?;
7395        }
7396        if !self._unknown_fields.is_empty() {
7397            for (key, value) in self._unknown_fields.iter() {
7398                state.serialize_entry(key, &value)?;
7399            }
7400        }
7401        state.end()
7402    }
7403}
7404
7405impl std::fmt::Debug for CreateBucketRequest {
7406    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7407        let mut debug_struct = f.debug_struct("CreateBucketRequest");
7408        debug_struct.field("parent", &self.parent);
7409        debug_struct.field("bucket_id", &self.bucket_id);
7410        debug_struct.field("bucket", &self.bucket);
7411        if !self._unknown_fields.is_empty() {
7412            debug_struct.field("_unknown_fields", &self._unknown_fields);
7413        }
7414        debug_struct.finish()
7415    }
7416}
7417
7418/// The parameters to `UpdateBucket`.
7419#[derive(Clone, Default, PartialEq)]
7420#[non_exhaustive]
7421pub struct UpdateBucketRequest {
7422    /// Required. The full resource name of the bucket to update.
7423    ///
7424    /// ```norust
7425    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7426    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7427    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7428    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7429    /// ```
7430    ///
7431    /// For example:
7432    ///
7433    /// `"projects/my-project/locations/global/buckets/my-bucket"`
7434    pub name: std::string::String,
7435
7436    /// Required. The updated bucket.
7437    pub bucket: std::option::Option<crate::model::LogBucket>,
7438
7439    /// Required. Field mask that specifies the fields in `bucket` that need an
7440    /// update. A bucket field will be overwritten if, and only if, it is in the
7441    /// update mask. `name` and output only fields cannot be updated.
7442    ///
7443    /// For a detailed `FieldMask` definition, see:
7444    /// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask>
7445    ///
7446    /// For example: `updateMask=retention_days`
7447    pub update_mask: std::option::Option<wkt::FieldMask>,
7448
7449    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7450}
7451
7452impl UpdateBucketRequest {
7453    pub fn new() -> Self {
7454        std::default::Default::default()
7455    }
7456
7457    /// Sets the value of [name][crate::model::UpdateBucketRequest::name].
7458    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7459        self.name = v.into();
7460        self
7461    }
7462
7463    /// Sets the value of [bucket][crate::model::UpdateBucketRequest::bucket].
7464    pub fn set_bucket<T>(mut self, v: T) -> Self
7465    where
7466        T: std::convert::Into<crate::model::LogBucket>,
7467    {
7468        self.bucket = std::option::Option::Some(v.into());
7469        self
7470    }
7471
7472    /// Sets or clears the value of [bucket][crate::model::UpdateBucketRequest::bucket].
7473    pub fn set_or_clear_bucket<T>(mut self, v: std::option::Option<T>) -> Self
7474    where
7475        T: std::convert::Into<crate::model::LogBucket>,
7476    {
7477        self.bucket = v.map(|x| x.into());
7478        self
7479    }
7480
7481    /// Sets the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
7482    pub fn set_update_mask<T>(mut self, v: T) -> Self
7483    where
7484        T: std::convert::Into<wkt::FieldMask>,
7485    {
7486        self.update_mask = std::option::Option::Some(v.into());
7487        self
7488    }
7489
7490    /// Sets or clears the value of [update_mask][crate::model::UpdateBucketRequest::update_mask].
7491    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7492    where
7493        T: std::convert::Into<wkt::FieldMask>,
7494    {
7495        self.update_mask = v.map(|x| x.into());
7496        self
7497    }
7498}
7499
7500impl wkt::message::Message for UpdateBucketRequest {
7501    fn typename() -> &'static str {
7502        "type.googleapis.com/google.logging.v2.UpdateBucketRequest"
7503    }
7504}
7505
7506#[doc(hidden)]
7507impl<'de> serde::de::Deserialize<'de> for UpdateBucketRequest {
7508    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7509    where
7510        D: serde::Deserializer<'de>,
7511    {
7512        #[allow(non_camel_case_types)]
7513        #[doc(hidden)]
7514        #[derive(PartialEq, Eq, Hash)]
7515        enum __FieldTag {
7516            __name,
7517            __bucket,
7518            __update_mask,
7519            Unknown(std::string::String),
7520        }
7521        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7522            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7523            where
7524                D: serde::Deserializer<'de>,
7525            {
7526                struct Visitor;
7527                impl<'de> serde::de::Visitor<'de> for Visitor {
7528                    type Value = __FieldTag;
7529                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7530                        formatter.write_str("a field name for UpdateBucketRequest")
7531                    }
7532                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7533                    where
7534                        E: serde::de::Error,
7535                    {
7536                        use std::result::Result::Ok;
7537                        use std::string::ToString;
7538                        match value {
7539                            "name" => Ok(__FieldTag::__name),
7540                            "bucket" => Ok(__FieldTag::__bucket),
7541                            "updateMask" => Ok(__FieldTag::__update_mask),
7542                            "update_mask" => Ok(__FieldTag::__update_mask),
7543                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7544                        }
7545                    }
7546                }
7547                deserializer.deserialize_identifier(Visitor)
7548            }
7549        }
7550        struct Visitor;
7551        impl<'de> serde::de::Visitor<'de> for Visitor {
7552            type Value = UpdateBucketRequest;
7553            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7554                formatter.write_str("struct UpdateBucketRequest")
7555            }
7556            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7557            where
7558                A: serde::de::MapAccess<'de>,
7559            {
7560                #[allow(unused_imports)]
7561                use serde::de::Error;
7562                use std::option::Option::Some;
7563                let mut fields = std::collections::HashSet::new();
7564                let mut result = Self::Value::new();
7565                while let Some(tag) = map.next_key::<__FieldTag>()? {
7566                    #[allow(clippy::match_single_binding)]
7567                    match tag {
7568                        __FieldTag::__name => {
7569                            if !fields.insert(__FieldTag::__name) {
7570                                return std::result::Result::Err(A::Error::duplicate_field(
7571                                    "multiple values for name",
7572                                ));
7573                            }
7574                            result.name = map
7575                                .next_value::<std::option::Option<std::string::String>>()?
7576                                .unwrap_or_default();
7577                        }
7578                        __FieldTag::__bucket => {
7579                            if !fields.insert(__FieldTag::__bucket) {
7580                                return std::result::Result::Err(A::Error::duplicate_field(
7581                                    "multiple values for bucket",
7582                                ));
7583                            }
7584                            result.bucket =
7585                                map.next_value::<std::option::Option<crate::model::LogBucket>>()?;
7586                        }
7587                        __FieldTag::__update_mask => {
7588                            if !fields.insert(__FieldTag::__update_mask) {
7589                                return std::result::Result::Err(A::Error::duplicate_field(
7590                                    "multiple values for update_mask",
7591                                ));
7592                            }
7593                            result.update_mask =
7594                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
7595                        }
7596                        __FieldTag::Unknown(key) => {
7597                            let value = map.next_value::<serde_json::Value>()?;
7598                            result._unknown_fields.insert(key, value);
7599                        }
7600                    }
7601                }
7602                std::result::Result::Ok(result)
7603            }
7604        }
7605        deserializer.deserialize_any(Visitor)
7606    }
7607}
7608
7609#[doc(hidden)]
7610impl serde::ser::Serialize for UpdateBucketRequest {
7611    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7612    where
7613        S: serde::ser::Serializer,
7614    {
7615        use serde::ser::SerializeMap;
7616        #[allow(unused_imports)]
7617        use std::option::Option::Some;
7618        let mut state = serializer.serialize_map(std::option::Option::None)?;
7619        if !self.name.is_empty() {
7620            state.serialize_entry("name", &self.name)?;
7621        }
7622        if self.bucket.is_some() {
7623            state.serialize_entry("bucket", &self.bucket)?;
7624        }
7625        if self.update_mask.is_some() {
7626            state.serialize_entry("updateMask", &self.update_mask)?;
7627        }
7628        if !self._unknown_fields.is_empty() {
7629            for (key, value) in self._unknown_fields.iter() {
7630                state.serialize_entry(key, &value)?;
7631            }
7632        }
7633        state.end()
7634    }
7635}
7636
7637impl std::fmt::Debug for UpdateBucketRequest {
7638    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7639        let mut debug_struct = f.debug_struct("UpdateBucketRequest");
7640        debug_struct.field("name", &self.name);
7641        debug_struct.field("bucket", &self.bucket);
7642        debug_struct.field("update_mask", &self.update_mask);
7643        if !self._unknown_fields.is_empty() {
7644            debug_struct.field("_unknown_fields", &self._unknown_fields);
7645        }
7646        debug_struct.finish()
7647    }
7648}
7649
7650/// The parameters to `GetBucket`.
7651#[derive(Clone, Default, PartialEq)]
7652#[non_exhaustive]
7653pub struct GetBucketRequest {
7654    /// Required. The resource name of the bucket:
7655    ///
7656    /// ```norust
7657    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7658    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7659    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7660    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7661    /// ```
7662    ///
7663    /// For example:
7664    ///
7665    /// `"projects/my-project/locations/global/buckets/my-bucket"`
7666    pub name: std::string::String,
7667
7668    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7669}
7670
7671impl GetBucketRequest {
7672    pub fn new() -> Self {
7673        std::default::Default::default()
7674    }
7675
7676    /// Sets the value of [name][crate::model::GetBucketRequest::name].
7677    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7678        self.name = v.into();
7679        self
7680    }
7681}
7682
7683impl wkt::message::Message for GetBucketRequest {
7684    fn typename() -> &'static str {
7685        "type.googleapis.com/google.logging.v2.GetBucketRequest"
7686    }
7687}
7688
7689#[doc(hidden)]
7690impl<'de> serde::de::Deserialize<'de> for GetBucketRequest {
7691    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7692    where
7693        D: serde::Deserializer<'de>,
7694    {
7695        #[allow(non_camel_case_types)]
7696        #[doc(hidden)]
7697        #[derive(PartialEq, Eq, Hash)]
7698        enum __FieldTag {
7699            __name,
7700            Unknown(std::string::String),
7701        }
7702        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7703            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7704            where
7705                D: serde::Deserializer<'de>,
7706            {
7707                struct Visitor;
7708                impl<'de> serde::de::Visitor<'de> for Visitor {
7709                    type Value = __FieldTag;
7710                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7711                        formatter.write_str("a field name for GetBucketRequest")
7712                    }
7713                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7714                    where
7715                        E: serde::de::Error,
7716                    {
7717                        use std::result::Result::Ok;
7718                        use std::string::ToString;
7719                        match value {
7720                            "name" => Ok(__FieldTag::__name),
7721                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7722                        }
7723                    }
7724                }
7725                deserializer.deserialize_identifier(Visitor)
7726            }
7727        }
7728        struct Visitor;
7729        impl<'de> serde::de::Visitor<'de> for Visitor {
7730            type Value = GetBucketRequest;
7731            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7732                formatter.write_str("struct GetBucketRequest")
7733            }
7734            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7735            where
7736                A: serde::de::MapAccess<'de>,
7737            {
7738                #[allow(unused_imports)]
7739                use serde::de::Error;
7740                use std::option::Option::Some;
7741                let mut fields = std::collections::HashSet::new();
7742                let mut result = Self::Value::new();
7743                while let Some(tag) = map.next_key::<__FieldTag>()? {
7744                    #[allow(clippy::match_single_binding)]
7745                    match tag {
7746                        __FieldTag::__name => {
7747                            if !fields.insert(__FieldTag::__name) {
7748                                return std::result::Result::Err(A::Error::duplicate_field(
7749                                    "multiple values for name",
7750                                ));
7751                            }
7752                            result.name = map
7753                                .next_value::<std::option::Option<std::string::String>>()?
7754                                .unwrap_or_default();
7755                        }
7756                        __FieldTag::Unknown(key) => {
7757                            let value = map.next_value::<serde_json::Value>()?;
7758                            result._unknown_fields.insert(key, value);
7759                        }
7760                    }
7761                }
7762                std::result::Result::Ok(result)
7763            }
7764        }
7765        deserializer.deserialize_any(Visitor)
7766    }
7767}
7768
7769#[doc(hidden)]
7770impl serde::ser::Serialize for GetBucketRequest {
7771    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7772    where
7773        S: serde::ser::Serializer,
7774    {
7775        use serde::ser::SerializeMap;
7776        #[allow(unused_imports)]
7777        use std::option::Option::Some;
7778        let mut state = serializer.serialize_map(std::option::Option::None)?;
7779        if !self.name.is_empty() {
7780            state.serialize_entry("name", &self.name)?;
7781        }
7782        if !self._unknown_fields.is_empty() {
7783            for (key, value) in self._unknown_fields.iter() {
7784                state.serialize_entry(key, &value)?;
7785            }
7786        }
7787        state.end()
7788    }
7789}
7790
7791impl std::fmt::Debug for GetBucketRequest {
7792    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7793        let mut debug_struct = f.debug_struct("GetBucketRequest");
7794        debug_struct.field("name", &self.name);
7795        if !self._unknown_fields.is_empty() {
7796            debug_struct.field("_unknown_fields", &self._unknown_fields);
7797        }
7798        debug_struct.finish()
7799    }
7800}
7801
7802/// The parameters to `DeleteBucket`.
7803#[derive(Clone, Default, PartialEq)]
7804#[non_exhaustive]
7805pub struct DeleteBucketRequest {
7806    /// Required. The full resource name of the bucket to delete.
7807    ///
7808    /// ```norust
7809    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7810    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7811    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7812    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7813    /// ```
7814    ///
7815    /// For example:
7816    ///
7817    /// `"projects/my-project/locations/global/buckets/my-bucket"`
7818    pub name: std::string::String,
7819
7820    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7821}
7822
7823impl DeleteBucketRequest {
7824    pub fn new() -> Self {
7825        std::default::Default::default()
7826    }
7827
7828    /// Sets the value of [name][crate::model::DeleteBucketRequest::name].
7829    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7830        self.name = v.into();
7831        self
7832    }
7833}
7834
7835impl wkt::message::Message for DeleteBucketRequest {
7836    fn typename() -> &'static str {
7837        "type.googleapis.com/google.logging.v2.DeleteBucketRequest"
7838    }
7839}
7840
7841#[doc(hidden)]
7842impl<'de> serde::de::Deserialize<'de> for DeleteBucketRequest {
7843    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7844    where
7845        D: serde::Deserializer<'de>,
7846    {
7847        #[allow(non_camel_case_types)]
7848        #[doc(hidden)]
7849        #[derive(PartialEq, Eq, Hash)]
7850        enum __FieldTag {
7851            __name,
7852            Unknown(std::string::String),
7853        }
7854        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7855            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7856            where
7857                D: serde::Deserializer<'de>,
7858            {
7859                struct Visitor;
7860                impl<'de> serde::de::Visitor<'de> for Visitor {
7861                    type Value = __FieldTag;
7862                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7863                        formatter.write_str("a field name for DeleteBucketRequest")
7864                    }
7865                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7866                    where
7867                        E: serde::de::Error,
7868                    {
7869                        use std::result::Result::Ok;
7870                        use std::string::ToString;
7871                        match value {
7872                            "name" => Ok(__FieldTag::__name),
7873                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7874                        }
7875                    }
7876                }
7877                deserializer.deserialize_identifier(Visitor)
7878            }
7879        }
7880        struct Visitor;
7881        impl<'de> serde::de::Visitor<'de> for Visitor {
7882            type Value = DeleteBucketRequest;
7883            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7884                formatter.write_str("struct DeleteBucketRequest")
7885            }
7886            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7887            where
7888                A: serde::de::MapAccess<'de>,
7889            {
7890                #[allow(unused_imports)]
7891                use serde::de::Error;
7892                use std::option::Option::Some;
7893                let mut fields = std::collections::HashSet::new();
7894                let mut result = Self::Value::new();
7895                while let Some(tag) = map.next_key::<__FieldTag>()? {
7896                    #[allow(clippy::match_single_binding)]
7897                    match tag {
7898                        __FieldTag::__name => {
7899                            if !fields.insert(__FieldTag::__name) {
7900                                return std::result::Result::Err(A::Error::duplicate_field(
7901                                    "multiple values for name",
7902                                ));
7903                            }
7904                            result.name = map
7905                                .next_value::<std::option::Option<std::string::String>>()?
7906                                .unwrap_or_default();
7907                        }
7908                        __FieldTag::Unknown(key) => {
7909                            let value = map.next_value::<serde_json::Value>()?;
7910                            result._unknown_fields.insert(key, value);
7911                        }
7912                    }
7913                }
7914                std::result::Result::Ok(result)
7915            }
7916        }
7917        deserializer.deserialize_any(Visitor)
7918    }
7919}
7920
7921#[doc(hidden)]
7922impl serde::ser::Serialize for DeleteBucketRequest {
7923    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7924    where
7925        S: serde::ser::Serializer,
7926    {
7927        use serde::ser::SerializeMap;
7928        #[allow(unused_imports)]
7929        use std::option::Option::Some;
7930        let mut state = serializer.serialize_map(std::option::Option::None)?;
7931        if !self.name.is_empty() {
7932            state.serialize_entry("name", &self.name)?;
7933        }
7934        if !self._unknown_fields.is_empty() {
7935            for (key, value) in self._unknown_fields.iter() {
7936                state.serialize_entry(key, &value)?;
7937            }
7938        }
7939        state.end()
7940    }
7941}
7942
7943impl std::fmt::Debug for DeleteBucketRequest {
7944    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7945        let mut debug_struct = f.debug_struct("DeleteBucketRequest");
7946        debug_struct.field("name", &self.name);
7947        if !self._unknown_fields.is_empty() {
7948            debug_struct.field("_unknown_fields", &self._unknown_fields);
7949        }
7950        debug_struct.finish()
7951    }
7952}
7953
7954/// The parameters to `UndeleteBucket`.
7955#[derive(Clone, Default, PartialEq)]
7956#[non_exhaustive]
7957pub struct UndeleteBucketRequest {
7958    /// Required. The full resource name of the bucket to undelete.
7959    ///
7960    /// ```norust
7961    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7962    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7963    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7964    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
7965    /// ```
7966    ///
7967    /// For example:
7968    ///
7969    /// `"projects/my-project/locations/global/buckets/my-bucket"`
7970    pub name: std::string::String,
7971
7972    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7973}
7974
7975impl UndeleteBucketRequest {
7976    pub fn new() -> Self {
7977        std::default::Default::default()
7978    }
7979
7980    /// Sets the value of [name][crate::model::UndeleteBucketRequest::name].
7981    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7982        self.name = v.into();
7983        self
7984    }
7985}
7986
7987impl wkt::message::Message for UndeleteBucketRequest {
7988    fn typename() -> &'static str {
7989        "type.googleapis.com/google.logging.v2.UndeleteBucketRequest"
7990    }
7991}
7992
7993#[doc(hidden)]
7994impl<'de> serde::de::Deserialize<'de> for UndeleteBucketRequest {
7995    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7996    where
7997        D: serde::Deserializer<'de>,
7998    {
7999        #[allow(non_camel_case_types)]
8000        #[doc(hidden)]
8001        #[derive(PartialEq, Eq, Hash)]
8002        enum __FieldTag {
8003            __name,
8004            Unknown(std::string::String),
8005        }
8006        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8007            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8008            where
8009                D: serde::Deserializer<'de>,
8010            {
8011                struct Visitor;
8012                impl<'de> serde::de::Visitor<'de> for Visitor {
8013                    type Value = __FieldTag;
8014                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8015                        formatter.write_str("a field name for UndeleteBucketRequest")
8016                    }
8017                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8018                    where
8019                        E: serde::de::Error,
8020                    {
8021                        use std::result::Result::Ok;
8022                        use std::string::ToString;
8023                        match value {
8024                            "name" => Ok(__FieldTag::__name),
8025                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8026                        }
8027                    }
8028                }
8029                deserializer.deserialize_identifier(Visitor)
8030            }
8031        }
8032        struct Visitor;
8033        impl<'de> serde::de::Visitor<'de> for Visitor {
8034            type Value = UndeleteBucketRequest;
8035            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8036                formatter.write_str("struct UndeleteBucketRequest")
8037            }
8038            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8039            where
8040                A: serde::de::MapAccess<'de>,
8041            {
8042                #[allow(unused_imports)]
8043                use serde::de::Error;
8044                use std::option::Option::Some;
8045                let mut fields = std::collections::HashSet::new();
8046                let mut result = Self::Value::new();
8047                while let Some(tag) = map.next_key::<__FieldTag>()? {
8048                    #[allow(clippy::match_single_binding)]
8049                    match tag {
8050                        __FieldTag::__name => {
8051                            if !fields.insert(__FieldTag::__name) {
8052                                return std::result::Result::Err(A::Error::duplicate_field(
8053                                    "multiple values for name",
8054                                ));
8055                            }
8056                            result.name = map
8057                                .next_value::<std::option::Option<std::string::String>>()?
8058                                .unwrap_or_default();
8059                        }
8060                        __FieldTag::Unknown(key) => {
8061                            let value = map.next_value::<serde_json::Value>()?;
8062                            result._unknown_fields.insert(key, value);
8063                        }
8064                    }
8065                }
8066                std::result::Result::Ok(result)
8067            }
8068        }
8069        deserializer.deserialize_any(Visitor)
8070    }
8071}
8072
8073#[doc(hidden)]
8074impl serde::ser::Serialize for UndeleteBucketRequest {
8075    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8076    where
8077        S: serde::ser::Serializer,
8078    {
8079        use serde::ser::SerializeMap;
8080        #[allow(unused_imports)]
8081        use std::option::Option::Some;
8082        let mut state = serializer.serialize_map(std::option::Option::None)?;
8083        if !self.name.is_empty() {
8084            state.serialize_entry("name", &self.name)?;
8085        }
8086        if !self._unknown_fields.is_empty() {
8087            for (key, value) in self._unknown_fields.iter() {
8088                state.serialize_entry(key, &value)?;
8089            }
8090        }
8091        state.end()
8092    }
8093}
8094
8095impl std::fmt::Debug for UndeleteBucketRequest {
8096    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8097        let mut debug_struct = f.debug_struct("UndeleteBucketRequest");
8098        debug_struct.field("name", &self.name);
8099        if !self._unknown_fields.is_empty() {
8100            debug_struct.field("_unknown_fields", &self._unknown_fields);
8101        }
8102        debug_struct.finish()
8103    }
8104}
8105
8106/// The parameters to `ListViews`.
8107#[derive(Clone, Default, PartialEq)]
8108#[non_exhaustive]
8109pub struct ListViewsRequest {
8110    /// Required. The bucket whose views are to be listed:
8111    ///
8112    /// ```norust
8113    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
8114    /// ```
8115    pub parent: std::string::String,
8116
8117    /// Optional. If present, then retrieve the next batch of results from the
8118    /// preceding call to this method. `pageToken` must be the value of
8119    /// `nextPageToken` from the previous response. The values of other method
8120    /// parameters should be identical to those in the previous call.
8121    pub page_token: std::string::String,
8122
8123    /// Optional. The maximum number of results to return from this request.
8124    ///
8125    /// Non-positive values are ignored. The presence of `nextPageToken` in the
8126    /// response indicates that more results might be available.
8127    pub page_size: i32,
8128
8129    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8130}
8131
8132impl ListViewsRequest {
8133    pub fn new() -> Self {
8134        std::default::Default::default()
8135    }
8136
8137    /// Sets the value of [parent][crate::model::ListViewsRequest::parent].
8138    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8139        self.parent = v.into();
8140        self
8141    }
8142
8143    /// Sets the value of [page_token][crate::model::ListViewsRequest::page_token].
8144    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8145        self.page_token = v.into();
8146        self
8147    }
8148
8149    /// Sets the value of [page_size][crate::model::ListViewsRequest::page_size].
8150    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8151        self.page_size = v.into();
8152        self
8153    }
8154}
8155
8156impl wkt::message::Message for ListViewsRequest {
8157    fn typename() -> &'static str {
8158        "type.googleapis.com/google.logging.v2.ListViewsRequest"
8159    }
8160}
8161
8162#[doc(hidden)]
8163impl<'de> serde::de::Deserialize<'de> for ListViewsRequest {
8164    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8165    where
8166        D: serde::Deserializer<'de>,
8167    {
8168        #[allow(non_camel_case_types)]
8169        #[doc(hidden)]
8170        #[derive(PartialEq, Eq, Hash)]
8171        enum __FieldTag {
8172            __parent,
8173            __page_token,
8174            __page_size,
8175            Unknown(std::string::String),
8176        }
8177        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8178            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8179            where
8180                D: serde::Deserializer<'de>,
8181            {
8182                struct Visitor;
8183                impl<'de> serde::de::Visitor<'de> for Visitor {
8184                    type Value = __FieldTag;
8185                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8186                        formatter.write_str("a field name for ListViewsRequest")
8187                    }
8188                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8189                    where
8190                        E: serde::de::Error,
8191                    {
8192                        use std::result::Result::Ok;
8193                        use std::string::ToString;
8194                        match value {
8195                            "parent" => Ok(__FieldTag::__parent),
8196                            "pageToken" => Ok(__FieldTag::__page_token),
8197                            "page_token" => Ok(__FieldTag::__page_token),
8198                            "pageSize" => Ok(__FieldTag::__page_size),
8199                            "page_size" => Ok(__FieldTag::__page_size),
8200                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8201                        }
8202                    }
8203                }
8204                deserializer.deserialize_identifier(Visitor)
8205            }
8206        }
8207        struct Visitor;
8208        impl<'de> serde::de::Visitor<'de> for Visitor {
8209            type Value = ListViewsRequest;
8210            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8211                formatter.write_str("struct ListViewsRequest")
8212            }
8213            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8214            where
8215                A: serde::de::MapAccess<'de>,
8216            {
8217                #[allow(unused_imports)]
8218                use serde::de::Error;
8219                use std::option::Option::Some;
8220                let mut fields = std::collections::HashSet::new();
8221                let mut result = Self::Value::new();
8222                while let Some(tag) = map.next_key::<__FieldTag>()? {
8223                    #[allow(clippy::match_single_binding)]
8224                    match tag {
8225                        __FieldTag::__parent => {
8226                            if !fields.insert(__FieldTag::__parent) {
8227                                return std::result::Result::Err(A::Error::duplicate_field(
8228                                    "multiple values for parent",
8229                                ));
8230                            }
8231                            result.parent = map
8232                                .next_value::<std::option::Option<std::string::String>>()?
8233                                .unwrap_or_default();
8234                        }
8235                        __FieldTag::__page_token => {
8236                            if !fields.insert(__FieldTag::__page_token) {
8237                                return std::result::Result::Err(A::Error::duplicate_field(
8238                                    "multiple values for page_token",
8239                                ));
8240                            }
8241                            result.page_token = map
8242                                .next_value::<std::option::Option<std::string::String>>()?
8243                                .unwrap_or_default();
8244                        }
8245                        __FieldTag::__page_size => {
8246                            if !fields.insert(__FieldTag::__page_size) {
8247                                return std::result::Result::Err(A::Error::duplicate_field(
8248                                    "multiple values for page_size",
8249                                ));
8250                            }
8251                            struct __With(std::option::Option<i32>);
8252                            impl<'de> serde::de::Deserialize<'de> for __With {
8253                                fn deserialize<D>(
8254                                    deserializer: D,
8255                                ) -> std::result::Result<Self, D::Error>
8256                                where
8257                                    D: serde::de::Deserializer<'de>,
8258                                {
8259                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
8260                                }
8261                            }
8262                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
8263                        }
8264                        __FieldTag::Unknown(key) => {
8265                            let value = map.next_value::<serde_json::Value>()?;
8266                            result._unknown_fields.insert(key, value);
8267                        }
8268                    }
8269                }
8270                std::result::Result::Ok(result)
8271            }
8272        }
8273        deserializer.deserialize_any(Visitor)
8274    }
8275}
8276
8277#[doc(hidden)]
8278impl serde::ser::Serialize for ListViewsRequest {
8279    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8280    where
8281        S: serde::ser::Serializer,
8282    {
8283        use serde::ser::SerializeMap;
8284        #[allow(unused_imports)]
8285        use std::option::Option::Some;
8286        let mut state = serializer.serialize_map(std::option::Option::None)?;
8287        if !self.parent.is_empty() {
8288            state.serialize_entry("parent", &self.parent)?;
8289        }
8290        if !self.page_token.is_empty() {
8291            state.serialize_entry("pageToken", &self.page_token)?;
8292        }
8293        if !wkt::internal::is_default(&self.page_size) {
8294            struct __With<'a>(&'a i32);
8295            impl<'a> serde::ser::Serialize for __With<'a> {
8296                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8297                where
8298                    S: serde::ser::Serializer,
8299                {
8300                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
8301                }
8302            }
8303            state.serialize_entry("pageSize", &__With(&self.page_size))?;
8304        }
8305        if !self._unknown_fields.is_empty() {
8306            for (key, value) in self._unknown_fields.iter() {
8307                state.serialize_entry(key, &value)?;
8308            }
8309        }
8310        state.end()
8311    }
8312}
8313
8314impl std::fmt::Debug for ListViewsRequest {
8315    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8316        let mut debug_struct = f.debug_struct("ListViewsRequest");
8317        debug_struct.field("parent", &self.parent);
8318        debug_struct.field("page_token", &self.page_token);
8319        debug_struct.field("page_size", &self.page_size);
8320        if !self._unknown_fields.is_empty() {
8321            debug_struct.field("_unknown_fields", &self._unknown_fields);
8322        }
8323        debug_struct.finish()
8324    }
8325}
8326
8327/// The response from ListViews.
8328#[derive(Clone, Default, PartialEq)]
8329#[non_exhaustive]
8330pub struct ListViewsResponse {
8331    /// A list of views.
8332    pub views: std::vec::Vec<crate::model::LogView>,
8333
8334    /// If there might be more results than appear in this response, then
8335    /// `nextPageToken` is included. To get the next set of results, call the same
8336    /// method again using the value of `nextPageToken` as `pageToken`.
8337    pub next_page_token: std::string::String,
8338
8339    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8340}
8341
8342impl ListViewsResponse {
8343    pub fn new() -> Self {
8344        std::default::Default::default()
8345    }
8346
8347    /// Sets the value of [views][crate::model::ListViewsResponse::views].
8348    pub fn set_views<T, V>(mut self, v: T) -> Self
8349    where
8350        T: std::iter::IntoIterator<Item = V>,
8351        V: std::convert::Into<crate::model::LogView>,
8352    {
8353        use std::iter::Iterator;
8354        self.views = v.into_iter().map(|i| i.into()).collect();
8355        self
8356    }
8357
8358    /// Sets the value of [next_page_token][crate::model::ListViewsResponse::next_page_token].
8359    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8360        self.next_page_token = v.into();
8361        self
8362    }
8363}
8364
8365impl wkt::message::Message for ListViewsResponse {
8366    fn typename() -> &'static str {
8367        "type.googleapis.com/google.logging.v2.ListViewsResponse"
8368    }
8369}
8370
8371#[doc(hidden)]
8372impl gax::paginator::internal::PageableResponse for ListViewsResponse {
8373    type PageItem = crate::model::LogView;
8374
8375    fn items(self) -> std::vec::Vec<Self::PageItem> {
8376        self.views
8377    }
8378
8379    fn next_page_token(&self) -> std::string::String {
8380        use std::clone::Clone;
8381        self.next_page_token.clone()
8382    }
8383}
8384
8385#[doc(hidden)]
8386impl<'de> serde::de::Deserialize<'de> for ListViewsResponse {
8387    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8388    where
8389        D: serde::Deserializer<'de>,
8390    {
8391        #[allow(non_camel_case_types)]
8392        #[doc(hidden)]
8393        #[derive(PartialEq, Eq, Hash)]
8394        enum __FieldTag {
8395            __views,
8396            __next_page_token,
8397            Unknown(std::string::String),
8398        }
8399        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8400            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8401            where
8402                D: serde::Deserializer<'de>,
8403            {
8404                struct Visitor;
8405                impl<'de> serde::de::Visitor<'de> for Visitor {
8406                    type Value = __FieldTag;
8407                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8408                        formatter.write_str("a field name for ListViewsResponse")
8409                    }
8410                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8411                    where
8412                        E: serde::de::Error,
8413                    {
8414                        use std::result::Result::Ok;
8415                        use std::string::ToString;
8416                        match value {
8417                            "views" => Ok(__FieldTag::__views),
8418                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
8419                            "next_page_token" => Ok(__FieldTag::__next_page_token),
8420                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8421                        }
8422                    }
8423                }
8424                deserializer.deserialize_identifier(Visitor)
8425            }
8426        }
8427        struct Visitor;
8428        impl<'de> serde::de::Visitor<'de> for Visitor {
8429            type Value = ListViewsResponse;
8430            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8431                formatter.write_str("struct ListViewsResponse")
8432            }
8433            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8434            where
8435                A: serde::de::MapAccess<'de>,
8436            {
8437                #[allow(unused_imports)]
8438                use serde::de::Error;
8439                use std::option::Option::Some;
8440                let mut fields = std::collections::HashSet::new();
8441                let mut result = Self::Value::new();
8442                while let Some(tag) = map.next_key::<__FieldTag>()? {
8443                    #[allow(clippy::match_single_binding)]
8444                    match tag {
8445                        __FieldTag::__views => {
8446                            if !fields.insert(__FieldTag::__views) {
8447                                return std::result::Result::Err(A::Error::duplicate_field(
8448                                    "multiple values for views",
8449                                ));
8450                            }
8451                            result.views = map.next_value::<std::option::Option<std::vec::Vec<crate::model::LogView>>>()?.unwrap_or_default();
8452                        }
8453                        __FieldTag::__next_page_token => {
8454                            if !fields.insert(__FieldTag::__next_page_token) {
8455                                return std::result::Result::Err(A::Error::duplicate_field(
8456                                    "multiple values for next_page_token",
8457                                ));
8458                            }
8459                            result.next_page_token = map
8460                                .next_value::<std::option::Option<std::string::String>>()?
8461                                .unwrap_or_default();
8462                        }
8463                        __FieldTag::Unknown(key) => {
8464                            let value = map.next_value::<serde_json::Value>()?;
8465                            result._unknown_fields.insert(key, value);
8466                        }
8467                    }
8468                }
8469                std::result::Result::Ok(result)
8470            }
8471        }
8472        deserializer.deserialize_any(Visitor)
8473    }
8474}
8475
8476#[doc(hidden)]
8477impl serde::ser::Serialize for ListViewsResponse {
8478    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8479    where
8480        S: serde::ser::Serializer,
8481    {
8482        use serde::ser::SerializeMap;
8483        #[allow(unused_imports)]
8484        use std::option::Option::Some;
8485        let mut state = serializer.serialize_map(std::option::Option::None)?;
8486        if !self.views.is_empty() {
8487            state.serialize_entry("views", &self.views)?;
8488        }
8489        if !self.next_page_token.is_empty() {
8490            state.serialize_entry("nextPageToken", &self.next_page_token)?;
8491        }
8492        if !self._unknown_fields.is_empty() {
8493            for (key, value) in self._unknown_fields.iter() {
8494                state.serialize_entry(key, &value)?;
8495            }
8496        }
8497        state.end()
8498    }
8499}
8500
8501impl std::fmt::Debug for ListViewsResponse {
8502    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8503        let mut debug_struct = f.debug_struct("ListViewsResponse");
8504        debug_struct.field("views", &self.views);
8505        debug_struct.field("next_page_token", &self.next_page_token);
8506        if !self._unknown_fields.is_empty() {
8507            debug_struct.field("_unknown_fields", &self._unknown_fields);
8508        }
8509        debug_struct.finish()
8510    }
8511}
8512
8513/// The parameters to `CreateView`.
8514#[derive(Clone, Default, PartialEq)]
8515#[non_exhaustive]
8516pub struct CreateViewRequest {
8517    /// Required. The bucket in which to create the view
8518    ///
8519    /// ```norust
8520    /// `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"`
8521    /// ```
8522    ///
8523    /// For example:
8524    ///
8525    /// `"projects/my-project/locations/global/buckets/my-bucket"`
8526    pub parent: std::string::String,
8527
8528    /// Required. A client-assigned identifier such as `"my-view"`. Identifiers are
8529    /// limited to 100 characters and can include only letters, digits,
8530    /// underscores, hyphens, and periods.
8531    pub view_id: std::string::String,
8532
8533    /// Required. The new view.
8534    pub view: std::option::Option<crate::model::LogView>,
8535
8536    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8537}
8538
8539impl CreateViewRequest {
8540    pub fn new() -> Self {
8541        std::default::Default::default()
8542    }
8543
8544    /// Sets the value of [parent][crate::model::CreateViewRequest::parent].
8545    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8546        self.parent = v.into();
8547        self
8548    }
8549
8550    /// Sets the value of [view_id][crate::model::CreateViewRequest::view_id].
8551    pub fn set_view_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8552        self.view_id = v.into();
8553        self
8554    }
8555
8556    /// Sets the value of [view][crate::model::CreateViewRequest::view].
8557    pub fn set_view<T>(mut self, v: T) -> Self
8558    where
8559        T: std::convert::Into<crate::model::LogView>,
8560    {
8561        self.view = std::option::Option::Some(v.into());
8562        self
8563    }
8564
8565    /// Sets or clears the value of [view][crate::model::CreateViewRequest::view].
8566    pub fn set_or_clear_view<T>(mut self, v: std::option::Option<T>) -> Self
8567    where
8568        T: std::convert::Into<crate::model::LogView>,
8569    {
8570        self.view = v.map(|x| x.into());
8571        self
8572    }
8573}
8574
8575impl wkt::message::Message for CreateViewRequest {
8576    fn typename() -> &'static str {
8577        "type.googleapis.com/google.logging.v2.CreateViewRequest"
8578    }
8579}
8580
8581#[doc(hidden)]
8582impl<'de> serde::de::Deserialize<'de> for CreateViewRequest {
8583    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8584    where
8585        D: serde::Deserializer<'de>,
8586    {
8587        #[allow(non_camel_case_types)]
8588        #[doc(hidden)]
8589        #[derive(PartialEq, Eq, Hash)]
8590        enum __FieldTag {
8591            __parent,
8592            __view_id,
8593            __view,
8594            Unknown(std::string::String),
8595        }
8596        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8597            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8598            where
8599                D: serde::Deserializer<'de>,
8600            {
8601                struct Visitor;
8602                impl<'de> serde::de::Visitor<'de> for Visitor {
8603                    type Value = __FieldTag;
8604                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8605                        formatter.write_str("a field name for CreateViewRequest")
8606                    }
8607                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8608                    where
8609                        E: serde::de::Error,
8610                    {
8611                        use std::result::Result::Ok;
8612                        use std::string::ToString;
8613                        match value {
8614                            "parent" => Ok(__FieldTag::__parent),
8615                            "viewId" => Ok(__FieldTag::__view_id),
8616                            "view_id" => Ok(__FieldTag::__view_id),
8617                            "view" => Ok(__FieldTag::__view),
8618                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8619                        }
8620                    }
8621                }
8622                deserializer.deserialize_identifier(Visitor)
8623            }
8624        }
8625        struct Visitor;
8626        impl<'de> serde::de::Visitor<'de> for Visitor {
8627            type Value = CreateViewRequest;
8628            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8629                formatter.write_str("struct CreateViewRequest")
8630            }
8631            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8632            where
8633                A: serde::de::MapAccess<'de>,
8634            {
8635                #[allow(unused_imports)]
8636                use serde::de::Error;
8637                use std::option::Option::Some;
8638                let mut fields = std::collections::HashSet::new();
8639                let mut result = Self::Value::new();
8640                while let Some(tag) = map.next_key::<__FieldTag>()? {
8641                    #[allow(clippy::match_single_binding)]
8642                    match tag {
8643                        __FieldTag::__parent => {
8644                            if !fields.insert(__FieldTag::__parent) {
8645                                return std::result::Result::Err(A::Error::duplicate_field(
8646                                    "multiple values for parent",
8647                                ));
8648                            }
8649                            result.parent = map
8650                                .next_value::<std::option::Option<std::string::String>>()?
8651                                .unwrap_or_default();
8652                        }
8653                        __FieldTag::__view_id => {
8654                            if !fields.insert(__FieldTag::__view_id) {
8655                                return std::result::Result::Err(A::Error::duplicate_field(
8656                                    "multiple values for view_id",
8657                                ));
8658                            }
8659                            result.view_id = map
8660                                .next_value::<std::option::Option<std::string::String>>()?
8661                                .unwrap_or_default();
8662                        }
8663                        __FieldTag::__view => {
8664                            if !fields.insert(__FieldTag::__view) {
8665                                return std::result::Result::Err(A::Error::duplicate_field(
8666                                    "multiple values for view",
8667                                ));
8668                            }
8669                            result.view =
8670                                map.next_value::<std::option::Option<crate::model::LogView>>()?;
8671                        }
8672                        __FieldTag::Unknown(key) => {
8673                            let value = map.next_value::<serde_json::Value>()?;
8674                            result._unknown_fields.insert(key, value);
8675                        }
8676                    }
8677                }
8678                std::result::Result::Ok(result)
8679            }
8680        }
8681        deserializer.deserialize_any(Visitor)
8682    }
8683}
8684
8685#[doc(hidden)]
8686impl serde::ser::Serialize for CreateViewRequest {
8687    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8688    where
8689        S: serde::ser::Serializer,
8690    {
8691        use serde::ser::SerializeMap;
8692        #[allow(unused_imports)]
8693        use std::option::Option::Some;
8694        let mut state = serializer.serialize_map(std::option::Option::None)?;
8695        if !self.parent.is_empty() {
8696            state.serialize_entry("parent", &self.parent)?;
8697        }
8698        if !self.view_id.is_empty() {
8699            state.serialize_entry("viewId", &self.view_id)?;
8700        }
8701        if self.view.is_some() {
8702            state.serialize_entry("view", &self.view)?;
8703        }
8704        if !self._unknown_fields.is_empty() {
8705            for (key, value) in self._unknown_fields.iter() {
8706                state.serialize_entry(key, &value)?;
8707            }
8708        }
8709        state.end()
8710    }
8711}
8712
8713impl std::fmt::Debug for CreateViewRequest {
8714    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8715        let mut debug_struct = f.debug_struct("CreateViewRequest");
8716        debug_struct.field("parent", &self.parent);
8717        debug_struct.field("view_id", &self.view_id);
8718        debug_struct.field("view", &self.view);
8719        if !self._unknown_fields.is_empty() {
8720            debug_struct.field("_unknown_fields", &self._unknown_fields);
8721        }
8722        debug_struct.finish()
8723    }
8724}
8725
8726/// The parameters to `UpdateView`.
8727#[derive(Clone, Default, PartialEq)]
8728#[non_exhaustive]
8729pub struct UpdateViewRequest {
8730    /// Required. The full resource name of the view to update
8731    ///
8732    /// ```norust
8733    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
8734    /// ```
8735    ///
8736    /// For example:
8737    ///
8738    /// `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
8739    pub name: std::string::String,
8740
8741    /// Required. The updated view.
8742    pub view: std::option::Option<crate::model::LogView>,
8743
8744    /// Optional. Field mask that specifies the fields in `view` that need
8745    /// an update. A field will be overwritten if, and only if, it is
8746    /// in the update mask. `name` and output only fields cannot be updated.
8747    ///
8748    /// For a detailed `FieldMask` definition, see
8749    /// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask>
8750    ///
8751    /// For example: `updateMask=filter`
8752    pub update_mask: std::option::Option<wkt::FieldMask>,
8753
8754    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8755}
8756
8757impl UpdateViewRequest {
8758    pub fn new() -> Self {
8759        std::default::Default::default()
8760    }
8761
8762    /// Sets the value of [name][crate::model::UpdateViewRequest::name].
8763    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8764        self.name = v.into();
8765        self
8766    }
8767
8768    /// Sets the value of [view][crate::model::UpdateViewRequest::view].
8769    pub fn set_view<T>(mut self, v: T) -> Self
8770    where
8771        T: std::convert::Into<crate::model::LogView>,
8772    {
8773        self.view = std::option::Option::Some(v.into());
8774        self
8775    }
8776
8777    /// Sets or clears the value of [view][crate::model::UpdateViewRequest::view].
8778    pub fn set_or_clear_view<T>(mut self, v: std::option::Option<T>) -> Self
8779    where
8780        T: std::convert::Into<crate::model::LogView>,
8781    {
8782        self.view = v.map(|x| x.into());
8783        self
8784    }
8785
8786    /// Sets the value of [update_mask][crate::model::UpdateViewRequest::update_mask].
8787    pub fn set_update_mask<T>(mut self, v: T) -> Self
8788    where
8789        T: std::convert::Into<wkt::FieldMask>,
8790    {
8791        self.update_mask = std::option::Option::Some(v.into());
8792        self
8793    }
8794
8795    /// Sets or clears the value of [update_mask][crate::model::UpdateViewRequest::update_mask].
8796    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8797    where
8798        T: std::convert::Into<wkt::FieldMask>,
8799    {
8800        self.update_mask = v.map(|x| x.into());
8801        self
8802    }
8803}
8804
8805impl wkt::message::Message for UpdateViewRequest {
8806    fn typename() -> &'static str {
8807        "type.googleapis.com/google.logging.v2.UpdateViewRequest"
8808    }
8809}
8810
8811#[doc(hidden)]
8812impl<'de> serde::de::Deserialize<'de> for UpdateViewRequest {
8813    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8814    where
8815        D: serde::Deserializer<'de>,
8816    {
8817        #[allow(non_camel_case_types)]
8818        #[doc(hidden)]
8819        #[derive(PartialEq, Eq, Hash)]
8820        enum __FieldTag {
8821            __name,
8822            __view,
8823            __update_mask,
8824            Unknown(std::string::String),
8825        }
8826        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8827            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8828            where
8829                D: serde::Deserializer<'de>,
8830            {
8831                struct Visitor;
8832                impl<'de> serde::de::Visitor<'de> for Visitor {
8833                    type Value = __FieldTag;
8834                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8835                        formatter.write_str("a field name for UpdateViewRequest")
8836                    }
8837                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8838                    where
8839                        E: serde::de::Error,
8840                    {
8841                        use std::result::Result::Ok;
8842                        use std::string::ToString;
8843                        match value {
8844                            "name" => Ok(__FieldTag::__name),
8845                            "view" => Ok(__FieldTag::__view),
8846                            "updateMask" => Ok(__FieldTag::__update_mask),
8847                            "update_mask" => Ok(__FieldTag::__update_mask),
8848                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8849                        }
8850                    }
8851                }
8852                deserializer.deserialize_identifier(Visitor)
8853            }
8854        }
8855        struct Visitor;
8856        impl<'de> serde::de::Visitor<'de> for Visitor {
8857            type Value = UpdateViewRequest;
8858            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8859                formatter.write_str("struct UpdateViewRequest")
8860            }
8861            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8862            where
8863                A: serde::de::MapAccess<'de>,
8864            {
8865                #[allow(unused_imports)]
8866                use serde::de::Error;
8867                use std::option::Option::Some;
8868                let mut fields = std::collections::HashSet::new();
8869                let mut result = Self::Value::new();
8870                while let Some(tag) = map.next_key::<__FieldTag>()? {
8871                    #[allow(clippy::match_single_binding)]
8872                    match tag {
8873                        __FieldTag::__name => {
8874                            if !fields.insert(__FieldTag::__name) {
8875                                return std::result::Result::Err(A::Error::duplicate_field(
8876                                    "multiple values for name",
8877                                ));
8878                            }
8879                            result.name = map
8880                                .next_value::<std::option::Option<std::string::String>>()?
8881                                .unwrap_or_default();
8882                        }
8883                        __FieldTag::__view => {
8884                            if !fields.insert(__FieldTag::__view) {
8885                                return std::result::Result::Err(A::Error::duplicate_field(
8886                                    "multiple values for view",
8887                                ));
8888                            }
8889                            result.view =
8890                                map.next_value::<std::option::Option<crate::model::LogView>>()?;
8891                        }
8892                        __FieldTag::__update_mask => {
8893                            if !fields.insert(__FieldTag::__update_mask) {
8894                                return std::result::Result::Err(A::Error::duplicate_field(
8895                                    "multiple values for update_mask",
8896                                ));
8897                            }
8898                            result.update_mask =
8899                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
8900                        }
8901                        __FieldTag::Unknown(key) => {
8902                            let value = map.next_value::<serde_json::Value>()?;
8903                            result._unknown_fields.insert(key, value);
8904                        }
8905                    }
8906                }
8907                std::result::Result::Ok(result)
8908            }
8909        }
8910        deserializer.deserialize_any(Visitor)
8911    }
8912}
8913
8914#[doc(hidden)]
8915impl serde::ser::Serialize for UpdateViewRequest {
8916    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8917    where
8918        S: serde::ser::Serializer,
8919    {
8920        use serde::ser::SerializeMap;
8921        #[allow(unused_imports)]
8922        use std::option::Option::Some;
8923        let mut state = serializer.serialize_map(std::option::Option::None)?;
8924        if !self.name.is_empty() {
8925            state.serialize_entry("name", &self.name)?;
8926        }
8927        if self.view.is_some() {
8928            state.serialize_entry("view", &self.view)?;
8929        }
8930        if self.update_mask.is_some() {
8931            state.serialize_entry("updateMask", &self.update_mask)?;
8932        }
8933        if !self._unknown_fields.is_empty() {
8934            for (key, value) in self._unknown_fields.iter() {
8935                state.serialize_entry(key, &value)?;
8936            }
8937        }
8938        state.end()
8939    }
8940}
8941
8942impl std::fmt::Debug for UpdateViewRequest {
8943    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8944        let mut debug_struct = f.debug_struct("UpdateViewRequest");
8945        debug_struct.field("name", &self.name);
8946        debug_struct.field("view", &self.view);
8947        debug_struct.field("update_mask", &self.update_mask);
8948        if !self._unknown_fields.is_empty() {
8949            debug_struct.field("_unknown_fields", &self._unknown_fields);
8950        }
8951        debug_struct.finish()
8952    }
8953}
8954
8955/// The parameters to `GetView`.
8956#[derive(Clone, Default, PartialEq)]
8957#[non_exhaustive]
8958pub struct GetViewRequest {
8959    /// Required. The resource name of the policy:
8960    ///
8961    /// ```norust
8962    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
8963    /// ```
8964    ///
8965    /// For example:
8966    ///
8967    /// `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
8968    pub name: std::string::String,
8969
8970    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8971}
8972
8973impl GetViewRequest {
8974    pub fn new() -> Self {
8975        std::default::Default::default()
8976    }
8977
8978    /// Sets the value of [name][crate::model::GetViewRequest::name].
8979    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8980        self.name = v.into();
8981        self
8982    }
8983}
8984
8985impl wkt::message::Message for GetViewRequest {
8986    fn typename() -> &'static str {
8987        "type.googleapis.com/google.logging.v2.GetViewRequest"
8988    }
8989}
8990
8991#[doc(hidden)]
8992impl<'de> serde::de::Deserialize<'de> for GetViewRequest {
8993    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8994    where
8995        D: serde::Deserializer<'de>,
8996    {
8997        #[allow(non_camel_case_types)]
8998        #[doc(hidden)]
8999        #[derive(PartialEq, Eq, Hash)]
9000        enum __FieldTag {
9001            __name,
9002            Unknown(std::string::String),
9003        }
9004        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9005            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9006            where
9007                D: serde::Deserializer<'de>,
9008            {
9009                struct Visitor;
9010                impl<'de> serde::de::Visitor<'de> for Visitor {
9011                    type Value = __FieldTag;
9012                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9013                        formatter.write_str("a field name for GetViewRequest")
9014                    }
9015                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9016                    where
9017                        E: serde::de::Error,
9018                    {
9019                        use std::result::Result::Ok;
9020                        use std::string::ToString;
9021                        match value {
9022                            "name" => Ok(__FieldTag::__name),
9023                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9024                        }
9025                    }
9026                }
9027                deserializer.deserialize_identifier(Visitor)
9028            }
9029        }
9030        struct Visitor;
9031        impl<'de> serde::de::Visitor<'de> for Visitor {
9032            type Value = GetViewRequest;
9033            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9034                formatter.write_str("struct GetViewRequest")
9035            }
9036            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9037            where
9038                A: serde::de::MapAccess<'de>,
9039            {
9040                #[allow(unused_imports)]
9041                use serde::de::Error;
9042                use std::option::Option::Some;
9043                let mut fields = std::collections::HashSet::new();
9044                let mut result = Self::Value::new();
9045                while let Some(tag) = map.next_key::<__FieldTag>()? {
9046                    #[allow(clippy::match_single_binding)]
9047                    match tag {
9048                        __FieldTag::__name => {
9049                            if !fields.insert(__FieldTag::__name) {
9050                                return std::result::Result::Err(A::Error::duplicate_field(
9051                                    "multiple values for name",
9052                                ));
9053                            }
9054                            result.name = map
9055                                .next_value::<std::option::Option<std::string::String>>()?
9056                                .unwrap_or_default();
9057                        }
9058                        __FieldTag::Unknown(key) => {
9059                            let value = map.next_value::<serde_json::Value>()?;
9060                            result._unknown_fields.insert(key, value);
9061                        }
9062                    }
9063                }
9064                std::result::Result::Ok(result)
9065            }
9066        }
9067        deserializer.deserialize_any(Visitor)
9068    }
9069}
9070
9071#[doc(hidden)]
9072impl serde::ser::Serialize for GetViewRequest {
9073    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9074    where
9075        S: serde::ser::Serializer,
9076    {
9077        use serde::ser::SerializeMap;
9078        #[allow(unused_imports)]
9079        use std::option::Option::Some;
9080        let mut state = serializer.serialize_map(std::option::Option::None)?;
9081        if !self.name.is_empty() {
9082            state.serialize_entry("name", &self.name)?;
9083        }
9084        if !self._unknown_fields.is_empty() {
9085            for (key, value) in self._unknown_fields.iter() {
9086                state.serialize_entry(key, &value)?;
9087            }
9088        }
9089        state.end()
9090    }
9091}
9092
9093impl std::fmt::Debug for GetViewRequest {
9094    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9095        let mut debug_struct = f.debug_struct("GetViewRequest");
9096        debug_struct.field("name", &self.name);
9097        if !self._unknown_fields.is_empty() {
9098            debug_struct.field("_unknown_fields", &self._unknown_fields);
9099        }
9100        debug_struct.finish()
9101    }
9102}
9103
9104/// The parameters to `DeleteView`.
9105#[derive(Clone, Default, PartialEq)]
9106#[non_exhaustive]
9107pub struct DeleteViewRequest {
9108    /// Required. The full resource name of the view to delete:
9109    ///
9110    /// ```norust
9111    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
9112    /// ```
9113    ///
9114    /// For example:
9115    ///
9116    /// `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
9117    pub name: std::string::String,
9118
9119    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9120}
9121
9122impl DeleteViewRequest {
9123    pub fn new() -> Self {
9124        std::default::Default::default()
9125    }
9126
9127    /// Sets the value of [name][crate::model::DeleteViewRequest::name].
9128    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9129        self.name = v.into();
9130        self
9131    }
9132}
9133
9134impl wkt::message::Message for DeleteViewRequest {
9135    fn typename() -> &'static str {
9136        "type.googleapis.com/google.logging.v2.DeleteViewRequest"
9137    }
9138}
9139
9140#[doc(hidden)]
9141impl<'de> serde::de::Deserialize<'de> for DeleteViewRequest {
9142    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9143    where
9144        D: serde::Deserializer<'de>,
9145    {
9146        #[allow(non_camel_case_types)]
9147        #[doc(hidden)]
9148        #[derive(PartialEq, Eq, Hash)]
9149        enum __FieldTag {
9150            __name,
9151            Unknown(std::string::String),
9152        }
9153        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9154            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9155            where
9156                D: serde::Deserializer<'de>,
9157            {
9158                struct Visitor;
9159                impl<'de> serde::de::Visitor<'de> for Visitor {
9160                    type Value = __FieldTag;
9161                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9162                        formatter.write_str("a field name for DeleteViewRequest")
9163                    }
9164                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9165                    where
9166                        E: serde::de::Error,
9167                    {
9168                        use std::result::Result::Ok;
9169                        use std::string::ToString;
9170                        match value {
9171                            "name" => Ok(__FieldTag::__name),
9172                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9173                        }
9174                    }
9175                }
9176                deserializer.deserialize_identifier(Visitor)
9177            }
9178        }
9179        struct Visitor;
9180        impl<'de> serde::de::Visitor<'de> for Visitor {
9181            type Value = DeleteViewRequest;
9182            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9183                formatter.write_str("struct DeleteViewRequest")
9184            }
9185            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9186            where
9187                A: serde::de::MapAccess<'de>,
9188            {
9189                #[allow(unused_imports)]
9190                use serde::de::Error;
9191                use std::option::Option::Some;
9192                let mut fields = std::collections::HashSet::new();
9193                let mut result = Self::Value::new();
9194                while let Some(tag) = map.next_key::<__FieldTag>()? {
9195                    #[allow(clippy::match_single_binding)]
9196                    match tag {
9197                        __FieldTag::__name => {
9198                            if !fields.insert(__FieldTag::__name) {
9199                                return std::result::Result::Err(A::Error::duplicate_field(
9200                                    "multiple values for name",
9201                                ));
9202                            }
9203                            result.name = map
9204                                .next_value::<std::option::Option<std::string::String>>()?
9205                                .unwrap_or_default();
9206                        }
9207                        __FieldTag::Unknown(key) => {
9208                            let value = map.next_value::<serde_json::Value>()?;
9209                            result._unknown_fields.insert(key, value);
9210                        }
9211                    }
9212                }
9213                std::result::Result::Ok(result)
9214            }
9215        }
9216        deserializer.deserialize_any(Visitor)
9217    }
9218}
9219
9220#[doc(hidden)]
9221impl serde::ser::Serialize for DeleteViewRequest {
9222    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9223    where
9224        S: serde::ser::Serializer,
9225    {
9226        use serde::ser::SerializeMap;
9227        #[allow(unused_imports)]
9228        use std::option::Option::Some;
9229        let mut state = serializer.serialize_map(std::option::Option::None)?;
9230        if !self.name.is_empty() {
9231            state.serialize_entry("name", &self.name)?;
9232        }
9233        if !self._unknown_fields.is_empty() {
9234            for (key, value) in self._unknown_fields.iter() {
9235                state.serialize_entry(key, &value)?;
9236            }
9237        }
9238        state.end()
9239    }
9240}
9241
9242impl std::fmt::Debug for DeleteViewRequest {
9243    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9244        let mut debug_struct = f.debug_struct("DeleteViewRequest");
9245        debug_struct.field("name", &self.name);
9246        if !self._unknown_fields.is_empty() {
9247            debug_struct.field("_unknown_fields", &self._unknown_fields);
9248        }
9249        debug_struct.finish()
9250    }
9251}
9252
9253/// The parameters to `ListSinks`.
9254#[derive(Clone, Default, PartialEq)]
9255#[non_exhaustive]
9256pub struct ListSinksRequest {
9257    /// Required. The parent resource whose sinks are to be listed:
9258    ///
9259    /// ```norust
9260    /// "projects/[PROJECT_ID]"
9261    /// "organizations/[ORGANIZATION_ID]"
9262    /// "billingAccounts/[BILLING_ACCOUNT_ID]"
9263    /// "folders/[FOLDER_ID]"
9264    /// ```
9265    pub parent: std::string::String,
9266
9267    /// Optional. If present, then retrieve the next batch of results from the
9268    /// preceding call to this method. `pageToken` must be the value of
9269    /// `nextPageToken` from the previous response. The values of other method
9270    /// parameters should be identical to those in the previous call.
9271    pub page_token: std::string::String,
9272
9273    /// Optional. The maximum number of results to return from this request.
9274    /// Non-positive values are ignored. The presence of `nextPageToken` in the
9275    /// response indicates that more results might be available.
9276    pub page_size: i32,
9277
9278    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9279}
9280
9281impl ListSinksRequest {
9282    pub fn new() -> Self {
9283        std::default::Default::default()
9284    }
9285
9286    /// Sets the value of [parent][crate::model::ListSinksRequest::parent].
9287    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9288        self.parent = v.into();
9289        self
9290    }
9291
9292    /// Sets the value of [page_token][crate::model::ListSinksRequest::page_token].
9293    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9294        self.page_token = v.into();
9295        self
9296    }
9297
9298    /// Sets the value of [page_size][crate::model::ListSinksRequest::page_size].
9299    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9300        self.page_size = v.into();
9301        self
9302    }
9303}
9304
9305impl wkt::message::Message for ListSinksRequest {
9306    fn typename() -> &'static str {
9307        "type.googleapis.com/google.logging.v2.ListSinksRequest"
9308    }
9309}
9310
9311#[doc(hidden)]
9312impl<'de> serde::de::Deserialize<'de> for ListSinksRequest {
9313    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9314    where
9315        D: serde::Deserializer<'de>,
9316    {
9317        #[allow(non_camel_case_types)]
9318        #[doc(hidden)]
9319        #[derive(PartialEq, Eq, Hash)]
9320        enum __FieldTag {
9321            __parent,
9322            __page_token,
9323            __page_size,
9324            Unknown(std::string::String),
9325        }
9326        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9327            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9328            where
9329                D: serde::Deserializer<'de>,
9330            {
9331                struct Visitor;
9332                impl<'de> serde::de::Visitor<'de> for Visitor {
9333                    type Value = __FieldTag;
9334                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9335                        formatter.write_str("a field name for ListSinksRequest")
9336                    }
9337                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9338                    where
9339                        E: serde::de::Error,
9340                    {
9341                        use std::result::Result::Ok;
9342                        use std::string::ToString;
9343                        match value {
9344                            "parent" => Ok(__FieldTag::__parent),
9345                            "pageToken" => Ok(__FieldTag::__page_token),
9346                            "page_token" => Ok(__FieldTag::__page_token),
9347                            "pageSize" => Ok(__FieldTag::__page_size),
9348                            "page_size" => Ok(__FieldTag::__page_size),
9349                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9350                        }
9351                    }
9352                }
9353                deserializer.deserialize_identifier(Visitor)
9354            }
9355        }
9356        struct Visitor;
9357        impl<'de> serde::de::Visitor<'de> for Visitor {
9358            type Value = ListSinksRequest;
9359            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9360                formatter.write_str("struct ListSinksRequest")
9361            }
9362            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9363            where
9364                A: serde::de::MapAccess<'de>,
9365            {
9366                #[allow(unused_imports)]
9367                use serde::de::Error;
9368                use std::option::Option::Some;
9369                let mut fields = std::collections::HashSet::new();
9370                let mut result = Self::Value::new();
9371                while let Some(tag) = map.next_key::<__FieldTag>()? {
9372                    #[allow(clippy::match_single_binding)]
9373                    match tag {
9374                        __FieldTag::__parent => {
9375                            if !fields.insert(__FieldTag::__parent) {
9376                                return std::result::Result::Err(A::Error::duplicate_field(
9377                                    "multiple values for parent",
9378                                ));
9379                            }
9380                            result.parent = map
9381                                .next_value::<std::option::Option<std::string::String>>()?
9382                                .unwrap_or_default();
9383                        }
9384                        __FieldTag::__page_token => {
9385                            if !fields.insert(__FieldTag::__page_token) {
9386                                return std::result::Result::Err(A::Error::duplicate_field(
9387                                    "multiple values for page_token",
9388                                ));
9389                            }
9390                            result.page_token = map
9391                                .next_value::<std::option::Option<std::string::String>>()?
9392                                .unwrap_or_default();
9393                        }
9394                        __FieldTag::__page_size => {
9395                            if !fields.insert(__FieldTag::__page_size) {
9396                                return std::result::Result::Err(A::Error::duplicate_field(
9397                                    "multiple values for page_size",
9398                                ));
9399                            }
9400                            struct __With(std::option::Option<i32>);
9401                            impl<'de> serde::de::Deserialize<'de> for __With {
9402                                fn deserialize<D>(
9403                                    deserializer: D,
9404                                ) -> std::result::Result<Self, D::Error>
9405                                where
9406                                    D: serde::de::Deserializer<'de>,
9407                                {
9408                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
9409                                }
9410                            }
9411                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
9412                        }
9413                        __FieldTag::Unknown(key) => {
9414                            let value = map.next_value::<serde_json::Value>()?;
9415                            result._unknown_fields.insert(key, value);
9416                        }
9417                    }
9418                }
9419                std::result::Result::Ok(result)
9420            }
9421        }
9422        deserializer.deserialize_any(Visitor)
9423    }
9424}
9425
9426#[doc(hidden)]
9427impl serde::ser::Serialize for ListSinksRequest {
9428    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9429    where
9430        S: serde::ser::Serializer,
9431    {
9432        use serde::ser::SerializeMap;
9433        #[allow(unused_imports)]
9434        use std::option::Option::Some;
9435        let mut state = serializer.serialize_map(std::option::Option::None)?;
9436        if !self.parent.is_empty() {
9437            state.serialize_entry("parent", &self.parent)?;
9438        }
9439        if !self.page_token.is_empty() {
9440            state.serialize_entry("pageToken", &self.page_token)?;
9441        }
9442        if !wkt::internal::is_default(&self.page_size) {
9443            struct __With<'a>(&'a i32);
9444            impl<'a> serde::ser::Serialize for __With<'a> {
9445                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9446                where
9447                    S: serde::ser::Serializer,
9448                {
9449                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
9450                }
9451            }
9452            state.serialize_entry("pageSize", &__With(&self.page_size))?;
9453        }
9454        if !self._unknown_fields.is_empty() {
9455            for (key, value) in self._unknown_fields.iter() {
9456                state.serialize_entry(key, &value)?;
9457            }
9458        }
9459        state.end()
9460    }
9461}
9462
9463impl std::fmt::Debug for ListSinksRequest {
9464    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9465        let mut debug_struct = f.debug_struct("ListSinksRequest");
9466        debug_struct.field("parent", &self.parent);
9467        debug_struct.field("page_token", &self.page_token);
9468        debug_struct.field("page_size", &self.page_size);
9469        if !self._unknown_fields.is_empty() {
9470            debug_struct.field("_unknown_fields", &self._unknown_fields);
9471        }
9472        debug_struct.finish()
9473    }
9474}
9475
9476/// Result returned from `ListSinks`.
9477#[derive(Clone, Default, PartialEq)]
9478#[non_exhaustive]
9479pub struct ListSinksResponse {
9480    /// A list of sinks.
9481    pub sinks: std::vec::Vec<crate::model::LogSink>,
9482
9483    /// If there might be more results than appear in this response, then
9484    /// `nextPageToken` is included. To get the next set of results, call the same
9485    /// method again using the value of `nextPageToken` as `pageToken`.
9486    pub next_page_token: std::string::String,
9487
9488    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9489}
9490
9491impl ListSinksResponse {
9492    pub fn new() -> Self {
9493        std::default::Default::default()
9494    }
9495
9496    /// Sets the value of [sinks][crate::model::ListSinksResponse::sinks].
9497    pub fn set_sinks<T, V>(mut self, v: T) -> Self
9498    where
9499        T: std::iter::IntoIterator<Item = V>,
9500        V: std::convert::Into<crate::model::LogSink>,
9501    {
9502        use std::iter::Iterator;
9503        self.sinks = v.into_iter().map(|i| i.into()).collect();
9504        self
9505    }
9506
9507    /// Sets the value of [next_page_token][crate::model::ListSinksResponse::next_page_token].
9508    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9509        self.next_page_token = v.into();
9510        self
9511    }
9512}
9513
9514impl wkt::message::Message for ListSinksResponse {
9515    fn typename() -> &'static str {
9516        "type.googleapis.com/google.logging.v2.ListSinksResponse"
9517    }
9518}
9519
9520#[doc(hidden)]
9521impl gax::paginator::internal::PageableResponse for ListSinksResponse {
9522    type PageItem = crate::model::LogSink;
9523
9524    fn items(self) -> std::vec::Vec<Self::PageItem> {
9525        self.sinks
9526    }
9527
9528    fn next_page_token(&self) -> std::string::String {
9529        use std::clone::Clone;
9530        self.next_page_token.clone()
9531    }
9532}
9533
9534#[doc(hidden)]
9535impl<'de> serde::de::Deserialize<'de> for ListSinksResponse {
9536    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9537    where
9538        D: serde::Deserializer<'de>,
9539    {
9540        #[allow(non_camel_case_types)]
9541        #[doc(hidden)]
9542        #[derive(PartialEq, Eq, Hash)]
9543        enum __FieldTag {
9544            __sinks,
9545            __next_page_token,
9546            Unknown(std::string::String),
9547        }
9548        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9549            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9550            where
9551                D: serde::Deserializer<'de>,
9552            {
9553                struct Visitor;
9554                impl<'de> serde::de::Visitor<'de> for Visitor {
9555                    type Value = __FieldTag;
9556                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9557                        formatter.write_str("a field name for ListSinksResponse")
9558                    }
9559                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9560                    where
9561                        E: serde::de::Error,
9562                    {
9563                        use std::result::Result::Ok;
9564                        use std::string::ToString;
9565                        match value {
9566                            "sinks" => Ok(__FieldTag::__sinks),
9567                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
9568                            "next_page_token" => Ok(__FieldTag::__next_page_token),
9569                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9570                        }
9571                    }
9572                }
9573                deserializer.deserialize_identifier(Visitor)
9574            }
9575        }
9576        struct Visitor;
9577        impl<'de> serde::de::Visitor<'de> for Visitor {
9578            type Value = ListSinksResponse;
9579            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9580                formatter.write_str("struct ListSinksResponse")
9581            }
9582            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9583            where
9584                A: serde::de::MapAccess<'de>,
9585            {
9586                #[allow(unused_imports)]
9587                use serde::de::Error;
9588                use std::option::Option::Some;
9589                let mut fields = std::collections::HashSet::new();
9590                let mut result = Self::Value::new();
9591                while let Some(tag) = map.next_key::<__FieldTag>()? {
9592                    #[allow(clippy::match_single_binding)]
9593                    match tag {
9594                        __FieldTag::__sinks => {
9595                            if !fields.insert(__FieldTag::__sinks) {
9596                                return std::result::Result::Err(A::Error::duplicate_field(
9597                                    "multiple values for sinks",
9598                                ));
9599                            }
9600                            result.sinks = map.next_value::<std::option::Option<std::vec::Vec<crate::model::LogSink>>>()?.unwrap_or_default();
9601                        }
9602                        __FieldTag::__next_page_token => {
9603                            if !fields.insert(__FieldTag::__next_page_token) {
9604                                return std::result::Result::Err(A::Error::duplicate_field(
9605                                    "multiple values for next_page_token",
9606                                ));
9607                            }
9608                            result.next_page_token = map
9609                                .next_value::<std::option::Option<std::string::String>>()?
9610                                .unwrap_or_default();
9611                        }
9612                        __FieldTag::Unknown(key) => {
9613                            let value = map.next_value::<serde_json::Value>()?;
9614                            result._unknown_fields.insert(key, value);
9615                        }
9616                    }
9617                }
9618                std::result::Result::Ok(result)
9619            }
9620        }
9621        deserializer.deserialize_any(Visitor)
9622    }
9623}
9624
9625#[doc(hidden)]
9626impl serde::ser::Serialize for ListSinksResponse {
9627    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9628    where
9629        S: serde::ser::Serializer,
9630    {
9631        use serde::ser::SerializeMap;
9632        #[allow(unused_imports)]
9633        use std::option::Option::Some;
9634        let mut state = serializer.serialize_map(std::option::Option::None)?;
9635        if !self.sinks.is_empty() {
9636            state.serialize_entry("sinks", &self.sinks)?;
9637        }
9638        if !self.next_page_token.is_empty() {
9639            state.serialize_entry("nextPageToken", &self.next_page_token)?;
9640        }
9641        if !self._unknown_fields.is_empty() {
9642            for (key, value) in self._unknown_fields.iter() {
9643                state.serialize_entry(key, &value)?;
9644            }
9645        }
9646        state.end()
9647    }
9648}
9649
9650impl std::fmt::Debug for ListSinksResponse {
9651    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9652        let mut debug_struct = f.debug_struct("ListSinksResponse");
9653        debug_struct.field("sinks", &self.sinks);
9654        debug_struct.field("next_page_token", &self.next_page_token);
9655        if !self._unknown_fields.is_empty() {
9656            debug_struct.field("_unknown_fields", &self._unknown_fields);
9657        }
9658        debug_struct.finish()
9659    }
9660}
9661
9662/// The parameters to `GetSink`.
9663#[derive(Clone, Default, PartialEq)]
9664#[non_exhaustive]
9665pub struct GetSinkRequest {
9666    /// Required. The resource name of the sink:
9667    ///
9668    /// ```norust
9669    /// "projects/[PROJECT_ID]/sinks/[SINK_ID]"
9670    /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
9671    /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
9672    /// "folders/[FOLDER_ID]/sinks/[SINK_ID]"
9673    /// ```
9674    ///
9675    /// For example:
9676    ///
9677    /// `"projects/my-project/sinks/my-sink"`
9678    pub sink_name: std::string::String,
9679
9680    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9681}
9682
9683impl GetSinkRequest {
9684    pub fn new() -> Self {
9685        std::default::Default::default()
9686    }
9687
9688    /// Sets the value of [sink_name][crate::model::GetSinkRequest::sink_name].
9689    pub fn set_sink_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9690        self.sink_name = v.into();
9691        self
9692    }
9693}
9694
9695impl wkt::message::Message for GetSinkRequest {
9696    fn typename() -> &'static str {
9697        "type.googleapis.com/google.logging.v2.GetSinkRequest"
9698    }
9699}
9700
9701#[doc(hidden)]
9702impl<'de> serde::de::Deserialize<'de> for GetSinkRequest {
9703    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9704    where
9705        D: serde::Deserializer<'de>,
9706    {
9707        #[allow(non_camel_case_types)]
9708        #[doc(hidden)]
9709        #[derive(PartialEq, Eq, Hash)]
9710        enum __FieldTag {
9711            __sink_name,
9712            Unknown(std::string::String),
9713        }
9714        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9715            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9716            where
9717                D: serde::Deserializer<'de>,
9718            {
9719                struct Visitor;
9720                impl<'de> serde::de::Visitor<'de> for Visitor {
9721                    type Value = __FieldTag;
9722                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9723                        formatter.write_str("a field name for GetSinkRequest")
9724                    }
9725                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9726                    where
9727                        E: serde::de::Error,
9728                    {
9729                        use std::result::Result::Ok;
9730                        use std::string::ToString;
9731                        match value {
9732                            "sinkName" => Ok(__FieldTag::__sink_name),
9733                            "sink_name" => Ok(__FieldTag::__sink_name),
9734                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9735                        }
9736                    }
9737                }
9738                deserializer.deserialize_identifier(Visitor)
9739            }
9740        }
9741        struct Visitor;
9742        impl<'de> serde::de::Visitor<'de> for Visitor {
9743            type Value = GetSinkRequest;
9744            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9745                formatter.write_str("struct GetSinkRequest")
9746            }
9747            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9748            where
9749                A: serde::de::MapAccess<'de>,
9750            {
9751                #[allow(unused_imports)]
9752                use serde::de::Error;
9753                use std::option::Option::Some;
9754                let mut fields = std::collections::HashSet::new();
9755                let mut result = Self::Value::new();
9756                while let Some(tag) = map.next_key::<__FieldTag>()? {
9757                    #[allow(clippy::match_single_binding)]
9758                    match tag {
9759                        __FieldTag::__sink_name => {
9760                            if !fields.insert(__FieldTag::__sink_name) {
9761                                return std::result::Result::Err(A::Error::duplicate_field(
9762                                    "multiple values for sink_name",
9763                                ));
9764                            }
9765                            result.sink_name = map
9766                                .next_value::<std::option::Option<std::string::String>>()?
9767                                .unwrap_or_default();
9768                        }
9769                        __FieldTag::Unknown(key) => {
9770                            let value = map.next_value::<serde_json::Value>()?;
9771                            result._unknown_fields.insert(key, value);
9772                        }
9773                    }
9774                }
9775                std::result::Result::Ok(result)
9776            }
9777        }
9778        deserializer.deserialize_any(Visitor)
9779    }
9780}
9781
9782#[doc(hidden)]
9783impl serde::ser::Serialize for GetSinkRequest {
9784    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9785    where
9786        S: serde::ser::Serializer,
9787    {
9788        use serde::ser::SerializeMap;
9789        #[allow(unused_imports)]
9790        use std::option::Option::Some;
9791        let mut state = serializer.serialize_map(std::option::Option::None)?;
9792        if !self.sink_name.is_empty() {
9793            state.serialize_entry("sinkName", &self.sink_name)?;
9794        }
9795        if !self._unknown_fields.is_empty() {
9796            for (key, value) in self._unknown_fields.iter() {
9797                state.serialize_entry(key, &value)?;
9798            }
9799        }
9800        state.end()
9801    }
9802}
9803
9804impl std::fmt::Debug for GetSinkRequest {
9805    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9806        let mut debug_struct = f.debug_struct("GetSinkRequest");
9807        debug_struct.field("sink_name", &self.sink_name);
9808        if !self._unknown_fields.is_empty() {
9809            debug_struct.field("_unknown_fields", &self._unknown_fields);
9810        }
9811        debug_struct.finish()
9812    }
9813}
9814
9815/// The parameters to `CreateSink`.
9816#[derive(Clone, Default, PartialEq)]
9817#[non_exhaustive]
9818pub struct CreateSinkRequest {
9819    /// Required. The resource in which to create the sink:
9820    ///
9821    /// ```norust
9822    /// "projects/[PROJECT_ID]"
9823    /// "organizations/[ORGANIZATION_ID]"
9824    /// "billingAccounts/[BILLING_ACCOUNT_ID]"
9825    /// "folders/[FOLDER_ID]"
9826    /// ```
9827    ///
9828    /// For examples:
9829    ///
9830    /// `"projects/my-project"`
9831    /// `"organizations/123456789"`
9832    pub parent: std::string::String,
9833
9834    /// Required. The new sink, whose `name` parameter is a sink identifier that
9835    /// is not already in use.
9836    pub sink: std::option::Option<crate::model::LogSink>,
9837
9838    /// Optional. Determines the kind of IAM identity returned as `writer_identity`
9839    /// in the new sink. If this value is omitted or set to false, and if the
9840    /// sink's parent is a project, then the value returned as `writer_identity` is
9841    /// the same group or service account used by Cloud Logging before the addition
9842    /// of writer identities to this API. The sink's destination must be in the
9843    /// same project as the sink itself.
9844    ///
9845    /// If this field is set to true, or if the sink is owned by a non-project
9846    /// resource such as an organization, then the value of `writer_identity` will
9847    /// be a unique service account used only for exports from the new sink. For
9848    /// more information, see `writer_identity` in
9849    /// [LogSink][google.logging.v2.LogSink].
9850    ///
9851    /// [google.logging.v2.LogSink]: crate::model::LogSink
9852    pub unique_writer_identity: bool,
9853
9854    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9855}
9856
9857impl CreateSinkRequest {
9858    pub fn new() -> Self {
9859        std::default::Default::default()
9860    }
9861
9862    /// Sets the value of [parent][crate::model::CreateSinkRequest::parent].
9863    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9864        self.parent = v.into();
9865        self
9866    }
9867
9868    /// Sets the value of [sink][crate::model::CreateSinkRequest::sink].
9869    pub fn set_sink<T>(mut self, v: T) -> Self
9870    where
9871        T: std::convert::Into<crate::model::LogSink>,
9872    {
9873        self.sink = std::option::Option::Some(v.into());
9874        self
9875    }
9876
9877    /// Sets or clears the value of [sink][crate::model::CreateSinkRequest::sink].
9878    pub fn set_or_clear_sink<T>(mut self, v: std::option::Option<T>) -> Self
9879    where
9880        T: std::convert::Into<crate::model::LogSink>,
9881    {
9882        self.sink = v.map(|x| x.into());
9883        self
9884    }
9885
9886    /// Sets the value of [unique_writer_identity][crate::model::CreateSinkRequest::unique_writer_identity].
9887    pub fn set_unique_writer_identity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9888        self.unique_writer_identity = v.into();
9889        self
9890    }
9891}
9892
9893impl wkt::message::Message for CreateSinkRequest {
9894    fn typename() -> &'static str {
9895        "type.googleapis.com/google.logging.v2.CreateSinkRequest"
9896    }
9897}
9898
9899#[doc(hidden)]
9900impl<'de> serde::de::Deserialize<'de> for CreateSinkRequest {
9901    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9902    where
9903        D: serde::Deserializer<'de>,
9904    {
9905        #[allow(non_camel_case_types)]
9906        #[doc(hidden)]
9907        #[derive(PartialEq, Eq, Hash)]
9908        enum __FieldTag {
9909            __parent,
9910            __sink,
9911            __unique_writer_identity,
9912            Unknown(std::string::String),
9913        }
9914        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9915            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9916            where
9917                D: serde::Deserializer<'de>,
9918            {
9919                struct Visitor;
9920                impl<'de> serde::de::Visitor<'de> for Visitor {
9921                    type Value = __FieldTag;
9922                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9923                        formatter.write_str("a field name for CreateSinkRequest")
9924                    }
9925                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9926                    where
9927                        E: serde::de::Error,
9928                    {
9929                        use std::result::Result::Ok;
9930                        use std::string::ToString;
9931                        match value {
9932                            "parent" => Ok(__FieldTag::__parent),
9933                            "sink" => Ok(__FieldTag::__sink),
9934                            "uniqueWriterIdentity" => Ok(__FieldTag::__unique_writer_identity),
9935                            "unique_writer_identity" => Ok(__FieldTag::__unique_writer_identity),
9936                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9937                        }
9938                    }
9939                }
9940                deserializer.deserialize_identifier(Visitor)
9941            }
9942        }
9943        struct Visitor;
9944        impl<'de> serde::de::Visitor<'de> for Visitor {
9945            type Value = CreateSinkRequest;
9946            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9947                formatter.write_str("struct CreateSinkRequest")
9948            }
9949            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9950            where
9951                A: serde::de::MapAccess<'de>,
9952            {
9953                #[allow(unused_imports)]
9954                use serde::de::Error;
9955                use std::option::Option::Some;
9956                let mut fields = std::collections::HashSet::new();
9957                let mut result = Self::Value::new();
9958                while let Some(tag) = map.next_key::<__FieldTag>()? {
9959                    #[allow(clippy::match_single_binding)]
9960                    match tag {
9961                        __FieldTag::__parent => {
9962                            if !fields.insert(__FieldTag::__parent) {
9963                                return std::result::Result::Err(A::Error::duplicate_field(
9964                                    "multiple values for parent",
9965                                ));
9966                            }
9967                            result.parent = map
9968                                .next_value::<std::option::Option<std::string::String>>()?
9969                                .unwrap_or_default();
9970                        }
9971                        __FieldTag::__sink => {
9972                            if !fields.insert(__FieldTag::__sink) {
9973                                return std::result::Result::Err(A::Error::duplicate_field(
9974                                    "multiple values for sink",
9975                                ));
9976                            }
9977                            result.sink =
9978                                map.next_value::<std::option::Option<crate::model::LogSink>>()?;
9979                        }
9980                        __FieldTag::__unique_writer_identity => {
9981                            if !fields.insert(__FieldTag::__unique_writer_identity) {
9982                                return std::result::Result::Err(A::Error::duplicate_field(
9983                                    "multiple values for unique_writer_identity",
9984                                ));
9985                            }
9986                            result.unique_writer_identity = map
9987                                .next_value::<std::option::Option<bool>>()?
9988                                .unwrap_or_default();
9989                        }
9990                        __FieldTag::Unknown(key) => {
9991                            let value = map.next_value::<serde_json::Value>()?;
9992                            result._unknown_fields.insert(key, value);
9993                        }
9994                    }
9995                }
9996                std::result::Result::Ok(result)
9997            }
9998        }
9999        deserializer.deserialize_any(Visitor)
10000    }
10001}
10002
10003#[doc(hidden)]
10004impl serde::ser::Serialize for CreateSinkRequest {
10005    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10006    where
10007        S: serde::ser::Serializer,
10008    {
10009        use serde::ser::SerializeMap;
10010        #[allow(unused_imports)]
10011        use std::option::Option::Some;
10012        let mut state = serializer.serialize_map(std::option::Option::None)?;
10013        if !self.parent.is_empty() {
10014            state.serialize_entry("parent", &self.parent)?;
10015        }
10016        if self.sink.is_some() {
10017            state.serialize_entry("sink", &self.sink)?;
10018        }
10019        if !wkt::internal::is_default(&self.unique_writer_identity) {
10020            state.serialize_entry("uniqueWriterIdentity", &self.unique_writer_identity)?;
10021        }
10022        if !self._unknown_fields.is_empty() {
10023            for (key, value) in self._unknown_fields.iter() {
10024                state.serialize_entry(key, &value)?;
10025            }
10026        }
10027        state.end()
10028    }
10029}
10030
10031impl std::fmt::Debug for CreateSinkRequest {
10032    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10033        let mut debug_struct = f.debug_struct("CreateSinkRequest");
10034        debug_struct.field("parent", &self.parent);
10035        debug_struct.field("sink", &self.sink);
10036        debug_struct.field("unique_writer_identity", &self.unique_writer_identity);
10037        if !self._unknown_fields.is_empty() {
10038            debug_struct.field("_unknown_fields", &self._unknown_fields);
10039        }
10040        debug_struct.finish()
10041    }
10042}
10043
10044/// The parameters to `UpdateSink`.
10045#[derive(Clone, Default, PartialEq)]
10046#[non_exhaustive]
10047pub struct UpdateSinkRequest {
10048    /// Required. The full resource name of the sink to update, including the
10049    /// parent resource and the sink identifier:
10050    ///
10051    /// ```norust
10052    /// "projects/[PROJECT_ID]/sinks/[SINK_ID]"
10053    /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
10054    /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
10055    /// "folders/[FOLDER_ID]/sinks/[SINK_ID]"
10056    /// ```
10057    ///
10058    /// For example:
10059    ///
10060    /// `"projects/my-project/sinks/my-sink"`
10061    pub sink_name: std::string::String,
10062
10063    /// Required. The updated sink, whose name is the same identifier that appears
10064    /// as part of `sink_name`.
10065    pub sink: std::option::Option<crate::model::LogSink>,
10066
10067    /// Optional. See [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink]
10068    /// for a description of this field. When updating a sink, the effect of this
10069    /// field on the value of `writer_identity` in the updated sink depends on both
10070    /// the old and new values of this field:
10071    ///
10072    /// + If the old and new values of this field are both false or both true,
10073    ///   then there is no change to the sink's `writer_identity`.
10074    /// + If the old value is false and the new value is true, then
10075    ///   `writer_identity` is changed to a unique service account.
10076    /// + It is an error if the old value is true and the new value is
10077    ///   set to false or defaulted to false.
10078    ///
10079    /// [google.logging.v2.ConfigServiceV2.CreateSink]: crate::client::ConfigServiceV2::create_sink
10080    pub unique_writer_identity: bool,
10081
10082    /// Optional. Field mask that specifies the fields in `sink` that need
10083    /// an update. A sink field will be overwritten if, and only if, it is
10084    /// in the update mask. `name` and output only fields cannot be updated.
10085    ///
10086    /// An empty `updateMask` is temporarily treated as using the following mask
10087    /// for backwards compatibility purposes:
10088    ///
10089    /// `destination,filter,includeChildren`
10090    ///
10091    /// At some point in the future, behavior will be removed and specifying an
10092    /// empty `updateMask` will be an error.
10093    ///
10094    /// For a detailed `FieldMask` definition, see
10095    /// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask>
10096    ///
10097    /// For example: `updateMask=filter`
10098    pub update_mask: std::option::Option<wkt::FieldMask>,
10099
10100    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10101}
10102
10103impl UpdateSinkRequest {
10104    pub fn new() -> Self {
10105        std::default::Default::default()
10106    }
10107
10108    /// Sets the value of [sink_name][crate::model::UpdateSinkRequest::sink_name].
10109    pub fn set_sink_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10110        self.sink_name = v.into();
10111        self
10112    }
10113
10114    /// Sets the value of [sink][crate::model::UpdateSinkRequest::sink].
10115    pub fn set_sink<T>(mut self, v: T) -> Self
10116    where
10117        T: std::convert::Into<crate::model::LogSink>,
10118    {
10119        self.sink = std::option::Option::Some(v.into());
10120        self
10121    }
10122
10123    /// Sets or clears the value of [sink][crate::model::UpdateSinkRequest::sink].
10124    pub fn set_or_clear_sink<T>(mut self, v: std::option::Option<T>) -> Self
10125    where
10126        T: std::convert::Into<crate::model::LogSink>,
10127    {
10128        self.sink = v.map(|x| x.into());
10129        self
10130    }
10131
10132    /// Sets the value of [unique_writer_identity][crate::model::UpdateSinkRequest::unique_writer_identity].
10133    pub fn set_unique_writer_identity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10134        self.unique_writer_identity = v.into();
10135        self
10136    }
10137
10138    /// Sets the value of [update_mask][crate::model::UpdateSinkRequest::update_mask].
10139    pub fn set_update_mask<T>(mut self, v: T) -> Self
10140    where
10141        T: std::convert::Into<wkt::FieldMask>,
10142    {
10143        self.update_mask = std::option::Option::Some(v.into());
10144        self
10145    }
10146
10147    /// Sets or clears the value of [update_mask][crate::model::UpdateSinkRequest::update_mask].
10148    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10149    where
10150        T: std::convert::Into<wkt::FieldMask>,
10151    {
10152        self.update_mask = v.map(|x| x.into());
10153        self
10154    }
10155}
10156
10157impl wkt::message::Message for UpdateSinkRequest {
10158    fn typename() -> &'static str {
10159        "type.googleapis.com/google.logging.v2.UpdateSinkRequest"
10160    }
10161}
10162
10163#[doc(hidden)]
10164impl<'de> serde::de::Deserialize<'de> for UpdateSinkRequest {
10165    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10166    where
10167        D: serde::Deserializer<'de>,
10168    {
10169        #[allow(non_camel_case_types)]
10170        #[doc(hidden)]
10171        #[derive(PartialEq, Eq, Hash)]
10172        enum __FieldTag {
10173            __sink_name,
10174            __sink,
10175            __unique_writer_identity,
10176            __update_mask,
10177            Unknown(std::string::String),
10178        }
10179        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10180            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10181            where
10182                D: serde::Deserializer<'de>,
10183            {
10184                struct Visitor;
10185                impl<'de> serde::de::Visitor<'de> for Visitor {
10186                    type Value = __FieldTag;
10187                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10188                        formatter.write_str("a field name for UpdateSinkRequest")
10189                    }
10190                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10191                    where
10192                        E: serde::de::Error,
10193                    {
10194                        use std::result::Result::Ok;
10195                        use std::string::ToString;
10196                        match value {
10197                            "sinkName" => Ok(__FieldTag::__sink_name),
10198                            "sink_name" => Ok(__FieldTag::__sink_name),
10199                            "sink" => Ok(__FieldTag::__sink),
10200                            "uniqueWriterIdentity" => Ok(__FieldTag::__unique_writer_identity),
10201                            "unique_writer_identity" => Ok(__FieldTag::__unique_writer_identity),
10202                            "updateMask" => Ok(__FieldTag::__update_mask),
10203                            "update_mask" => Ok(__FieldTag::__update_mask),
10204                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10205                        }
10206                    }
10207                }
10208                deserializer.deserialize_identifier(Visitor)
10209            }
10210        }
10211        struct Visitor;
10212        impl<'de> serde::de::Visitor<'de> for Visitor {
10213            type Value = UpdateSinkRequest;
10214            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10215                formatter.write_str("struct UpdateSinkRequest")
10216            }
10217            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10218            where
10219                A: serde::de::MapAccess<'de>,
10220            {
10221                #[allow(unused_imports)]
10222                use serde::de::Error;
10223                use std::option::Option::Some;
10224                let mut fields = std::collections::HashSet::new();
10225                let mut result = Self::Value::new();
10226                while let Some(tag) = map.next_key::<__FieldTag>()? {
10227                    #[allow(clippy::match_single_binding)]
10228                    match tag {
10229                        __FieldTag::__sink_name => {
10230                            if !fields.insert(__FieldTag::__sink_name) {
10231                                return std::result::Result::Err(A::Error::duplicate_field(
10232                                    "multiple values for sink_name",
10233                                ));
10234                            }
10235                            result.sink_name = map
10236                                .next_value::<std::option::Option<std::string::String>>()?
10237                                .unwrap_or_default();
10238                        }
10239                        __FieldTag::__sink => {
10240                            if !fields.insert(__FieldTag::__sink) {
10241                                return std::result::Result::Err(A::Error::duplicate_field(
10242                                    "multiple values for sink",
10243                                ));
10244                            }
10245                            result.sink =
10246                                map.next_value::<std::option::Option<crate::model::LogSink>>()?;
10247                        }
10248                        __FieldTag::__unique_writer_identity => {
10249                            if !fields.insert(__FieldTag::__unique_writer_identity) {
10250                                return std::result::Result::Err(A::Error::duplicate_field(
10251                                    "multiple values for unique_writer_identity",
10252                                ));
10253                            }
10254                            result.unique_writer_identity = map
10255                                .next_value::<std::option::Option<bool>>()?
10256                                .unwrap_or_default();
10257                        }
10258                        __FieldTag::__update_mask => {
10259                            if !fields.insert(__FieldTag::__update_mask) {
10260                                return std::result::Result::Err(A::Error::duplicate_field(
10261                                    "multiple values for update_mask",
10262                                ));
10263                            }
10264                            result.update_mask =
10265                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
10266                        }
10267                        __FieldTag::Unknown(key) => {
10268                            let value = map.next_value::<serde_json::Value>()?;
10269                            result._unknown_fields.insert(key, value);
10270                        }
10271                    }
10272                }
10273                std::result::Result::Ok(result)
10274            }
10275        }
10276        deserializer.deserialize_any(Visitor)
10277    }
10278}
10279
10280#[doc(hidden)]
10281impl serde::ser::Serialize for UpdateSinkRequest {
10282    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10283    where
10284        S: serde::ser::Serializer,
10285    {
10286        use serde::ser::SerializeMap;
10287        #[allow(unused_imports)]
10288        use std::option::Option::Some;
10289        let mut state = serializer.serialize_map(std::option::Option::None)?;
10290        if !self.sink_name.is_empty() {
10291            state.serialize_entry("sinkName", &self.sink_name)?;
10292        }
10293        if self.sink.is_some() {
10294            state.serialize_entry("sink", &self.sink)?;
10295        }
10296        if !wkt::internal::is_default(&self.unique_writer_identity) {
10297            state.serialize_entry("uniqueWriterIdentity", &self.unique_writer_identity)?;
10298        }
10299        if self.update_mask.is_some() {
10300            state.serialize_entry("updateMask", &self.update_mask)?;
10301        }
10302        if !self._unknown_fields.is_empty() {
10303            for (key, value) in self._unknown_fields.iter() {
10304                state.serialize_entry(key, &value)?;
10305            }
10306        }
10307        state.end()
10308    }
10309}
10310
10311impl std::fmt::Debug for UpdateSinkRequest {
10312    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10313        let mut debug_struct = f.debug_struct("UpdateSinkRequest");
10314        debug_struct.field("sink_name", &self.sink_name);
10315        debug_struct.field("sink", &self.sink);
10316        debug_struct.field("unique_writer_identity", &self.unique_writer_identity);
10317        debug_struct.field("update_mask", &self.update_mask);
10318        if !self._unknown_fields.is_empty() {
10319            debug_struct.field("_unknown_fields", &self._unknown_fields);
10320        }
10321        debug_struct.finish()
10322    }
10323}
10324
10325/// The parameters to `DeleteSink`.
10326#[derive(Clone, Default, PartialEq)]
10327#[non_exhaustive]
10328pub struct DeleteSinkRequest {
10329    /// Required. The full resource name of the sink to delete, including the
10330    /// parent resource and the sink identifier:
10331    ///
10332    /// ```norust
10333    /// "projects/[PROJECT_ID]/sinks/[SINK_ID]"
10334    /// "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
10335    /// "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
10336    /// "folders/[FOLDER_ID]/sinks/[SINK_ID]"
10337    /// ```
10338    ///
10339    /// For example:
10340    ///
10341    /// `"projects/my-project/sinks/my-sink"`
10342    pub sink_name: std::string::String,
10343
10344    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10345}
10346
10347impl DeleteSinkRequest {
10348    pub fn new() -> Self {
10349        std::default::Default::default()
10350    }
10351
10352    /// Sets the value of [sink_name][crate::model::DeleteSinkRequest::sink_name].
10353    pub fn set_sink_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10354        self.sink_name = v.into();
10355        self
10356    }
10357}
10358
10359impl wkt::message::Message for DeleteSinkRequest {
10360    fn typename() -> &'static str {
10361        "type.googleapis.com/google.logging.v2.DeleteSinkRequest"
10362    }
10363}
10364
10365#[doc(hidden)]
10366impl<'de> serde::de::Deserialize<'de> for DeleteSinkRequest {
10367    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10368    where
10369        D: serde::Deserializer<'de>,
10370    {
10371        #[allow(non_camel_case_types)]
10372        #[doc(hidden)]
10373        #[derive(PartialEq, Eq, Hash)]
10374        enum __FieldTag {
10375            __sink_name,
10376            Unknown(std::string::String),
10377        }
10378        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10379            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10380            where
10381                D: serde::Deserializer<'de>,
10382            {
10383                struct Visitor;
10384                impl<'de> serde::de::Visitor<'de> for Visitor {
10385                    type Value = __FieldTag;
10386                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10387                        formatter.write_str("a field name for DeleteSinkRequest")
10388                    }
10389                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10390                    where
10391                        E: serde::de::Error,
10392                    {
10393                        use std::result::Result::Ok;
10394                        use std::string::ToString;
10395                        match value {
10396                            "sinkName" => Ok(__FieldTag::__sink_name),
10397                            "sink_name" => Ok(__FieldTag::__sink_name),
10398                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10399                        }
10400                    }
10401                }
10402                deserializer.deserialize_identifier(Visitor)
10403            }
10404        }
10405        struct Visitor;
10406        impl<'de> serde::de::Visitor<'de> for Visitor {
10407            type Value = DeleteSinkRequest;
10408            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10409                formatter.write_str("struct DeleteSinkRequest")
10410            }
10411            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10412            where
10413                A: serde::de::MapAccess<'de>,
10414            {
10415                #[allow(unused_imports)]
10416                use serde::de::Error;
10417                use std::option::Option::Some;
10418                let mut fields = std::collections::HashSet::new();
10419                let mut result = Self::Value::new();
10420                while let Some(tag) = map.next_key::<__FieldTag>()? {
10421                    #[allow(clippy::match_single_binding)]
10422                    match tag {
10423                        __FieldTag::__sink_name => {
10424                            if !fields.insert(__FieldTag::__sink_name) {
10425                                return std::result::Result::Err(A::Error::duplicate_field(
10426                                    "multiple values for sink_name",
10427                                ));
10428                            }
10429                            result.sink_name = map
10430                                .next_value::<std::option::Option<std::string::String>>()?
10431                                .unwrap_or_default();
10432                        }
10433                        __FieldTag::Unknown(key) => {
10434                            let value = map.next_value::<serde_json::Value>()?;
10435                            result._unknown_fields.insert(key, value);
10436                        }
10437                    }
10438                }
10439                std::result::Result::Ok(result)
10440            }
10441        }
10442        deserializer.deserialize_any(Visitor)
10443    }
10444}
10445
10446#[doc(hidden)]
10447impl serde::ser::Serialize for DeleteSinkRequest {
10448    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10449    where
10450        S: serde::ser::Serializer,
10451    {
10452        use serde::ser::SerializeMap;
10453        #[allow(unused_imports)]
10454        use std::option::Option::Some;
10455        let mut state = serializer.serialize_map(std::option::Option::None)?;
10456        if !self.sink_name.is_empty() {
10457            state.serialize_entry("sinkName", &self.sink_name)?;
10458        }
10459        if !self._unknown_fields.is_empty() {
10460            for (key, value) in self._unknown_fields.iter() {
10461                state.serialize_entry(key, &value)?;
10462            }
10463        }
10464        state.end()
10465    }
10466}
10467
10468impl std::fmt::Debug for DeleteSinkRequest {
10469    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10470        let mut debug_struct = f.debug_struct("DeleteSinkRequest");
10471        debug_struct.field("sink_name", &self.sink_name);
10472        if !self._unknown_fields.is_empty() {
10473            debug_struct.field("_unknown_fields", &self._unknown_fields);
10474        }
10475        debug_struct.finish()
10476    }
10477}
10478
10479/// The parameters to CreateLink.
10480#[derive(Clone, Default, PartialEq)]
10481#[non_exhaustive]
10482pub struct CreateLinkRequest {
10483    /// Required. The full resource name of the bucket to create a link for.
10484    ///
10485    /// ```norust
10486    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
10487    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
10488    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
10489    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
10490    /// ```
10491    pub parent: std::string::String,
10492
10493    /// Required. The new link.
10494    pub link: std::option::Option<crate::model::Link>,
10495
10496    /// Required. The ID to use for the link. The link_id can have up to 100
10497    /// characters. A valid link_id must only have alphanumeric characters and
10498    /// underscores within it.
10499    pub link_id: std::string::String,
10500
10501    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10502}
10503
10504impl CreateLinkRequest {
10505    pub fn new() -> Self {
10506        std::default::Default::default()
10507    }
10508
10509    /// Sets the value of [parent][crate::model::CreateLinkRequest::parent].
10510    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10511        self.parent = v.into();
10512        self
10513    }
10514
10515    /// Sets the value of [link][crate::model::CreateLinkRequest::link].
10516    pub fn set_link<T>(mut self, v: T) -> Self
10517    where
10518        T: std::convert::Into<crate::model::Link>,
10519    {
10520        self.link = std::option::Option::Some(v.into());
10521        self
10522    }
10523
10524    /// Sets or clears the value of [link][crate::model::CreateLinkRequest::link].
10525    pub fn set_or_clear_link<T>(mut self, v: std::option::Option<T>) -> Self
10526    where
10527        T: std::convert::Into<crate::model::Link>,
10528    {
10529        self.link = v.map(|x| x.into());
10530        self
10531    }
10532
10533    /// Sets the value of [link_id][crate::model::CreateLinkRequest::link_id].
10534    pub fn set_link_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10535        self.link_id = v.into();
10536        self
10537    }
10538}
10539
10540impl wkt::message::Message for CreateLinkRequest {
10541    fn typename() -> &'static str {
10542        "type.googleapis.com/google.logging.v2.CreateLinkRequest"
10543    }
10544}
10545
10546#[doc(hidden)]
10547impl<'de> serde::de::Deserialize<'de> for CreateLinkRequest {
10548    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10549    where
10550        D: serde::Deserializer<'de>,
10551    {
10552        #[allow(non_camel_case_types)]
10553        #[doc(hidden)]
10554        #[derive(PartialEq, Eq, Hash)]
10555        enum __FieldTag {
10556            __parent,
10557            __link,
10558            __link_id,
10559            Unknown(std::string::String),
10560        }
10561        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10562            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10563            where
10564                D: serde::Deserializer<'de>,
10565            {
10566                struct Visitor;
10567                impl<'de> serde::de::Visitor<'de> for Visitor {
10568                    type Value = __FieldTag;
10569                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10570                        formatter.write_str("a field name for CreateLinkRequest")
10571                    }
10572                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10573                    where
10574                        E: serde::de::Error,
10575                    {
10576                        use std::result::Result::Ok;
10577                        use std::string::ToString;
10578                        match value {
10579                            "parent" => Ok(__FieldTag::__parent),
10580                            "link" => Ok(__FieldTag::__link),
10581                            "linkId" => Ok(__FieldTag::__link_id),
10582                            "link_id" => Ok(__FieldTag::__link_id),
10583                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10584                        }
10585                    }
10586                }
10587                deserializer.deserialize_identifier(Visitor)
10588            }
10589        }
10590        struct Visitor;
10591        impl<'de> serde::de::Visitor<'de> for Visitor {
10592            type Value = CreateLinkRequest;
10593            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10594                formatter.write_str("struct CreateLinkRequest")
10595            }
10596            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10597            where
10598                A: serde::de::MapAccess<'de>,
10599            {
10600                #[allow(unused_imports)]
10601                use serde::de::Error;
10602                use std::option::Option::Some;
10603                let mut fields = std::collections::HashSet::new();
10604                let mut result = Self::Value::new();
10605                while let Some(tag) = map.next_key::<__FieldTag>()? {
10606                    #[allow(clippy::match_single_binding)]
10607                    match tag {
10608                        __FieldTag::__parent => {
10609                            if !fields.insert(__FieldTag::__parent) {
10610                                return std::result::Result::Err(A::Error::duplicate_field(
10611                                    "multiple values for parent",
10612                                ));
10613                            }
10614                            result.parent = map
10615                                .next_value::<std::option::Option<std::string::String>>()?
10616                                .unwrap_or_default();
10617                        }
10618                        __FieldTag::__link => {
10619                            if !fields.insert(__FieldTag::__link) {
10620                                return std::result::Result::Err(A::Error::duplicate_field(
10621                                    "multiple values for link",
10622                                ));
10623                            }
10624                            result.link =
10625                                map.next_value::<std::option::Option<crate::model::Link>>()?;
10626                        }
10627                        __FieldTag::__link_id => {
10628                            if !fields.insert(__FieldTag::__link_id) {
10629                                return std::result::Result::Err(A::Error::duplicate_field(
10630                                    "multiple values for link_id",
10631                                ));
10632                            }
10633                            result.link_id = map
10634                                .next_value::<std::option::Option<std::string::String>>()?
10635                                .unwrap_or_default();
10636                        }
10637                        __FieldTag::Unknown(key) => {
10638                            let value = map.next_value::<serde_json::Value>()?;
10639                            result._unknown_fields.insert(key, value);
10640                        }
10641                    }
10642                }
10643                std::result::Result::Ok(result)
10644            }
10645        }
10646        deserializer.deserialize_any(Visitor)
10647    }
10648}
10649
10650#[doc(hidden)]
10651impl serde::ser::Serialize for CreateLinkRequest {
10652    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10653    where
10654        S: serde::ser::Serializer,
10655    {
10656        use serde::ser::SerializeMap;
10657        #[allow(unused_imports)]
10658        use std::option::Option::Some;
10659        let mut state = serializer.serialize_map(std::option::Option::None)?;
10660        if !self.parent.is_empty() {
10661            state.serialize_entry("parent", &self.parent)?;
10662        }
10663        if self.link.is_some() {
10664            state.serialize_entry("link", &self.link)?;
10665        }
10666        if !self.link_id.is_empty() {
10667            state.serialize_entry("linkId", &self.link_id)?;
10668        }
10669        if !self._unknown_fields.is_empty() {
10670            for (key, value) in self._unknown_fields.iter() {
10671                state.serialize_entry(key, &value)?;
10672            }
10673        }
10674        state.end()
10675    }
10676}
10677
10678impl std::fmt::Debug for CreateLinkRequest {
10679    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10680        let mut debug_struct = f.debug_struct("CreateLinkRequest");
10681        debug_struct.field("parent", &self.parent);
10682        debug_struct.field("link", &self.link);
10683        debug_struct.field("link_id", &self.link_id);
10684        if !self._unknown_fields.is_empty() {
10685            debug_struct.field("_unknown_fields", &self._unknown_fields);
10686        }
10687        debug_struct.finish()
10688    }
10689}
10690
10691/// The parameters to DeleteLink.
10692#[derive(Clone, Default, PartialEq)]
10693#[non_exhaustive]
10694pub struct DeleteLinkRequest {
10695    /// Required. The full resource name of the link to delete.
10696    ///
10697    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
10698    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
10699    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
10700    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
10701    pub name: std::string::String,
10702
10703    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10704}
10705
10706impl DeleteLinkRequest {
10707    pub fn new() -> Self {
10708        std::default::Default::default()
10709    }
10710
10711    /// Sets the value of [name][crate::model::DeleteLinkRequest::name].
10712    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10713        self.name = v.into();
10714        self
10715    }
10716}
10717
10718impl wkt::message::Message for DeleteLinkRequest {
10719    fn typename() -> &'static str {
10720        "type.googleapis.com/google.logging.v2.DeleteLinkRequest"
10721    }
10722}
10723
10724#[doc(hidden)]
10725impl<'de> serde::de::Deserialize<'de> for DeleteLinkRequest {
10726    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10727    where
10728        D: serde::Deserializer<'de>,
10729    {
10730        #[allow(non_camel_case_types)]
10731        #[doc(hidden)]
10732        #[derive(PartialEq, Eq, Hash)]
10733        enum __FieldTag {
10734            __name,
10735            Unknown(std::string::String),
10736        }
10737        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10738            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10739            where
10740                D: serde::Deserializer<'de>,
10741            {
10742                struct Visitor;
10743                impl<'de> serde::de::Visitor<'de> for Visitor {
10744                    type Value = __FieldTag;
10745                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10746                        formatter.write_str("a field name for DeleteLinkRequest")
10747                    }
10748                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10749                    where
10750                        E: serde::de::Error,
10751                    {
10752                        use std::result::Result::Ok;
10753                        use std::string::ToString;
10754                        match value {
10755                            "name" => Ok(__FieldTag::__name),
10756                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10757                        }
10758                    }
10759                }
10760                deserializer.deserialize_identifier(Visitor)
10761            }
10762        }
10763        struct Visitor;
10764        impl<'de> serde::de::Visitor<'de> for Visitor {
10765            type Value = DeleteLinkRequest;
10766            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10767                formatter.write_str("struct DeleteLinkRequest")
10768            }
10769            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10770            where
10771                A: serde::de::MapAccess<'de>,
10772            {
10773                #[allow(unused_imports)]
10774                use serde::de::Error;
10775                use std::option::Option::Some;
10776                let mut fields = std::collections::HashSet::new();
10777                let mut result = Self::Value::new();
10778                while let Some(tag) = map.next_key::<__FieldTag>()? {
10779                    #[allow(clippy::match_single_binding)]
10780                    match tag {
10781                        __FieldTag::__name => {
10782                            if !fields.insert(__FieldTag::__name) {
10783                                return std::result::Result::Err(A::Error::duplicate_field(
10784                                    "multiple values for name",
10785                                ));
10786                            }
10787                            result.name = map
10788                                .next_value::<std::option::Option<std::string::String>>()?
10789                                .unwrap_or_default();
10790                        }
10791                        __FieldTag::Unknown(key) => {
10792                            let value = map.next_value::<serde_json::Value>()?;
10793                            result._unknown_fields.insert(key, value);
10794                        }
10795                    }
10796                }
10797                std::result::Result::Ok(result)
10798            }
10799        }
10800        deserializer.deserialize_any(Visitor)
10801    }
10802}
10803
10804#[doc(hidden)]
10805impl serde::ser::Serialize for DeleteLinkRequest {
10806    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10807    where
10808        S: serde::ser::Serializer,
10809    {
10810        use serde::ser::SerializeMap;
10811        #[allow(unused_imports)]
10812        use std::option::Option::Some;
10813        let mut state = serializer.serialize_map(std::option::Option::None)?;
10814        if !self.name.is_empty() {
10815            state.serialize_entry("name", &self.name)?;
10816        }
10817        if !self._unknown_fields.is_empty() {
10818            for (key, value) in self._unknown_fields.iter() {
10819                state.serialize_entry(key, &value)?;
10820            }
10821        }
10822        state.end()
10823    }
10824}
10825
10826impl std::fmt::Debug for DeleteLinkRequest {
10827    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10828        let mut debug_struct = f.debug_struct("DeleteLinkRequest");
10829        debug_struct.field("name", &self.name);
10830        if !self._unknown_fields.is_empty() {
10831            debug_struct.field("_unknown_fields", &self._unknown_fields);
10832        }
10833        debug_struct.finish()
10834    }
10835}
10836
10837/// The parameters to ListLinks.
10838#[derive(Clone, Default, PartialEq)]
10839#[non_exhaustive]
10840pub struct ListLinksRequest {
10841    /// Required. The parent resource whose links are to be listed:
10842    ///
10843    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/"
10844    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/"
10845    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/"
10846    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/
10847    pub parent: std::string::String,
10848
10849    /// Optional. If present, then retrieve the next batch of results from the
10850    /// preceding call to this method. `pageToken` must be the value of
10851    /// `nextPageToken` from the previous response.
10852    pub page_token: std::string::String,
10853
10854    /// Optional. The maximum number of results to return from this request.
10855    pub page_size: i32,
10856
10857    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10858}
10859
10860impl ListLinksRequest {
10861    pub fn new() -> Self {
10862        std::default::Default::default()
10863    }
10864
10865    /// Sets the value of [parent][crate::model::ListLinksRequest::parent].
10866    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10867        self.parent = v.into();
10868        self
10869    }
10870
10871    /// Sets the value of [page_token][crate::model::ListLinksRequest::page_token].
10872    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10873        self.page_token = v.into();
10874        self
10875    }
10876
10877    /// Sets the value of [page_size][crate::model::ListLinksRequest::page_size].
10878    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10879        self.page_size = v.into();
10880        self
10881    }
10882}
10883
10884impl wkt::message::Message for ListLinksRequest {
10885    fn typename() -> &'static str {
10886        "type.googleapis.com/google.logging.v2.ListLinksRequest"
10887    }
10888}
10889
10890#[doc(hidden)]
10891impl<'de> serde::de::Deserialize<'de> for ListLinksRequest {
10892    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10893    where
10894        D: serde::Deserializer<'de>,
10895    {
10896        #[allow(non_camel_case_types)]
10897        #[doc(hidden)]
10898        #[derive(PartialEq, Eq, Hash)]
10899        enum __FieldTag {
10900            __parent,
10901            __page_token,
10902            __page_size,
10903            Unknown(std::string::String),
10904        }
10905        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10906            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10907            where
10908                D: serde::Deserializer<'de>,
10909            {
10910                struct Visitor;
10911                impl<'de> serde::de::Visitor<'de> for Visitor {
10912                    type Value = __FieldTag;
10913                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10914                        formatter.write_str("a field name for ListLinksRequest")
10915                    }
10916                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10917                    where
10918                        E: serde::de::Error,
10919                    {
10920                        use std::result::Result::Ok;
10921                        use std::string::ToString;
10922                        match value {
10923                            "parent" => Ok(__FieldTag::__parent),
10924                            "pageToken" => Ok(__FieldTag::__page_token),
10925                            "page_token" => Ok(__FieldTag::__page_token),
10926                            "pageSize" => Ok(__FieldTag::__page_size),
10927                            "page_size" => Ok(__FieldTag::__page_size),
10928                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10929                        }
10930                    }
10931                }
10932                deserializer.deserialize_identifier(Visitor)
10933            }
10934        }
10935        struct Visitor;
10936        impl<'de> serde::de::Visitor<'de> for Visitor {
10937            type Value = ListLinksRequest;
10938            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10939                formatter.write_str("struct ListLinksRequest")
10940            }
10941            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10942            where
10943                A: serde::de::MapAccess<'de>,
10944            {
10945                #[allow(unused_imports)]
10946                use serde::de::Error;
10947                use std::option::Option::Some;
10948                let mut fields = std::collections::HashSet::new();
10949                let mut result = Self::Value::new();
10950                while let Some(tag) = map.next_key::<__FieldTag>()? {
10951                    #[allow(clippy::match_single_binding)]
10952                    match tag {
10953                        __FieldTag::__parent => {
10954                            if !fields.insert(__FieldTag::__parent) {
10955                                return std::result::Result::Err(A::Error::duplicate_field(
10956                                    "multiple values for parent",
10957                                ));
10958                            }
10959                            result.parent = map
10960                                .next_value::<std::option::Option<std::string::String>>()?
10961                                .unwrap_or_default();
10962                        }
10963                        __FieldTag::__page_token => {
10964                            if !fields.insert(__FieldTag::__page_token) {
10965                                return std::result::Result::Err(A::Error::duplicate_field(
10966                                    "multiple values for page_token",
10967                                ));
10968                            }
10969                            result.page_token = map
10970                                .next_value::<std::option::Option<std::string::String>>()?
10971                                .unwrap_or_default();
10972                        }
10973                        __FieldTag::__page_size => {
10974                            if !fields.insert(__FieldTag::__page_size) {
10975                                return std::result::Result::Err(A::Error::duplicate_field(
10976                                    "multiple values for page_size",
10977                                ));
10978                            }
10979                            struct __With(std::option::Option<i32>);
10980                            impl<'de> serde::de::Deserialize<'de> for __With {
10981                                fn deserialize<D>(
10982                                    deserializer: D,
10983                                ) -> std::result::Result<Self, D::Error>
10984                                where
10985                                    D: serde::de::Deserializer<'de>,
10986                                {
10987                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
10988                                }
10989                            }
10990                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
10991                        }
10992                        __FieldTag::Unknown(key) => {
10993                            let value = map.next_value::<serde_json::Value>()?;
10994                            result._unknown_fields.insert(key, value);
10995                        }
10996                    }
10997                }
10998                std::result::Result::Ok(result)
10999            }
11000        }
11001        deserializer.deserialize_any(Visitor)
11002    }
11003}
11004
11005#[doc(hidden)]
11006impl serde::ser::Serialize for ListLinksRequest {
11007    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11008    where
11009        S: serde::ser::Serializer,
11010    {
11011        use serde::ser::SerializeMap;
11012        #[allow(unused_imports)]
11013        use std::option::Option::Some;
11014        let mut state = serializer.serialize_map(std::option::Option::None)?;
11015        if !self.parent.is_empty() {
11016            state.serialize_entry("parent", &self.parent)?;
11017        }
11018        if !self.page_token.is_empty() {
11019            state.serialize_entry("pageToken", &self.page_token)?;
11020        }
11021        if !wkt::internal::is_default(&self.page_size) {
11022            struct __With<'a>(&'a i32);
11023            impl<'a> serde::ser::Serialize for __With<'a> {
11024                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11025                where
11026                    S: serde::ser::Serializer,
11027                {
11028                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
11029                }
11030            }
11031            state.serialize_entry("pageSize", &__With(&self.page_size))?;
11032        }
11033        if !self._unknown_fields.is_empty() {
11034            for (key, value) in self._unknown_fields.iter() {
11035                state.serialize_entry(key, &value)?;
11036            }
11037        }
11038        state.end()
11039    }
11040}
11041
11042impl std::fmt::Debug for ListLinksRequest {
11043    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11044        let mut debug_struct = f.debug_struct("ListLinksRequest");
11045        debug_struct.field("parent", &self.parent);
11046        debug_struct.field("page_token", &self.page_token);
11047        debug_struct.field("page_size", &self.page_size);
11048        if !self._unknown_fields.is_empty() {
11049            debug_struct.field("_unknown_fields", &self._unknown_fields);
11050        }
11051        debug_struct.finish()
11052    }
11053}
11054
11055/// The response from ListLinks.
11056#[derive(Clone, Default, PartialEq)]
11057#[non_exhaustive]
11058pub struct ListLinksResponse {
11059    /// A list of links.
11060    pub links: std::vec::Vec<crate::model::Link>,
11061
11062    /// If there might be more results than those appearing in this response, then
11063    /// `nextPageToken` is included. To get the next set of results, call the same
11064    /// method again using the value of `nextPageToken` as `pageToken`.
11065    pub next_page_token: std::string::String,
11066
11067    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11068}
11069
11070impl ListLinksResponse {
11071    pub fn new() -> Self {
11072        std::default::Default::default()
11073    }
11074
11075    /// Sets the value of [links][crate::model::ListLinksResponse::links].
11076    pub fn set_links<T, V>(mut self, v: T) -> Self
11077    where
11078        T: std::iter::IntoIterator<Item = V>,
11079        V: std::convert::Into<crate::model::Link>,
11080    {
11081        use std::iter::Iterator;
11082        self.links = v.into_iter().map(|i| i.into()).collect();
11083        self
11084    }
11085
11086    /// Sets the value of [next_page_token][crate::model::ListLinksResponse::next_page_token].
11087    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11088        self.next_page_token = v.into();
11089        self
11090    }
11091}
11092
11093impl wkt::message::Message for ListLinksResponse {
11094    fn typename() -> &'static str {
11095        "type.googleapis.com/google.logging.v2.ListLinksResponse"
11096    }
11097}
11098
11099#[doc(hidden)]
11100impl gax::paginator::internal::PageableResponse for ListLinksResponse {
11101    type PageItem = crate::model::Link;
11102
11103    fn items(self) -> std::vec::Vec<Self::PageItem> {
11104        self.links
11105    }
11106
11107    fn next_page_token(&self) -> std::string::String {
11108        use std::clone::Clone;
11109        self.next_page_token.clone()
11110    }
11111}
11112
11113#[doc(hidden)]
11114impl<'de> serde::de::Deserialize<'de> for ListLinksResponse {
11115    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11116    where
11117        D: serde::Deserializer<'de>,
11118    {
11119        #[allow(non_camel_case_types)]
11120        #[doc(hidden)]
11121        #[derive(PartialEq, Eq, Hash)]
11122        enum __FieldTag {
11123            __links,
11124            __next_page_token,
11125            Unknown(std::string::String),
11126        }
11127        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11128            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11129            where
11130                D: serde::Deserializer<'de>,
11131            {
11132                struct Visitor;
11133                impl<'de> serde::de::Visitor<'de> for Visitor {
11134                    type Value = __FieldTag;
11135                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11136                        formatter.write_str("a field name for ListLinksResponse")
11137                    }
11138                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11139                    where
11140                        E: serde::de::Error,
11141                    {
11142                        use std::result::Result::Ok;
11143                        use std::string::ToString;
11144                        match value {
11145                            "links" => Ok(__FieldTag::__links),
11146                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
11147                            "next_page_token" => Ok(__FieldTag::__next_page_token),
11148                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11149                        }
11150                    }
11151                }
11152                deserializer.deserialize_identifier(Visitor)
11153            }
11154        }
11155        struct Visitor;
11156        impl<'de> serde::de::Visitor<'de> for Visitor {
11157            type Value = ListLinksResponse;
11158            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11159                formatter.write_str("struct ListLinksResponse")
11160            }
11161            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11162            where
11163                A: serde::de::MapAccess<'de>,
11164            {
11165                #[allow(unused_imports)]
11166                use serde::de::Error;
11167                use std::option::Option::Some;
11168                let mut fields = std::collections::HashSet::new();
11169                let mut result = Self::Value::new();
11170                while let Some(tag) = map.next_key::<__FieldTag>()? {
11171                    #[allow(clippy::match_single_binding)]
11172                    match tag {
11173                        __FieldTag::__links => {
11174                            if !fields.insert(__FieldTag::__links) {
11175                                return std::result::Result::Err(A::Error::duplicate_field(
11176                                    "multiple values for links",
11177                                ));
11178                            }
11179                            result.links = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Link>>>()?.unwrap_or_default();
11180                        }
11181                        __FieldTag::__next_page_token => {
11182                            if !fields.insert(__FieldTag::__next_page_token) {
11183                                return std::result::Result::Err(A::Error::duplicate_field(
11184                                    "multiple values for next_page_token",
11185                                ));
11186                            }
11187                            result.next_page_token = map
11188                                .next_value::<std::option::Option<std::string::String>>()?
11189                                .unwrap_or_default();
11190                        }
11191                        __FieldTag::Unknown(key) => {
11192                            let value = map.next_value::<serde_json::Value>()?;
11193                            result._unknown_fields.insert(key, value);
11194                        }
11195                    }
11196                }
11197                std::result::Result::Ok(result)
11198            }
11199        }
11200        deserializer.deserialize_any(Visitor)
11201    }
11202}
11203
11204#[doc(hidden)]
11205impl serde::ser::Serialize for ListLinksResponse {
11206    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11207    where
11208        S: serde::ser::Serializer,
11209    {
11210        use serde::ser::SerializeMap;
11211        #[allow(unused_imports)]
11212        use std::option::Option::Some;
11213        let mut state = serializer.serialize_map(std::option::Option::None)?;
11214        if !self.links.is_empty() {
11215            state.serialize_entry("links", &self.links)?;
11216        }
11217        if !self.next_page_token.is_empty() {
11218            state.serialize_entry("nextPageToken", &self.next_page_token)?;
11219        }
11220        if !self._unknown_fields.is_empty() {
11221            for (key, value) in self._unknown_fields.iter() {
11222                state.serialize_entry(key, &value)?;
11223            }
11224        }
11225        state.end()
11226    }
11227}
11228
11229impl std::fmt::Debug for ListLinksResponse {
11230    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11231        let mut debug_struct = f.debug_struct("ListLinksResponse");
11232        debug_struct.field("links", &self.links);
11233        debug_struct.field("next_page_token", &self.next_page_token);
11234        if !self._unknown_fields.is_empty() {
11235            debug_struct.field("_unknown_fields", &self._unknown_fields);
11236        }
11237        debug_struct.finish()
11238    }
11239}
11240
11241/// The parameters to GetLink.
11242#[derive(Clone, Default, PartialEq)]
11243#[non_exhaustive]
11244pub struct GetLinkRequest {
11245    /// Required. The resource name of the link:
11246    ///
11247    /// "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
11248    /// "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
11249    /// "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]"
11250    /// "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]
11251    pub name: std::string::String,
11252
11253    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11254}
11255
11256impl GetLinkRequest {
11257    pub fn new() -> Self {
11258        std::default::Default::default()
11259    }
11260
11261    /// Sets the value of [name][crate::model::GetLinkRequest::name].
11262    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11263        self.name = v.into();
11264        self
11265    }
11266}
11267
11268impl wkt::message::Message for GetLinkRequest {
11269    fn typename() -> &'static str {
11270        "type.googleapis.com/google.logging.v2.GetLinkRequest"
11271    }
11272}
11273
11274#[doc(hidden)]
11275impl<'de> serde::de::Deserialize<'de> for GetLinkRequest {
11276    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11277    where
11278        D: serde::Deserializer<'de>,
11279    {
11280        #[allow(non_camel_case_types)]
11281        #[doc(hidden)]
11282        #[derive(PartialEq, Eq, Hash)]
11283        enum __FieldTag {
11284            __name,
11285            Unknown(std::string::String),
11286        }
11287        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11288            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11289            where
11290                D: serde::Deserializer<'de>,
11291            {
11292                struct Visitor;
11293                impl<'de> serde::de::Visitor<'de> for Visitor {
11294                    type Value = __FieldTag;
11295                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11296                        formatter.write_str("a field name for GetLinkRequest")
11297                    }
11298                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11299                    where
11300                        E: serde::de::Error,
11301                    {
11302                        use std::result::Result::Ok;
11303                        use std::string::ToString;
11304                        match value {
11305                            "name" => Ok(__FieldTag::__name),
11306                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11307                        }
11308                    }
11309                }
11310                deserializer.deserialize_identifier(Visitor)
11311            }
11312        }
11313        struct Visitor;
11314        impl<'de> serde::de::Visitor<'de> for Visitor {
11315            type Value = GetLinkRequest;
11316            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11317                formatter.write_str("struct GetLinkRequest")
11318            }
11319            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11320            where
11321                A: serde::de::MapAccess<'de>,
11322            {
11323                #[allow(unused_imports)]
11324                use serde::de::Error;
11325                use std::option::Option::Some;
11326                let mut fields = std::collections::HashSet::new();
11327                let mut result = Self::Value::new();
11328                while let Some(tag) = map.next_key::<__FieldTag>()? {
11329                    #[allow(clippy::match_single_binding)]
11330                    match tag {
11331                        __FieldTag::__name => {
11332                            if !fields.insert(__FieldTag::__name) {
11333                                return std::result::Result::Err(A::Error::duplicate_field(
11334                                    "multiple values for name",
11335                                ));
11336                            }
11337                            result.name = map
11338                                .next_value::<std::option::Option<std::string::String>>()?
11339                                .unwrap_or_default();
11340                        }
11341                        __FieldTag::Unknown(key) => {
11342                            let value = map.next_value::<serde_json::Value>()?;
11343                            result._unknown_fields.insert(key, value);
11344                        }
11345                    }
11346                }
11347                std::result::Result::Ok(result)
11348            }
11349        }
11350        deserializer.deserialize_any(Visitor)
11351    }
11352}
11353
11354#[doc(hidden)]
11355impl serde::ser::Serialize for GetLinkRequest {
11356    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11357    where
11358        S: serde::ser::Serializer,
11359    {
11360        use serde::ser::SerializeMap;
11361        #[allow(unused_imports)]
11362        use std::option::Option::Some;
11363        let mut state = serializer.serialize_map(std::option::Option::None)?;
11364        if !self.name.is_empty() {
11365            state.serialize_entry("name", &self.name)?;
11366        }
11367        if !self._unknown_fields.is_empty() {
11368            for (key, value) in self._unknown_fields.iter() {
11369                state.serialize_entry(key, &value)?;
11370            }
11371        }
11372        state.end()
11373    }
11374}
11375
11376impl std::fmt::Debug for GetLinkRequest {
11377    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11378        let mut debug_struct = f.debug_struct("GetLinkRequest");
11379        debug_struct.field("name", &self.name);
11380        if !self._unknown_fields.is_empty() {
11381            debug_struct.field("_unknown_fields", &self._unknown_fields);
11382        }
11383        debug_struct.finish()
11384    }
11385}
11386
11387/// Specifies a set of log entries that are filtered out by a sink. If
11388/// your Google Cloud resource receives a large volume of log entries, you can
11389/// use exclusions to reduce your chargeable logs. Note that exclusions on
11390/// organization-level and folder-level sinks don't apply to child resources.
11391/// Note also that you cannot modify the _Required sink or exclude logs from it.
11392#[derive(Clone, Default, PartialEq)]
11393#[non_exhaustive]
11394pub struct LogExclusion {
11395    /// Required. A client-assigned identifier, such as
11396    /// `"load-balancer-exclusion"`. Identifiers are limited to 100 characters and
11397    /// can include only letters, digits, underscores, hyphens, and periods. First
11398    /// character has to be alphanumeric.
11399    pub name: std::string::String,
11400
11401    /// Optional. A description of this exclusion.
11402    pub description: std::string::String,
11403
11404    /// Required. An [advanced logs
11405    /// filter](https://cloud.google.com/logging/docs/view/advanced-queries) that
11406    /// matches the log entries to be excluded. By using the [sample
11407    /// function](https://cloud.google.com/logging/docs/view/advanced-queries#sample),
11408    /// you can exclude less than 100% of the matching log entries.
11409    ///
11410    /// For example, the following query matches 99% of low-severity log entries
11411    /// from Google Cloud Storage buckets:
11412    ///
11413    /// `resource.type=gcs_bucket severity<ERROR sample(insertId, 0.99)`
11414    pub filter: std::string::String,
11415
11416    /// Optional. If set to True, then this exclusion is disabled and it does not
11417    /// exclude any log entries. You can [update an
11418    /// exclusion][google.logging.v2.ConfigServiceV2.UpdateExclusion] to change the
11419    /// value of this field.
11420    ///
11421    /// [google.logging.v2.ConfigServiceV2.UpdateExclusion]: crate::client::ConfigServiceV2::update_exclusion
11422    pub disabled: bool,
11423
11424    /// Output only. The creation timestamp of the exclusion.
11425    ///
11426    /// This field may not be present for older exclusions.
11427    pub create_time: std::option::Option<wkt::Timestamp>,
11428
11429    /// Output only. The last update timestamp of the exclusion.
11430    ///
11431    /// This field may not be present for older exclusions.
11432    pub update_time: std::option::Option<wkt::Timestamp>,
11433
11434    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11435}
11436
11437impl LogExclusion {
11438    pub fn new() -> Self {
11439        std::default::Default::default()
11440    }
11441
11442    /// Sets the value of [name][crate::model::LogExclusion::name].
11443    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11444        self.name = v.into();
11445        self
11446    }
11447
11448    /// Sets the value of [description][crate::model::LogExclusion::description].
11449    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11450        self.description = v.into();
11451        self
11452    }
11453
11454    /// Sets the value of [filter][crate::model::LogExclusion::filter].
11455    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11456        self.filter = v.into();
11457        self
11458    }
11459
11460    /// Sets the value of [disabled][crate::model::LogExclusion::disabled].
11461    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11462        self.disabled = v.into();
11463        self
11464    }
11465
11466    /// Sets the value of [create_time][crate::model::LogExclusion::create_time].
11467    pub fn set_create_time<T>(mut self, v: T) -> Self
11468    where
11469        T: std::convert::Into<wkt::Timestamp>,
11470    {
11471        self.create_time = std::option::Option::Some(v.into());
11472        self
11473    }
11474
11475    /// Sets or clears the value of [create_time][crate::model::LogExclusion::create_time].
11476    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11477    where
11478        T: std::convert::Into<wkt::Timestamp>,
11479    {
11480        self.create_time = v.map(|x| x.into());
11481        self
11482    }
11483
11484    /// Sets the value of [update_time][crate::model::LogExclusion::update_time].
11485    pub fn set_update_time<T>(mut self, v: T) -> Self
11486    where
11487        T: std::convert::Into<wkt::Timestamp>,
11488    {
11489        self.update_time = std::option::Option::Some(v.into());
11490        self
11491    }
11492
11493    /// Sets or clears the value of [update_time][crate::model::LogExclusion::update_time].
11494    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11495    where
11496        T: std::convert::Into<wkt::Timestamp>,
11497    {
11498        self.update_time = v.map(|x| x.into());
11499        self
11500    }
11501}
11502
11503impl wkt::message::Message for LogExclusion {
11504    fn typename() -> &'static str {
11505        "type.googleapis.com/google.logging.v2.LogExclusion"
11506    }
11507}
11508
11509#[doc(hidden)]
11510impl<'de> serde::de::Deserialize<'de> for LogExclusion {
11511    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11512    where
11513        D: serde::Deserializer<'de>,
11514    {
11515        #[allow(non_camel_case_types)]
11516        #[doc(hidden)]
11517        #[derive(PartialEq, Eq, Hash)]
11518        enum __FieldTag {
11519            __name,
11520            __description,
11521            __filter,
11522            __disabled,
11523            __create_time,
11524            __update_time,
11525            Unknown(std::string::String),
11526        }
11527        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11528            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11529            where
11530                D: serde::Deserializer<'de>,
11531            {
11532                struct Visitor;
11533                impl<'de> serde::de::Visitor<'de> for Visitor {
11534                    type Value = __FieldTag;
11535                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11536                        formatter.write_str("a field name for LogExclusion")
11537                    }
11538                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11539                    where
11540                        E: serde::de::Error,
11541                    {
11542                        use std::result::Result::Ok;
11543                        use std::string::ToString;
11544                        match value {
11545                            "name" => Ok(__FieldTag::__name),
11546                            "description" => Ok(__FieldTag::__description),
11547                            "filter" => Ok(__FieldTag::__filter),
11548                            "disabled" => Ok(__FieldTag::__disabled),
11549                            "createTime" => Ok(__FieldTag::__create_time),
11550                            "create_time" => Ok(__FieldTag::__create_time),
11551                            "updateTime" => Ok(__FieldTag::__update_time),
11552                            "update_time" => Ok(__FieldTag::__update_time),
11553                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11554                        }
11555                    }
11556                }
11557                deserializer.deserialize_identifier(Visitor)
11558            }
11559        }
11560        struct Visitor;
11561        impl<'de> serde::de::Visitor<'de> for Visitor {
11562            type Value = LogExclusion;
11563            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11564                formatter.write_str("struct LogExclusion")
11565            }
11566            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11567            where
11568                A: serde::de::MapAccess<'de>,
11569            {
11570                #[allow(unused_imports)]
11571                use serde::de::Error;
11572                use std::option::Option::Some;
11573                let mut fields = std::collections::HashSet::new();
11574                let mut result = Self::Value::new();
11575                while let Some(tag) = map.next_key::<__FieldTag>()? {
11576                    #[allow(clippy::match_single_binding)]
11577                    match tag {
11578                        __FieldTag::__name => {
11579                            if !fields.insert(__FieldTag::__name) {
11580                                return std::result::Result::Err(A::Error::duplicate_field(
11581                                    "multiple values for name",
11582                                ));
11583                            }
11584                            result.name = map
11585                                .next_value::<std::option::Option<std::string::String>>()?
11586                                .unwrap_or_default();
11587                        }
11588                        __FieldTag::__description => {
11589                            if !fields.insert(__FieldTag::__description) {
11590                                return std::result::Result::Err(A::Error::duplicate_field(
11591                                    "multiple values for description",
11592                                ));
11593                            }
11594                            result.description = map
11595                                .next_value::<std::option::Option<std::string::String>>()?
11596                                .unwrap_or_default();
11597                        }
11598                        __FieldTag::__filter => {
11599                            if !fields.insert(__FieldTag::__filter) {
11600                                return std::result::Result::Err(A::Error::duplicate_field(
11601                                    "multiple values for filter",
11602                                ));
11603                            }
11604                            result.filter = map
11605                                .next_value::<std::option::Option<std::string::String>>()?
11606                                .unwrap_or_default();
11607                        }
11608                        __FieldTag::__disabled => {
11609                            if !fields.insert(__FieldTag::__disabled) {
11610                                return std::result::Result::Err(A::Error::duplicate_field(
11611                                    "multiple values for disabled",
11612                                ));
11613                            }
11614                            result.disabled = map
11615                                .next_value::<std::option::Option<bool>>()?
11616                                .unwrap_or_default();
11617                        }
11618                        __FieldTag::__create_time => {
11619                            if !fields.insert(__FieldTag::__create_time) {
11620                                return std::result::Result::Err(A::Error::duplicate_field(
11621                                    "multiple values for create_time",
11622                                ));
11623                            }
11624                            result.create_time =
11625                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11626                        }
11627                        __FieldTag::__update_time => {
11628                            if !fields.insert(__FieldTag::__update_time) {
11629                                return std::result::Result::Err(A::Error::duplicate_field(
11630                                    "multiple values for update_time",
11631                                ));
11632                            }
11633                            result.update_time =
11634                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
11635                        }
11636                        __FieldTag::Unknown(key) => {
11637                            let value = map.next_value::<serde_json::Value>()?;
11638                            result._unknown_fields.insert(key, value);
11639                        }
11640                    }
11641                }
11642                std::result::Result::Ok(result)
11643            }
11644        }
11645        deserializer.deserialize_any(Visitor)
11646    }
11647}
11648
11649#[doc(hidden)]
11650impl serde::ser::Serialize for LogExclusion {
11651    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11652    where
11653        S: serde::ser::Serializer,
11654    {
11655        use serde::ser::SerializeMap;
11656        #[allow(unused_imports)]
11657        use std::option::Option::Some;
11658        let mut state = serializer.serialize_map(std::option::Option::None)?;
11659        if !self.name.is_empty() {
11660            state.serialize_entry("name", &self.name)?;
11661        }
11662        if !self.description.is_empty() {
11663            state.serialize_entry("description", &self.description)?;
11664        }
11665        if !self.filter.is_empty() {
11666            state.serialize_entry("filter", &self.filter)?;
11667        }
11668        if !wkt::internal::is_default(&self.disabled) {
11669            state.serialize_entry("disabled", &self.disabled)?;
11670        }
11671        if self.create_time.is_some() {
11672            state.serialize_entry("createTime", &self.create_time)?;
11673        }
11674        if self.update_time.is_some() {
11675            state.serialize_entry("updateTime", &self.update_time)?;
11676        }
11677        if !self._unknown_fields.is_empty() {
11678            for (key, value) in self._unknown_fields.iter() {
11679                state.serialize_entry(key, &value)?;
11680            }
11681        }
11682        state.end()
11683    }
11684}
11685
11686impl std::fmt::Debug for LogExclusion {
11687    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11688        let mut debug_struct = f.debug_struct("LogExclusion");
11689        debug_struct.field("name", &self.name);
11690        debug_struct.field("description", &self.description);
11691        debug_struct.field("filter", &self.filter);
11692        debug_struct.field("disabled", &self.disabled);
11693        debug_struct.field("create_time", &self.create_time);
11694        debug_struct.field("update_time", &self.update_time);
11695        if !self._unknown_fields.is_empty() {
11696            debug_struct.field("_unknown_fields", &self._unknown_fields);
11697        }
11698        debug_struct.finish()
11699    }
11700}
11701
11702/// The parameters to `ListExclusions`.
11703#[derive(Clone, Default, PartialEq)]
11704#[non_exhaustive]
11705pub struct ListExclusionsRequest {
11706    /// Required. The parent resource whose exclusions are to be listed.
11707    ///
11708    /// ```norust
11709    /// "projects/[PROJECT_ID]"
11710    /// "organizations/[ORGANIZATION_ID]"
11711    /// "billingAccounts/[BILLING_ACCOUNT_ID]"
11712    /// "folders/[FOLDER_ID]"
11713    /// ```
11714    pub parent: std::string::String,
11715
11716    /// Optional. If present, then retrieve the next batch of results from the
11717    /// preceding call to this method. `pageToken` must be the value of
11718    /// `nextPageToken` from the previous response. The values of other method
11719    /// parameters should be identical to those in the previous call.
11720    pub page_token: std::string::String,
11721
11722    /// Optional. The maximum number of results to return from this request.
11723    /// Non-positive values are ignored. The presence of `nextPageToken` in the
11724    /// response indicates that more results might be available.
11725    pub page_size: i32,
11726
11727    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11728}
11729
11730impl ListExclusionsRequest {
11731    pub fn new() -> Self {
11732        std::default::Default::default()
11733    }
11734
11735    /// Sets the value of [parent][crate::model::ListExclusionsRequest::parent].
11736    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11737        self.parent = v.into();
11738        self
11739    }
11740
11741    /// Sets the value of [page_token][crate::model::ListExclusionsRequest::page_token].
11742    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11743        self.page_token = v.into();
11744        self
11745    }
11746
11747    /// Sets the value of [page_size][crate::model::ListExclusionsRequest::page_size].
11748    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11749        self.page_size = v.into();
11750        self
11751    }
11752}
11753
11754impl wkt::message::Message for ListExclusionsRequest {
11755    fn typename() -> &'static str {
11756        "type.googleapis.com/google.logging.v2.ListExclusionsRequest"
11757    }
11758}
11759
11760#[doc(hidden)]
11761impl<'de> serde::de::Deserialize<'de> for ListExclusionsRequest {
11762    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11763    where
11764        D: serde::Deserializer<'de>,
11765    {
11766        #[allow(non_camel_case_types)]
11767        #[doc(hidden)]
11768        #[derive(PartialEq, Eq, Hash)]
11769        enum __FieldTag {
11770            __parent,
11771            __page_token,
11772            __page_size,
11773            Unknown(std::string::String),
11774        }
11775        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11776            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11777            where
11778                D: serde::Deserializer<'de>,
11779            {
11780                struct Visitor;
11781                impl<'de> serde::de::Visitor<'de> for Visitor {
11782                    type Value = __FieldTag;
11783                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11784                        formatter.write_str("a field name for ListExclusionsRequest")
11785                    }
11786                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11787                    where
11788                        E: serde::de::Error,
11789                    {
11790                        use std::result::Result::Ok;
11791                        use std::string::ToString;
11792                        match value {
11793                            "parent" => Ok(__FieldTag::__parent),
11794                            "pageToken" => Ok(__FieldTag::__page_token),
11795                            "page_token" => Ok(__FieldTag::__page_token),
11796                            "pageSize" => Ok(__FieldTag::__page_size),
11797                            "page_size" => Ok(__FieldTag::__page_size),
11798                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11799                        }
11800                    }
11801                }
11802                deserializer.deserialize_identifier(Visitor)
11803            }
11804        }
11805        struct Visitor;
11806        impl<'de> serde::de::Visitor<'de> for Visitor {
11807            type Value = ListExclusionsRequest;
11808            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11809                formatter.write_str("struct ListExclusionsRequest")
11810            }
11811            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11812            where
11813                A: serde::de::MapAccess<'de>,
11814            {
11815                #[allow(unused_imports)]
11816                use serde::de::Error;
11817                use std::option::Option::Some;
11818                let mut fields = std::collections::HashSet::new();
11819                let mut result = Self::Value::new();
11820                while let Some(tag) = map.next_key::<__FieldTag>()? {
11821                    #[allow(clippy::match_single_binding)]
11822                    match tag {
11823                        __FieldTag::__parent => {
11824                            if !fields.insert(__FieldTag::__parent) {
11825                                return std::result::Result::Err(A::Error::duplicate_field(
11826                                    "multiple values for parent",
11827                                ));
11828                            }
11829                            result.parent = map
11830                                .next_value::<std::option::Option<std::string::String>>()?
11831                                .unwrap_or_default();
11832                        }
11833                        __FieldTag::__page_token => {
11834                            if !fields.insert(__FieldTag::__page_token) {
11835                                return std::result::Result::Err(A::Error::duplicate_field(
11836                                    "multiple values for page_token",
11837                                ));
11838                            }
11839                            result.page_token = map
11840                                .next_value::<std::option::Option<std::string::String>>()?
11841                                .unwrap_or_default();
11842                        }
11843                        __FieldTag::__page_size => {
11844                            if !fields.insert(__FieldTag::__page_size) {
11845                                return std::result::Result::Err(A::Error::duplicate_field(
11846                                    "multiple values for page_size",
11847                                ));
11848                            }
11849                            struct __With(std::option::Option<i32>);
11850                            impl<'de> serde::de::Deserialize<'de> for __With {
11851                                fn deserialize<D>(
11852                                    deserializer: D,
11853                                ) -> std::result::Result<Self, D::Error>
11854                                where
11855                                    D: serde::de::Deserializer<'de>,
11856                                {
11857                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
11858                                }
11859                            }
11860                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
11861                        }
11862                        __FieldTag::Unknown(key) => {
11863                            let value = map.next_value::<serde_json::Value>()?;
11864                            result._unknown_fields.insert(key, value);
11865                        }
11866                    }
11867                }
11868                std::result::Result::Ok(result)
11869            }
11870        }
11871        deserializer.deserialize_any(Visitor)
11872    }
11873}
11874
11875#[doc(hidden)]
11876impl serde::ser::Serialize for ListExclusionsRequest {
11877    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11878    where
11879        S: serde::ser::Serializer,
11880    {
11881        use serde::ser::SerializeMap;
11882        #[allow(unused_imports)]
11883        use std::option::Option::Some;
11884        let mut state = serializer.serialize_map(std::option::Option::None)?;
11885        if !self.parent.is_empty() {
11886            state.serialize_entry("parent", &self.parent)?;
11887        }
11888        if !self.page_token.is_empty() {
11889            state.serialize_entry("pageToken", &self.page_token)?;
11890        }
11891        if !wkt::internal::is_default(&self.page_size) {
11892            struct __With<'a>(&'a i32);
11893            impl<'a> serde::ser::Serialize for __With<'a> {
11894                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11895                where
11896                    S: serde::ser::Serializer,
11897                {
11898                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
11899                }
11900            }
11901            state.serialize_entry("pageSize", &__With(&self.page_size))?;
11902        }
11903        if !self._unknown_fields.is_empty() {
11904            for (key, value) in self._unknown_fields.iter() {
11905                state.serialize_entry(key, &value)?;
11906            }
11907        }
11908        state.end()
11909    }
11910}
11911
11912impl std::fmt::Debug for ListExclusionsRequest {
11913    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11914        let mut debug_struct = f.debug_struct("ListExclusionsRequest");
11915        debug_struct.field("parent", &self.parent);
11916        debug_struct.field("page_token", &self.page_token);
11917        debug_struct.field("page_size", &self.page_size);
11918        if !self._unknown_fields.is_empty() {
11919            debug_struct.field("_unknown_fields", &self._unknown_fields);
11920        }
11921        debug_struct.finish()
11922    }
11923}
11924
11925/// Result returned from `ListExclusions`.
11926#[derive(Clone, Default, PartialEq)]
11927#[non_exhaustive]
11928pub struct ListExclusionsResponse {
11929    /// A list of exclusions.
11930    pub exclusions: std::vec::Vec<crate::model::LogExclusion>,
11931
11932    /// If there might be more results than appear in this response, then
11933    /// `nextPageToken` is included. To get the next set of results, call the same
11934    /// method again using the value of `nextPageToken` as `pageToken`.
11935    pub next_page_token: std::string::String,
11936
11937    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11938}
11939
11940impl ListExclusionsResponse {
11941    pub fn new() -> Self {
11942        std::default::Default::default()
11943    }
11944
11945    /// Sets the value of [exclusions][crate::model::ListExclusionsResponse::exclusions].
11946    pub fn set_exclusions<T, V>(mut self, v: T) -> Self
11947    where
11948        T: std::iter::IntoIterator<Item = V>,
11949        V: std::convert::Into<crate::model::LogExclusion>,
11950    {
11951        use std::iter::Iterator;
11952        self.exclusions = v.into_iter().map(|i| i.into()).collect();
11953        self
11954    }
11955
11956    /// Sets the value of [next_page_token][crate::model::ListExclusionsResponse::next_page_token].
11957    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11958        self.next_page_token = v.into();
11959        self
11960    }
11961}
11962
11963impl wkt::message::Message for ListExclusionsResponse {
11964    fn typename() -> &'static str {
11965        "type.googleapis.com/google.logging.v2.ListExclusionsResponse"
11966    }
11967}
11968
11969#[doc(hidden)]
11970impl gax::paginator::internal::PageableResponse for ListExclusionsResponse {
11971    type PageItem = crate::model::LogExclusion;
11972
11973    fn items(self) -> std::vec::Vec<Self::PageItem> {
11974        self.exclusions
11975    }
11976
11977    fn next_page_token(&self) -> std::string::String {
11978        use std::clone::Clone;
11979        self.next_page_token.clone()
11980    }
11981}
11982
11983#[doc(hidden)]
11984impl<'de> serde::de::Deserialize<'de> for ListExclusionsResponse {
11985    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11986    where
11987        D: serde::Deserializer<'de>,
11988    {
11989        #[allow(non_camel_case_types)]
11990        #[doc(hidden)]
11991        #[derive(PartialEq, Eq, Hash)]
11992        enum __FieldTag {
11993            __exclusions,
11994            __next_page_token,
11995            Unknown(std::string::String),
11996        }
11997        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11998            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11999            where
12000                D: serde::Deserializer<'de>,
12001            {
12002                struct Visitor;
12003                impl<'de> serde::de::Visitor<'de> for Visitor {
12004                    type Value = __FieldTag;
12005                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12006                        formatter.write_str("a field name for ListExclusionsResponse")
12007                    }
12008                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12009                    where
12010                        E: serde::de::Error,
12011                    {
12012                        use std::result::Result::Ok;
12013                        use std::string::ToString;
12014                        match value {
12015                            "exclusions" => Ok(__FieldTag::__exclusions),
12016                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
12017                            "next_page_token" => Ok(__FieldTag::__next_page_token),
12018                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12019                        }
12020                    }
12021                }
12022                deserializer.deserialize_identifier(Visitor)
12023            }
12024        }
12025        struct Visitor;
12026        impl<'de> serde::de::Visitor<'de> for Visitor {
12027            type Value = ListExclusionsResponse;
12028            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12029                formatter.write_str("struct ListExclusionsResponse")
12030            }
12031            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12032            where
12033                A: serde::de::MapAccess<'de>,
12034            {
12035                #[allow(unused_imports)]
12036                use serde::de::Error;
12037                use std::option::Option::Some;
12038                let mut fields = std::collections::HashSet::new();
12039                let mut result = Self::Value::new();
12040                while let Some(tag) = map.next_key::<__FieldTag>()? {
12041                    #[allow(clippy::match_single_binding)]
12042                    match tag {
12043                        __FieldTag::__exclusions => {
12044                            if !fields.insert(__FieldTag::__exclusions) {
12045                                return std::result::Result::Err(A::Error::duplicate_field(
12046                                    "multiple values for exclusions",
12047                                ));
12048                            }
12049                            result.exclusions = map.next_value::<std::option::Option<std::vec::Vec<crate::model::LogExclusion>>>()?.unwrap_or_default();
12050                        }
12051                        __FieldTag::__next_page_token => {
12052                            if !fields.insert(__FieldTag::__next_page_token) {
12053                                return std::result::Result::Err(A::Error::duplicate_field(
12054                                    "multiple values for next_page_token",
12055                                ));
12056                            }
12057                            result.next_page_token = map
12058                                .next_value::<std::option::Option<std::string::String>>()?
12059                                .unwrap_or_default();
12060                        }
12061                        __FieldTag::Unknown(key) => {
12062                            let value = map.next_value::<serde_json::Value>()?;
12063                            result._unknown_fields.insert(key, value);
12064                        }
12065                    }
12066                }
12067                std::result::Result::Ok(result)
12068            }
12069        }
12070        deserializer.deserialize_any(Visitor)
12071    }
12072}
12073
12074#[doc(hidden)]
12075impl serde::ser::Serialize for ListExclusionsResponse {
12076    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12077    where
12078        S: serde::ser::Serializer,
12079    {
12080        use serde::ser::SerializeMap;
12081        #[allow(unused_imports)]
12082        use std::option::Option::Some;
12083        let mut state = serializer.serialize_map(std::option::Option::None)?;
12084        if !self.exclusions.is_empty() {
12085            state.serialize_entry("exclusions", &self.exclusions)?;
12086        }
12087        if !self.next_page_token.is_empty() {
12088            state.serialize_entry("nextPageToken", &self.next_page_token)?;
12089        }
12090        if !self._unknown_fields.is_empty() {
12091            for (key, value) in self._unknown_fields.iter() {
12092                state.serialize_entry(key, &value)?;
12093            }
12094        }
12095        state.end()
12096    }
12097}
12098
12099impl std::fmt::Debug for ListExclusionsResponse {
12100    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12101        let mut debug_struct = f.debug_struct("ListExclusionsResponse");
12102        debug_struct.field("exclusions", &self.exclusions);
12103        debug_struct.field("next_page_token", &self.next_page_token);
12104        if !self._unknown_fields.is_empty() {
12105            debug_struct.field("_unknown_fields", &self._unknown_fields);
12106        }
12107        debug_struct.finish()
12108    }
12109}
12110
12111/// The parameters to `GetExclusion`.
12112#[derive(Clone, Default, PartialEq)]
12113#[non_exhaustive]
12114pub struct GetExclusionRequest {
12115    /// Required. The resource name of an existing exclusion:
12116    ///
12117    /// ```norust
12118    /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
12119    /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
12120    /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
12121    /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
12122    /// ```
12123    ///
12124    /// For example:
12125    ///
12126    /// `"projects/my-project/exclusions/my-exclusion"`
12127    pub name: std::string::String,
12128
12129    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12130}
12131
12132impl GetExclusionRequest {
12133    pub fn new() -> Self {
12134        std::default::Default::default()
12135    }
12136
12137    /// Sets the value of [name][crate::model::GetExclusionRequest::name].
12138    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12139        self.name = v.into();
12140        self
12141    }
12142}
12143
12144impl wkt::message::Message for GetExclusionRequest {
12145    fn typename() -> &'static str {
12146        "type.googleapis.com/google.logging.v2.GetExclusionRequest"
12147    }
12148}
12149
12150#[doc(hidden)]
12151impl<'de> serde::de::Deserialize<'de> for GetExclusionRequest {
12152    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12153    where
12154        D: serde::Deserializer<'de>,
12155    {
12156        #[allow(non_camel_case_types)]
12157        #[doc(hidden)]
12158        #[derive(PartialEq, Eq, Hash)]
12159        enum __FieldTag {
12160            __name,
12161            Unknown(std::string::String),
12162        }
12163        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12164            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12165            where
12166                D: serde::Deserializer<'de>,
12167            {
12168                struct Visitor;
12169                impl<'de> serde::de::Visitor<'de> for Visitor {
12170                    type Value = __FieldTag;
12171                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12172                        formatter.write_str("a field name for GetExclusionRequest")
12173                    }
12174                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12175                    where
12176                        E: serde::de::Error,
12177                    {
12178                        use std::result::Result::Ok;
12179                        use std::string::ToString;
12180                        match value {
12181                            "name" => Ok(__FieldTag::__name),
12182                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12183                        }
12184                    }
12185                }
12186                deserializer.deserialize_identifier(Visitor)
12187            }
12188        }
12189        struct Visitor;
12190        impl<'de> serde::de::Visitor<'de> for Visitor {
12191            type Value = GetExclusionRequest;
12192            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12193                formatter.write_str("struct GetExclusionRequest")
12194            }
12195            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12196            where
12197                A: serde::de::MapAccess<'de>,
12198            {
12199                #[allow(unused_imports)]
12200                use serde::de::Error;
12201                use std::option::Option::Some;
12202                let mut fields = std::collections::HashSet::new();
12203                let mut result = Self::Value::new();
12204                while let Some(tag) = map.next_key::<__FieldTag>()? {
12205                    #[allow(clippy::match_single_binding)]
12206                    match tag {
12207                        __FieldTag::__name => {
12208                            if !fields.insert(__FieldTag::__name) {
12209                                return std::result::Result::Err(A::Error::duplicate_field(
12210                                    "multiple values for name",
12211                                ));
12212                            }
12213                            result.name = map
12214                                .next_value::<std::option::Option<std::string::String>>()?
12215                                .unwrap_or_default();
12216                        }
12217                        __FieldTag::Unknown(key) => {
12218                            let value = map.next_value::<serde_json::Value>()?;
12219                            result._unknown_fields.insert(key, value);
12220                        }
12221                    }
12222                }
12223                std::result::Result::Ok(result)
12224            }
12225        }
12226        deserializer.deserialize_any(Visitor)
12227    }
12228}
12229
12230#[doc(hidden)]
12231impl serde::ser::Serialize for GetExclusionRequest {
12232    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12233    where
12234        S: serde::ser::Serializer,
12235    {
12236        use serde::ser::SerializeMap;
12237        #[allow(unused_imports)]
12238        use std::option::Option::Some;
12239        let mut state = serializer.serialize_map(std::option::Option::None)?;
12240        if !self.name.is_empty() {
12241            state.serialize_entry("name", &self.name)?;
12242        }
12243        if !self._unknown_fields.is_empty() {
12244            for (key, value) in self._unknown_fields.iter() {
12245                state.serialize_entry(key, &value)?;
12246            }
12247        }
12248        state.end()
12249    }
12250}
12251
12252impl std::fmt::Debug for GetExclusionRequest {
12253    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12254        let mut debug_struct = f.debug_struct("GetExclusionRequest");
12255        debug_struct.field("name", &self.name);
12256        if !self._unknown_fields.is_empty() {
12257            debug_struct.field("_unknown_fields", &self._unknown_fields);
12258        }
12259        debug_struct.finish()
12260    }
12261}
12262
12263/// The parameters to `CreateExclusion`.
12264#[derive(Clone, Default, PartialEq)]
12265#[non_exhaustive]
12266pub struct CreateExclusionRequest {
12267    /// Required. The parent resource in which to create the exclusion:
12268    ///
12269    /// ```norust
12270    /// "projects/[PROJECT_ID]"
12271    /// "organizations/[ORGANIZATION_ID]"
12272    /// "billingAccounts/[BILLING_ACCOUNT_ID]"
12273    /// "folders/[FOLDER_ID]"
12274    /// ```
12275    ///
12276    /// For examples:
12277    ///
12278    /// `"projects/my-logging-project"`
12279    /// `"organizations/123456789"`
12280    pub parent: std::string::String,
12281
12282    /// Required. The new exclusion, whose `name` parameter is an exclusion name
12283    /// that is not already used in the parent resource.
12284    pub exclusion: std::option::Option<crate::model::LogExclusion>,
12285
12286    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12287}
12288
12289impl CreateExclusionRequest {
12290    pub fn new() -> Self {
12291        std::default::Default::default()
12292    }
12293
12294    /// Sets the value of [parent][crate::model::CreateExclusionRequest::parent].
12295    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12296        self.parent = v.into();
12297        self
12298    }
12299
12300    /// Sets the value of [exclusion][crate::model::CreateExclusionRequest::exclusion].
12301    pub fn set_exclusion<T>(mut self, v: T) -> Self
12302    where
12303        T: std::convert::Into<crate::model::LogExclusion>,
12304    {
12305        self.exclusion = std::option::Option::Some(v.into());
12306        self
12307    }
12308
12309    /// Sets or clears the value of [exclusion][crate::model::CreateExclusionRequest::exclusion].
12310    pub fn set_or_clear_exclusion<T>(mut self, v: std::option::Option<T>) -> Self
12311    where
12312        T: std::convert::Into<crate::model::LogExclusion>,
12313    {
12314        self.exclusion = v.map(|x| x.into());
12315        self
12316    }
12317}
12318
12319impl wkt::message::Message for CreateExclusionRequest {
12320    fn typename() -> &'static str {
12321        "type.googleapis.com/google.logging.v2.CreateExclusionRequest"
12322    }
12323}
12324
12325#[doc(hidden)]
12326impl<'de> serde::de::Deserialize<'de> for CreateExclusionRequest {
12327    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12328    where
12329        D: serde::Deserializer<'de>,
12330    {
12331        #[allow(non_camel_case_types)]
12332        #[doc(hidden)]
12333        #[derive(PartialEq, Eq, Hash)]
12334        enum __FieldTag {
12335            __parent,
12336            __exclusion,
12337            Unknown(std::string::String),
12338        }
12339        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12340            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12341            where
12342                D: serde::Deserializer<'de>,
12343            {
12344                struct Visitor;
12345                impl<'de> serde::de::Visitor<'de> for Visitor {
12346                    type Value = __FieldTag;
12347                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12348                        formatter.write_str("a field name for CreateExclusionRequest")
12349                    }
12350                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12351                    where
12352                        E: serde::de::Error,
12353                    {
12354                        use std::result::Result::Ok;
12355                        use std::string::ToString;
12356                        match value {
12357                            "parent" => Ok(__FieldTag::__parent),
12358                            "exclusion" => Ok(__FieldTag::__exclusion),
12359                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12360                        }
12361                    }
12362                }
12363                deserializer.deserialize_identifier(Visitor)
12364            }
12365        }
12366        struct Visitor;
12367        impl<'de> serde::de::Visitor<'de> for Visitor {
12368            type Value = CreateExclusionRequest;
12369            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12370                formatter.write_str("struct CreateExclusionRequest")
12371            }
12372            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12373            where
12374                A: serde::de::MapAccess<'de>,
12375            {
12376                #[allow(unused_imports)]
12377                use serde::de::Error;
12378                use std::option::Option::Some;
12379                let mut fields = std::collections::HashSet::new();
12380                let mut result = Self::Value::new();
12381                while let Some(tag) = map.next_key::<__FieldTag>()? {
12382                    #[allow(clippy::match_single_binding)]
12383                    match tag {
12384                        __FieldTag::__parent => {
12385                            if !fields.insert(__FieldTag::__parent) {
12386                                return std::result::Result::Err(A::Error::duplicate_field(
12387                                    "multiple values for parent",
12388                                ));
12389                            }
12390                            result.parent = map
12391                                .next_value::<std::option::Option<std::string::String>>()?
12392                                .unwrap_or_default();
12393                        }
12394                        __FieldTag::__exclusion => {
12395                            if !fields.insert(__FieldTag::__exclusion) {
12396                                return std::result::Result::Err(A::Error::duplicate_field(
12397                                    "multiple values for exclusion",
12398                                ));
12399                            }
12400                            result.exclusion = map
12401                                .next_value::<std::option::Option<crate::model::LogExclusion>>()?;
12402                        }
12403                        __FieldTag::Unknown(key) => {
12404                            let value = map.next_value::<serde_json::Value>()?;
12405                            result._unknown_fields.insert(key, value);
12406                        }
12407                    }
12408                }
12409                std::result::Result::Ok(result)
12410            }
12411        }
12412        deserializer.deserialize_any(Visitor)
12413    }
12414}
12415
12416#[doc(hidden)]
12417impl serde::ser::Serialize for CreateExclusionRequest {
12418    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12419    where
12420        S: serde::ser::Serializer,
12421    {
12422        use serde::ser::SerializeMap;
12423        #[allow(unused_imports)]
12424        use std::option::Option::Some;
12425        let mut state = serializer.serialize_map(std::option::Option::None)?;
12426        if !self.parent.is_empty() {
12427            state.serialize_entry("parent", &self.parent)?;
12428        }
12429        if self.exclusion.is_some() {
12430            state.serialize_entry("exclusion", &self.exclusion)?;
12431        }
12432        if !self._unknown_fields.is_empty() {
12433            for (key, value) in self._unknown_fields.iter() {
12434                state.serialize_entry(key, &value)?;
12435            }
12436        }
12437        state.end()
12438    }
12439}
12440
12441impl std::fmt::Debug for CreateExclusionRequest {
12442    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12443        let mut debug_struct = f.debug_struct("CreateExclusionRequest");
12444        debug_struct.field("parent", &self.parent);
12445        debug_struct.field("exclusion", &self.exclusion);
12446        if !self._unknown_fields.is_empty() {
12447            debug_struct.field("_unknown_fields", &self._unknown_fields);
12448        }
12449        debug_struct.finish()
12450    }
12451}
12452
12453/// The parameters to `UpdateExclusion`.
12454#[derive(Clone, Default, PartialEq)]
12455#[non_exhaustive]
12456pub struct UpdateExclusionRequest {
12457    /// Required. The resource name of the exclusion to update:
12458    ///
12459    /// ```norust
12460    /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
12461    /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
12462    /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
12463    /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
12464    /// ```
12465    ///
12466    /// For example:
12467    ///
12468    /// `"projects/my-project/exclusions/my-exclusion"`
12469    pub name: std::string::String,
12470
12471    /// Required. New values for the existing exclusion. Only the fields specified
12472    /// in `update_mask` are relevant.
12473    pub exclusion: std::option::Option<crate::model::LogExclusion>,
12474
12475    /// Required. A non-empty list of fields to change in the existing exclusion.
12476    /// New values for the fields are taken from the corresponding fields in the
12477    /// [LogExclusion][google.logging.v2.LogExclusion] included in this request.
12478    /// Fields not mentioned in `update_mask` are not changed and are ignored in
12479    /// the request.
12480    ///
12481    /// For example, to change the filter and description of an exclusion,
12482    /// specify an `update_mask` of `"filter,description"`.
12483    ///
12484    /// [google.logging.v2.LogExclusion]: crate::model::LogExclusion
12485    pub update_mask: std::option::Option<wkt::FieldMask>,
12486
12487    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12488}
12489
12490impl UpdateExclusionRequest {
12491    pub fn new() -> Self {
12492        std::default::Default::default()
12493    }
12494
12495    /// Sets the value of [name][crate::model::UpdateExclusionRequest::name].
12496    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12497        self.name = v.into();
12498        self
12499    }
12500
12501    /// Sets the value of [exclusion][crate::model::UpdateExclusionRequest::exclusion].
12502    pub fn set_exclusion<T>(mut self, v: T) -> Self
12503    where
12504        T: std::convert::Into<crate::model::LogExclusion>,
12505    {
12506        self.exclusion = std::option::Option::Some(v.into());
12507        self
12508    }
12509
12510    /// Sets or clears the value of [exclusion][crate::model::UpdateExclusionRequest::exclusion].
12511    pub fn set_or_clear_exclusion<T>(mut self, v: std::option::Option<T>) -> Self
12512    where
12513        T: std::convert::Into<crate::model::LogExclusion>,
12514    {
12515        self.exclusion = v.map(|x| x.into());
12516        self
12517    }
12518
12519    /// Sets the value of [update_mask][crate::model::UpdateExclusionRequest::update_mask].
12520    pub fn set_update_mask<T>(mut self, v: T) -> Self
12521    where
12522        T: std::convert::Into<wkt::FieldMask>,
12523    {
12524        self.update_mask = std::option::Option::Some(v.into());
12525        self
12526    }
12527
12528    /// Sets or clears the value of [update_mask][crate::model::UpdateExclusionRequest::update_mask].
12529    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12530    where
12531        T: std::convert::Into<wkt::FieldMask>,
12532    {
12533        self.update_mask = v.map(|x| x.into());
12534        self
12535    }
12536}
12537
12538impl wkt::message::Message for UpdateExclusionRequest {
12539    fn typename() -> &'static str {
12540        "type.googleapis.com/google.logging.v2.UpdateExclusionRequest"
12541    }
12542}
12543
12544#[doc(hidden)]
12545impl<'de> serde::de::Deserialize<'de> for UpdateExclusionRequest {
12546    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12547    where
12548        D: serde::Deserializer<'de>,
12549    {
12550        #[allow(non_camel_case_types)]
12551        #[doc(hidden)]
12552        #[derive(PartialEq, Eq, Hash)]
12553        enum __FieldTag {
12554            __name,
12555            __exclusion,
12556            __update_mask,
12557            Unknown(std::string::String),
12558        }
12559        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12560            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12561            where
12562                D: serde::Deserializer<'de>,
12563            {
12564                struct Visitor;
12565                impl<'de> serde::de::Visitor<'de> for Visitor {
12566                    type Value = __FieldTag;
12567                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12568                        formatter.write_str("a field name for UpdateExclusionRequest")
12569                    }
12570                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12571                    where
12572                        E: serde::de::Error,
12573                    {
12574                        use std::result::Result::Ok;
12575                        use std::string::ToString;
12576                        match value {
12577                            "name" => Ok(__FieldTag::__name),
12578                            "exclusion" => Ok(__FieldTag::__exclusion),
12579                            "updateMask" => Ok(__FieldTag::__update_mask),
12580                            "update_mask" => Ok(__FieldTag::__update_mask),
12581                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12582                        }
12583                    }
12584                }
12585                deserializer.deserialize_identifier(Visitor)
12586            }
12587        }
12588        struct Visitor;
12589        impl<'de> serde::de::Visitor<'de> for Visitor {
12590            type Value = UpdateExclusionRequest;
12591            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12592                formatter.write_str("struct UpdateExclusionRequest")
12593            }
12594            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12595            where
12596                A: serde::de::MapAccess<'de>,
12597            {
12598                #[allow(unused_imports)]
12599                use serde::de::Error;
12600                use std::option::Option::Some;
12601                let mut fields = std::collections::HashSet::new();
12602                let mut result = Self::Value::new();
12603                while let Some(tag) = map.next_key::<__FieldTag>()? {
12604                    #[allow(clippy::match_single_binding)]
12605                    match tag {
12606                        __FieldTag::__name => {
12607                            if !fields.insert(__FieldTag::__name) {
12608                                return std::result::Result::Err(A::Error::duplicate_field(
12609                                    "multiple values for name",
12610                                ));
12611                            }
12612                            result.name = map
12613                                .next_value::<std::option::Option<std::string::String>>()?
12614                                .unwrap_or_default();
12615                        }
12616                        __FieldTag::__exclusion => {
12617                            if !fields.insert(__FieldTag::__exclusion) {
12618                                return std::result::Result::Err(A::Error::duplicate_field(
12619                                    "multiple values for exclusion",
12620                                ));
12621                            }
12622                            result.exclusion = map
12623                                .next_value::<std::option::Option<crate::model::LogExclusion>>()?;
12624                        }
12625                        __FieldTag::__update_mask => {
12626                            if !fields.insert(__FieldTag::__update_mask) {
12627                                return std::result::Result::Err(A::Error::duplicate_field(
12628                                    "multiple values for update_mask",
12629                                ));
12630                            }
12631                            result.update_mask =
12632                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
12633                        }
12634                        __FieldTag::Unknown(key) => {
12635                            let value = map.next_value::<serde_json::Value>()?;
12636                            result._unknown_fields.insert(key, value);
12637                        }
12638                    }
12639                }
12640                std::result::Result::Ok(result)
12641            }
12642        }
12643        deserializer.deserialize_any(Visitor)
12644    }
12645}
12646
12647#[doc(hidden)]
12648impl serde::ser::Serialize for UpdateExclusionRequest {
12649    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12650    where
12651        S: serde::ser::Serializer,
12652    {
12653        use serde::ser::SerializeMap;
12654        #[allow(unused_imports)]
12655        use std::option::Option::Some;
12656        let mut state = serializer.serialize_map(std::option::Option::None)?;
12657        if !self.name.is_empty() {
12658            state.serialize_entry("name", &self.name)?;
12659        }
12660        if self.exclusion.is_some() {
12661            state.serialize_entry("exclusion", &self.exclusion)?;
12662        }
12663        if self.update_mask.is_some() {
12664            state.serialize_entry("updateMask", &self.update_mask)?;
12665        }
12666        if !self._unknown_fields.is_empty() {
12667            for (key, value) in self._unknown_fields.iter() {
12668                state.serialize_entry(key, &value)?;
12669            }
12670        }
12671        state.end()
12672    }
12673}
12674
12675impl std::fmt::Debug for UpdateExclusionRequest {
12676    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12677        let mut debug_struct = f.debug_struct("UpdateExclusionRequest");
12678        debug_struct.field("name", &self.name);
12679        debug_struct.field("exclusion", &self.exclusion);
12680        debug_struct.field("update_mask", &self.update_mask);
12681        if !self._unknown_fields.is_empty() {
12682            debug_struct.field("_unknown_fields", &self._unknown_fields);
12683        }
12684        debug_struct.finish()
12685    }
12686}
12687
12688/// The parameters to `DeleteExclusion`.
12689#[derive(Clone, Default, PartialEq)]
12690#[non_exhaustive]
12691pub struct DeleteExclusionRequest {
12692    /// Required. The resource name of an existing exclusion to delete:
12693    ///
12694    /// ```norust
12695    /// "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
12696    /// "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
12697    /// "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
12698    /// "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
12699    /// ```
12700    ///
12701    /// For example:
12702    ///
12703    /// `"projects/my-project/exclusions/my-exclusion"`
12704    pub name: std::string::String,
12705
12706    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12707}
12708
12709impl DeleteExclusionRequest {
12710    pub fn new() -> Self {
12711        std::default::Default::default()
12712    }
12713
12714    /// Sets the value of [name][crate::model::DeleteExclusionRequest::name].
12715    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12716        self.name = v.into();
12717        self
12718    }
12719}
12720
12721impl wkt::message::Message for DeleteExclusionRequest {
12722    fn typename() -> &'static str {
12723        "type.googleapis.com/google.logging.v2.DeleteExclusionRequest"
12724    }
12725}
12726
12727#[doc(hidden)]
12728impl<'de> serde::de::Deserialize<'de> for DeleteExclusionRequest {
12729    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12730    where
12731        D: serde::Deserializer<'de>,
12732    {
12733        #[allow(non_camel_case_types)]
12734        #[doc(hidden)]
12735        #[derive(PartialEq, Eq, Hash)]
12736        enum __FieldTag {
12737            __name,
12738            Unknown(std::string::String),
12739        }
12740        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12741            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12742            where
12743                D: serde::Deserializer<'de>,
12744            {
12745                struct Visitor;
12746                impl<'de> serde::de::Visitor<'de> for Visitor {
12747                    type Value = __FieldTag;
12748                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12749                        formatter.write_str("a field name for DeleteExclusionRequest")
12750                    }
12751                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12752                    where
12753                        E: serde::de::Error,
12754                    {
12755                        use std::result::Result::Ok;
12756                        use std::string::ToString;
12757                        match value {
12758                            "name" => Ok(__FieldTag::__name),
12759                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12760                        }
12761                    }
12762                }
12763                deserializer.deserialize_identifier(Visitor)
12764            }
12765        }
12766        struct Visitor;
12767        impl<'de> serde::de::Visitor<'de> for Visitor {
12768            type Value = DeleteExclusionRequest;
12769            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12770                formatter.write_str("struct DeleteExclusionRequest")
12771            }
12772            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12773            where
12774                A: serde::de::MapAccess<'de>,
12775            {
12776                #[allow(unused_imports)]
12777                use serde::de::Error;
12778                use std::option::Option::Some;
12779                let mut fields = std::collections::HashSet::new();
12780                let mut result = Self::Value::new();
12781                while let Some(tag) = map.next_key::<__FieldTag>()? {
12782                    #[allow(clippy::match_single_binding)]
12783                    match tag {
12784                        __FieldTag::__name => {
12785                            if !fields.insert(__FieldTag::__name) {
12786                                return std::result::Result::Err(A::Error::duplicate_field(
12787                                    "multiple values for name",
12788                                ));
12789                            }
12790                            result.name = map
12791                                .next_value::<std::option::Option<std::string::String>>()?
12792                                .unwrap_or_default();
12793                        }
12794                        __FieldTag::Unknown(key) => {
12795                            let value = map.next_value::<serde_json::Value>()?;
12796                            result._unknown_fields.insert(key, value);
12797                        }
12798                    }
12799                }
12800                std::result::Result::Ok(result)
12801            }
12802        }
12803        deserializer.deserialize_any(Visitor)
12804    }
12805}
12806
12807#[doc(hidden)]
12808impl serde::ser::Serialize for DeleteExclusionRequest {
12809    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12810    where
12811        S: serde::ser::Serializer,
12812    {
12813        use serde::ser::SerializeMap;
12814        #[allow(unused_imports)]
12815        use std::option::Option::Some;
12816        let mut state = serializer.serialize_map(std::option::Option::None)?;
12817        if !self.name.is_empty() {
12818            state.serialize_entry("name", &self.name)?;
12819        }
12820        if !self._unknown_fields.is_empty() {
12821            for (key, value) in self._unknown_fields.iter() {
12822                state.serialize_entry(key, &value)?;
12823            }
12824        }
12825        state.end()
12826    }
12827}
12828
12829impl std::fmt::Debug for DeleteExclusionRequest {
12830    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12831        let mut debug_struct = f.debug_struct("DeleteExclusionRequest");
12832        debug_struct.field("name", &self.name);
12833        if !self._unknown_fields.is_empty() {
12834            debug_struct.field("_unknown_fields", &self._unknown_fields);
12835        }
12836        debug_struct.finish()
12837    }
12838}
12839
12840/// The parameters to
12841/// [GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings].
12842///
12843/// See [Enabling CMEK for Log
12844/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
12845/// more information.
12846///
12847/// [google.logging.v2.ConfigServiceV2.GetCmekSettings]: crate::client::ConfigServiceV2::get_cmek_settings
12848#[derive(Clone, Default, PartialEq)]
12849#[non_exhaustive]
12850pub struct GetCmekSettingsRequest {
12851    /// Required. The resource for which to retrieve CMEK settings.
12852    ///
12853    /// ```norust
12854    /// "projects/[PROJECT_ID]/cmekSettings"
12855    /// "organizations/[ORGANIZATION_ID]/cmekSettings"
12856    /// "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
12857    /// "folders/[FOLDER_ID]/cmekSettings"
12858    /// ```
12859    ///
12860    /// For example:
12861    ///
12862    /// `"organizations/12345/cmekSettings"`
12863    ///
12864    /// Note: CMEK for the Log Router can be configured for Google Cloud projects,
12865    /// folders, organizations and billing accounts. Once configured for an
12866    /// organization, it applies to all projects and folders in the Google Cloud
12867    /// organization.
12868    pub name: std::string::String,
12869
12870    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12871}
12872
12873impl GetCmekSettingsRequest {
12874    pub fn new() -> Self {
12875        std::default::Default::default()
12876    }
12877
12878    /// Sets the value of [name][crate::model::GetCmekSettingsRequest::name].
12879    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12880        self.name = v.into();
12881        self
12882    }
12883}
12884
12885impl wkt::message::Message for GetCmekSettingsRequest {
12886    fn typename() -> &'static str {
12887        "type.googleapis.com/google.logging.v2.GetCmekSettingsRequest"
12888    }
12889}
12890
12891#[doc(hidden)]
12892impl<'de> serde::de::Deserialize<'de> for GetCmekSettingsRequest {
12893    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12894    where
12895        D: serde::Deserializer<'de>,
12896    {
12897        #[allow(non_camel_case_types)]
12898        #[doc(hidden)]
12899        #[derive(PartialEq, Eq, Hash)]
12900        enum __FieldTag {
12901            __name,
12902            Unknown(std::string::String),
12903        }
12904        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12905            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12906            where
12907                D: serde::Deserializer<'de>,
12908            {
12909                struct Visitor;
12910                impl<'de> serde::de::Visitor<'de> for Visitor {
12911                    type Value = __FieldTag;
12912                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12913                        formatter.write_str("a field name for GetCmekSettingsRequest")
12914                    }
12915                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12916                    where
12917                        E: serde::de::Error,
12918                    {
12919                        use std::result::Result::Ok;
12920                        use std::string::ToString;
12921                        match value {
12922                            "name" => Ok(__FieldTag::__name),
12923                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12924                        }
12925                    }
12926                }
12927                deserializer.deserialize_identifier(Visitor)
12928            }
12929        }
12930        struct Visitor;
12931        impl<'de> serde::de::Visitor<'de> for Visitor {
12932            type Value = GetCmekSettingsRequest;
12933            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12934                formatter.write_str("struct GetCmekSettingsRequest")
12935            }
12936            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12937            where
12938                A: serde::de::MapAccess<'de>,
12939            {
12940                #[allow(unused_imports)]
12941                use serde::de::Error;
12942                use std::option::Option::Some;
12943                let mut fields = std::collections::HashSet::new();
12944                let mut result = Self::Value::new();
12945                while let Some(tag) = map.next_key::<__FieldTag>()? {
12946                    #[allow(clippy::match_single_binding)]
12947                    match tag {
12948                        __FieldTag::__name => {
12949                            if !fields.insert(__FieldTag::__name) {
12950                                return std::result::Result::Err(A::Error::duplicate_field(
12951                                    "multiple values for name",
12952                                ));
12953                            }
12954                            result.name = map
12955                                .next_value::<std::option::Option<std::string::String>>()?
12956                                .unwrap_or_default();
12957                        }
12958                        __FieldTag::Unknown(key) => {
12959                            let value = map.next_value::<serde_json::Value>()?;
12960                            result._unknown_fields.insert(key, value);
12961                        }
12962                    }
12963                }
12964                std::result::Result::Ok(result)
12965            }
12966        }
12967        deserializer.deserialize_any(Visitor)
12968    }
12969}
12970
12971#[doc(hidden)]
12972impl serde::ser::Serialize for GetCmekSettingsRequest {
12973    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12974    where
12975        S: serde::ser::Serializer,
12976    {
12977        use serde::ser::SerializeMap;
12978        #[allow(unused_imports)]
12979        use std::option::Option::Some;
12980        let mut state = serializer.serialize_map(std::option::Option::None)?;
12981        if !self.name.is_empty() {
12982            state.serialize_entry("name", &self.name)?;
12983        }
12984        if !self._unknown_fields.is_empty() {
12985            for (key, value) in self._unknown_fields.iter() {
12986                state.serialize_entry(key, &value)?;
12987            }
12988        }
12989        state.end()
12990    }
12991}
12992
12993impl std::fmt::Debug for GetCmekSettingsRequest {
12994    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12995        let mut debug_struct = f.debug_struct("GetCmekSettingsRequest");
12996        debug_struct.field("name", &self.name);
12997        if !self._unknown_fields.is_empty() {
12998            debug_struct.field("_unknown_fields", &self._unknown_fields);
12999        }
13000        debug_struct.finish()
13001    }
13002}
13003
13004/// The parameters to
13005/// [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings].
13006///
13007/// See [Enabling CMEK for Log
13008/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
13009/// more information.
13010///
13011/// [google.logging.v2.ConfigServiceV2.UpdateCmekSettings]: crate::client::ConfigServiceV2::update_cmek_settings
13012#[derive(Clone, Default, PartialEq)]
13013#[non_exhaustive]
13014pub struct UpdateCmekSettingsRequest {
13015    /// Required. The resource name for the CMEK settings to update.
13016    ///
13017    /// ```norust
13018    /// "projects/[PROJECT_ID]/cmekSettings"
13019    /// "organizations/[ORGANIZATION_ID]/cmekSettings"
13020    /// "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
13021    /// "folders/[FOLDER_ID]/cmekSettings"
13022    /// ```
13023    ///
13024    /// For example:
13025    ///
13026    /// `"organizations/12345/cmekSettings"`
13027    ///
13028    /// Note: CMEK for the Log Router can currently only be configured for Google
13029    /// Cloud organizations. Once configured, it applies to all projects and
13030    /// folders in the Google Cloud organization.
13031    pub name: std::string::String,
13032
13033    /// Required. The CMEK settings to update.
13034    ///
13035    /// See [Enabling CMEK for Log
13036    /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
13037    /// for more information.
13038    pub cmek_settings: std::option::Option<crate::model::CmekSettings>,
13039
13040    /// Optional. Field mask identifying which fields from `cmek_settings` should
13041    /// be updated. A field will be overwritten if and only if it is in the update
13042    /// mask. Output only fields cannot be updated.
13043    ///
13044    /// See [FieldMask][google.protobuf.FieldMask] for more information.
13045    ///
13046    /// For example: `"updateMask=kmsKeyName"`
13047    ///
13048    /// [google.protobuf.FieldMask]: wkt::FieldMask
13049    pub update_mask: std::option::Option<wkt::FieldMask>,
13050
13051    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13052}
13053
13054impl UpdateCmekSettingsRequest {
13055    pub fn new() -> Self {
13056        std::default::Default::default()
13057    }
13058
13059    /// Sets the value of [name][crate::model::UpdateCmekSettingsRequest::name].
13060    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13061        self.name = v.into();
13062        self
13063    }
13064
13065    /// Sets the value of [cmek_settings][crate::model::UpdateCmekSettingsRequest::cmek_settings].
13066    pub fn set_cmek_settings<T>(mut self, v: T) -> Self
13067    where
13068        T: std::convert::Into<crate::model::CmekSettings>,
13069    {
13070        self.cmek_settings = std::option::Option::Some(v.into());
13071        self
13072    }
13073
13074    /// Sets or clears the value of [cmek_settings][crate::model::UpdateCmekSettingsRequest::cmek_settings].
13075    pub fn set_or_clear_cmek_settings<T>(mut self, v: std::option::Option<T>) -> Self
13076    where
13077        T: std::convert::Into<crate::model::CmekSettings>,
13078    {
13079        self.cmek_settings = v.map(|x| x.into());
13080        self
13081    }
13082
13083    /// Sets the value of [update_mask][crate::model::UpdateCmekSettingsRequest::update_mask].
13084    pub fn set_update_mask<T>(mut self, v: T) -> Self
13085    where
13086        T: std::convert::Into<wkt::FieldMask>,
13087    {
13088        self.update_mask = std::option::Option::Some(v.into());
13089        self
13090    }
13091
13092    /// Sets or clears the value of [update_mask][crate::model::UpdateCmekSettingsRequest::update_mask].
13093    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13094    where
13095        T: std::convert::Into<wkt::FieldMask>,
13096    {
13097        self.update_mask = v.map(|x| x.into());
13098        self
13099    }
13100}
13101
13102impl wkt::message::Message for UpdateCmekSettingsRequest {
13103    fn typename() -> &'static str {
13104        "type.googleapis.com/google.logging.v2.UpdateCmekSettingsRequest"
13105    }
13106}
13107
13108#[doc(hidden)]
13109impl<'de> serde::de::Deserialize<'de> for UpdateCmekSettingsRequest {
13110    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13111    where
13112        D: serde::Deserializer<'de>,
13113    {
13114        #[allow(non_camel_case_types)]
13115        #[doc(hidden)]
13116        #[derive(PartialEq, Eq, Hash)]
13117        enum __FieldTag {
13118            __name,
13119            __cmek_settings,
13120            __update_mask,
13121            Unknown(std::string::String),
13122        }
13123        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13124            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13125            where
13126                D: serde::Deserializer<'de>,
13127            {
13128                struct Visitor;
13129                impl<'de> serde::de::Visitor<'de> for Visitor {
13130                    type Value = __FieldTag;
13131                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13132                        formatter.write_str("a field name for UpdateCmekSettingsRequest")
13133                    }
13134                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13135                    where
13136                        E: serde::de::Error,
13137                    {
13138                        use std::result::Result::Ok;
13139                        use std::string::ToString;
13140                        match value {
13141                            "name" => Ok(__FieldTag::__name),
13142                            "cmekSettings" => Ok(__FieldTag::__cmek_settings),
13143                            "cmek_settings" => Ok(__FieldTag::__cmek_settings),
13144                            "updateMask" => Ok(__FieldTag::__update_mask),
13145                            "update_mask" => Ok(__FieldTag::__update_mask),
13146                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13147                        }
13148                    }
13149                }
13150                deserializer.deserialize_identifier(Visitor)
13151            }
13152        }
13153        struct Visitor;
13154        impl<'de> serde::de::Visitor<'de> for Visitor {
13155            type Value = UpdateCmekSettingsRequest;
13156            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13157                formatter.write_str("struct UpdateCmekSettingsRequest")
13158            }
13159            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13160            where
13161                A: serde::de::MapAccess<'de>,
13162            {
13163                #[allow(unused_imports)]
13164                use serde::de::Error;
13165                use std::option::Option::Some;
13166                let mut fields = std::collections::HashSet::new();
13167                let mut result = Self::Value::new();
13168                while let Some(tag) = map.next_key::<__FieldTag>()? {
13169                    #[allow(clippy::match_single_binding)]
13170                    match tag {
13171                        __FieldTag::__name => {
13172                            if !fields.insert(__FieldTag::__name) {
13173                                return std::result::Result::Err(A::Error::duplicate_field(
13174                                    "multiple values for name",
13175                                ));
13176                            }
13177                            result.name = map
13178                                .next_value::<std::option::Option<std::string::String>>()?
13179                                .unwrap_or_default();
13180                        }
13181                        __FieldTag::__cmek_settings => {
13182                            if !fields.insert(__FieldTag::__cmek_settings) {
13183                                return std::result::Result::Err(A::Error::duplicate_field(
13184                                    "multiple values for cmek_settings",
13185                                ));
13186                            }
13187                            result.cmek_settings = map
13188                                .next_value::<std::option::Option<crate::model::CmekSettings>>()?;
13189                        }
13190                        __FieldTag::__update_mask => {
13191                            if !fields.insert(__FieldTag::__update_mask) {
13192                                return std::result::Result::Err(A::Error::duplicate_field(
13193                                    "multiple values for update_mask",
13194                                ));
13195                            }
13196                            result.update_mask =
13197                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
13198                        }
13199                        __FieldTag::Unknown(key) => {
13200                            let value = map.next_value::<serde_json::Value>()?;
13201                            result._unknown_fields.insert(key, value);
13202                        }
13203                    }
13204                }
13205                std::result::Result::Ok(result)
13206            }
13207        }
13208        deserializer.deserialize_any(Visitor)
13209    }
13210}
13211
13212#[doc(hidden)]
13213impl serde::ser::Serialize for UpdateCmekSettingsRequest {
13214    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13215    where
13216        S: serde::ser::Serializer,
13217    {
13218        use serde::ser::SerializeMap;
13219        #[allow(unused_imports)]
13220        use std::option::Option::Some;
13221        let mut state = serializer.serialize_map(std::option::Option::None)?;
13222        if !self.name.is_empty() {
13223            state.serialize_entry("name", &self.name)?;
13224        }
13225        if self.cmek_settings.is_some() {
13226            state.serialize_entry("cmekSettings", &self.cmek_settings)?;
13227        }
13228        if self.update_mask.is_some() {
13229            state.serialize_entry("updateMask", &self.update_mask)?;
13230        }
13231        if !self._unknown_fields.is_empty() {
13232            for (key, value) in self._unknown_fields.iter() {
13233                state.serialize_entry(key, &value)?;
13234            }
13235        }
13236        state.end()
13237    }
13238}
13239
13240impl std::fmt::Debug for UpdateCmekSettingsRequest {
13241    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13242        let mut debug_struct = f.debug_struct("UpdateCmekSettingsRequest");
13243        debug_struct.field("name", &self.name);
13244        debug_struct.field("cmek_settings", &self.cmek_settings);
13245        debug_struct.field("update_mask", &self.update_mask);
13246        if !self._unknown_fields.is_empty() {
13247            debug_struct.field("_unknown_fields", &self._unknown_fields);
13248        }
13249        debug_struct.finish()
13250    }
13251}
13252
13253/// Describes the customer-managed encryption key (CMEK) settings associated with
13254/// a project, folder, organization, billing account, or flexible resource.
13255///
13256/// Note: CMEK for the Log Router can currently only be configured for Google
13257/// Cloud organizations. Once configured, it applies to all projects and folders
13258/// in the Google Cloud organization.
13259///
13260/// See [Enabling CMEK for Log
13261/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
13262/// more information.
13263#[derive(Clone, Default, PartialEq)]
13264#[non_exhaustive]
13265pub struct CmekSettings {
13266    /// Output only. The resource name of the CMEK settings.
13267    pub name: std::string::String,
13268
13269    /// The resource name for the configured Cloud KMS key.
13270    ///
13271    /// KMS key name format:
13272    ///
13273    /// ```norust
13274    /// "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]"
13275    /// ```
13276    ///
13277    /// For example:
13278    ///
13279    /// `"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"`
13280    ///
13281    /// To enable CMEK for the Log Router, set this field to a valid
13282    /// `kms_key_name` for which the associated service account has the required
13283    /// cloudkms.cryptoKeyEncrypterDecrypter roles assigned for the key.
13284    ///
13285    /// The Cloud KMS key used by the Log Router can be updated by changing the
13286    /// `kms_key_name` to a new valid key name or disabled by setting the key name
13287    /// to an empty string. Encryption operations that are in progress will be
13288    /// completed with the key that was in use when they started. Decryption
13289    /// operations will be completed using the key that was used at the time of
13290    /// encryption unless access to that key has been revoked.
13291    ///
13292    /// To disable CMEK for the Log Router, set this field to an empty string.
13293    ///
13294    /// See [Enabling CMEK for Log
13295    /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
13296    /// for more information.
13297    pub kms_key_name: std::string::String,
13298
13299    /// The CryptoKeyVersion resource name for the configured Cloud KMS key.
13300    ///
13301    /// KMS key name format:
13302    ///
13303    /// ```norust
13304    /// "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]/cryptoKeyVersions/[VERSION]"
13305    /// ```
13306    ///
13307    /// For example:
13308    ///
13309    /// `"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key/cryptoKeyVersions/1"`
13310    ///
13311    /// This is a read-only field used to convey the specific configured
13312    /// CryptoKeyVersion of `kms_key` that has been configured. It will be
13313    /// populated in cases where the CMEK settings are bound to a single key
13314    /// version.
13315    ///
13316    /// If this field is populated, the `kms_key` is tied to a specific
13317    /// CryptoKeyVersion.
13318    pub kms_key_version_name: std::string::String,
13319
13320    /// Output only. The service account that will be used by the Log Router to
13321    /// access your Cloud KMS key.
13322    ///
13323    /// Before enabling CMEK for Log Router, you must first assign the
13324    /// cloudkms.cryptoKeyEncrypterDecrypter role to the service account that
13325    /// the Log Router will use to access your Cloud KMS key. Use
13326    /// [GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings] to
13327    /// obtain the service account ID.
13328    ///
13329    /// See [Enabling CMEK for Log
13330    /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
13331    /// for more information.
13332    ///
13333    /// [google.logging.v2.ConfigServiceV2.GetCmekSettings]: crate::client::ConfigServiceV2::get_cmek_settings
13334    pub service_account_id: std::string::String,
13335
13336    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13337}
13338
13339impl CmekSettings {
13340    pub fn new() -> Self {
13341        std::default::Default::default()
13342    }
13343
13344    /// Sets the value of [name][crate::model::CmekSettings::name].
13345    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13346        self.name = v.into();
13347        self
13348    }
13349
13350    /// Sets the value of [kms_key_name][crate::model::CmekSettings::kms_key_name].
13351    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13352        self.kms_key_name = v.into();
13353        self
13354    }
13355
13356    /// Sets the value of [kms_key_version_name][crate::model::CmekSettings::kms_key_version_name].
13357    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
13358        mut self,
13359        v: T,
13360    ) -> Self {
13361        self.kms_key_version_name = v.into();
13362        self
13363    }
13364
13365    /// Sets the value of [service_account_id][crate::model::CmekSettings::service_account_id].
13366    pub fn set_service_account_id<T: std::convert::Into<std::string::String>>(
13367        mut self,
13368        v: T,
13369    ) -> Self {
13370        self.service_account_id = v.into();
13371        self
13372    }
13373}
13374
13375impl wkt::message::Message for CmekSettings {
13376    fn typename() -> &'static str {
13377        "type.googleapis.com/google.logging.v2.CmekSettings"
13378    }
13379}
13380
13381#[doc(hidden)]
13382impl<'de> serde::de::Deserialize<'de> for CmekSettings {
13383    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13384    where
13385        D: serde::Deserializer<'de>,
13386    {
13387        #[allow(non_camel_case_types)]
13388        #[doc(hidden)]
13389        #[derive(PartialEq, Eq, Hash)]
13390        enum __FieldTag {
13391            __name,
13392            __kms_key_name,
13393            __kms_key_version_name,
13394            __service_account_id,
13395            Unknown(std::string::String),
13396        }
13397        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13398            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13399            where
13400                D: serde::Deserializer<'de>,
13401            {
13402                struct Visitor;
13403                impl<'de> serde::de::Visitor<'de> for Visitor {
13404                    type Value = __FieldTag;
13405                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13406                        formatter.write_str("a field name for CmekSettings")
13407                    }
13408                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13409                    where
13410                        E: serde::de::Error,
13411                    {
13412                        use std::result::Result::Ok;
13413                        use std::string::ToString;
13414                        match value {
13415                            "name" => Ok(__FieldTag::__name),
13416                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
13417                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
13418                            "kmsKeyVersionName" => Ok(__FieldTag::__kms_key_version_name),
13419                            "kms_key_version_name" => Ok(__FieldTag::__kms_key_version_name),
13420                            "serviceAccountId" => Ok(__FieldTag::__service_account_id),
13421                            "service_account_id" => Ok(__FieldTag::__service_account_id),
13422                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13423                        }
13424                    }
13425                }
13426                deserializer.deserialize_identifier(Visitor)
13427            }
13428        }
13429        struct Visitor;
13430        impl<'de> serde::de::Visitor<'de> for Visitor {
13431            type Value = CmekSettings;
13432            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13433                formatter.write_str("struct CmekSettings")
13434            }
13435            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13436            where
13437                A: serde::de::MapAccess<'de>,
13438            {
13439                #[allow(unused_imports)]
13440                use serde::de::Error;
13441                use std::option::Option::Some;
13442                let mut fields = std::collections::HashSet::new();
13443                let mut result = Self::Value::new();
13444                while let Some(tag) = map.next_key::<__FieldTag>()? {
13445                    #[allow(clippy::match_single_binding)]
13446                    match tag {
13447                        __FieldTag::__name => {
13448                            if !fields.insert(__FieldTag::__name) {
13449                                return std::result::Result::Err(A::Error::duplicate_field(
13450                                    "multiple values for name",
13451                                ));
13452                            }
13453                            result.name = map
13454                                .next_value::<std::option::Option<std::string::String>>()?
13455                                .unwrap_or_default();
13456                        }
13457                        __FieldTag::__kms_key_name => {
13458                            if !fields.insert(__FieldTag::__kms_key_name) {
13459                                return std::result::Result::Err(A::Error::duplicate_field(
13460                                    "multiple values for kms_key_name",
13461                                ));
13462                            }
13463                            result.kms_key_name = map
13464                                .next_value::<std::option::Option<std::string::String>>()?
13465                                .unwrap_or_default();
13466                        }
13467                        __FieldTag::__kms_key_version_name => {
13468                            if !fields.insert(__FieldTag::__kms_key_version_name) {
13469                                return std::result::Result::Err(A::Error::duplicate_field(
13470                                    "multiple values for kms_key_version_name",
13471                                ));
13472                            }
13473                            result.kms_key_version_name = map
13474                                .next_value::<std::option::Option<std::string::String>>()?
13475                                .unwrap_or_default();
13476                        }
13477                        __FieldTag::__service_account_id => {
13478                            if !fields.insert(__FieldTag::__service_account_id) {
13479                                return std::result::Result::Err(A::Error::duplicate_field(
13480                                    "multiple values for service_account_id",
13481                                ));
13482                            }
13483                            result.service_account_id = map
13484                                .next_value::<std::option::Option<std::string::String>>()?
13485                                .unwrap_or_default();
13486                        }
13487                        __FieldTag::Unknown(key) => {
13488                            let value = map.next_value::<serde_json::Value>()?;
13489                            result._unknown_fields.insert(key, value);
13490                        }
13491                    }
13492                }
13493                std::result::Result::Ok(result)
13494            }
13495        }
13496        deserializer.deserialize_any(Visitor)
13497    }
13498}
13499
13500#[doc(hidden)]
13501impl serde::ser::Serialize for CmekSettings {
13502    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13503    where
13504        S: serde::ser::Serializer,
13505    {
13506        use serde::ser::SerializeMap;
13507        #[allow(unused_imports)]
13508        use std::option::Option::Some;
13509        let mut state = serializer.serialize_map(std::option::Option::None)?;
13510        if !self.name.is_empty() {
13511            state.serialize_entry("name", &self.name)?;
13512        }
13513        if !self.kms_key_name.is_empty() {
13514            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
13515        }
13516        if !self.kms_key_version_name.is_empty() {
13517            state.serialize_entry("kmsKeyVersionName", &self.kms_key_version_name)?;
13518        }
13519        if !self.service_account_id.is_empty() {
13520            state.serialize_entry("serviceAccountId", &self.service_account_id)?;
13521        }
13522        if !self._unknown_fields.is_empty() {
13523            for (key, value) in self._unknown_fields.iter() {
13524                state.serialize_entry(key, &value)?;
13525            }
13526        }
13527        state.end()
13528    }
13529}
13530
13531impl std::fmt::Debug for CmekSettings {
13532    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13533        let mut debug_struct = f.debug_struct("CmekSettings");
13534        debug_struct.field("name", &self.name);
13535        debug_struct.field("kms_key_name", &self.kms_key_name);
13536        debug_struct.field("kms_key_version_name", &self.kms_key_version_name);
13537        debug_struct.field("service_account_id", &self.service_account_id);
13538        if !self._unknown_fields.is_empty() {
13539            debug_struct.field("_unknown_fields", &self._unknown_fields);
13540        }
13541        debug_struct.finish()
13542    }
13543}
13544
13545/// The parameters to
13546/// [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings].
13547///
13548/// See [Enabling CMEK for Log
13549/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
13550/// more information.
13551///
13552/// [google.logging.v2.ConfigServiceV2.GetSettings]: crate::client::ConfigServiceV2::get_settings
13553#[derive(Clone, Default, PartialEq)]
13554#[non_exhaustive]
13555pub struct GetSettingsRequest {
13556    /// Required. The resource for which to retrieve settings.
13557    ///
13558    /// ```norust
13559    /// "projects/[PROJECT_ID]/settings"
13560    /// "organizations/[ORGANIZATION_ID]/settings"
13561    /// "billingAccounts/[BILLING_ACCOUNT_ID]/settings"
13562    /// "folders/[FOLDER_ID]/settings"
13563    /// ```
13564    ///
13565    /// For example:
13566    ///
13567    /// `"organizations/12345/settings"`
13568    ///
13569    /// Note: Settings for the Log Router can be get for Google Cloud projects,
13570    /// folders, organizations and billing accounts. Currently it can only be
13571    /// configured for organizations. Once configured for an organization, it
13572    /// applies to all projects and folders in the Google Cloud organization.
13573    pub name: std::string::String,
13574
13575    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13576}
13577
13578impl GetSettingsRequest {
13579    pub fn new() -> Self {
13580        std::default::Default::default()
13581    }
13582
13583    /// Sets the value of [name][crate::model::GetSettingsRequest::name].
13584    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13585        self.name = v.into();
13586        self
13587    }
13588}
13589
13590impl wkt::message::Message for GetSettingsRequest {
13591    fn typename() -> &'static str {
13592        "type.googleapis.com/google.logging.v2.GetSettingsRequest"
13593    }
13594}
13595
13596#[doc(hidden)]
13597impl<'de> serde::de::Deserialize<'de> for GetSettingsRequest {
13598    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13599    where
13600        D: serde::Deserializer<'de>,
13601    {
13602        #[allow(non_camel_case_types)]
13603        #[doc(hidden)]
13604        #[derive(PartialEq, Eq, Hash)]
13605        enum __FieldTag {
13606            __name,
13607            Unknown(std::string::String),
13608        }
13609        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13610            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13611            where
13612                D: serde::Deserializer<'de>,
13613            {
13614                struct Visitor;
13615                impl<'de> serde::de::Visitor<'de> for Visitor {
13616                    type Value = __FieldTag;
13617                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13618                        formatter.write_str("a field name for GetSettingsRequest")
13619                    }
13620                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13621                    where
13622                        E: serde::de::Error,
13623                    {
13624                        use std::result::Result::Ok;
13625                        use std::string::ToString;
13626                        match value {
13627                            "name" => Ok(__FieldTag::__name),
13628                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13629                        }
13630                    }
13631                }
13632                deserializer.deserialize_identifier(Visitor)
13633            }
13634        }
13635        struct Visitor;
13636        impl<'de> serde::de::Visitor<'de> for Visitor {
13637            type Value = GetSettingsRequest;
13638            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13639                formatter.write_str("struct GetSettingsRequest")
13640            }
13641            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13642            where
13643                A: serde::de::MapAccess<'de>,
13644            {
13645                #[allow(unused_imports)]
13646                use serde::de::Error;
13647                use std::option::Option::Some;
13648                let mut fields = std::collections::HashSet::new();
13649                let mut result = Self::Value::new();
13650                while let Some(tag) = map.next_key::<__FieldTag>()? {
13651                    #[allow(clippy::match_single_binding)]
13652                    match tag {
13653                        __FieldTag::__name => {
13654                            if !fields.insert(__FieldTag::__name) {
13655                                return std::result::Result::Err(A::Error::duplicate_field(
13656                                    "multiple values for name",
13657                                ));
13658                            }
13659                            result.name = map
13660                                .next_value::<std::option::Option<std::string::String>>()?
13661                                .unwrap_or_default();
13662                        }
13663                        __FieldTag::Unknown(key) => {
13664                            let value = map.next_value::<serde_json::Value>()?;
13665                            result._unknown_fields.insert(key, value);
13666                        }
13667                    }
13668                }
13669                std::result::Result::Ok(result)
13670            }
13671        }
13672        deserializer.deserialize_any(Visitor)
13673    }
13674}
13675
13676#[doc(hidden)]
13677impl serde::ser::Serialize for GetSettingsRequest {
13678    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13679    where
13680        S: serde::ser::Serializer,
13681    {
13682        use serde::ser::SerializeMap;
13683        #[allow(unused_imports)]
13684        use std::option::Option::Some;
13685        let mut state = serializer.serialize_map(std::option::Option::None)?;
13686        if !self.name.is_empty() {
13687            state.serialize_entry("name", &self.name)?;
13688        }
13689        if !self._unknown_fields.is_empty() {
13690            for (key, value) in self._unknown_fields.iter() {
13691                state.serialize_entry(key, &value)?;
13692            }
13693        }
13694        state.end()
13695    }
13696}
13697
13698impl std::fmt::Debug for GetSettingsRequest {
13699    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13700        let mut debug_struct = f.debug_struct("GetSettingsRequest");
13701        debug_struct.field("name", &self.name);
13702        if !self._unknown_fields.is_empty() {
13703            debug_struct.field("_unknown_fields", &self._unknown_fields);
13704        }
13705        debug_struct.finish()
13706    }
13707}
13708
13709/// The parameters to
13710/// [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings].
13711///
13712/// See [Enabling CMEK for Log
13713/// Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for
13714/// more information.
13715///
13716/// [google.logging.v2.ConfigServiceV2.UpdateSettings]: crate::client::ConfigServiceV2::update_settings
13717#[derive(Clone, Default, PartialEq)]
13718#[non_exhaustive]
13719pub struct UpdateSettingsRequest {
13720    /// Required. The resource name for the settings to update.
13721    ///
13722    /// ```norust
13723    /// "organizations/[ORGANIZATION_ID]/settings"
13724    /// ```
13725    ///
13726    /// For example:
13727    ///
13728    /// `"organizations/12345/settings"`
13729    ///
13730    /// Note: Settings for the Log Router can currently only be configured for
13731    /// Google Cloud organizations. Once configured, it applies to all projects and
13732    /// folders in the Google Cloud organization.
13733    pub name: std::string::String,
13734
13735    /// Required. The settings to update.
13736    ///
13737    /// See [Enabling CMEK for Log
13738    /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
13739    /// for more information.
13740    pub settings: std::option::Option<crate::model::Settings>,
13741
13742    /// Optional. Field mask identifying which fields from `settings` should
13743    /// be updated. A field will be overwritten if and only if it is in the update
13744    /// mask. Output only fields cannot be updated.
13745    ///
13746    /// See [FieldMask][google.protobuf.FieldMask] for more information.
13747    ///
13748    /// For example: `"updateMask=kmsKeyName"`
13749    ///
13750    /// [google.protobuf.FieldMask]: wkt::FieldMask
13751    pub update_mask: std::option::Option<wkt::FieldMask>,
13752
13753    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13754}
13755
13756impl UpdateSettingsRequest {
13757    pub fn new() -> Self {
13758        std::default::Default::default()
13759    }
13760
13761    /// Sets the value of [name][crate::model::UpdateSettingsRequest::name].
13762    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13763        self.name = v.into();
13764        self
13765    }
13766
13767    /// Sets the value of [settings][crate::model::UpdateSettingsRequest::settings].
13768    pub fn set_settings<T>(mut self, v: T) -> Self
13769    where
13770        T: std::convert::Into<crate::model::Settings>,
13771    {
13772        self.settings = std::option::Option::Some(v.into());
13773        self
13774    }
13775
13776    /// Sets or clears the value of [settings][crate::model::UpdateSettingsRequest::settings].
13777    pub fn set_or_clear_settings<T>(mut self, v: std::option::Option<T>) -> Self
13778    where
13779        T: std::convert::Into<crate::model::Settings>,
13780    {
13781        self.settings = v.map(|x| x.into());
13782        self
13783    }
13784
13785    /// Sets the value of [update_mask][crate::model::UpdateSettingsRequest::update_mask].
13786    pub fn set_update_mask<T>(mut self, v: T) -> Self
13787    where
13788        T: std::convert::Into<wkt::FieldMask>,
13789    {
13790        self.update_mask = std::option::Option::Some(v.into());
13791        self
13792    }
13793
13794    /// Sets or clears the value of [update_mask][crate::model::UpdateSettingsRequest::update_mask].
13795    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13796    where
13797        T: std::convert::Into<wkt::FieldMask>,
13798    {
13799        self.update_mask = v.map(|x| x.into());
13800        self
13801    }
13802}
13803
13804impl wkt::message::Message for UpdateSettingsRequest {
13805    fn typename() -> &'static str {
13806        "type.googleapis.com/google.logging.v2.UpdateSettingsRequest"
13807    }
13808}
13809
13810#[doc(hidden)]
13811impl<'de> serde::de::Deserialize<'de> for UpdateSettingsRequest {
13812    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13813    where
13814        D: serde::Deserializer<'de>,
13815    {
13816        #[allow(non_camel_case_types)]
13817        #[doc(hidden)]
13818        #[derive(PartialEq, Eq, Hash)]
13819        enum __FieldTag {
13820            __name,
13821            __settings,
13822            __update_mask,
13823            Unknown(std::string::String),
13824        }
13825        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13826            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13827            where
13828                D: serde::Deserializer<'de>,
13829            {
13830                struct Visitor;
13831                impl<'de> serde::de::Visitor<'de> for Visitor {
13832                    type Value = __FieldTag;
13833                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13834                        formatter.write_str("a field name for UpdateSettingsRequest")
13835                    }
13836                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13837                    where
13838                        E: serde::de::Error,
13839                    {
13840                        use std::result::Result::Ok;
13841                        use std::string::ToString;
13842                        match value {
13843                            "name" => Ok(__FieldTag::__name),
13844                            "settings" => Ok(__FieldTag::__settings),
13845                            "updateMask" => Ok(__FieldTag::__update_mask),
13846                            "update_mask" => Ok(__FieldTag::__update_mask),
13847                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13848                        }
13849                    }
13850                }
13851                deserializer.deserialize_identifier(Visitor)
13852            }
13853        }
13854        struct Visitor;
13855        impl<'de> serde::de::Visitor<'de> for Visitor {
13856            type Value = UpdateSettingsRequest;
13857            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13858                formatter.write_str("struct UpdateSettingsRequest")
13859            }
13860            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13861            where
13862                A: serde::de::MapAccess<'de>,
13863            {
13864                #[allow(unused_imports)]
13865                use serde::de::Error;
13866                use std::option::Option::Some;
13867                let mut fields = std::collections::HashSet::new();
13868                let mut result = Self::Value::new();
13869                while let Some(tag) = map.next_key::<__FieldTag>()? {
13870                    #[allow(clippy::match_single_binding)]
13871                    match tag {
13872                        __FieldTag::__name => {
13873                            if !fields.insert(__FieldTag::__name) {
13874                                return std::result::Result::Err(A::Error::duplicate_field(
13875                                    "multiple values for name",
13876                                ));
13877                            }
13878                            result.name = map
13879                                .next_value::<std::option::Option<std::string::String>>()?
13880                                .unwrap_or_default();
13881                        }
13882                        __FieldTag::__settings => {
13883                            if !fields.insert(__FieldTag::__settings) {
13884                                return std::result::Result::Err(A::Error::duplicate_field(
13885                                    "multiple values for settings",
13886                                ));
13887                            }
13888                            result.settings =
13889                                map.next_value::<std::option::Option<crate::model::Settings>>()?;
13890                        }
13891                        __FieldTag::__update_mask => {
13892                            if !fields.insert(__FieldTag::__update_mask) {
13893                                return std::result::Result::Err(A::Error::duplicate_field(
13894                                    "multiple values for update_mask",
13895                                ));
13896                            }
13897                            result.update_mask =
13898                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
13899                        }
13900                        __FieldTag::Unknown(key) => {
13901                            let value = map.next_value::<serde_json::Value>()?;
13902                            result._unknown_fields.insert(key, value);
13903                        }
13904                    }
13905                }
13906                std::result::Result::Ok(result)
13907            }
13908        }
13909        deserializer.deserialize_any(Visitor)
13910    }
13911}
13912
13913#[doc(hidden)]
13914impl serde::ser::Serialize for UpdateSettingsRequest {
13915    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13916    where
13917        S: serde::ser::Serializer,
13918    {
13919        use serde::ser::SerializeMap;
13920        #[allow(unused_imports)]
13921        use std::option::Option::Some;
13922        let mut state = serializer.serialize_map(std::option::Option::None)?;
13923        if !self.name.is_empty() {
13924            state.serialize_entry("name", &self.name)?;
13925        }
13926        if self.settings.is_some() {
13927            state.serialize_entry("settings", &self.settings)?;
13928        }
13929        if self.update_mask.is_some() {
13930            state.serialize_entry("updateMask", &self.update_mask)?;
13931        }
13932        if !self._unknown_fields.is_empty() {
13933            for (key, value) in self._unknown_fields.iter() {
13934                state.serialize_entry(key, &value)?;
13935            }
13936        }
13937        state.end()
13938    }
13939}
13940
13941impl std::fmt::Debug for UpdateSettingsRequest {
13942    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13943        let mut debug_struct = f.debug_struct("UpdateSettingsRequest");
13944        debug_struct.field("name", &self.name);
13945        debug_struct.field("settings", &self.settings);
13946        debug_struct.field("update_mask", &self.update_mask);
13947        if !self._unknown_fields.is_empty() {
13948            debug_struct.field("_unknown_fields", &self._unknown_fields);
13949        }
13950        debug_struct.finish()
13951    }
13952}
13953
13954/// Describes the settings associated with a project, folder, organization,
13955/// billing account, or flexible resource.
13956#[derive(Clone, Default, PartialEq)]
13957#[non_exhaustive]
13958pub struct Settings {
13959    /// Output only. The resource name of the settings.
13960    pub name: std::string::String,
13961
13962    /// Optional. The resource name for the configured Cloud KMS key.
13963    ///
13964    /// KMS key name format:
13965    ///
13966    /// ```norust
13967    /// "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]"
13968    /// ```
13969    ///
13970    /// For example:
13971    ///
13972    /// `"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"`
13973    ///
13974    /// To enable CMEK for the Log Router, set this field to a valid
13975    /// `kms_key_name` for which the associated service account has the required
13976    /// `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key.
13977    ///
13978    /// The Cloud KMS key used by the Log Router can be updated by changing the
13979    /// `kms_key_name` to a new valid key name. Encryption operations that are in
13980    /// progress will be completed with the key that was in use when they started.
13981    /// Decryption operations will be completed using the key that was used at the
13982    /// time of encryption unless access to that key has been revoked.
13983    ///
13984    /// To disable CMEK for the Log Router, set this field to an empty string.
13985    ///
13986    /// See [Enabling CMEK for Log
13987    /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
13988    /// for more information.
13989    pub kms_key_name: std::string::String,
13990
13991    /// Output only. The service account that will be used by the Log Router to
13992    /// access your Cloud KMS key.
13993    ///
13994    /// Before enabling CMEK for Log Router, you must first assign the role
13995    /// `roles/cloudkms.cryptoKeyEncrypterDecrypter` to the service account that
13996    /// the Log Router will use to access your Cloud KMS key. Use
13997    /// [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings] to
13998    /// obtain the service account ID.
13999    ///
14000    /// See [Enabling CMEK for Log
14001    /// Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
14002    /// for more information.
14003    ///
14004    /// [google.logging.v2.ConfigServiceV2.GetSettings]: crate::client::ConfigServiceV2::get_settings
14005    pub kms_service_account_id: std::string::String,
14006
14007    /// Optional. The Cloud region that will be used for _Default and _Required log
14008    /// buckets for newly created projects and folders. For example `europe-west1`.
14009    /// This setting does not affect the location of custom log buckets.
14010    pub storage_location: std::string::String,
14011
14012    /// Optional. If set to true, the _Default sink in newly created projects and
14013    /// folders will created in a disabled state. This can be used to automatically
14014    /// disable log ingestion if there is already an aggregated sink configured in
14015    /// the hierarchy. The _Default sink can be re-enabled manually if needed.
14016    pub disable_default_sink: bool,
14017
14018    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14019}
14020
14021impl Settings {
14022    pub fn new() -> Self {
14023        std::default::Default::default()
14024    }
14025
14026    /// Sets the value of [name][crate::model::Settings::name].
14027    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14028        self.name = v.into();
14029        self
14030    }
14031
14032    /// Sets the value of [kms_key_name][crate::model::Settings::kms_key_name].
14033    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14034        self.kms_key_name = v.into();
14035        self
14036    }
14037
14038    /// Sets the value of [kms_service_account_id][crate::model::Settings::kms_service_account_id].
14039    pub fn set_kms_service_account_id<T: std::convert::Into<std::string::String>>(
14040        mut self,
14041        v: T,
14042    ) -> Self {
14043        self.kms_service_account_id = v.into();
14044        self
14045    }
14046
14047    /// Sets the value of [storage_location][crate::model::Settings::storage_location].
14048    pub fn set_storage_location<T: std::convert::Into<std::string::String>>(
14049        mut self,
14050        v: T,
14051    ) -> Self {
14052        self.storage_location = v.into();
14053        self
14054    }
14055
14056    /// Sets the value of [disable_default_sink][crate::model::Settings::disable_default_sink].
14057    pub fn set_disable_default_sink<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14058        self.disable_default_sink = v.into();
14059        self
14060    }
14061}
14062
14063impl wkt::message::Message for Settings {
14064    fn typename() -> &'static str {
14065        "type.googleapis.com/google.logging.v2.Settings"
14066    }
14067}
14068
14069#[doc(hidden)]
14070impl<'de> serde::de::Deserialize<'de> for Settings {
14071    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14072    where
14073        D: serde::Deserializer<'de>,
14074    {
14075        #[allow(non_camel_case_types)]
14076        #[doc(hidden)]
14077        #[derive(PartialEq, Eq, Hash)]
14078        enum __FieldTag {
14079            __name,
14080            __kms_key_name,
14081            __kms_service_account_id,
14082            __storage_location,
14083            __disable_default_sink,
14084            Unknown(std::string::String),
14085        }
14086        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14087            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14088            where
14089                D: serde::Deserializer<'de>,
14090            {
14091                struct Visitor;
14092                impl<'de> serde::de::Visitor<'de> for Visitor {
14093                    type Value = __FieldTag;
14094                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14095                        formatter.write_str("a field name for Settings")
14096                    }
14097                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14098                    where
14099                        E: serde::de::Error,
14100                    {
14101                        use std::result::Result::Ok;
14102                        use std::string::ToString;
14103                        match value {
14104                            "name" => Ok(__FieldTag::__name),
14105                            "kmsKeyName" => Ok(__FieldTag::__kms_key_name),
14106                            "kms_key_name" => Ok(__FieldTag::__kms_key_name),
14107                            "kmsServiceAccountId" => Ok(__FieldTag::__kms_service_account_id),
14108                            "kms_service_account_id" => Ok(__FieldTag::__kms_service_account_id),
14109                            "storageLocation" => Ok(__FieldTag::__storage_location),
14110                            "storage_location" => Ok(__FieldTag::__storage_location),
14111                            "disableDefaultSink" => Ok(__FieldTag::__disable_default_sink),
14112                            "disable_default_sink" => Ok(__FieldTag::__disable_default_sink),
14113                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14114                        }
14115                    }
14116                }
14117                deserializer.deserialize_identifier(Visitor)
14118            }
14119        }
14120        struct Visitor;
14121        impl<'de> serde::de::Visitor<'de> for Visitor {
14122            type Value = Settings;
14123            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14124                formatter.write_str("struct Settings")
14125            }
14126            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14127            where
14128                A: serde::de::MapAccess<'de>,
14129            {
14130                #[allow(unused_imports)]
14131                use serde::de::Error;
14132                use std::option::Option::Some;
14133                let mut fields = std::collections::HashSet::new();
14134                let mut result = Self::Value::new();
14135                while let Some(tag) = map.next_key::<__FieldTag>()? {
14136                    #[allow(clippy::match_single_binding)]
14137                    match tag {
14138                        __FieldTag::__name => {
14139                            if !fields.insert(__FieldTag::__name) {
14140                                return std::result::Result::Err(A::Error::duplicate_field(
14141                                    "multiple values for name",
14142                                ));
14143                            }
14144                            result.name = map
14145                                .next_value::<std::option::Option<std::string::String>>()?
14146                                .unwrap_or_default();
14147                        }
14148                        __FieldTag::__kms_key_name => {
14149                            if !fields.insert(__FieldTag::__kms_key_name) {
14150                                return std::result::Result::Err(A::Error::duplicate_field(
14151                                    "multiple values for kms_key_name",
14152                                ));
14153                            }
14154                            result.kms_key_name = map
14155                                .next_value::<std::option::Option<std::string::String>>()?
14156                                .unwrap_or_default();
14157                        }
14158                        __FieldTag::__kms_service_account_id => {
14159                            if !fields.insert(__FieldTag::__kms_service_account_id) {
14160                                return std::result::Result::Err(A::Error::duplicate_field(
14161                                    "multiple values for kms_service_account_id",
14162                                ));
14163                            }
14164                            result.kms_service_account_id = map
14165                                .next_value::<std::option::Option<std::string::String>>()?
14166                                .unwrap_or_default();
14167                        }
14168                        __FieldTag::__storage_location => {
14169                            if !fields.insert(__FieldTag::__storage_location) {
14170                                return std::result::Result::Err(A::Error::duplicate_field(
14171                                    "multiple values for storage_location",
14172                                ));
14173                            }
14174                            result.storage_location = map
14175                                .next_value::<std::option::Option<std::string::String>>()?
14176                                .unwrap_or_default();
14177                        }
14178                        __FieldTag::__disable_default_sink => {
14179                            if !fields.insert(__FieldTag::__disable_default_sink) {
14180                                return std::result::Result::Err(A::Error::duplicate_field(
14181                                    "multiple values for disable_default_sink",
14182                                ));
14183                            }
14184                            result.disable_default_sink = map
14185                                .next_value::<std::option::Option<bool>>()?
14186                                .unwrap_or_default();
14187                        }
14188                        __FieldTag::Unknown(key) => {
14189                            let value = map.next_value::<serde_json::Value>()?;
14190                            result._unknown_fields.insert(key, value);
14191                        }
14192                    }
14193                }
14194                std::result::Result::Ok(result)
14195            }
14196        }
14197        deserializer.deserialize_any(Visitor)
14198    }
14199}
14200
14201#[doc(hidden)]
14202impl serde::ser::Serialize for Settings {
14203    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14204    where
14205        S: serde::ser::Serializer,
14206    {
14207        use serde::ser::SerializeMap;
14208        #[allow(unused_imports)]
14209        use std::option::Option::Some;
14210        let mut state = serializer.serialize_map(std::option::Option::None)?;
14211        if !self.name.is_empty() {
14212            state.serialize_entry("name", &self.name)?;
14213        }
14214        if !self.kms_key_name.is_empty() {
14215            state.serialize_entry("kmsKeyName", &self.kms_key_name)?;
14216        }
14217        if !self.kms_service_account_id.is_empty() {
14218            state.serialize_entry("kmsServiceAccountId", &self.kms_service_account_id)?;
14219        }
14220        if !self.storage_location.is_empty() {
14221            state.serialize_entry("storageLocation", &self.storage_location)?;
14222        }
14223        if !wkt::internal::is_default(&self.disable_default_sink) {
14224            state.serialize_entry("disableDefaultSink", &self.disable_default_sink)?;
14225        }
14226        if !self._unknown_fields.is_empty() {
14227            for (key, value) in self._unknown_fields.iter() {
14228                state.serialize_entry(key, &value)?;
14229            }
14230        }
14231        state.end()
14232    }
14233}
14234
14235impl std::fmt::Debug for Settings {
14236    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14237        let mut debug_struct = f.debug_struct("Settings");
14238        debug_struct.field("name", &self.name);
14239        debug_struct.field("kms_key_name", &self.kms_key_name);
14240        debug_struct.field("kms_service_account_id", &self.kms_service_account_id);
14241        debug_struct.field("storage_location", &self.storage_location);
14242        debug_struct.field("disable_default_sink", &self.disable_default_sink);
14243        if !self._unknown_fields.is_empty() {
14244            debug_struct.field("_unknown_fields", &self._unknown_fields);
14245        }
14246        debug_struct.finish()
14247    }
14248}
14249
14250/// The parameters to CopyLogEntries.
14251#[derive(Clone, Default, PartialEq)]
14252#[non_exhaustive]
14253pub struct CopyLogEntriesRequest {
14254    /// Required. Log bucket from which to copy log entries.
14255    ///
14256    /// For example:
14257    ///
14258    /// `"projects/my-project/locations/global/buckets/my-source-bucket"`
14259    pub name: std::string::String,
14260
14261    /// Optional. A filter specifying which log entries to copy. The filter must be
14262    /// no more than 20k characters. An empty filter matches all log entries.
14263    pub filter: std::string::String,
14264
14265    /// Required. Destination to which to copy log entries.
14266    pub destination: std::string::String,
14267
14268    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14269}
14270
14271impl CopyLogEntriesRequest {
14272    pub fn new() -> Self {
14273        std::default::Default::default()
14274    }
14275
14276    /// Sets the value of [name][crate::model::CopyLogEntriesRequest::name].
14277    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14278        self.name = v.into();
14279        self
14280    }
14281
14282    /// Sets the value of [filter][crate::model::CopyLogEntriesRequest::filter].
14283    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14284        self.filter = v.into();
14285        self
14286    }
14287
14288    /// Sets the value of [destination][crate::model::CopyLogEntriesRequest::destination].
14289    pub fn set_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14290        self.destination = v.into();
14291        self
14292    }
14293}
14294
14295impl wkt::message::Message for CopyLogEntriesRequest {
14296    fn typename() -> &'static str {
14297        "type.googleapis.com/google.logging.v2.CopyLogEntriesRequest"
14298    }
14299}
14300
14301#[doc(hidden)]
14302impl<'de> serde::de::Deserialize<'de> for CopyLogEntriesRequest {
14303    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14304    where
14305        D: serde::Deserializer<'de>,
14306    {
14307        #[allow(non_camel_case_types)]
14308        #[doc(hidden)]
14309        #[derive(PartialEq, Eq, Hash)]
14310        enum __FieldTag {
14311            __name,
14312            __filter,
14313            __destination,
14314            Unknown(std::string::String),
14315        }
14316        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14317            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14318            where
14319                D: serde::Deserializer<'de>,
14320            {
14321                struct Visitor;
14322                impl<'de> serde::de::Visitor<'de> for Visitor {
14323                    type Value = __FieldTag;
14324                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14325                        formatter.write_str("a field name for CopyLogEntriesRequest")
14326                    }
14327                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14328                    where
14329                        E: serde::de::Error,
14330                    {
14331                        use std::result::Result::Ok;
14332                        use std::string::ToString;
14333                        match value {
14334                            "name" => Ok(__FieldTag::__name),
14335                            "filter" => Ok(__FieldTag::__filter),
14336                            "destination" => Ok(__FieldTag::__destination),
14337                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14338                        }
14339                    }
14340                }
14341                deserializer.deserialize_identifier(Visitor)
14342            }
14343        }
14344        struct Visitor;
14345        impl<'de> serde::de::Visitor<'de> for Visitor {
14346            type Value = CopyLogEntriesRequest;
14347            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14348                formatter.write_str("struct CopyLogEntriesRequest")
14349            }
14350            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14351            where
14352                A: serde::de::MapAccess<'de>,
14353            {
14354                #[allow(unused_imports)]
14355                use serde::de::Error;
14356                use std::option::Option::Some;
14357                let mut fields = std::collections::HashSet::new();
14358                let mut result = Self::Value::new();
14359                while let Some(tag) = map.next_key::<__FieldTag>()? {
14360                    #[allow(clippy::match_single_binding)]
14361                    match tag {
14362                        __FieldTag::__name => {
14363                            if !fields.insert(__FieldTag::__name) {
14364                                return std::result::Result::Err(A::Error::duplicate_field(
14365                                    "multiple values for name",
14366                                ));
14367                            }
14368                            result.name = map
14369                                .next_value::<std::option::Option<std::string::String>>()?
14370                                .unwrap_or_default();
14371                        }
14372                        __FieldTag::__filter => {
14373                            if !fields.insert(__FieldTag::__filter) {
14374                                return std::result::Result::Err(A::Error::duplicate_field(
14375                                    "multiple values for filter",
14376                                ));
14377                            }
14378                            result.filter = map
14379                                .next_value::<std::option::Option<std::string::String>>()?
14380                                .unwrap_or_default();
14381                        }
14382                        __FieldTag::__destination => {
14383                            if !fields.insert(__FieldTag::__destination) {
14384                                return std::result::Result::Err(A::Error::duplicate_field(
14385                                    "multiple values for destination",
14386                                ));
14387                            }
14388                            result.destination = map
14389                                .next_value::<std::option::Option<std::string::String>>()?
14390                                .unwrap_or_default();
14391                        }
14392                        __FieldTag::Unknown(key) => {
14393                            let value = map.next_value::<serde_json::Value>()?;
14394                            result._unknown_fields.insert(key, value);
14395                        }
14396                    }
14397                }
14398                std::result::Result::Ok(result)
14399            }
14400        }
14401        deserializer.deserialize_any(Visitor)
14402    }
14403}
14404
14405#[doc(hidden)]
14406impl serde::ser::Serialize for CopyLogEntriesRequest {
14407    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14408    where
14409        S: serde::ser::Serializer,
14410    {
14411        use serde::ser::SerializeMap;
14412        #[allow(unused_imports)]
14413        use std::option::Option::Some;
14414        let mut state = serializer.serialize_map(std::option::Option::None)?;
14415        if !self.name.is_empty() {
14416            state.serialize_entry("name", &self.name)?;
14417        }
14418        if !self.filter.is_empty() {
14419            state.serialize_entry("filter", &self.filter)?;
14420        }
14421        if !self.destination.is_empty() {
14422            state.serialize_entry("destination", &self.destination)?;
14423        }
14424        if !self._unknown_fields.is_empty() {
14425            for (key, value) in self._unknown_fields.iter() {
14426                state.serialize_entry(key, &value)?;
14427            }
14428        }
14429        state.end()
14430    }
14431}
14432
14433impl std::fmt::Debug for CopyLogEntriesRequest {
14434    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14435        let mut debug_struct = f.debug_struct("CopyLogEntriesRequest");
14436        debug_struct.field("name", &self.name);
14437        debug_struct.field("filter", &self.filter);
14438        debug_struct.field("destination", &self.destination);
14439        if !self._unknown_fields.is_empty() {
14440            debug_struct.field("_unknown_fields", &self._unknown_fields);
14441        }
14442        debug_struct.finish()
14443    }
14444}
14445
14446/// Metadata for CopyLogEntries long running operations.
14447#[derive(Clone, Default, PartialEq)]
14448#[non_exhaustive]
14449pub struct CopyLogEntriesMetadata {
14450    /// The create time of an operation.
14451    pub start_time: std::option::Option<wkt::Timestamp>,
14452
14453    /// The end time of an operation.
14454    pub end_time: std::option::Option<wkt::Timestamp>,
14455
14456    /// State of an operation.
14457    pub state: crate::model::OperationState,
14458
14459    /// Identifies whether the user has requested cancellation of the operation.
14460    pub cancellation_requested: bool,
14461
14462    /// CopyLogEntries RPC request.
14463    pub request: std::option::Option<crate::model::CopyLogEntriesRequest>,
14464
14465    /// Estimated progress of the operation (0 - 100%).
14466    pub progress: i32,
14467
14468    /// The IAM identity of a service account that must be granted access to the
14469    /// destination.
14470    ///
14471    /// If the service account is not granted permission to the destination within
14472    /// an hour, the operation will be cancelled.
14473    ///
14474    /// For example: `"serviceAccount:foo@bar.com"`
14475    pub writer_identity: std::string::String,
14476
14477    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14478}
14479
14480impl CopyLogEntriesMetadata {
14481    pub fn new() -> Self {
14482        std::default::Default::default()
14483    }
14484
14485    /// Sets the value of [start_time][crate::model::CopyLogEntriesMetadata::start_time].
14486    pub fn set_start_time<T>(mut self, v: T) -> Self
14487    where
14488        T: std::convert::Into<wkt::Timestamp>,
14489    {
14490        self.start_time = std::option::Option::Some(v.into());
14491        self
14492    }
14493
14494    /// Sets or clears the value of [start_time][crate::model::CopyLogEntriesMetadata::start_time].
14495    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
14496    where
14497        T: std::convert::Into<wkt::Timestamp>,
14498    {
14499        self.start_time = v.map(|x| x.into());
14500        self
14501    }
14502
14503    /// Sets the value of [end_time][crate::model::CopyLogEntriesMetadata::end_time].
14504    pub fn set_end_time<T>(mut self, v: T) -> Self
14505    where
14506        T: std::convert::Into<wkt::Timestamp>,
14507    {
14508        self.end_time = std::option::Option::Some(v.into());
14509        self
14510    }
14511
14512    /// Sets or clears the value of [end_time][crate::model::CopyLogEntriesMetadata::end_time].
14513    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
14514    where
14515        T: std::convert::Into<wkt::Timestamp>,
14516    {
14517        self.end_time = v.map(|x| x.into());
14518        self
14519    }
14520
14521    /// Sets the value of [state][crate::model::CopyLogEntriesMetadata::state].
14522    pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
14523        self.state = v.into();
14524        self
14525    }
14526
14527    /// Sets the value of [cancellation_requested][crate::model::CopyLogEntriesMetadata::cancellation_requested].
14528    pub fn set_cancellation_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14529        self.cancellation_requested = v.into();
14530        self
14531    }
14532
14533    /// Sets the value of [request][crate::model::CopyLogEntriesMetadata::request].
14534    pub fn set_request<T>(mut self, v: T) -> Self
14535    where
14536        T: std::convert::Into<crate::model::CopyLogEntriesRequest>,
14537    {
14538        self.request = std::option::Option::Some(v.into());
14539        self
14540    }
14541
14542    /// Sets or clears the value of [request][crate::model::CopyLogEntriesMetadata::request].
14543    pub fn set_or_clear_request<T>(mut self, v: std::option::Option<T>) -> Self
14544    where
14545        T: std::convert::Into<crate::model::CopyLogEntriesRequest>,
14546    {
14547        self.request = v.map(|x| x.into());
14548        self
14549    }
14550
14551    /// Sets the value of [progress][crate::model::CopyLogEntriesMetadata::progress].
14552    pub fn set_progress<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14553        self.progress = v.into();
14554        self
14555    }
14556
14557    /// Sets the value of [writer_identity][crate::model::CopyLogEntriesMetadata::writer_identity].
14558    pub fn set_writer_identity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14559        self.writer_identity = v.into();
14560        self
14561    }
14562}
14563
14564impl wkt::message::Message for CopyLogEntriesMetadata {
14565    fn typename() -> &'static str {
14566        "type.googleapis.com/google.logging.v2.CopyLogEntriesMetadata"
14567    }
14568}
14569
14570#[doc(hidden)]
14571impl<'de> serde::de::Deserialize<'de> for CopyLogEntriesMetadata {
14572    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14573    where
14574        D: serde::Deserializer<'de>,
14575    {
14576        #[allow(non_camel_case_types)]
14577        #[doc(hidden)]
14578        #[derive(PartialEq, Eq, Hash)]
14579        enum __FieldTag {
14580            __start_time,
14581            __end_time,
14582            __state,
14583            __cancellation_requested,
14584            __request,
14585            __progress,
14586            __writer_identity,
14587            Unknown(std::string::String),
14588        }
14589        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14590            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14591            where
14592                D: serde::Deserializer<'de>,
14593            {
14594                struct Visitor;
14595                impl<'de> serde::de::Visitor<'de> for Visitor {
14596                    type Value = __FieldTag;
14597                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14598                        formatter.write_str("a field name for CopyLogEntriesMetadata")
14599                    }
14600                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14601                    where
14602                        E: serde::de::Error,
14603                    {
14604                        use std::result::Result::Ok;
14605                        use std::string::ToString;
14606                        match value {
14607                            "startTime" => Ok(__FieldTag::__start_time),
14608                            "start_time" => Ok(__FieldTag::__start_time),
14609                            "endTime" => Ok(__FieldTag::__end_time),
14610                            "end_time" => Ok(__FieldTag::__end_time),
14611                            "state" => Ok(__FieldTag::__state),
14612                            "cancellationRequested" => Ok(__FieldTag::__cancellation_requested),
14613                            "cancellation_requested" => Ok(__FieldTag::__cancellation_requested),
14614                            "request" => Ok(__FieldTag::__request),
14615                            "progress" => Ok(__FieldTag::__progress),
14616                            "writerIdentity" => Ok(__FieldTag::__writer_identity),
14617                            "writer_identity" => Ok(__FieldTag::__writer_identity),
14618                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14619                        }
14620                    }
14621                }
14622                deserializer.deserialize_identifier(Visitor)
14623            }
14624        }
14625        struct Visitor;
14626        impl<'de> serde::de::Visitor<'de> for Visitor {
14627            type Value = CopyLogEntriesMetadata;
14628            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14629                formatter.write_str("struct CopyLogEntriesMetadata")
14630            }
14631            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14632            where
14633                A: serde::de::MapAccess<'de>,
14634            {
14635                #[allow(unused_imports)]
14636                use serde::de::Error;
14637                use std::option::Option::Some;
14638                let mut fields = std::collections::HashSet::new();
14639                let mut result = Self::Value::new();
14640                while let Some(tag) = map.next_key::<__FieldTag>()? {
14641                    #[allow(clippy::match_single_binding)]
14642                    match tag {
14643                        __FieldTag::__start_time => {
14644                            if !fields.insert(__FieldTag::__start_time) {
14645                                return std::result::Result::Err(A::Error::duplicate_field(
14646                                    "multiple values for start_time",
14647                                ));
14648                            }
14649                            result.start_time =
14650                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14651                        }
14652                        __FieldTag::__end_time => {
14653                            if !fields.insert(__FieldTag::__end_time) {
14654                                return std::result::Result::Err(A::Error::duplicate_field(
14655                                    "multiple values for end_time",
14656                                ));
14657                            }
14658                            result.end_time =
14659                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
14660                        }
14661                        __FieldTag::__state => {
14662                            if !fields.insert(__FieldTag::__state) {
14663                                return std::result::Result::Err(A::Error::duplicate_field(
14664                                    "multiple values for state",
14665                                ));
14666                            }
14667                            result.state = map
14668                                .next_value::<std::option::Option<crate::model::OperationState>>()?
14669                                .unwrap_or_default();
14670                        }
14671                        __FieldTag::__cancellation_requested => {
14672                            if !fields.insert(__FieldTag::__cancellation_requested) {
14673                                return std::result::Result::Err(A::Error::duplicate_field(
14674                                    "multiple values for cancellation_requested",
14675                                ));
14676                            }
14677                            result.cancellation_requested = map
14678                                .next_value::<std::option::Option<bool>>()?
14679                                .unwrap_or_default();
14680                        }
14681                        __FieldTag::__request => {
14682                            if !fields.insert(__FieldTag::__request) {
14683                                return std::result::Result::Err(A::Error::duplicate_field(
14684                                    "multiple values for request",
14685                                ));
14686                            }
14687                            result.request = map.next_value::<std::option::Option<crate::model::CopyLogEntriesRequest>>()?
14688                                ;
14689                        }
14690                        __FieldTag::__progress => {
14691                            if !fields.insert(__FieldTag::__progress) {
14692                                return std::result::Result::Err(A::Error::duplicate_field(
14693                                    "multiple values for progress",
14694                                ));
14695                            }
14696                            struct __With(std::option::Option<i32>);
14697                            impl<'de> serde::de::Deserialize<'de> for __With {
14698                                fn deserialize<D>(
14699                                    deserializer: D,
14700                                ) -> std::result::Result<Self, D::Error>
14701                                where
14702                                    D: serde::de::Deserializer<'de>,
14703                                {
14704                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
14705                                }
14706                            }
14707                            result.progress = map.next_value::<__With>()?.0.unwrap_or_default();
14708                        }
14709                        __FieldTag::__writer_identity => {
14710                            if !fields.insert(__FieldTag::__writer_identity) {
14711                                return std::result::Result::Err(A::Error::duplicate_field(
14712                                    "multiple values for writer_identity",
14713                                ));
14714                            }
14715                            result.writer_identity = map
14716                                .next_value::<std::option::Option<std::string::String>>()?
14717                                .unwrap_or_default();
14718                        }
14719                        __FieldTag::Unknown(key) => {
14720                            let value = map.next_value::<serde_json::Value>()?;
14721                            result._unknown_fields.insert(key, value);
14722                        }
14723                    }
14724                }
14725                std::result::Result::Ok(result)
14726            }
14727        }
14728        deserializer.deserialize_any(Visitor)
14729    }
14730}
14731
14732#[doc(hidden)]
14733impl serde::ser::Serialize for CopyLogEntriesMetadata {
14734    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14735    where
14736        S: serde::ser::Serializer,
14737    {
14738        use serde::ser::SerializeMap;
14739        #[allow(unused_imports)]
14740        use std::option::Option::Some;
14741        let mut state = serializer.serialize_map(std::option::Option::None)?;
14742        if self.start_time.is_some() {
14743            state.serialize_entry("startTime", &self.start_time)?;
14744        }
14745        if self.end_time.is_some() {
14746            state.serialize_entry("endTime", &self.end_time)?;
14747        }
14748        if !wkt::internal::is_default(&self.state) {
14749            state.serialize_entry("state", &self.state)?;
14750        }
14751        if !wkt::internal::is_default(&self.cancellation_requested) {
14752            state.serialize_entry("cancellationRequested", &self.cancellation_requested)?;
14753        }
14754        if self.request.is_some() {
14755            state.serialize_entry("request", &self.request)?;
14756        }
14757        if !wkt::internal::is_default(&self.progress) {
14758            struct __With<'a>(&'a i32);
14759            impl<'a> serde::ser::Serialize for __With<'a> {
14760                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14761                where
14762                    S: serde::ser::Serializer,
14763                {
14764                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
14765                }
14766            }
14767            state.serialize_entry("progress", &__With(&self.progress))?;
14768        }
14769        if !self.writer_identity.is_empty() {
14770            state.serialize_entry("writerIdentity", &self.writer_identity)?;
14771        }
14772        if !self._unknown_fields.is_empty() {
14773            for (key, value) in self._unknown_fields.iter() {
14774                state.serialize_entry(key, &value)?;
14775            }
14776        }
14777        state.end()
14778    }
14779}
14780
14781impl std::fmt::Debug for CopyLogEntriesMetadata {
14782    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14783        let mut debug_struct = f.debug_struct("CopyLogEntriesMetadata");
14784        debug_struct.field("start_time", &self.start_time);
14785        debug_struct.field("end_time", &self.end_time);
14786        debug_struct.field("state", &self.state);
14787        debug_struct.field("cancellation_requested", &self.cancellation_requested);
14788        debug_struct.field("request", &self.request);
14789        debug_struct.field("progress", &self.progress);
14790        debug_struct.field("writer_identity", &self.writer_identity);
14791        if !self._unknown_fields.is_empty() {
14792            debug_struct.field("_unknown_fields", &self._unknown_fields);
14793        }
14794        debug_struct.finish()
14795    }
14796}
14797
14798/// Response type for CopyLogEntries long running operations.
14799#[derive(Clone, Default, PartialEq)]
14800#[non_exhaustive]
14801pub struct CopyLogEntriesResponse {
14802    /// Number of log entries copied.
14803    pub log_entries_copied_count: i64,
14804
14805    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14806}
14807
14808impl CopyLogEntriesResponse {
14809    pub fn new() -> Self {
14810        std::default::Default::default()
14811    }
14812
14813    /// Sets the value of [log_entries_copied_count][crate::model::CopyLogEntriesResponse::log_entries_copied_count].
14814    pub fn set_log_entries_copied_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14815        self.log_entries_copied_count = v.into();
14816        self
14817    }
14818}
14819
14820impl wkt::message::Message for CopyLogEntriesResponse {
14821    fn typename() -> &'static str {
14822        "type.googleapis.com/google.logging.v2.CopyLogEntriesResponse"
14823    }
14824}
14825
14826#[doc(hidden)]
14827impl<'de> serde::de::Deserialize<'de> for CopyLogEntriesResponse {
14828    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14829    where
14830        D: serde::Deserializer<'de>,
14831    {
14832        #[allow(non_camel_case_types)]
14833        #[doc(hidden)]
14834        #[derive(PartialEq, Eq, Hash)]
14835        enum __FieldTag {
14836            __log_entries_copied_count,
14837            Unknown(std::string::String),
14838        }
14839        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14840            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14841            where
14842                D: serde::Deserializer<'de>,
14843            {
14844                struct Visitor;
14845                impl<'de> serde::de::Visitor<'de> for Visitor {
14846                    type Value = __FieldTag;
14847                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14848                        formatter.write_str("a field name for CopyLogEntriesResponse")
14849                    }
14850                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14851                    where
14852                        E: serde::de::Error,
14853                    {
14854                        use std::result::Result::Ok;
14855                        use std::string::ToString;
14856                        match value {
14857                            "logEntriesCopiedCount" => Ok(__FieldTag::__log_entries_copied_count),
14858                            "log_entries_copied_count" => {
14859                                Ok(__FieldTag::__log_entries_copied_count)
14860                            }
14861                            _ => Ok(__FieldTag::Unknown(value.to_string())),
14862                        }
14863                    }
14864                }
14865                deserializer.deserialize_identifier(Visitor)
14866            }
14867        }
14868        struct Visitor;
14869        impl<'de> serde::de::Visitor<'de> for Visitor {
14870            type Value = CopyLogEntriesResponse;
14871            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14872                formatter.write_str("struct CopyLogEntriesResponse")
14873            }
14874            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14875            where
14876                A: serde::de::MapAccess<'de>,
14877            {
14878                #[allow(unused_imports)]
14879                use serde::de::Error;
14880                use std::option::Option::Some;
14881                let mut fields = std::collections::HashSet::new();
14882                let mut result = Self::Value::new();
14883                while let Some(tag) = map.next_key::<__FieldTag>()? {
14884                    #[allow(clippy::match_single_binding)]
14885                    match tag {
14886                        __FieldTag::__log_entries_copied_count => {
14887                            if !fields.insert(__FieldTag::__log_entries_copied_count) {
14888                                return std::result::Result::Err(A::Error::duplicate_field(
14889                                    "multiple values for log_entries_copied_count",
14890                                ));
14891                            }
14892                            struct __With(std::option::Option<i64>);
14893                            impl<'de> serde::de::Deserialize<'de> for __With {
14894                                fn deserialize<D>(
14895                                    deserializer: D,
14896                                ) -> std::result::Result<Self, D::Error>
14897                                where
14898                                    D: serde::de::Deserializer<'de>,
14899                                {
14900                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
14901                                }
14902                            }
14903                            result.log_entries_copied_count =
14904                                map.next_value::<__With>()?.0.unwrap_or_default();
14905                        }
14906                        __FieldTag::Unknown(key) => {
14907                            let value = map.next_value::<serde_json::Value>()?;
14908                            result._unknown_fields.insert(key, value);
14909                        }
14910                    }
14911                }
14912                std::result::Result::Ok(result)
14913            }
14914        }
14915        deserializer.deserialize_any(Visitor)
14916    }
14917}
14918
14919#[doc(hidden)]
14920impl serde::ser::Serialize for CopyLogEntriesResponse {
14921    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14922    where
14923        S: serde::ser::Serializer,
14924    {
14925        use serde::ser::SerializeMap;
14926        #[allow(unused_imports)]
14927        use std::option::Option::Some;
14928        let mut state = serializer.serialize_map(std::option::Option::None)?;
14929        if !wkt::internal::is_default(&self.log_entries_copied_count) {
14930            struct __With<'a>(&'a i64);
14931            impl<'a> serde::ser::Serialize for __With<'a> {
14932                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14933                where
14934                    S: serde::ser::Serializer,
14935                {
14936                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
14937                }
14938            }
14939            state.serialize_entry(
14940                "logEntriesCopiedCount",
14941                &__With(&self.log_entries_copied_count),
14942            )?;
14943        }
14944        if !self._unknown_fields.is_empty() {
14945            for (key, value) in self._unknown_fields.iter() {
14946                state.serialize_entry(key, &value)?;
14947            }
14948        }
14949        state.end()
14950    }
14951}
14952
14953impl std::fmt::Debug for CopyLogEntriesResponse {
14954    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14955        let mut debug_struct = f.debug_struct("CopyLogEntriesResponse");
14956        debug_struct.field("log_entries_copied_count", &self.log_entries_copied_count);
14957        if !self._unknown_fields.is_empty() {
14958            debug_struct.field("_unknown_fields", &self._unknown_fields);
14959        }
14960        debug_struct.finish()
14961    }
14962}
14963
14964/// Metadata for LongRunningUpdateBucket Operations.
14965#[derive(Clone, Default, PartialEq)]
14966#[non_exhaustive]
14967pub struct BucketMetadata {
14968    /// The create time of an operation.
14969    pub start_time: std::option::Option<wkt::Timestamp>,
14970
14971    /// The end time of an operation.
14972    pub end_time: std::option::Option<wkt::Timestamp>,
14973
14974    /// State of an operation.
14975    pub state: crate::model::OperationState,
14976
14977    pub request: std::option::Option<crate::model::bucket_metadata::Request>,
14978
14979    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14980}
14981
14982impl BucketMetadata {
14983    pub fn new() -> Self {
14984        std::default::Default::default()
14985    }
14986
14987    /// Sets the value of [start_time][crate::model::BucketMetadata::start_time].
14988    pub fn set_start_time<T>(mut self, v: T) -> Self
14989    where
14990        T: std::convert::Into<wkt::Timestamp>,
14991    {
14992        self.start_time = std::option::Option::Some(v.into());
14993        self
14994    }
14995
14996    /// Sets or clears the value of [start_time][crate::model::BucketMetadata::start_time].
14997    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
14998    where
14999        T: std::convert::Into<wkt::Timestamp>,
15000    {
15001        self.start_time = v.map(|x| x.into());
15002        self
15003    }
15004
15005    /// Sets the value of [end_time][crate::model::BucketMetadata::end_time].
15006    pub fn set_end_time<T>(mut self, v: T) -> Self
15007    where
15008        T: std::convert::Into<wkt::Timestamp>,
15009    {
15010        self.end_time = std::option::Option::Some(v.into());
15011        self
15012    }
15013
15014    /// Sets or clears the value of [end_time][crate::model::BucketMetadata::end_time].
15015    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
15016    where
15017        T: std::convert::Into<wkt::Timestamp>,
15018    {
15019        self.end_time = v.map(|x| x.into());
15020        self
15021    }
15022
15023    /// Sets the value of [state][crate::model::BucketMetadata::state].
15024    pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
15025        self.state = v.into();
15026        self
15027    }
15028
15029    /// Sets the value of [request][crate::model::BucketMetadata::request].
15030    ///
15031    /// Note that all the setters affecting `request` are mutually
15032    /// exclusive.
15033    pub fn set_request<
15034        T: std::convert::Into<std::option::Option<crate::model::bucket_metadata::Request>>,
15035    >(
15036        mut self,
15037        v: T,
15038    ) -> Self {
15039        self.request = v.into();
15040        self
15041    }
15042
15043    /// The value of [request][crate::model::BucketMetadata::request]
15044    /// if it holds a `CreateBucketRequest`, `None` if the field is not set or
15045    /// holds a different branch.
15046    pub fn create_bucket_request(
15047        &self,
15048    ) -> std::option::Option<&std::boxed::Box<crate::model::CreateBucketRequest>> {
15049        #[allow(unreachable_patterns)]
15050        self.request.as_ref().and_then(|v| match v {
15051            crate::model::bucket_metadata::Request::CreateBucketRequest(v) => {
15052                std::option::Option::Some(v)
15053            }
15054            _ => std::option::Option::None,
15055        })
15056    }
15057
15058    /// Sets the value of [request][crate::model::BucketMetadata::request]
15059    /// to hold a `CreateBucketRequest`.
15060    ///
15061    /// Note that all the setters affecting `request` are
15062    /// mutually exclusive.
15063    pub fn set_create_bucket_request<
15064        T: std::convert::Into<std::boxed::Box<crate::model::CreateBucketRequest>>,
15065    >(
15066        mut self,
15067        v: T,
15068    ) -> Self {
15069        self.request = std::option::Option::Some(
15070            crate::model::bucket_metadata::Request::CreateBucketRequest(v.into()),
15071        );
15072        self
15073    }
15074
15075    /// The value of [request][crate::model::BucketMetadata::request]
15076    /// if it holds a `UpdateBucketRequest`, `None` if the field is not set or
15077    /// holds a different branch.
15078    pub fn update_bucket_request(
15079        &self,
15080    ) -> std::option::Option<&std::boxed::Box<crate::model::UpdateBucketRequest>> {
15081        #[allow(unreachable_patterns)]
15082        self.request.as_ref().and_then(|v| match v {
15083            crate::model::bucket_metadata::Request::UpdateBucketRequest(v) => {
15084                std::option::Option::Some(v)
15085            }
15086            _ => std::option::Option::None,
15087        })
15088    }
15089
15090    /// Sets the value of [request][crate::model::BucketMetadata::request]
15091    /// to hold a `UpdateBucketRequest`.
15092    ///
15093    /// Note that all the setters affecting `request` are
15094    /// mutually exclusive.
15095    pub fn set_update_bucket_request<
15096        T: std::convert::Into<std::boxed::Box<crate::model::UpdateBucketRequest>>,
15097    >(
15098        mut self,
15099        v: T,
15100    ) -> Self {
15101        self.request = std::option::Option::Some(
15102            crate::model::bucket_metadata::Request::UpdateBucketRequest(v.into()),
15103        );
15104        self
15105    }
15106}
15107
15108impl wkt::message::Message for BucketMetadata {
15109    fn typename() -> &'static str {
15110        "type.googleapis.com/google.logging.v2.BucketMetadata"
15111    }
15112}
15113
15114#[doc(hidden)]
15115impl<'de> serde::de::Deserialize<'de> for BucketMetadata {
15116    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15117    where
15118        D: serde::Deserializer<'de>,
15119    {
15120        #[allow(non_camel_case_types)]
15121        #[doc(hidden)]
15122        #[derive(PartialEq, Eq, Hash)]
15123        enum __FieldTag {
15124            __start_time,
15125            __end_time,
15126            __state,
15127            __create_bucket_request,
15128            __update_bucket_request,
15129            Unknown(std::string::String),
15130        }
15131        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15132            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15133            where
15134                D: serde::Deserializer<'de>,
15135            {
15136                struct Visitor;
15137                impl<'de> serde::de::Visitor<'de> for Visitor {
15138                    type Value = __FieldTag;
15139                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15140                        formatter.write_str("a field name for BucketMetadata")
15141                    }
15142                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15143                    where
15144                        E: serde::de::Error,
15145                    {
15146                        use std::result::Result::Ok;
15147                        use std::string::ToString;
15148                        match value {
15149                            "startTime" => Ok(__FieldTag::__start_time),
15150                            "start_time" => Ok(__FieldTag::__start_time),
15151                            "endTime" => Ok(__FieldTag::__end_time),
15152                            "end_time" => Ok(__FieldTag::__end_time),
15153                            "state" => Ok(__FieldTag::__state),
15154                            "createBucketRequest" => Ok(__FieldTag::__create_bucket_request),
15155                            "create_bucket_request" => Ok(__FieldTag::__create_bucket_request),
15156                            "updateBucketRequest" => Ok(__FieldTag::__update_bucket_request),
15157                            "update_bucket_request" => Ok(__FieldTag::__update_bucket_request),
15158                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15159                        }
15160                    }
15161                }
15162                deserializer.deserialize_identifier(Visitor)
15163            }
15164        }
15165        struct Visitor;
15166        impl<'de> serde::de::Visitor<'de> for Visitor {
15167            type Value = BucketMetadata;
15168            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15169                formatter.write_str("struct BucketMetadata")
15170            }
15171            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15172            where
15173                A: serde::de::MapAccess<'de>,
15174            {
15175                #[allow(unused_imports)]
15176                use serde::de::Error;
15177                use std::option::Option::Some;
15178                let mut fields = std::collections::HashSet::new();
15179                let mut result = Self::Value::new();
15180                while let Some(tag) = map.next_key::<__FieldTag>()? {
15181                    #[allow(clippy::match_single_binding)]
15182                    match tag {
15183                        __FieldTag::__start_time => {
15184                            if !fields.insert(__FieldTag::__start_time) {
15185                                return std::result::Result::Err(A::Error::duplicate_field(
15186                                    "multiple values for start_time",
15187                                ));
15188                            }
15189                            result.start_time =
15190                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
15191                        }
15192                        __FieldTag::__end_time => {
15193                            if !fields.insert(__FieldTag::__end_time) {
15194                                return std::result::Result::Err(A::Error::duplicate_field(
15195                                    "multiple values for end_time",
15196                                ));
15197                            }
15198                            result.end_time =
15199                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
15200                        }
15201                        __FieldTag::__state => {
15202                            if !fields.insert(__FieldTag::__state) {
15203                                return std::result::Result::Err(A::Error::duplicate_field(
15204                                    "multiple values for state",
15205                                ));
15206                            }
15207                            result.state = map
15208                                .next_value::<std::option::Option<crate::model::OperationState>>()?
15209                                .unwrap_or_default();
15210                        }
15211                        __FieldTag::__create_bucket_request => {
15212                            if !fields.insert(__FieldTag::__create_bucket_request) {
15213                                return std::result::Result::Err(A::Error::duplicate_field(
15214                                    "multiple values for create_bucket_request",
15215                                ));
15216                            }
15217                            if result.request.is_some() {
15218                                return std::result::Result::Err(A::Error::duplicate_field(
15219                                    "multiple values for `request`, a oneof with full ID .google.logging.v2.BucketMetadata.create_bucket_request, latest field was createBucketRequest",
15220                                ));
15221                            }
15222                            result.request = std::option::Option::Some(
15223                                crate::model::bucket_metadata::Request::CreateBucketRequest(
15224                                    map.next_value::<std::option::Option<
15225                                        std::boxed::Box<crate::model::CreateBucketRequest>,
15226                                    >>()?
15227                                    .unwrap_or_default(),
15228                                ),
15229                            );
15230                        }
15231                        __FieldTag::__update_bucket_request => {
15232                            if !fields.insert(__FieldTag::__update_bucket_request) {
15233                                return std::result::Result::Err(A::Error::duplicate_field(
15234                                    "multiple values for update_bucket_request",
15235                                ));
15236                            }
15237                            if result.request.is_some() {
15238                                return std::result::Result::Err(A::Error::duplicate_field(
15239                                    "multiple values for `request`, a oneof with full ID .google.logging.v2.BucketMetadata.update_bucket_request, latest field was updateBucketRequest",
15240                                ));
15241                            }
15242                            result.request = std::option::Option::Some(
15243                                crate::model::bucket_metadata::Request::UpdateBucketRequest(
15244                                    map.next_value::<std::option::Option<
15245                                        std::boxed::Box<crate::model::UpdateBucketRequest>,
15246                                    >>()?
15247                                    .unwrap_or_default(),
15248                                ),
15249                            );
15250                        }
15251                        __FieldTag::Unknown(key) => {
15252                            let value = map.next_value::<serde_json::Value>()?;
15253                            result._unknown_fields.insert(key, value);
15254                        }
15255                    }
15256                }
15257                std::result::Result::Ok(result)
15258            }
15259        }
15260        deserializer.deserialize_any(Visitor)
15261    }
15262}
15263
15264#[doc(hidden)]
15265impl serde::ser::Serialize for BucketMetadata {
15266    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15267    where
15268        S: serde::ser::Serializer,
15269    {
15270        use serde::ser::SerializeMap;
15271        #[allow(unused_imports)]
15272        use std::option::Option::Some;
15273        let mut state = serializer.serialize_map(std::option::Option::None)?;
15274        if self.start_time.is_some() {
15275            state.serialize_entry("startTime", &self.start_time)?;
15276        }
15277        if self.end_time.is_some() {
15278            state.serialize_entry("endTime", &self.end_time)?;
15279        }
15280        if !wkt::internal::is_default(&self.state) {
15281            state.serialize_entry("state", &self.state)?;
15282        }
15283        if let Some(value) = self.create_bucket_request() {
15284            state.serialize_entry("createBucketRequest", value)?;
15285        }
15286        if let Some(value) = self.update_bucket_request() {
15287            state.serialize_entry("updateBucketRequest", value)?;
15288        }
15289        if !self._unknown_fields.is_empty() {
15290            for (key, value) in self._unknown_fields.iter() {
15291                state.serialize_entry(key, &value)?;
15292            }
15293        }
15294        state.end()
15295    }
15296}
15297
15298impl std::fmt::Debug for BucketMetadata {
15299    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15300        let mut debug_struct = f.debug_struct("BucketMetadata");
15301        debug_struct.field("start_time", &self.start_time);
15302        debug_struct.field("end_time", &self.end_time);
15303        debug_struct.field("state", &self.state);
15304        debug_struct.field("request", &self.request);
15305        if !self._unknown_fields.is_empty() {
15306            debug_struct.field("_unknown_fields", &self._unknown_fields);
15307        }
15308        debug_struct.finish()
15309    }
15310}
15311
15312/// Defines additional types related to [BucketMetadata].
15313pub mod bucket_metadata {
15314    #[allow(unused_imports)]
15315    use super::*;
15316
15317    #[derive(Clone, Debug, PartialEq)]
15318    #[non_exhaustive]
15319    pub enum Request {
15320        /// LongRunningCreateBucket RPC request.
15321        CreateBucketRequest(std::boxed::Box<crate::model::CreateBucketRequest>),
15322        /// LongRunningUpdateBucket RPC request.
15323        UpdateBucketRequest(std::boxed::Box<crate::model::UpdateBucketRequest>),
15324    }
15325}
15326
15327/// Metadata for long running Link operations.
15328#[derive(Clone, Default, PartialEq)]
15329#[non_exhaustive]
15330pub struct LinkMetadata {
15331    /// The start time of an operation.
15332    pub start_time: std::option::Option<wkt::Timestamp>,
15333
15334    /// The end time of an operation.
15335    pub end_time: std::option::Option<wkt::Timestamp>,
15336
15337    /// State of an operation.
15338    pub state: crate::model::OperationState,
15339
15340    pub request: std::option::Option<crate::model::link_metadata::Request>,
15341
15342    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15343}
15344
15345impl LinkMetadata {
15346    pub fn new() -> Self {
15347        std::default::Default::default()
15348    }
15349
15350    /// Sets the value of [start_time][crate::model::LinkMetadata::start_time].
15351    pub fn set_start_time<T>(mut self, v: T) -> Self
15352    where
15353        T: std::convert::Into<wkt::Timestamp>,
15354    {
15355        self.start_time = std::option::Option::Some(v.into());
15356        self
15357    }
15358
15359    /// Sets or clears the value of [start_time][crate::model::LinkMetadata::start_time].
15360    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
15361    where
15362        T: std::convert::Into<wkt::Timestamp>,
15363    {
15364        self.start_time = v.map(|x| x.into());
15365        self
15366    }
15367
15368    /// Sets the value of [end_time][crate::model::LinkMetadata::end_time].
15369    pub fn set_end_time<T>(mut self, v: T) -> Self
15370    where
15371        T: std::convert::Into<wkt::Timestamp>,
15372    {
15373        self.end_time = std::option::Option::Some(v.into());
15374        self
15375    }
15376
15377    /// Sets or clears the value of [end_time][crate::model::LinkMetadata::end_time].
15378    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
15379    where
15380        T: std::convert::Into<wkt::Timestamp>,
15381    {
15382        self.end_time = v.map(|x| x.into());
15383        self
15384    }
15385
15386    /// Sets the value of [state][crate::model::LinkMetadata::state].
15387    pub fn set_state<T: std::convert::Into<crate::model::OperationState>>(mut self, v: T) -> Self {
15388        self.state = v.into();
15389        self
15390    }
15391
15392    /// Sets the value of [request][crate::model::LinkMetadata::request].
15393    ///
15394    /// Note that all the setters affecting `request` are mutually
15395    /// exclusive.
15396    pub fn set_request<
15397        T: std::convert::Into<std::option::Option<crate::model::link_metadata::Request>>,
15398    >(
15399        mut self,
15400        v: T,
15401    ) -> Self {
15402        self.request = v.into();
15403        self
15404    }
15405
15406    /// The value of [request][crate::model::LinkMetadata::request]
15407    /// if it holds a `CreateLinkRequest`, `None` if the field is not set or
15408    /// holds a different branch.
15409    pub fn create_link_request(
15410        &self,
15411    ) -> std::option::Option<&std::boxed::Box<crate::model::CreateLinkRequest>> {
15412        #[allow(unreachable_patterns)]
15413        self.request.as_ref().and_then(|v| match v {
15414            crate::model::link_metadata::Request::CreateLinkRequest(v) => {
15415                std::option::Option::Some(v)
15416            }
15417            _ => std::option::Option::None,
15418        })
15419    }
15420
15421    /// Sets the value of [request][crate::model::LinkMetadata::request]
15422    /// to hold a `CreateLinkRequest`.
15423    ///
15424    /// Note that all the setters affecting `request` are
15425    /// mutually exclusive.
15426    pub fn set_create_link_request<
15427        T: std::convert::Into<std::boxed::Box<crate::model::CreateLinkRequest>>,
15428    >(
15429        mut self,
15430        v: T,
15431    ) -> Self {
15432        self.request = std::option::Option::Some(
15433            crate::model::link_metadata::Request::CreateLinkRequest(v.into()),
15434        );
15435        self
15436    }
15437
15438    /// The value of [request][crate::model::LinkMetadata::request]
15439    /// if it holds a `DeleteLinkRequest`, `None` if the field is not set or
15440    /// holds a different branch.
15441    pub fn delete_link_request(
15442        &self,
15443    ) -> std::option::Option<&std::boxed::Box<crate::model::DeleteLinkRequest>> {
15444        #[allow(unreachable_patterns)]
15445        self.request.as_ref().and_then(|v| match v {
15446            crate::model::link_metadata::Request::DeleteLinkRequest(v) => {
15447                std::option::Option::Some(v)
15448            }
15449            _ => std::option::Option::None,
15450        })
15451    }
15452
15453    /// Sets the value of [request][crate::model::LinkMetadata::request]
15454    /// to hold a `DeleteLinkRequest`.
15455    ///
15456    /// Note that all the setters affecting `request` are
15457    /// mutually exclusive.
15458    pub fn set_delete_link_request<
15459        T: std::convert::Into<std::boxed::Box<crate::model::DeleteLinkRequest>>,
15460    >(
15461        mut self,
15462        v: T,
15463    ) -> Self {
15464        self.request = std::option::Option::Some(
15465            crate::model::link_metadata::Request::DeleteLinkRequest(v.into()),
15466        );
15467        self
15468    }
15469}
15470
15471impl wkt::message::Message for LinkMetadata {
15472    fn typename() -> &'static str {
15473        "type.googleapis.com/google.logging.v2.LinkMetadata"
15474    }
15475}
15476
15477#[doc(hidden)]
15478impl<'de> serde::de::Deserialize<'de> for LinkMetadata {
15479    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15480    where
15481        D: serde::Deserializer<'de>,
15482    {
15483        #[allow(non_camel_case_types)]
15484        #[doc(hidden)]
15485        #[derive(PartialEq, Eq, Hash)]
15486        enum __FieldTag {
15487            __start_time,
15488            __end_time,
15489            __state,
15490            __create_link_request,
15491            __delete_link_request,
15492            Unknown(std::string::String),
15493        }
15494        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15495            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15496            where
15497                D: serde::Deserializer<'de>,
15498            {
15499                struct Visitor;
15500                impl<'de> serde::de::Visitor<'de> for Visitor {
15501                    type Value = __FieldTag;
15502                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15503                        formatter.write_str("a field name for LinkMetadata")
15504                    }
15505                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15506                    where
15507                        E: serde::de::Error,
15508                    {
15509                        use std::result::Result::Ok;
15510                        use std::string::ToString;
15511                        match value {
15512                            "startTime" => Ok(__FieldTag::__start_time),
15513                            "start_time" => Ok(__FieldTag::__start_time),
15514                            "endTime" => Ok(__FieldTag::__end_time),
15515                            "end_time" => Ok(__FieldTag::__end_time),
15516                            "state" => Ok(__FieldTag::__state),
15517                            "createLinkRequest" => Ok(__FieldTag::__create_link_request),
15518                            "create_link_request" => Ok(__FieldTag::__create_link_request),
15519                            "deleteLinkRequest" => Ok(__FieldTag::__delete_link_request),
15520                            "delete_link_request" => Ok(__FieldTag::__delete_link_request),
15521                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15522                        }
15523                    }
15524                }
15525                deserializer.deserialize_identifier(Visitor)
15526            }
15527        }
15528        struct Visitor;
15529        impl<'de> serde::de::Visitor<'de> for Visitor {
15530            type Value = LinkMetadata;
15531            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15532                formatter.write_str("struct LinkMetadata")
15533            }
15534            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15535            where
15536                A: serde::de::MapAccess<'de>,
15537            {
15538                #[allow(unused_imports)]
15539                use serde::de::Error;
15540                use std::option::Option::Some;
15541                let mut fields = std::collections::HashSet::new();
15542                let mut result = Self::Value::new();
15543                while let Some(tag) = map.next_key::<__FieldTag>()? {
15544                    #[allow(clippy::match_single_binding)]
15545                    match tag {
15546                        __FieldTag::__start_time => {
15547                            if !fields.insert(__FieldTag::__start_time) {
15548                                return std::result::Result::Err(A::Error::duplicate_field(
15549                                    "multiple values for start_time",
15550                                ));
15551                            }
15552                            result.start_time =
15553                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
15554                        }
15555                        __FieldTag::__end_time => {
15556                            if !fields.insert(__FieldTag::__end_time) {
15557                                return std::result::Result::Err(A::Error::duplicate_field(
15558                                    "multiple values for end_time",
15559                                ));
15560                            }
15561                            result.end_time =
15562                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
15563                        }
15564                        __FieldTag::__state => {
15565                            if !fields.insert(__FieldTag::__state) {
15566                                return std::result::Result::Err(A::Error::duplicate_field(
15567                                    "multiple values for state",
15568                                ));
15569                            }
15570                            result.state = map
15571                                .next_value::<std::option::Option<crate::model::OperationState>>()?
15572                                .unwrap_or_default();
15573                        }
15574                        __FieldTag::__create_link_request => {
15575                            if !fields.insert(__FieldTag::__create_link_request) {
15576                                return std::result::Result::Err(A::Error::duplicate_field(
15577                                    "multiple values for create_link_request",
15578                                ));
15579                            }
15580                            if result.request.is_some() {
15581                                return std::result::Result::Err(A::Error::duplicate_field(
15582                                    "multiple values for `request`, a oneof with full ID .google.logging.v2.LinkMetadata.create_link_request, latest field was createLinkRequest",
15583                                ));
15584                            }
15585                            result.request = std::option::Option::Some(
15586                                crate::model::link_metadata::Request::CreateLinkRequest(
15587                                    map.next_value::<std::option::Option<
15588                                        std::boxed::Box<crate::model::CreateLinkRequest>,
15589                                    >>()?
15590                                    .unwrap_or_default(),
15591                                ),
15592                            );
15593                        }
15594                        __FieldTag::__delete_link_request => {
15595                            if !fields.insert(__FieldTag::__delete_link_request) {
15596                                return std::result::Result::Err(A::Error::duplicate_field(
15597                                    "multiple values for delete_link_request",
15598                                ));
15599                            }
15600                            if result.request.is_some() {
15601                                return std::result::Result::Err(A::Error::duplicate_field(
15602                                    "multiple values for `request`, a oneof with full ID .google.logging.v2.LinkMetadata.delete_link_request, latest field was deleteLinkRequest",
15603                                ));
15604                            }
15605                            result.request = std::option::Option::Some(
15606                                crate::model::link_metadata::Request::DeleteLinkRequest(
15607                                    map.next_value::<std::option::Option<
15608                                        std::boxed::Box<crate::model::DeleteLinkRequest>,
15609                                    >>()?
15610                                    .unwrap_or_default(),
15611                                ),
15612                            );
15613                        }
15614                        __FieldTag::Unknown(key) => {
15615                            let value = map.next_value::<serde_json::Value>()?;
15616                            result._unknown_fields.insert(key, value);
15617                        }
15618                    }
15619                }
15620                std::result::Result::Ok(result)
15621            }
15622        }
15623        deserializer.deserialize_any(Visitor)
15624    }
15625}
15626
15627#[doc(hidden)]
15628impl serde::ser::Serialize for LinkMetadata {
15629    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15630    where
15631        S: serde::ser::Serializer,
15632    {
15633        use serde::ser::SerializeMap;
15634        #[allow(unused_imports)]
15635        use std::option::Option::Some;
15636        let mut state = serializer.serialize_map(std::option::Option::None)?;
15637        if self.start_time.is_some() {
15638            state.serialize_entry("startTime", &self.start_time)?;
15639        }
15640        if self.end_time.is_some() {
15641            state.serialize_entry("endTime", &self.end_time)?;
15642        }
15643        if !wkt::internal::is_default(&self.state) {
15644            state.serialize_entry("state", &self.state)?;
15645        }
15646        if let Some(value) = self.create_link_request() {
15647            state.serialize_entry("createLinkRequest", value)?;
15648        }
15649        if let Some(value) = self.delete_link_request() {
15650            state.serialize_entry("deleteLinkRequest", value)?;
15651        }
15652        if !self._unknown_fields.is_empty() {
15653            for (key, value) in self._unknown_fields.iter() {
15654                state.serialize_entry(key, &value)?;
15655            }
15656        }
15657        state.end()
15658    }
15659}
15660
15661impl std::fmt::Debug for LinkMetadata {
15662    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15663        let mut debug_struct = f.debug_struct("LinkMetadata");
15664        debug_struct.field("start_time", &self.start_time);
15665        debug_struct.field("end_time", &self.end_time);
15666        debug_struct.field("state", &self.state);
15667        debug_struct.field("request", &self.request);
15668        if !self._unknown_fields.is_empty() {
15669            debug_struct.field("_unknown_fields", &self._unknown_fields);
15670        }
15671        debug_struct.finish()
15672    }
15673}
15674
15675/// Defines additional types related to [LinkMetadata].
15676pub mod link_metadata {
15677    #[allow(unused_imports)]
15678    use super::*;
15679
15680    #[derive(Clone, Debug, PartialEq)]
15681    #[non_exhaustive]
15682    pub enum Request {
15683        /// CreateLink RPC request.
15684        CreateLinkRequest(std::boxed::Box<crate::model::CreateLinkRequest>),
15685        /// DeleteLink RPC request.
15686        DeleteLinkRequest(std::boxed::Box<crate::model::DeleteLinkRequest>),
15687    }
15688}
15689
15690/// Cloud Logging specific location metadata.
15691#[derive(Clone, Default, PartialEq)]
15692#[non_exhaustive]
15693pub struct LocationMetadata {
15694    /// Indicates whether or not Log Analytics features are supported in the given
15695    /// location.
15696    pub log_analytics_enabled: bool,
15697
15698    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15699}
15700
15701impl LocationMetadata {
15702    pub fn new() -> Self {
15703        std::default::Default::default()
15704    }
15705
15706    /// Sets the value of [log_analytics_enabled][crate::model::LocationMetadata::log_analytics_enabled].
15707    pub fn set_log_analytics_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15708        self.log_analytics_enabled = v.into();
15709        self
15710    }
15711}
15712
15713impl wkt::message::Message for LocationMetadata {
15714    fn typename() -> &'static str {
15715        "type.googleapis.com/google.logging.v2.LocationMetadata"
15716    }
15717}
15718
15719#[doc(hidden)]
15720impl<'de> serde::de::Deserialize<'de> for LocationMetadata {
15721    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15722    where
15723        D: serde::Deserializer<'de>,
15724    {
15725        #[allow(non_camel_case_types)]
15726        #[doc(hidden)]
15727        #[derive(PartialEq, Eq, Hash)]
15728        enum __FieldTag {
15729            __log_analytics_enabled,
15730            Unknown(std::string::String),
15731        }
15732        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
15733            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15734            where
15735                D: serde::Deserializer<'de>,
15736            {
15737                struct Visitor;
15738                impl<'de> serde::de::Visitor<'de> for Visitor {
15739                    type Value = __FieldTag;
15740                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15741                        formatter.write_str("a field name for LocationMetadata")
15742                    }
15743                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
15744                    where
15745                        E: serde::de::Error,
15746                    {
15747                        use std::result::Result::Ok;
15748                        use std::string::ToString;
15749                        match value {
15750                            "logAnalyticsEnabled" => Ok(__FieldTag::__log_analytics_enabled),
15751                            "log_analytics_enabled" => Ok(__FieldTag::__log_analytics_enabled),
15752                            _ => Ok(__FieldTag::Unknown(value.to_string())),
15753                        }
15754                    }
15755                }
15756                deserializer.deserialize_identifier(Visitor)
15757            }
15758        }
15759        struct Visitor;
15760        impl<'de> serde::de::Visitor<'de> for Visitor {
15761            type Value = LocationMetadata;
15762            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
15763                formatter.write_str("struct LocationMetadata")
15764            }
15765            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
15766            where
15767                A: serde::de::MapAccess<'de>,
15768            {
15769                #[allow(unused_imports)]
15770                use serde::de::Error;
15771                use std::option::Option::Some;
15772                let mut fields = std::collections::HashSet::new();
15773                let mut result = Self::Value::new();
15774                while let Some(tag) = map.next_key::<__FieldTag>()? {
15775                    #[allow(clippy::match_single_binding)]
15776                    match tag {
15777                        __FieldTag::__log_analytics_enabled => {
15778                            if !fields.insert(__FieldTag::__log_analytics_enabled) {
15779                                return std::result::Result::Err(A::Error::duplicate_field(
15780                                    "multiple values for log_analytics_enabled",
15781                                ));
15782                            }
15783                            result.log_analytics_enabled = map
15784                                .next_value::<std::option::Option<bool>>()?
15785                                .unwrap_or_default();
15786                        }
15787                        __FieldTag::Unknown(key) => {
15788                            let value = map.next_value::<serde_json::Value>()?;
15789                            result._unknown_fields.insert(key, value);
15790                        }
15791                    }
15792                }
15793                std::result::Result::Ok(result)
15794            }
15795        }
15796        deserializer.deserialize_any(Visitor)
15797    }
15798}
15799
15800#[doc(hidden)]
15801impl serde::ser::Serialize for LocationMetadata {
15802    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15803    where
15804        S: serde::ser::Serializer,
15805    {
15806        use serde::ser::SerializeMap;
15807        #[allow(unused_imports)]
15808        use std::option::Option::Some;
15809        let mut state = serializer.serialize_map(std::option::Option::None)?;
15810        if !wkt::internal::is_default(&self.log_analytics_enabled) {
15811            state.serialize_entry("logAnalyticsEnabled", &self.log_analytics_enabled)?;
15812        }
15813        if !self._unknown_fields.is_empty() {
15814            for (key, value) in self._unknown_fields.iter() {
15815                state.serialize_entry(key, &value)?;
15816            }
15817        }
15818        state.end()
15819    }
15820}
15821
15822impl std::fmt::Debug for LocationMetadata {
15823    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15824        let mut debug_struct = f.debug_struct("LocationMetadata");
15825        debug_struct.field("log_analytics_enabled", &self.log_analytics_enabled);
15826        if !self._unknown_fields.is_empty() {
15827            debug_struct.field("_unknown_fields", &self._unknown_fields);
15828        }
15829        debug_struct.finish()
15830    }
15831}
15832
15833/// Describes a logs-based metric. The value of the metric is the number of log
15834/// entries that match a logs filter in a given time interval.
15835///
15836/// Logs-based metrics can also be used to extract values from logs and create a
15837/// distribution of the values. The distribution records the statistics of the
15838/// extracted values along with an optional histogram of the values as specified
15839/// by the bucket options.
15840#[derive(Clone, Default, PartialEq)]
15841#[non_exhaustive]
15842pub struct LogMetric {
15843    /// Required. The client-assigned metric identifier.
15844    /// Examples: `"error_count"`, `"nginx/requests"`.
15845    ///
15846    /// Metric identifiers are limited to 100 characters and can include only the
15847    /// following characters: `A-Z`, `a-z`, `0-9`, and the special characters
15848    /// `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
15849    /// name pieces, and it cannot be the first character of the name.
15850    ///
15851    /// This field is the `[METRIC_ID]` part of a metric resource name in the
15852    /// format "projects/[PROJECT_ID]/metrics/[METRIC_ID]". Example: If the
15853    /// resource name of a metric is
15854    /// `"projects/my-project/metrics/nginx%2Frequests"`, this field's value is
15855    /// `"nginx/requests"`.
15856    pub name: std::string::String,
15857
15858    /// Optional. A description of this metric, which is used in documentation.
15859    /// The maximum length of the description is 8000 characters.
15860    pub description: std::string::String,
15861
15862    /// Required. An [advanced logs
15863    /// filter](https://cloud.google.com/logging/docs/view/advanced_filters) which
15864    /// is used to match log entries. Example:
15865    ///
15866    /// ```norust
15867    /// "resource.type=gae_app AND severity>=ERROR"
15868    /// ```
15869    ///
15870    /// The maximum length of the filter is 20000 characters.
15871    pub filter: std::string::String,
15872
15873    /// Optional. The resource name of the Log Bucket that owns the Log Metric.
15874    /// Only Log Buckets in projects are supported. The bucket has to be in the
15875    /// same project as the metric.
15876    ///
15877    /// For example:
15878    ///
15879    /// `projects/my-project/locations/global/buckets/my-bucket`
15880    ///
15881    /// If empty, then the Log Metric is considered a non-Bucket Log Metric.
15882    pub bucket_name: std::string::String,
15883
15884    /// Optional. If set to True, then this metric is disabled and it does not
15885    /// generate any points.
15886    pub disabled: bool,
15887
15888    /// Optional. The metric descriptor associated with the logs-based metric.
15889    /// If unspecified, it uses a default metric descriptor with a DELTA metric
15890    /// kind, INT64 value type, with no labels and a unit of "1". Such a metric
15891    /// counts the number of log entries matching the `filter` expression.
15892    ///
15893    /// The `name`, `type`, and `description` fields in the `metric_descriptor`
15894    /// are output only, and is constructed using the `name` and `description`
15895    /// field in the LogMetric.
15896    ///
15897    /// To create a logs-based metric that records a distribution of log values, a
15898    /// DELTA metric kind with a DISTRIBUTION value type must be used along with
15899    /// a `value_extractor` expression in the LogMetric.
15900    ///
15901    /// Each label in the metric descriptor must have a matching label
15902    /// name as the key and an extractor expression as the value in the
15903    /// `label_extractors` map.
15904    ///
15905    /// The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
15906    /// be updated once initially configured. New labels can be added in the
15907    /// `metric_descriptor`, but existing labels cannot be modified except for
15908    /// their description.
15909    pub metric_descriptor: std::option::Option<api::model::MetricDescriptor>,
15910
15911    /// Optional. A `value_extractor` is required when using a distribution
15912    /// logs-based metric to extract the values to record from a log entry.
15913    /// Two functions are supported for value extraction: `EXTRACT(field)` or
15914    /// `REGEXP_EXTRACT(field, regex)`. The arguments are:
15915    ///
15916    /// 1. field: The name of the log entry field from which the value is to be
15917    ///    extracted.
15918    /// 1. regex: A regular expression using the Google RE2 syntax
15919    ///    (<https://github.com/google/re2/wiki/Syntax>) with a single capture
15920    ///    group to extract data from the specified log entry field. The value
15921    ///    of the field is converted to a string before applying the regex.
15922    ///    It is an error to specify a regex that does not include exactly one
15923    ///    capture group.
15924    ///
15925    /// The result of the extraction must be convertible to a double type, as the
15926    /// distribution always records double values. If either the extraction or
15927    /// the conversion to double fails, then those values are not recorded in the
15928    /// distribution.
15929    ///
15930    /// Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")`
15931    pub value_extractor: std::string::String,
15932
15933    /// Optional. A map from a label key string to an extractor expression which is
15934    /// used to extract data from a log entry field and assign as the label value.
15935    /// Each label key specified in the LabelDescriptor must have an associated
15936    /// extractor expression in this map. The syntax of the extractor expression
15937    /// is the same as for the `value_extractor` field.
15938    ///
15939    /// The extracted value is converted to the type defined in the label
15940    /// descriptor. If either the extraction or the type conversion fails,
15941    /// the label will have a default value. The default value for a string
15942    /// label is an empty string, for an integer label its 0, and for a boolean
15943    /// label its `false`.
15944    ///
15945    /// Note that there are upper bounds on the maximum number of labels and the
15946    /// number of active time series that are allowed in a project.
15947    pub label_extractors: std::collections::HashMap<std::string::String, std::string::String>,
15948
15949    /// Optional. The `bucket_options` are required when the logs-based metric is
15950    /// using a DISTRIBUTION value type and it describes the bucket boundaries
15951    /// used to create a histogram of the extracted values.
15952    pub bucket_options: std::option::Option<api::model::distribution::BucketOptions>,
15953
15954    /// Output only. The creation timestamp of the metric.
15955    ///
15956    /// This field may not be present for older metrics.
15957    pub create_time: std::option::Option<wkt::Timestamp>,
15958
15959    /// Output only. The last update timestamp of the metric.
15960    ///
15961    /// This field may not be present for older metrics.
15962    pub update_time: std::option::Option<wkt::Timestamp>,
15963
15964    /// Deprecated. The API version that created or updated this metric.
15965    /// The v2 format is used by default and cannot be changed.
15966    #[deprecated]
15967    pub version: crate::model::log_metric::ApiVersion,
15968
15969    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15970}
15971
15972impl LogMetric {
15973    pub fn new() -> Self {
15974        std::default::Default::default()
15975    }
15976
15977    /// Sets the value of [name][crate::model::LogMetric::name].
15978    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15979        self.name = v.into();
15980        self
15981    }
15982
15983    /// Sets the value of [description][crate::model::LogMetric::description].
15984    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15985        self.description = v.into();
15986        self
15987    }
15988
15989    /// Sets the value of [filter][crate::model::LogMetric::filter].
15990    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15991        self.filter = v.into();
15992        self
15993    }
15994
15995    /// Sets the value of [bucket_name][crate::model::LogMetric::bucket_name].
15996    pub fn set_bucket_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15997        self.bucket_name = v.into();
15998        self
15999    }
16000
16001    /// Sets the value of [disabled][crate::model::LogMetric::disabled].
16002    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16003        self.disabled = v.into();
16004        self
16005    }
16006
16007    /// Sets the value of [metric_descriptor][crate::model::LogMetric::metric_descriptor].
16008    pub fn set_metric_descriptor<T>(mut self, v: T) -> Self
16009    where
16010        T: std::convert::Into<api::model::MetricDescriptor>,
16011    {
16012        self.metric_descriptor = std::option::Option::Some(v.into());
16013        self
16014    }
16015
16016    /// Sets or clears the value of [metric_descriptor][crate::model::LogMetric::metric_descriptor].
16017    pub fn set_or_clear_metric_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
16018    where
16019        T: std::convert::Into<api::model::MetricDescriptor>,
16020    {
16021        self.metric_descriptor = v.map(|x| x.into());
16022        self
16023    }
16024
16025    /// Sets the value of [value_extractor][crate::model::LogMetric::value_extractor].
16026    pub fn set_value_extractor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16027        self.value_extractor = v.into();
16028        self
16029    }
16030
16031    /// Sets the value of [label_extractors][crate::model::LogMetric::label_extractors].
16032    pub fn set_label_extractors<T, K, V>(mut self, v: T) -> Self
16033    where
16034        T: std::iter::IntoIterator<Item = (K, V)>,
16035        K: std::convert::Into<std::string::String>,
16036        V: std::convert::Into<std::string::String>,
16037    {
16038        use std::iter::Iterator;
16039        self.label_extractors = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16040        self
16041    }
16042
16043    /// Sets the value of [bucket_options][crate::model::LogMetric::bucket_options].
16044    pub fn set_bucket_options<T>(mut self, v: T) -> Self
16045    where
16046        T: std::convert::Into<api::model::distribution::BucketOptions>,
16047    {
16048        self.bucket_options = std::option::Option::Some(v.into());
16049        self
16050    }
16051
16052    /// Sets or clears the value of [bucket_options][crate::model::LogMetric::bucket_options].
16053    pub fn set_or_clear_bucket_options<T>(mut self, v: std::option::Option<T>) -> Self
16054    where
16055        T: std::convert::Into<api::model::distribution::BucketOptions>,
16056    {
16057        self.bucket_options = v.map(|x| x.into());
16058        self
16059    }
16060
16061    /// Sets the value of [create_time][crate::model::LogMetric::create_time].
16062    pub fn set_create_time<T>(mut self, v: T) -> Self
16063    where
16064        T: std::convert::Into<wkt::Timestamp>,
16065    {
16066        self.create_time = std::option::Option::Some(v.into());
16067        self
16068    }
16069
16070    /// Sets or clears the value of [create_time][crate::model::LogMetric::create_time].
16071    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16072    where
16073        T: std::convert::Into<wkt::Timestamp>,
16074    {
16075        self.create_time = v.map(|x| x.into());
16076        self
16077    }
16078
16079    /// Sets the value of [update_time][crate::model::LogMetric::update_time].
16080    pub fn set_update_time<T>(mut self, v: T) -> Self
16081    where
16082        T: std::convert::Into<wkt::Timestamp>,
16083    {
16084        self.update_time = std::option::Option::Some(v.into());
16085        self
16086    }
16087
16088    /// Sets or clears the value of [update_time][crate::model::LogMetric::update_time].
16089    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
16090    where
16091        T: std::convert::Into<wkt::Timestamp>,
16092    {
16093        self.update_time = v.map(|x| x.into());
16094        self
16095    }
16096
16097    /// Sets the value of [version][crate::model::LogMetric::version].
16098    #[deprecated]
16099    pub fn set_version<T: std::convert::Into<crate::model::log_metric::ApiVersion>>(
16100        mut self,
16101        v: T,
16102    ) -> Self {
16103        self.version = v.into();
16104        self
16105    }
16106}
16107
16108impl wkt::message::Message for LogMetric {
16109    fn typename() -> &'static str {
16110        "type.googleapis.com/google.logging.v2.LogMetric"
16111    }
16112}
16113
16114#[doc(hidden)]
16115impl<'de> serde::de::Deserialize<'de> for LogMetric {
16116    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16117    where
16118        D: serde::Deserializer<'de>,
16119    {
16120        #[allow(non_camel_case_types)]
16121        #[doc(hidden)]
16122        #[derive(PartialEq, Eq, Hash)]
16123        enum __FieldTag {
16124            __name,
16125            __description,
16126            __filter,
16127            __bucket_name,
16128            __disabled,
16129            __metric_descriptor,
16130            __value_extractor,
16131            __label_extractors,
16132            __bucket_options,
16133            __create_time,
16134            __update_time,
16135            __version,
16136            Unknown(std::string::String),
16137        }
16138        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16139            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16140            where
16141                D: serde::Deserializer<'de>,
16142            {
16143                struct Visitor;
16144                impl<'de> serde::de::Visitor<'de> for Visitor {
16145                    type Value = __FieldTag;
16146                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16147                        formatter.write_str("a field name for LogMetric")
16148                    }
16149                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16150                    where
16151                        E: serde::de::Error,
16152                    {
16153                        use std::result::Result::Ok;
16154                        use std::string::ToString;
16155                        match value {
16156                            "name" => Ok(__FieldTag::__name),
16157                            "description" => Ok(__FieldTag::__description),
16158                            "filter" => Ok(__FieldTag::__filter),
16159                            "bucketName" => Ok(__FieldTag::__bucket_name),
16160                            "bucket_name" => Ok(__FieldTag::__bucket_name),
16161                            "disabled" => Ok(__FieldTag::__disabled),
16162                            "metricDescriptor" => Ok(__FieldTag::__metric_descriptor),
16163                            "metric_descriptor" => Ok(__FieldTag::__metric_descriptor),
16164                            "valueExtractor" => Ok(__FieldTag::__value_extractor),
16165                            "value_extractor" => Ok(__FieldTag::__value_extractor),
16166                            "labelExtractors" => Ok(__FieldTag::__label_extractors),
16167                            "label_extractors" => Ok(__FieldTag::__label_extractors),
16168                            "bucketOptions" => Ok(__FieldTag::__bucket_options),
16169                            "bucket_options" => Ok(__FieldTag::__bucket_options),
16170                            "createTime" => Ok(__FieldTag::__create_time),
16171                            "create_time" => Ok(__FieldTag::__create_time),
16172                            "updateTime" => Ok(__FieldTag::__update_time),
16173                            "update_time" => Ok(__FieldTag::__update_time),
16174                            "version" => Ok(__FieldTag::__version),
16175                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16176                        }
16177                    }
16178                }
16179                deserializer.deserialize_identifier(Visitor)
16180            }
16181        }
16182        struct Visitor;
16183        impl<'de> serde::de::Visitor<'de> for Visitor {
16184            type Value = LogMetric;
16185            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16186                formatter.write_str("struct LogMetric")
16187            }
16188            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16189            where
16190                A: serde::de::MapAccess<'de>,
16191            {
16192                #[allow(unused_imports)]
16193                use serde::de::Error;
16194                use std::option::Option::Some;
16195                let mut fields = std::collections::HashSet::new();
16196                let mut result = Self::Value::new();
16197                while let Some(tag) = map.next_key::<__FieldTag>()? {
16198                    #[allow(clippy::match_single_binding)]
16199                    match tag {
16200                        __FieldTag::__name => {
16201                            if !fields.insert(__FieldTag::__name) {
16202                                return std::result::Result::Err(A::Error::duplicate_field(
16203                                    "multiple values for name",
16204                                ));
16205                            }
16206                            result.name = map
16207                                .next_value::<std::option::Option<std::string::String>>()?
16208                                .unwrap_or_default();
16209                        }
16210                        __FieldTag::__description => {
16211                            if !fields.insert(__FieldTag::__description) {
16212                                return std::result::Result::Err(A::Error::duplicate_field(
16213                                    "multiple values for description",
16214                                ));
16215                            }
16216                            result.description = map
16217                                .next_value::<std::option::Option<std::string::String>>()?
16218                                .unwrap_or_default();
16219                        }
16220                        __FieldTag::__filter => {
16221                            if !fields.insert(__FieldTag::__filter) {
16222                                return std::result::Result::Err(A::Error::duplicate_field(
16223                                    "multiple values for filter",
16224                                ));
16225                            }
16226                            result.filter = map
16227                                .next_value::<std::option::Option<std::string::String>>()?
16228                                .unwrap_or_default();
16229                        }
16230                        __FieldTag::__bucket_name => {
16231                            if !fields.insert(__FieldTag::__bucket_name) {
16232                                return std::result::Result::Err(A::Error::duplicate_field(
16233                                    "multiple values for bucket_name",
16234                                ));
16235                            }
16236                            result.bucket_name = map
16237                                .next_value::<std::option::Option<std::string::String>>()?
16238                                .unwrap_or_default();
16239                        }
16240                        __FieldTag::__disabled => {
16241                            if !fields.insert(__FieldTag::__disabled) {
16242                                return std::result::Result::Err(A::Error::duplicate_field(
16243                                    "multiple values for disabled",
16244                                ));
16245                            }
16246                            result.disabled = map
16247                                .next_value::<std::option::Option<bool>>()?
16248                                .unwrap_or_default();
16249                        }
16250                        __FieldTag::__metric_descriptor => {
16251                            if !fields.insert(__FieldTag::__metric_descriptor) {
16252                                return std::result::Result::Err(A::Error::duplicate_field(
16253                                    "multiple values for metric_descriptor",
16254                                ));
16255                            }
16256                            result.metric_descriptor = map
16257                                .next_value::<std::option::Option<api::model::MetricDescriptor>>(
16258                                )?;
16259                        }
16260                        __FieldTag::__value_extractor => {
16261                            if !fields.insert(__FieldTag::__value_extractor) {
16262                                return std::result::Result::Err(A::Error::duplicate_field(
16263                                    "multiple values for value_extractor",
16264                                ));
16265                            }
16266                            result.value_extractor = map
16267                                .next_value::<std::option::Option<std::string::String>>()?
16268                                .unwrap_or_default();
16269                        }
16270                        __FieldTag::__label_extractors => {
16271                            if !fields.insert(__FieldTag::__label_extractors) {
16272                                return std::result::Result::Err(A::Error::duplicate_field(
16273                                    "multiple values for label_extractors",
16274                                ));
16275                            }
16276                            result.label_extractors = map
16277                                .next_value::<std::option::Option<
16278                                    std::collections::HashMap<
16279                                        std::string::String,
16280                                        std::string::String,
16281                                    >,
16282                                >>()?
16283                                .unwrap_or_default();
16284                        }
16285                        __FieldTag::__bucket_options => {
16286                            if !fields.insert(__FieldTag::__bucket_options) {
16287                                return std::result::Result::Err(A::Error::duplicate_field(
16288                                    "multiple values for bucket_options",
16289                                ));
16290                            }
16291                            result.bucket_options = map.next_value::<std::option::Option<api::model::distribution::BucketOptions>>()?
16292                                ;
16293                        }
16294                        __FieldTag::__create_time => {
16295                            if !fields.insert(__FieldTag::__create_time) {
16296                                return std::result::Result::Err(A::Error::duplicate_field(
16297                                    "multiple values for create_time",
16298                                ));
16299                            }
16300                            result.create_time =
16301                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16302                        }
16303                        __FieldTag::__update_time => {
16304                            if !fields.insert(__FieldTag::__update_time) {
16305                                return std::result::Result::Err(A::Error::duplicate_field(
16306                                    "multiple values for update_time",
16307                                ));
16308                            }
16309                            result.update_time =
16310                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
16311                        }
16312                        __FieldTag::__version => {
16313                            if !fields.insert(__FieldTag::__version) {
16314                                return std::result::Result::Err(A::Error::duplicate_field(
16315                                    "multiple values for version",
16316                                ));
16317                            }
16318                            result.version = map.next_value::<std::option::Option<crate::model::log_metric::ApiVersion>>()?.unwrap_or_default();
16319                        }
16320                        __FieldTag::Unknown(key) => {
16321                            let value = map.next_value::<serde_json::Value>()?;
16322                            result._unknown_fields.insert(key, value);
16323                        }
16324                    }
16325                }
16326                std::result::Result::Ok(result)
16327            }
16328        }
16329        deserializer.deserialize_any(Visitor)
16330    }
16331}
16332
16333#[doc(hidden)]
16334impl serde::ser::Serialize for LogMetric {
16335    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16336    where
16337        S: serde::ser::Serializer,
16338    {
16339        use serde::ser::SerializeMap;
16340        #[allow(unused_imports)]
16341        use std::option::Option::Some;
16342        let mut state = serializer.serialize_map(std::option::Option::None)?;
16343        if !self.name.is_empty() {
16344            state.serialize_entry("name", &self.name)?;
16345        }
16346        if !self.description.is_empty() {
16347            state.serialize_entry("description", &self.description)?;
16348        }
16349        if !self.filter.is_empty() {
16350            state.serialize_entry("filter", &self.filter)?;
16351        }
16352        if !self.bucket_name.is_empty() {
16353            state.serialize_entry("bucketName", &self.bucket_name)?;
16354        }
16355        if !wkt::internal::is_default(&self.disabled) {
16356            state.serialize_entry("disabled", &self.disabled)?;
16357        }
16358        if self.metric_descriptor.is_some() {
16359            state.serialize_entry("metricDescriptor", &self.metric_descriptor)?;
16360        }
16361        if !self.value_extractor.is_empty() {
16362            state.serialize_entry("valueExtractor", &self.value_extractor)?;
16363        }
16364        if !self.label_extractors.is_empty() {
16365            state.serialize_entry("labelExtractors", &self.label_extractors)?;
16366        }
16367        if self.bucket_options.is_some() {
16368            state.serialize_entry("bucketOptions", &self.bucket_options)?;
16369        }
16370        if self.create_time.is_some() {
16371            state.serialize_entry("createTime", &self.create_time)?;
16372        }
16373        if self.update_time.is_some() {
16374            state.serialize_entry("updateTime", &self.update_time)?;
16375        }
16376        if !wkt::internal::is_default(&self.version) {
16377            state.serialize_entry("version", &self.version)?;
16378        }
16379        if !self._unknown_fields.is_empty() {
16380            for (key, value) in self._unknown_fields.iter() {
16381                state.serialize_entry(key, &value)?;
16382            }
16383        }
16384        state.end()
16385    }
16386}
16387
16388impl std::fmt::Debug for LogMetric {
16389    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16390        let mut debug_struct = f.debug_struct("LogMetric");
16391        debug_struct.field("name", &self.name);
16392        debug_struct.field("description", &self.description);
16393        debug_struct.field("filter", &self.filter);
16394        debug_struct.field("bucket_name", &self.bucket_name);
16395        debug_struct.field("disabled", &self.disabled);
16396        debug_struct.field("metric_descriptor", &self.metric_descriptor);
16397        debug_struct.field("value_extractor", &self.value_extractor);
16398        debug_struct.field("label_extractors", &self.label_extractors);
16399        debug_struct.field("bucket_options", &self.bucket_options);
16400        debug_struct.field("create_time", &self.create_time);
16401        debug_struct.field("update_time", &self.update_time);
16402        debug_struct.field("version", &self.version);
16403        if !self._unknown_fields.is_empty() {
16404            debug_struct.field("_unknown_fields", &self._unknown_fields);
16405        }
16406        debug_struct.finish()
16407    }
16408}
16409
16410/// Defines additional types related to [LogMetric].
16411pub mod log_metric {
16412    #[allow(unused_imports)]
16413    use super::*;
16414
16415    /// Logging API version.
16416    ///
16417    /// # Working with unknown values
16418    ///
16419    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16420    /// additional enum variants at any time. Adding new variants is not considered
16421    /// a breaking change. Applications should write their code in anticipation of:
16422    ///
16423    /// - New values appearing in future releases of the client library, **and**
16424    /// - New values received dynamically, without application changes.
16425    ///
16426    /// Please consult the [Working with enums] section in the user guide for some
16427    /// guidelines.
16428    ///
16429    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16430    #[derive(Clone, Debug, PartialEq)]
16431    #[non_exhaustive]
16432    pub enum ApiVersion {
16433        /// Logging API v2.
16434        V2,
16435        /// Logging API v1.
16436        V1,
16437        /// If set, the enum was initialized with an unknown value.
16438        ///
16439        /// Applications can examine the value using [ApiVersion::value] or
16440        /// [ApiVersion::name].
16441        UnknownValue(api_version::UnknownValue),
16442    }
16443
16444    #[doc(hidden)]
16445    pub mod api_version {
16446        #[allow(unused_imports)]
16447        use super::*;
16448        #[derive(Clone, Debug, PartialEq)]
16449        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16450    }
16451
16452    impl ApiVersion {
16453        /// Gets the enum value.
16454        ///
16455        /// Returns `None` if the enum contains an unknown value deserialized from
16456        /// the string representation of enums.
16457        pub fn value(&self) -> std::option::Option<i32> {
16458            match self {
16459                Self::V2 => std::option::Option::Some(0),
16460                Self::V1 => std::option::Option::Some(1),
16461                Self::UnknownValue(u) => u.0.value(),
16462            }
16463        }
16464
16465        /// Gets the enum value as a string.
16466        ///
16467        /// Returns `None` if the enum contains an unknown value deserialized from
16468        /// the integer representation of enums.
16469        pub fn name(&self) -> std::option::Option<&str> {
16470            match self {
16471                Self::V2 => std::option::Option::Some("V2"),
16472                Self::V1 => std::option::Option::Some("V1"),
16473                Self::UnknownValue(u) => u.0.name(),
16474            }
16475        }
16476    }
16477
16478    impl std::default::Default for ApiVersion {
16479        fn default() -> Self {
16480            use std::convert::From;
16481            Self::from(0)
16482        }
16483    }
16484
16485    impl std::fmt::Display for ApiVersion {
16486        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16487            wkt::internal::display_enum(f, self.name(), self.value())
16488        }
16489    }
16490
16491    impl std::convert::From<i32> for ApiVersion {
16492        fn from(value: i32) -> Self {
16493            match value {
16494                0 => Self::V2,
16495                1 => Self::V1,
16496                _ => Self::UnknownValue(api_version::UnknownValue(
16497                    wkt::internal::UnknownEnumValue::Integer(value),
16498                )),
16499            }
16500        }
16501    }
16502
16503    impl std::convert::From<&str> for ApiVersion {
16504        fn from(value: &str) -> Self {
16505            use std::string::ToString;
16506            match value {
16507                "V2" => Self::V2,
16508                "V1" => Self::V1,
16509                _ => Self::UnknownValue(api_version::UnknownValue(
16510                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16511                )),
16512            }
16513        }
16514    }
16515
16516    impl serde::ser::Serialize for ApiVersion {
16517        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16518        where
16519            S: serde::Serializer,
16520        {
16521            match self {
16522                Self::V2 => serializer.serialize_i32(0),
16523                Self::V1 => serializer.serialize_i32(1),
16524                Self::UnknownValue(u) => u.0.serialize(serializer),
16525            }
16526        }
16527    }
16528
16529    impl<'de> serde::de::Deserialize<'de> for ApiVersion {
16530        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16531        where
16532            D: serde::Deserializer<'de>,
16533        {
16534            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ApiVersion>::new(
16535                ".google.logging.v2.LogMetric.ApiVersion",
16536            ))
16537        }
16538    }
16539}
16540
16541/// The parameters to ListLogMetrics.
16542#[derive(Clone, Default, PartialEq)]
16543#[non_exhaustive]
16544pub struct ListLogMetricsRequest {
16545    /// Required. The name of the project containing the metrics:
16546    ///
16547    /// ```norust
16548    /// "projects/[PROJECT_ID]"
16549    /// ```
16550    pub parent: std::string::String,
16551
16552    /// Optional. If present, then retrieve the next batch of results from the
16553    /// preceding call to this method. `pageToken` must be the value of
16554    /// `nextPageToken` from the previous response. The values of other method
16555    /// parameters should be identical to those in the previous call.
16556    pub page_token: std::string::String,
16557
16558    /// Optional. The maximum number of results to return from this request.
16559    /// Non-positive values are ignored. The presence of `nextPageToken` in the
16560    /// response indicates that more results might be available.
16561    pub page_size: i32,
16562
16563    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16564}
16565
16566impl ListLogMetricsRequest {
16567    pub fn new() -> Self {
16568        std::default::Default::default()
16569    }
16570
16571    /// Sets the value of [parent][crate::model::ListLogMetricsRequest::parent].
16572    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16573        self.parent = v.into();
16574        self
16575    }
16576
16577    /// Sets the value of [page_token][crate::model::ListLogMetricsRequest::page_token].
16578    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16579        self.page_token = v.into();
16580        self
16581    }
16582
16583    /// Sets the value of [page_size][crate::model::ListLogMetricsRequest::page_size].
16584    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16585        self.page_size = v.into();
16586        self
16587    }
16588}
16589
16590impl wkt::message::Message for ListLogMetricsRequest {
16591    fn typename() -> &'static str {
16592        "type.googleapis.com/google.logging.v2.ListLogMetricsRequest"
16593    }
16594}
16595
16596#[doc(hidden)]
16597impl<'de> serde::de::Deserialize<'de> for ListLogMetricsRequest {
16598    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16599    where
16600        D: serde::Deserializer<'de>,
16601    {
16602        #[allow(non_camel_case_types)]
16603        #[doc(hidden)]
16604        #[derive(PartialEq, Eq, Hash)]
16605        enum __FieldTag {
16606            __parent,
16607            __page_token,
16608            __page_size,
16609            Unknown(std::string::String),
16610        }
16611        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16612            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16613            where
16614                D: serde::Deserializer<'de>,
16615            {
16616                struct Visitor;
16617                impl<'de> serde::de::Visitor<'de> for Visitor {
16618                    type Value = __FieldTag;
16619                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16620                        formatter.write_str("a field name for ListLogMetricsRequest")
16621                    }
16622                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16623                    where
16624                        E: serde::de::Error,
16625                    {
16626                        use std::result::Result::Ok;
16627                        use std::string::ToString;
16628                        match value {
16629                            "parent" => Ok(__FieldTag::__parent),
16630                            "pageToken" => Ok(__FieldTag::__page_token),
16631                            "page_token" => Ok(__FieldTag::__page_token),
16632                            "pageSize" => Ok(__FieldTag::__page_size),
16633                            "page_size" => Ok(__FieldTag::__page_size),
16634                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16635                        }
16636                    }
16637                }
16638                deserializer.deserialize_identifier(Visitor)
16639            }
16640        }
16641        struct Visitor;
16642        impl<'de> serde::de::Visitor<'de> for Visitor {
16643            type Value = ListLogMetricsRequest;
16644            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16645                formatter.write_str("struct ListLogMetricsRequest")
16646            }
16647            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16648            where
16649                A: serde::de::MapAccess<'de>,
16650            {
16651                #[allow(unused_imports)]
16652                use serde::de::Error;
16653                use std::option::Option::Some;
16654                let mut fields = std::collections::HashSet::new();
16655                let mut result = Self::Value::new();
16656                while let Some(tag) = map.next_key::<__FieldTag>()? {
16657                    #[allow(clippy::match_single_binding)]
16658                    match tag {
16659                        __FieldTag::__parent => {
16660                            if !fields.insert(__FieldTag::__parent) {
16661                                return std::result::Result::Err(A::Error::duplicate_field(
16662                                    "multiple values for parent",
16663                                ));
16664                            }
16665                            result.parent = map
16666                                .next_value::<std::option::Option<std::string::String>>()?
16667                                .unwrap_or_default();
16668                        }
16669                        __FieldTag::__page_token => {
16670                            if !fields.insert(__FieldTag::__page_token) {
16671                                return std::result::Result::Err(A::Error::duplicate_field(
16672                                    "multiple values for page_token",
16673                                ));
16674                            }
16675                            result.page_token = map
16676                                .next_value::<std::option::Option<std::string::String>>()?
16677                                .unwrap_or_default();
16678                        }
16679                        __FieldTag::__page_size => {
16680                            if !fields.insert(__FieldTag::__page_size) {
16681                                return std::result::Result::Err(A::Error::duplicate_field(
16682                                    "multiple values for page_size",
16683                                ));
16684                            }
16685                            struct __With(std::option::Option<i32>);
16686                            impl<'de> serde::de::Deserialize<'de> for __With {
16687                                fn deserialize<D>(
16688                                    deserializer: D,
16689                                ) -> std::result::Result<Self, D::Error>
16690                                where
16691                                    D: serde::de::Deserializer<'de>,
16692                                {
16693                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
16694                                }
16695                            }
16696                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
16697                        }
16698                        __FieldTag::Unknown(key) => {
16699                            let value = map.next_value::<serde_json::Value>()?;
16700                            result._unknown_fields.insert(key, value);
16701                        }
16702                    }
16703                }
16704                std::result::Result::Ok(result)
16705            }
16706        }
16707        deserializer.deserialize_any(Visitor)
16708    }
16709}
16710
16711#[doc(hidden)]
16712impl serde::ser::Serialize for ListLogMetricsRequest {
16713    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16714    where
16715        S: serde::ser::Serializer,
16716    {
16717        use serde::ser::SerializeMap;
16718        #[allow(unused_imports)]
16719        use std::option::Option::Some;
16720        let mut state = serializer.serialize_map(std::option::Option::None)?;
16721        if !self.parent.is_empty() {
16722            state.serialize_entry("parent", &self.parent)?;
16723        }
16724        if !self.page_token.is_empty() {
16725            state.serialize_entry("pageToken", &self.page_token)?;
16726        }
16727        if !wkt::internal::is_default(&self.page_size) {
16728            struct __With<'a>(&'a i32);
16729            impl<'a> serde::ser::Serialize for __With<'a> {
16730                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16731                where
16732                    S: serde::ser::Serializer,
16733                {
16734                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
16735                }
16736            }
16737            state.serialize_entry("pageSize", &__With(&self.page_size))?;
16738        }
16739        if !self._unknown_fields.is_empty() {
16740            for (key, value) in self._unknown_fields.iter() {
16741                state.serialize_entry(key, &value)?;
16742            }
16743        }
16744        state.end()
16745    }
16746}
16747
16748impl std::fmt::Debug for ListLogMetricsRequest {
16749    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16750        let mut debug_struct = f.debug_struct("ListLogMetricsRequest");
16751        debug_struct.field("parent", &self.parent);
16752        debug_struct.field("page_token", &self.page_token);
16753        debug_struct.field("page_size", &self.page_size);
16754        if !self._unknown_fields.is_empty() {
16755            debug_struct.field("_unknown_fields", &self._unknown_fields);
16756        }
16757        debug_struct.finish()
16758    }
16759}
16760
16761/// Result returned from ListLogMetrics.
16762#[derive(Clone, Default, PartialEq)]
16763#[non_exhaustive]
16764pub struct ListLogMetricsResponse {
16765    /// A list of logs-based metrics.
16766    pub metrics: std::vec::Vec<crate::model::LogMetric>,
16767
16768    /// If there might be more results than appear in this response, then
16769    /// `nextPageToken` is included. To get the next set of results, call this
16770    /// method again using the value of `nextPageToken` as `pageToken`.
16771    pub next_page_token: std::string::String,
16772
16773    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16774}
16775
16776impl ListLogMetricsResponse {
16777    pub fn new() -> Self {
16778        std::default::Default::default()
16779    }
16780
16781    /// Sets the value of [metrics][crate::model::ListLogMetricsResponse::metrics].
16782    pub fn set_metrics<T, V>(mut self, v: T) -> Self
16783    where
16784        T: std::iter::IntoIterator<Item = V>,
16785        V: std::convert::Into<crate::model::LogMetric>,
16786    {
16787        use std::iter::Iterator;
16788        self.metrics = v.into_iter().map(|i| i.into()).collect();
16789        self
16790    }
16791
16792    /// Sets the value of [next_page_token][crate::model::ListLogMetricsResponse::next_page_token].
16793    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16794        self.next_page_token = v.into();
16795        self
16796    }
16797}
16798
16799impl wkt::message::Message for ListLogMetricsResponse {
16800    fn typename() -> &'static str {
16801        "type.googleapis.com/google.logging.v2.ListLogMetricsResponse"
16802    }
16803}
16804
16805#[doc(hidden)]
16806impl gax::paginator::internal::PageableResponse for ListLogMetricsResponse {
16807    type PageItem = crate::model::LogMetric;
16808
16809    fn items(self) -> std::vec::Vec<Self::PageItem> {
16810        self.metrics
16811    }
16812
16813    fn next_page_token(&self) -> std::string::String {
16814        use std::clone::Clone;
16815        self.next_page_token.clone()
16816    }
16817}
16818
16819#[doc(hidden)]
16820impl<'de> serde::de::Deserialize<'de> for ListLogMetricsResponse {
16821    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16822    where
16823        D: serde::Deserializer<'de>,
16824    {
16825        #[allow(non_camel_case_types)]
16826        #[doc(hidden)]
16827        #[derive(PartialEq, Eq, Hash)]
16828        enum __FieldTag {
16829            __metrics,
16830            __next_page_token,
16831            Unknown(std::string::String),
16832        }
16833        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16834            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16835            where
16836                D: serde::Deserializer<'de>,
16837            {
16838                struct Visitor;
16839                impl<'de> serde::de::Visitor<'de> for Visitor {
16840                    type Value = __FieldTag;
16841                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16842                        formatter.write_str("a field name for ListLogMetricsResponse")
16843                    }
16844                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
16845                    where
16846                        E: serde::de::Error,
16847                    {
16848                        use std::result::Result::Ok;
16849                        use std::string::ToString;
16850                        match value {
16851                            "metrics" => Ok(__FieldTag::__metrics),
16852                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
16853                            "next_page_token" => Ok(__FieldTag::__next_page_token),
16854                            _ => Ok(__FieldTag::Unknown(value.to_string())),
16855                        }
16856                    }
16857                }
16858                deserializer.deserialize_identifier(Visitor)
16859            }
16860        }
16861        struct Visitor;
16862        impl<'de> serde::de::Visitor<'de> for Visitor {
16863            type Value = ListLogMetricsResponse;
16864            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
16865                formatter.write_str("struct ListLogMetricsResponse")
16866            }
16867            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
16868            where
16869                A: serde::de::MapAccess<'de>,
16870            {
16871                #[allow(unused_imports)]
16872                use serde::de::Error;
16873                use std::option::Option::Some;
16874                let mut fields = std::collections::HashSet::new();
16875                let mut result = Self::Value::new();
16876                while let Some(tag) = map.next_key::<__FieldTag>()? {
16877                    #[allow(clippy::match_single_binding)]
16878                    match tag {
16879                        __FieldTag::__metrics => {
16880                            if !fields.insert(__FieldTag::__metrics) {
16881                                return std::result::Result::Err(A::Error::duplicate_field(
16882                                    "multiple values for metrics",
16883                                ));
16884                            }
16885                            result.metrics = map.next_value::<std::option::Option<std::vec::Vec<crate::model::LogMetric>>>()?.unwrap_or_default();
16886                        }
16887                        __FieldTag::__next_page_token => {
16888                            if !fields.insert(__FieldTag::__next_page_token) {
16889                                return std::result::Result::Err(A::Error::duplicate_field(
16890                                    "multiple values for next_page_token",
16891                                ));
16892                            }
16893                            result.next_page_token = map
16894                                .next_value::<std::option::Option<std::string::String>>()?
16895                                .unwrap_or_default();
16896                        }
16897                        __FieldTag::Unknown(key) => {
16898                            let value = map.next_value::<serde_json::Value>()?;
16899                            result._unknown_fields.insert(key, value);
16900                        }
16901                    }
16902                }
16903                std::result::Result::Ok(result)
16904            }
16905        }
16906        deserializer.deserialize_any(Visitor)
16907    }
16908}
16909
16910#[doc(hidden)]
16911impl serde::ser::Serialize for ListLogMetricsResponse {
16912    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16913    where
16914        S: serde::ser::Serializer,
16915    {
16916        use serde::ser::SerializeMap;
16917        #[allow(unused_imports)]
16918        use std::option::Option::Some;
16919        let mut state = serializer.serialize_map(std::option::Option::None)?;
16920        if !self.metrics.is_empty() {
16921            state.serialize_entry("metrics", &self.metrics)?;
16922        }
16923        if !self.next_page_token.is_empty() {
16924            state.serialize_entry("nextPageToken", &self.next_page_token)?;
16925        }
16926        if !self._unknown_fields.is_empty() {
16927            for (key, value) in self._unknown_fields.iter() {
16928                state.serialize_entry(key, &value)?;
16929            }
16930        }
16931        state.end()
16932    }
16933}
16934
16935impl std::fmt::Debug for ListLogMetricsResponse {
16936    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16937        let mut debug_struct = f.debug_struct("ListLogMetricsResponse");
16938        debug_struct.field("metrics", &self.metrics);
16939        debug_struct.field("next_page_token", &self.next_page_token);
16940        if !self._unknown_fields.is_empty() {
16941            debug_struct.field("_unknown_fields", &self._unknown_fields);
16942        }
16943        debug_struct.finish()
16944    }
16945}
16946
16947/// The parameters to GetLogMetric.
16948#[derive(Clone, Default, PartialEq)]
16949#[non_exhaustive]
16950pub struct GetLogMetricRequest {
16951    /// Required. The resource name of the desired metric:
16952    ///
16953    /// ```norust
16954    /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
16955    /// ```
16956    pub metric_name: std::string::String,
16957
16958    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16959}
16960
16961impl GetLogMetricRequest {
16962    pub fn new() -> Self {
16963        std::default::Default::default()
16964    }
16965
16966    /// Sets the value of [metric_name][crate::model::GetLogMetricRequest::metric_name].
16967    pub fn set_metric_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16968        self.metric_name = v.into();
16969        self
16970    }
16971}
16972
16973impl wkt::message::Message for GetLogMetricRequest {
16974    fn typename() -> &'static str {
16975        "type.googleapis.com/google.logging.v2.GetLogMetricRequest"
16976    }
16977}
16978
16979#[doc(hidden)]
16980impl<'de> serde::de::Deserialize<'de> for GetLogMetricRequest {
16981    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16982    where
16983        D: serde::Deserializer<'de>,
16984    {
16985        #[allow(non_camel_case_types)]
16986        #[doc(hidden)]
16987        #[derive(PartialEq, Eq, Hash)]
16988        enum __FieldTag {
16989            __metric_name,
16990            Unknown(std::string::String),
16991        }
16992        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
16993            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16994            where
16995                D: serde::Deserializer<'de>,
16996            {
16997                struct Visitor;
16998                impl<'de> serde::de::Visitor<'de> for Visitor {
16999                    type Value = __FieldTag;
17000                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17001                        formatter.write_str("a field name for GetLogMetricRequest")
17002                    }
17003                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17004                    where
17005                        E: serde::de::Error,
17006                    {
17007                        use std::result::Result::Ok;
17008                        use std::string::ToString;
17009                        match value {
17010                            "metricName" => Ok(__FieldTag::__metric_name),
17011                            "metric_name" => Ok(__FieldTag::__metric_name),
17012                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17013                        }
17014                    }
17015                }
17016                deserializer.deserialize_identifier(Visitor)
17017            }
17018        }
17019        struct Visitor;
17020        impl<'de> serde::de::Visitor<'de> for Visitor {
17021            type Value = GetLogMetricRequest;
17022            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17023                formatter.write_str("struct GetLogMetricRequest")
17024            }
17025            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17026            where
17027                A: serde::de::MapAccess<'de>,
17028            {
17029                #[allow(unused_imports)]
17030                use serde::de::Error;
17031                use std::option::Option::Some;
17032                let mut fields = std::collections::HashSet::new();
17033                let mut result = Self::Value::new();
17034                while let Some(tag) = map.next_key::<__FieldTag>()? {
17035                    #[allow(clippy::match_single_binding)]
17036                    match tag {
17037                        __FieldTag::__metric_name => {
17038                            if !fields.insert(__FieldTag::__metric_name) {
17039                                return std::result::Result::Err(A::Error::duplicate_field(
17040                                    "multiple values for metric_name",
17041                                ));
17042                            }
17043                            result.metric_name = map
17044                                .next_value::<std::option::Option<std::string::String>>()?
17045                                .unwrap_or_default();
17046                        }
17047                        __FieldTag::Unknown(key) => {
17048                            let value = map.next_value::<serde_json::Value>()?;
17049                            result._unknown_fields.insert(key, value);
17050                        }
17051                    }
17052                }
17053                std::result::Result::Ok(result)
17054            }
17055        }
17056        deserializer.deserialize_any(Visitor)
17057    }
17058}
17059
17060#[doc(hidden)]
17061impl serde::ser::Serialize for GetLogMetricRequest {
17062    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17063    where
17064        S: serde::ser::Serializer,
17065    {
17066        use serde::ser::SerializeMap;
17067        #[allow(unused_imports)]
17068        use std::option::Option::Some;
17069        let mut state = serializer.serialize_map(std::option::Option::None)?;
17070        if !self.metric_name.is_empty() {
17071            state.serialize_entry("metricName", &self.metric_name)?;
17072        }
17073        if !self._unknown_fields.is_empty() {
17074            for (key, value) in self._unknown_fields.iter() {
17075                state.serialize_entry(key, &value)?;
17076            }
17077        }
17078        state.end()
17079    }
17080}
17081
17082impl std::fmt::Debug for GetLogMetricRequest {
17083    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17084        let mut debug_struct = f.debug_struct("GetLogMetricRequest");
17085        debug_struct.field("metric_name", &self.metric_name);
17086        if !self._unknown_fields.is_empty() {
17087            debug_struct.field("_unknown_fields", &self._unknown_fields);
17088        }
17089        debug_struct.finish()
17090    }
17091}
17092
17093/// The parameters to CreateLogMetric.
17094#[derive(Clone, Default, PartialEq)]
17095#[non_exhaustive]
17096pub struct CreateLogMetricRequest {
17097    /// Required. The resource name of the project in which to create the metric:
17098    ///
17099    /// ```norust
17100    /// "projects/[PROJECT_ID]"
17101    /// ```
17102    ///
17103    /// The new metric must be provided in the request.
17104    pub parent: std::string::String,
17105
17106    /// Required. The new logs-based metric, which must not have an identifier that
17107    /// already exists.
17108    pub metric: std::option::Option<crate::model::LogMetric>,
17109
17110    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17111}
17112
17113impl CreateLogMetricRequest {
17114    pub fn new() -> Self {
17115        std::default::Default::default()
17116    }
17117
17118    /// Sets the value of [parent][crate::model::CreateLogMetricRequest::parent].
17119    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17120        self.parent = v.into();
17121        self
17122    }
17123
17124    /// Sets the value of [metric][crate::model::CreateLogMetricRequest::metric].
17125    pub fn set_metric<T>(mut self, v: T) -> Self
17126    where
17127        T: std::convert::Into<crate::model::LogMetric>,
17128    {
17129        self.metric = std::option::Option::Some(v.into());
17130        self
17131    }
17132
17133    /// Sets or clears the value of [metric][crate::model::CreateLogMetricRequest::metric].
17134    pub fn set_or_clear_metric<T>(mut self, v: std::option::Option<T>) -> Self
17135    where
17136        T: std::convert::Into<crate::model::LogMetric>,
17137    {
17138        self.metric = v.map(|x| x.into());
17139        self
17140    }
17141}
17142
17143impl wkt::message::Message for CreateLogMetricRequest {
17144    fn typename() -> &'static str {
17145        "type.googleapis.com/google.logging.v2.CreateLogMetricRequest"
17146    }
17147}
17148
17149#[doc(hidden)]
17150impl<'de> serde::de::Deserialize<'de> for CreateLogMetricRequest {
17151    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17152    where
17153        D: serde::Deserializer<'de>,
17154    {
17155        #[allow(non_camel_case_types)]
17156        #[doc(hidden)]
17157        #[derive(PartialEq, Eq, Hash)]
17158        enum __FieldTag {
17159            __parent,
17160            __metric,
17161            Unknown(std::string::String),
17162        }
17163        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17164            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17165            where
17166                D: serde::Deserializer<'de>,
17167            {
17168                struct Visitor;
17169                impl<'de> serde::de::Visitor<'de> for Visitor {
17170                    type Value = __FieldTag;
17171                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17172                        formatter.write_str("a field name for CreateLogMetricRequest")
17173                    }
17174                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17175                    where
17176                        E: serde::de::Error,
17177                    {
17178                        use std::result::Result::Ok;
17179                        use std::string::ToString;
17180                        match value {
17181                            "parent" => Ok(__FieldTag::__parent),
17182                            "metric" => Ok(__FieldTag::__metric),
17183                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17184                        }
17185                    }
17186                }
17187                deserializer.deserialize_identifier(Visitor)
17188            }
17189        }
17190        struct Visitor;
17191        impl<'de> serde::de::Visitor<'de> for Visitor {
17192            type Value = CreateLogMetricRequest;
17193            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17194                formatter.write_str("struct CreateLogMetricRequest")
17195            }
17196            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17197            where
17198                A: serde::de::MapAccess<'de>,
17199            {
17200                #[allow(unused_imports)]
17201                use serde::de::Error;
17202                use std::option::Option::Some;
17203                let mut fields = std::collections::HashSet::new();
17204                let mut result = Self::Value::new();
17205                while let Some(tag) = map.next_key::<__FieldTag>()? {
17206                    #[allow(clippy::match_single_binding)]
17207                    match tag {
17208                        __FieldTag::__parent => {
17209                            if !fields.insert(__FieldTag::__parent) {
17210                                return std::result::Result::Err(A::Error::duplicate_field(
17211                                    "multiple values for parent",
17212                                ));
17213                            }
17214                            result.parent = map
17215                                .next_value::<std::option::Option<std::string::String>>()?
17216                                .unwrap_or_default();
17217                        }
17218                        __FieldTag::__metric => {
17219                            if !fields.insert(__FieldTag::__metric) {
17220                                return std::result::Result::Err(A::Error::duplicate_field(
17221                                    "multiple values for metric",
17222                                ));
17223                            }
17224                            result.metric =
17225                                map.next_value::<std::option::Option<crate::model::LogMetric>>()?;
17226                        }
17227                        __FieldTag::Unknown(key) => {
17228                            let value = map.next_value::<serde_json::Value>()?;
17229                            result._unknown_fields.insert(key, value);
17230                        }
17231                    }
17232                }
17233                std::result::Result::Ok(result)
17234            }
17235        }
17236        deserializer.deserialize_any(Visitor)
17237    }
17238}
17239
17240#[doc(hidden)]
17241impl serde::ser::Serialize for CreateLogMetricRequest {
17242    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17243    where
17244        S: serde::ser::Serializer,
17245    {
17246        use serde::ser::SerializeMap;
17247        #[allow(unused_imports)]
17248        use std::option::Option::Some;
17249        let mut state = serializer.serialize_map(std::option::Option::None)?;
17250        if !self.parent.is_empty() {
17251            state.serialize_entry("parent", &self.parent)?;
17252        }
17253        if self.metric.is_some() {
17254            state.serialize_entry("metric", &self.metric)?;
17255        }
17256        if !self._unknown_fields.is_empty() {
17257            for (key, value) in self._unknown_fields.iter() {
17258                state.serialize_entry(key, &value)?;
17259            }
17260        }
17261        state.end()
17262    }
17263}
17264
17265impl std::fmt::Debug for CreateLogMetricRequest {
17266    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17267        let mut debug_struct = f.debug_struct("CreateLogMetricRequest");
17268        debug_struct.field("parent", &self.parent);
17269        debug_struct.field("metric", &self.metric);
17270        if !self._unknown_fields.is_empty() {
17271            debug_struct.field("_unknown_fields", &self._unknown_fields);
17272        }
17273        debug_struct.finish()
17274    }
17275}
17276
17277/// The parameters to UpdateLogMetric.
17278#[derive(Clone, Default, PartialEq)]
17279#[non_exhaustive]
17280pub struct UpdateLogMetricRequest {
17281    /// Required. The resource name of the metric to update:
17282    ///
17283    /// ```norust
17284    /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
17285    /// ```
17286    ///
17287    /// The updated metric must be provided in the request and it's
17288    /// `name` field must be the same as `[METRIC_ID]` If the metric
17289    /// does not exist in `[PROJECT_ID]`, then a new metric is created.
17290    pub metric_name: std::string::String,
17291
17292    /// Required. The updated metric.
17293    pub metric: std::option::Option<crate::model::LogMetric>,
17294
17295    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17296}
17297
17298impl UpdateLogMetricRequest {
17299    pub fn new() -> Self {
17300        std::default::Default::default()
17301    }
17302
17303    /// Sets the value of [metric_name][crate::model::UpdateLogMetricRequest::metric_name].
17304    pub fn set_metric_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17305        self.metric_name = v.into();
17306        self
17307    }
17308
17309    /// Sets the value of [metric][crate::model::UpdateLogMetricRequest::metric].
17310    pub fn set_metric<T>(mut self, v: T) -> Self
17311    where
17312        T: std::convert::Into<crate::model::LogMetric>,
17313    {
17314        self.metric = std::option::Option::Some(v.into());
17315        self
17316    }
17317
17318    /// Sets or clears the value of [metric][crate::model::UpdateLogMetricRequest::metric].
17319    pub fn set_or_clear_metric<T>(mut self, v: std::option::Option<T>) -> Self
17320    where
17321        T: std::convert::Into<crate::model::LogMetric>,
17322    {
17323        self.metric = v.map(|x| x.into());
17324        self
17325    }
17326}
17327
17328impl wkt::message::Message for UpdateLogMetricRequest {
17329    fn typename() -> &'static str {
17330        "type.googleapis.com/google.logging.v2.UpdateLogMetricRequest"
17331    }
17332}
17333
17334#[doc(hidden)]
17335impl<'de> serde::de::Deserialize<'de> for UpdateLogMetricRequest {
17336    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17337    where
17338        D: serde::Deserializer<'de>,
17339    {
17340        #[allow(non_camel_case_types)]
17341        #[doc(hidden)]
17342        #[derive(PartialEq, Eq, Hash)]
17343        enum __FieldTag {
17344            __metric_name,
17345            __metric,
17346            Unknown(std::string::String),
17347        }
17348        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17349            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17350            where
17351                D: serde::Deserializer<'de>,
17352            {
17353                struct Visitor;
17354                impl<'de> serde::de::Visitor<'de> for Visitor {
17355                    type Value = __FieldTag;
17356                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17357                        formatter.write_str("a field name for UpdateLogMetricRequest")
17358                    }
17359                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17360                    where
17361                        E: serde::de::Error,
17362                    {
17363                        use std::result::Result::Ok;
17364                        use std::string::ToString;
17365                        match value {
17366                            "metricName" => Ok(__FieldTag::__metric_name),
17367                            "metric_name" => Ok(__FieldTag::__metric_name),
17368                            "metric" => Ok(__FieldTag::__metric),
17369                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17370                        }
17371                    }
17372                }
17373                deserializer.deserialize_identifier(Visitor)
17374            }
17375        }
17376        struct Visitor;
17377        impl<'de> serde::de::Visitor<'de> for Visitor {
17378            type Value = UpdateLogMetricRequest;
17379            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17380                formatter.write_str("struct UpdateLogMetricRequest")
17381            }
17382            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17383            where
17384                A: serde::de::MapAccess<'de>,
17385            {
17386                #[allow(unused_imports)]
17387                use serde::de::Error;
17388                use std::option::Option::Some;
17389                let mut fields = std::collections::HashSet::new();
17390                let mut result = Self::Value::new();
17391                while let Some(tag) = map.next_key::<__FieldTag>()? {
17392                    #[allow(clippy::match_single_binding)]
17393                    match tag {
17394                        __FieldTag::__metric_name => {
17395                            if !fields.insert(__FieldTag::__metric_name) {
17396                                return std::result::Result::Err(A::Error::duplicate_field(
17397                                    "multiple values for metric_name",
17398                                ));
17399                            }
17400                            result.metric_name = map
17401                                .next_value::<std::option::Option<std::string::String>>()?
17402                                .unwrap_or_default();
17403                        }
17404                        __FieldTag::__metric => {
17405                            if !fields.insert(__FieldTag::__metric) {
17406                                return std::result::Result::Err(A::Error::duplicate_field(
17407                                    "multiple values for metric",
17408                                ));
17409                            }
17410                            result.metric =
17411                                map.next_value::<std::option::Option<crate::model::LogMetric>>()?;
17412                        }
17413                        __FieldTag::Unknown(key) => {
17414                            let value = map.next_value::<serde_json::Value>()?;
17415                            result._unknown_fields.insert(key, value);
17416                        }
17417                    }
17418                }
17419                std::result::Result::Ok(result)
17420            }
17421        }
17422        deserializer.deserialize_any(Visitor)
17423    }
17424}
17425
17426#[doc(hidden)]
17427impl serde::ser::Serialize for UpdateLogMetricRequest {
17428    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17429    where
17430        S: serde::ser::Serializer,
17431    {
17432        use serde::ser::SerializeMap;
17433        #[allow(unused_imports)]
17434        use std::option::Option::Some;
17435        let mut state = serializer.serialize_map(std::option::Option::None)?;
17436        if !self.metric_name.is_empty() {
17437            state.serialize_entry("metricName", &self.metric_name)?;
17438        }
17439        if self.metric.is_some() {
17440            state.serialize_entry("metric", &self.metric)?;
17441        }
17442        if !self._unknown_fields.is_empty() {
17443            for (key, value) in self._unknown_fields.iter() {
17444                state.serialize_entry(key, &value)?;
17445            }
17446        }
17447        state.end()
17448    }
17449}
17450
17451impl std::fmt::Debug for UpdateLogMetricRequest {
17452    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17453        let mut debug_struct = f.debug_struct("UpdateLogMetricRequest");
17454        debug_struct.field("metric_name", &self.metric_name);
17455        debug_struct.field("metric", &self.metric);
17456        if !self._unknown_fields.is_empty() {
17457            debug_struct.field("_unknown_fields", &self._unknown_fields);
17458        }
17459        debug_struct.finish()
17460    }
17461}
17462
17463/// The parameters to DeleteLogMetric.
17464#[derive(Clone, Default, PartialEq)]
17465#[non_exhaustive]
17466pub struct DeleteLogMetricRequest {
17467    /// Required. The resource name of the metric to delete:
17468    ///
17469    /// ```norust
17470    /// "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
17471    /// ```
17472    pub metric_name: std::string::String,
17473
17474    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17475}
17476
17477impl DeleteLogMetricRequest {
17478    pub fn new() -> Self {
17479        std::default::Default::default()
17480    }
17481
17482    /// Sets the value of [metric_name][crate::model::DeleteLogMetricRequest::metric_name].
17483    pub fn set_metric_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17484        self.metric_name = v.into();
17485        self
17486    }
17487}
17488
17489impl wkt::message::Message for DeleteLogMetricRequest {
17490    fn typename() -> &'static str {
17491        "type.googleapis.com/google.logging.v2.DeleteLogMetricRequest"
17492    }
17493}
17494
17495#[doc(hidden)]
17496impl<'de> serde::de::Deserialize<'de> for DeleteLogMetricRequest {
17497    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17498    where
17499        D: serde::Deserializer<'de>,
17500    {
17501        #[allow(non_camel_case_types)]
17502        #[doc(hidden)]
17503        #[derive(PartialEq, Eq, Hash)]
17504        enum __FieldTag {
17505            __metric_name,
17506            Unknown(std::string::String),
17507        }
17508        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
17509            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17510            where
17511                D: serde::Deserializer<'de>,
17512            {
17513                struct Visitor;
17514                impl<'de> serde::de::Visitor<'de> for Visitor {
17515                    type Value = __FieldTag;
17516                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17517                        formatter.write_str("a field name for DeleteLogMetricRequest")
17518                    }
17519                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
17520                    where
17521                        E: serde::de::Error,
17522                    {
17523                        use std::result::Result::Ok;
17524                        use std::string::ToString;
17525                        match value {
17526                            "metricName" => Ok(__FieldTag::__metric_name),
17527                            "metric_name" => Ok(__FieldTag::__metric_name),
17528                            _ => Ok(__FieldTag::Unknown(value.to_string())),
17529                        }
17530                    }
17531                }
17532                deserializer.deserialize_identifier(Visitor)
17533            }
17534        }
17535        struct Visitor;
17536        impl<'de> serde::de::Visitor<'de> for Visitor {
17537            type Value = DeleteLogMetricRequest;
17538            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
17539                formatter.write_str("struct DeleteLogMetricRequest")
17540            }
17541            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
17542            where
17543                A: serde::de::MapAccess<'de>,
17544            {
17545                #[allow(unused_imports)]
17546                use serde::de::Error;
17547                use std::option::Option::Some;
17548                let mut fields = std::collections::HashSet::new();
17549                let mut result = Self::Value::new();
17550                while let Some(tag) = map.next_key::<__FieldTag>()? {
17551                    #[allow(clippy::match_single_binding)]
17552                    match tag {
17553                        __FieldTag::__metric_name => {
17554                            if !fields.insert(__FieldTag::__metric_name) {
17555                                return std::result::Result::Err(A::Error::duplicate_field(
17556                                    "multiple values for metric_name",
17557                                ));
17558                            }
17559                            result.metric_name = map
17560                                .next_value::<std::option::Option<std::string::String>>()?
17561                                .unwrap_or_default();
17562                        }
17563                        __FieldTag::Unknown(key) => {
17564                            let value = map.next_value::<serde_json::Value>()?;
17565                            result._unknown_fields.insert(key, value);
17566                        }
17567                    }
17568                }
17569                std::result::Result::Ok(result)
17570            }
17571        }
17572        deserializer.deserialize_any(Visitor)
17573    }
17574}
17575
17576#[doc(hidden)]
17577impl serde::ser::Serialize for DeleteLogMetricRequest {
17578    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17579    where
17580        S: serde::ser::Serializer,
17581    {
17582        use serde::ser::SerializeMap;
17583        #[allow(unused_imports)]
17584        use std::option::Option::Some;
17585        let mut state = serializer.serialize_map(std::option::Option::None)?;
17586        if !self.metric_name.is_empty() {
17587            state.serialize_entry("metricName", &self.metric_name)?;
17588        }
17589        if !self._unknown_fields.is_empty() {
17590            for (key, value) in self._unknown_fields.iter() {
17591                state.serialize_entry(key, &value)?;
17592            }
17593        }
17594        state.end()
17595    }
17596}
17597
17598impl std::fmt::Debug for DeleteLogMetricRequest {
17599    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17600        let mut debug_struct = f.debug_struct("DeleteLogMetricRequest");
17601        debug_struct.field("metric_name", &self.metric_name);
17602        if !self._unknown_fields.is_empty() {
17603            debug_struct.field("_unknown_fields", &self._unknown_fields);
17604        }
17605        debug_struct.finish()
17606    }
17607}
17608
17609/// List of different operation states.
17610/// High level state of the operation. This is used to report the job's
17611/// current state to the user. Once a long running operation is created,
17612/// the current state of the operation can be queried even before the
17613/// operation is finished and the final result is available.
17614///
17615/// # Working with unknown values
17616///
17617/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17618/// additional enum variants at any time. Adding new variants is not considered
17619/// a breaking change. Applications should write their code in anticipation of:
17620///
17621/// - New values appearing in future releases of the client library, **and**
17622/// - New values received dynamically, without application changes.
17623///
17624/// Please consult the [Working with enums] section in the user guide for some
17625/// guidelines.
17626///
17627/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17628#[derive(Clone, Debug, PartialEq)]
17629#[non_exhaustive]
17630pub enum OperationState {
17631    /// Should not be used.
17632    Unspecified,
17633    /// The operation is scheduled.
17634    Scheduled,
17635    /// Waiting for necessary permissions.
17636    WaitingForPermissions,
17637    /// The operation is running.
17638    Running,
17639    /// The operation was completed successfully.
17640    Succeeded,
17641    /// The operation failed.
17642    Failed,
17643    /// The operation was cancelled by the user.
17644    Cancelled,
17645    /// If set, the enum was initialized with an unknown value.
17646    ///
17647    /// Applications can examine the value using [OperationState::value] or
17648    /// [OperationState::name].
17649    UnknownValue(operation_state::UnknownValue),
17650}
17651
17652#[doc(hidden)]
17653pub mod operation_state {
17654    #[allow(unused_imports)]
17655    use super::*;
17656    #[derive(Clone, Debug, PartialEq)]
17657    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17658}
17659
17660impl OperationState {
17661    /// Gets the enum value.
17662    ///
17663    /// Returns `None` if the enum contains an unknown value deserialized from
17664    /// the string representation of enums.
17665    pub fn value(&self) -> std::option::Option<i32> {
17666        match self {
17667            Self::Unspecified => std::option::Option::Some(0),
17668            Self::Scheduled => std::option::Option::Some(1),
17669            Self::WaitingForPermissions => std::option::Option::Some(2),
17670            Self::Running => std::option::Option::Some(3),
17671            Self::Succeeded => std::option::Option::Some(4),
17672            Self::Failed => std::option::Option::Some(5),
17673            Self::Cancelled => std::option::Option::Some(6),
17674            Self::UnknownValue(u) => u.0.value(),
17675        }
17676    }
17677
17678    /// Gets the enum value as a string.
17679    ///
17680    /// Returns `None` if the enum contains an unknown value deserialized from
17681    /// the integer representation of enums.
17682    pub fn name(&self) -> std::option::Option<&str> {
17683        match self {
17684            Self::Unspecified => std::option::Option::Some("OPERATION_STATE_UNSPECIFIED"),
17685            Self::Scheduled => std::option::Option::Some("OPERATION_STATE_SCHEDULED"),
17686            Self::WaitingForPermissions => {
17687                std::option::Option::Some("OPERATION_STATE_WAITING_FOR_PERMISSIONS")
17688            }
17689            Self::Running => std::option::Option::Some("OPERATION_STATE_RUNNING"),
17690            Self::Succeeded => std::option::Option::Some("OPERATION_STATE_SUCCEEDED"),
17691            Self::Failed => std::option::Option::Some("OPERATION_STATE_FAILED"),
17692            Self::Cancelled => std::option::Option::Some("OPERATION_STATE_CANCELLED"),
17693            Self::UnknownValue(u) => u.0.name(),
17694        }
17695    }
17696}
17697
17698impl std::default::Default for OperationState {
17699    fn default() -> Self {
17700        use std::convert::From;
17701        Self::from(0)
17702    }
17703}
17704
17705impl std::fmt::Display for OperationState {
17706    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17707        wkt::internal::display_enum(f, self.name(), self.value())
17708    }
17709}
17710
17711impl std::convert::From<i32> for OperationState {
17712    fn from(value: i32) -> Self {
17713        match value {
17714            0 => Self::Unspecified,
17715            1 => Self::Scheduled,
17716            2 => Self::WaitingForPermissions,
17717            3 => Self::Running,
17718            4 => Self::Succeeded,
17719            5 => Self::Failed,
17720            6 => Self::Cancelled,
17721            _ => Self::UnknownValue(operation_state::UnknownValue(
17722                wkt::internal::UnknownEnumValue::Integer(value),
17723            )),
17724        }
17725    }
17726}
17727
17728impl std::convert::From<&str> for OperationState {
17729    fn from(value: &str) -> Self {
17730        use std::string::ToString;
17731        match value {
17732            "OPERATION_STATE_UNSPECIFIED" => Self::Unspecified,
17733            "OPERATION_STATE_SCHEDULED" => Self::Scheduled,
17734            "OPERATION_STATE_WAITING_FOR_PERMISSIONS" => Self::WaitingForPermissions,
17735            "OPERATION_STATE_RUNNING" => Self::Running,
17736            "OPERATION_STATE_SUCCEEDED" => Self::Succeeded,
17737            "OPERATION_STATE_FAILED" => Self::Failed,
17738            "OPERATION_STATE_CANCELLED" => Self::Cancelled,
17739            _ => Self::UnknownValue(operation_state::UnknownValue(
17740                wkt::internal::UnknownEnumValue::String(value.to_string()),
17741            )),
17742        }
17743    }
17744}
17745
17746impl serde::ser::Serialize for OperationState {
17747    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17748    where
17749        S: serde::Serializer,
17750    {
17751        match self {
17752            Self::Unspecified => serializer.serialize_i32(0),
17753            Self::Scheduled => serializer.serialize_i32(1),
17754            Self::WaitingForPermissions => serializer.serialize_i32(2),
17755            Self::Running => serializer.serialize_i32(3),
17756            Self::Succeeded => serializer.serialize_i32(4),
17757            Self::Failed => serializer.serialize_i32(5),
17758            Self::Cancelled => serializer.serialize_i32(6),
17759            Self::UnknownValue(u) => u.0.serialize(serializer),
17760        }
17761    }
17762}
17763
17764impl<'de> serde::de::Deserialize<'de> for OperationState {
17765    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17766    where
17767        D: serde::Deserializer<'de>,
17768    {
17769        deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationState>::new(
17770            ".google.logging.v2.OperationState",
17771        ))
17772    }
17773}
17774
17775/// LogBucket lifecycle states.
17776///
17777/// # Working with unknown values
17778///
17779/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17780/// additional enum variants at any time. Adding new variants is not considered
17781/// a breaking change. Applications should write their code in anticipation of:
17782///
17783/// - New values appearing in future releases of the client library, **and**
17784/// - New values received dynamically, without application changes.
17785///
17786/// Please consult the [Working with enums] section in the user guide for some
17787/// guidelines.
17788///
17789/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17790#[derive(Clone, Debug, PartialEq)]
17791#[non_exhaustive]
17792pub enum LifecycleState {
17793    /// Unspecified state. This is only used/useful for distinguishing unset
17794    /// values.
17795    Unspecified,
17796    /// The normal and active state.
17797    Active,
17798    /// The resource has been marked for deletion by the user. For some resources
17799    /// (e.g. buckets), this can be reversed by an un-delete operation.
17800    DeleteRequested,
17801    /// The resource has been marked for an update by the user. It will remain in
17802    /// this state until the update is complete.
17803    Updating,
17804    /// The resource has been marked for creation by the user. It will remain in
17805    /// this state until the creation is complete.
17806    Creating,
17807    /// The resource is in an INTERNAL error state.
17808    Failed,
17809    /// If set, the enum was initialized with an unknown value.
17810    ///
17811    /// Applications can examine the value using [LifecycleState::value] or
17812    /// [LifecycleState::name].
17813    UnknownValue(lifecycle_state::UnknownValue),
17814}
17815
17816#[doc(hidden)]
17817pub mod lifecycle_state {
17818    #[allow(unused_imports)]
17819    use super::*;
17820    #[derive(Clone, Debug, PartialEq)]
17821    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17822}
17823
17824impl LifecycleState {
17825    /// Gets the enum value.
17826    ///
17827    /// Returns `None` if the enum contains an unknown value deserialized from
17828    /// the string representation of enums.
17829    pub fn value(&self) -> std::option::Option<i32> {
17830        match self {
17831            Self::Unspecified => std::option::Option::Some(0),
17832            Self::Active => std::option::Option::Some(1),
17833            Self::DeleteRequested => std::option::Option::Some(2),
17834            Self::Updating => std::option::Option::Some(3),
17835            Self::Creating => std::option::Option::Some(4),
17836            Self::Failed => std::option::Option::Some(5),
17837            Self::UnknownValue(u) => u.0.value(),
17838        }
17839    }
17840
17841    /// Gets the enum value as a string.
17842    ///
17843    /// Returns `None` if the enum contains an unknown value deserialized from
17844    /// the integer representation of enums.
17845    pub fn name(&self) -> std::option::Option<&str> {
17846        match self {
17847            Self::Unspecified => std::option::Option::Some("LIFECYCLE_STATE_UNSPECIFIED"),
17848            Self::Active => std::option::Option::Some("ACTIVE"),
17849            Self::DeleteRequested => std::option::Option::Some("DELETE_REQUESTED"),
17850            Self::Updating => std::option::Option::Some("UPDATING"),
17851            Self::Creating => std::option::Option::Some("CREATING"),
17852            Self::Failed => std::option::Option::Some("FAILED"),
17853            Self::UnknownValue(u) => u.0.name(),
17854        }
17855    }
17856}
17857
17858impl std::default::Default for LifecycleState {
17859    fn default() -> Self {
17860        use std::convert::From;
17861        Self::from(0)
17862    }
17863}
17864
17865impl std::fmt::Display for LifecycleState {
17866    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17867        wkt::internal::display_enum(f, self.name(), self.value())
17868    }
17869}
17870
17871impl std::convert::From<i32> for LifecycleState {
17872    fn from(value: i32) -> Self {
17873        match value {
17874            0 => Self::Unspecified,
17875            1 => Self::Active,
17876            2 => Self::DeleteRequested,
17877            3 => Self::Updating,
17878            4 => Self::Creating,
17879            5 => Self::Failed,
17880            _ => Self::UnknownValue(lifecycle_state::UnknownValue(
17881                wkt::internal::UnknownEnumValue::Integer(value),
17882            )),
17883        }
17884    }
17885}
17886
17887impl std::convert::From<&str> for LifecycleState {
17888    fn from(value: &str) -> Self {
17889        use std::string::ToString;
17890        match value {
17891            "LIFECYCLE_STATE_UNSPECIFIED" => Self::Unspecified,
17892            "ACTIVE" => Self::Active,
17893            "DELETE_REQUESTED" => Self::DeleteRequested,
17894            "UPDATING" => Self::Updating,
17895            "CREATING" => Self::Creating,
17896            "FAILED" => Self::Failed,
17897            _ => Self::UnknownValue(lifecycle_state::UnknownValue(
17898                wkt::internal::UnknownEnumValue::String(value.to_string()),
17899            )),
17900        }
17901    }
17902}
17903
17904impl serde::ser::Serialize for LifecycleState {
17905    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17906    where
17907        S: serde::Serializer,
17908    {
17909        match self {
17910            Self::Unspecified => serializer.serialize_i32(0),
17911            Self::Active => serializer.serialize_i32(1),
17912            Self::DeleteRequested => serializer.serialize_i32(2),
17913            Self::Updating => serializer.serialize_i32(3),
17914            Self::Creating => serializer.serialize_i32(4),
17915            Self::Failed => serializer.serialize_i32(5),
17916            Self::UnknownValue(u) => u.0.serialize(serializer),
17917        }
17918    }
17919}
17920
17921impl<'de> serde::de::Deserialize<'de> for LifecycleState {
17922    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17923    where
17924        D: serde::Deserializer<'de>,
17925    {
17926        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LifecycleState>::new(
17927            ".google.logging.v2.LifecycleState",
17928        ))
17929    }
17930}
17931
17932/// IndexType is used for custom indexing. It describes the type of an indexed
17933/// field.
17934///
17935/// # Working with unknown values
17936///
17937/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17938/// additional enum variants at any time. Adding new variants is not considered
17939/// a breaking change. Applications should write their code in anticipation of:
17940///
17941/// - New values appearing in future releases of the client library, **and**
17942/// - New values received dynamically, without application changes.
17943///
17944/// Please consult the [Working with enums] section in the user guide for some
17945/// guidelines.
17946///
17947/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17948#[derive(Clone, Debug, PartialEq)]
17949#[non_exhaustive]
17950pub enum IndexType {
17951    /// The index's type is unspecified.
17952    Unspecified,
17953    /// The index is a string-type index.
17954    String,
17955    /// The index is a integer-type index.
17956    Integer,
17957    /// If set, the enum was initialized with an unknown value.
17958    ///
17959    /// Applications can examine the value using [IndexType::value] or
17960    /// [IndexType::name].
17961    UnknownValue(index_type::UnknownValue),
17962}
17963
17964#[doc(hidden)]
17965pub mod index_type {
17966    #[allow(unused_imports)]
17967    use super::*;
17968    #[derive(Clone, Debug, PartialEq)]
17969    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17970}
17971
17972impl IndexType {
17973    /// Gets the enum value.
17974    ///
17975    /// Returns `None` if the enum contains an unknown value deserialized from
17976    /// the string representation of enums.
17977    pub fn value(&self) -> std::option::Option<i32> {
17978        match self {
17979            Self::Unspecified => std::option::Option::Some(0),
17980            Self::String => std::option::Option::Some(1),
17981            Self::Integer => std::option::Option::Some(2),
17982            Self::UnknownValue(u) => u.0.value(),
17983        }
17984    }
17985
17986    /// Gets the enum value as a string.
17987    ///
17988    /// Returns `None` if the enum contains an unknown value deserialized from
17989    /// the integer representation of enums.
17990    pub fn name(&self) -> std::option::Option<&str> {
17991        match self {
17992            Self::Unspecified => std::option::Option::Some("INDEX_TYPE_UNSPECIFIED"),
17993            Self::String => std::option::Option::Some("INDEX_TYPE_STRING"),
17994            Self::Integer => std::option::Option::Some("INDEX_TYPE_INTEGER"),
17995            Self::UnknownValue(u) => u.0.name(),
17996        }
17997    }
17998}
17999
18000impl std::default::Default for IndexType {
18001    fn default() -> Self {
18002        use std::convert::From;
18003        Self::from(0)
18004    }
18005}
18006
18007impl std::fmt::Display for IndexType {
18008    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18009        wkt::internal::display_enum(f, self.name(), self.value())
18010    }
18011}
18012
18013impl std::convert::From<i32> for IndexType {
18014    fn from(value: i32) -> Self {
18015        match value {
18016            0 => Self::Unspecified,
18017            1 => Self::String,
18018            2 => Self::Integer,
18019            _ => Self::UnknownValue(index_type::UnknownValue(
18020                wkt::internal::UnknownEnumValue::Integer(value),
18021            )),
18022        }
18023    }
18024}
18025
18026impl std::convert::From<&str> for IndexType {
18027    fn from(value: &str) -> Self {
18028        use std::string::ToString;
18029        match value {
18030            "INDEX_TYPE_UNSPECIFIED" => Self::Unspecified,
18031            "INDEX_TYPE_STRING" => Self::String,
18032            "INDEX_TYPE_INTEGER" => Self::Integer,
18033            _ => Self::UnknownValue(index_type::UnknownValue(
18034                wkt::internal::UnknownEnumValue::String(value.to_string()),
18035            )),
18036        }
18037    }
18038}
18039
18040impl serde::ser::Serialize for IndexType {
18041    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18042    where
18043        S: serde::Serializer,
18044    {
18045        match self {
18046            Self::Unspecified => serializer.serialize_i32(0),
18047            Self::String => serializer.serialize_i32(1),
18048            Self::Integer => serializer.serialize_i32(2),
18049            Self::UnknownValue(u) => u.0.serialize(serializer),
18050        }
18051    }
18052}
18053
18054impl<'de> serde::de::Deserialize<'de> for IndexType {
18055    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18056    where
18057        D: serde::Deserializer<'de>,
18058    {
18059        deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexType>::new(
18060            ".google.logging.v2.IndexType",
18061        ))
18062    }
18063}