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