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