opentelemetry_stackdriver/proto/logging/v2.rs
1// This file is @generated by prost-build.
2/// An individual entry in a log.
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct LogEntry {
5 /// Required. The resource name of the log to which this log entry belongs:
6 ///
7 /// "projects/\[PROJECT_ID\]/logs/\[LOG_ID\]"
8 /// "organizations/\[ORGANIZATION_ID\]/logs/\[LOG_ID\]"
9 /// "billingAccounts/\[BILLING_ACCOUNT_ID\]/logs/\[LOG_ID\]"
10 /// "folders/\[FOLDER_ID\]/logs/\[LOG_ID\]"
11 ///
12 /// A project number may be used in place of PROJECT_ID. The project number is
13 /// translated to its corresponding PROJECT_ID internally and the `log_name`
14 /// field will contain PROJECT_ID in queries and exports.
15 ///
16 /// `\[LOG_ID\]` must be URL-encoded within `log_name`. Example:
17 /// `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
18 ///
19 /// `\[LOG_ID\]` must be less than 512 characters long and can only include the
20 /// following characters: upper and lower case alphanumeric characters,
21 /// forward-slash, underscore, hyphen, and period.
22 ///
23 /// For backward compatibility, if `log_name` begins with a forward-slash, such
24 /// as `/projects/...`, then the log entry is ingested as usual, but the
25 /// forward-slash is removed. Listing the log entry will not show the leading
26 /// slash and filtering for a log name with a leading slash will never return
27 /// any results.
28 #[prost(string, tag = "12")]
29 pub log_name: ::prost::alloc::string::String,
30 /// Required. The monitored resource that produced this log entry.
31 ///
32 /// Example: a log entry that reports a database error would be associated with
33 /// the monitored resource designating the particular database that reported
34 /// the error.
35 #[prost(message, optional, tag = "8")]
36 pub resource: ::core::option::Option<super::super::api::MonitoredResource>,
37 /// Optional. The time the event described by the log entry occurred. This time
38 /// is used to compute the log entry's age and to enforce the logs retention
39 /// period. If this field is omitted in a new log entry, then Logging assigns
40 /// it the current time. Timestamps have nanosecond accuracy, but trailing
41 /// zeros in the fractional seconds might be omitted when the timestamp is
42 /// displayed.
43 ///
44 /// Incoming log entries must have timestamps that don't exceed the
45 /// [logs retention
46 /// period](<https://cloud.google.com/logging/quotas#logs_retention_periods>) in
47 /// the past, and that don't exceed 24 hours in the future. Log entries outside
48 /// those time boundaries aren't ingested by Logging.
49 #[prost(message, optional, tag = "9")]
50 pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
51 /// Output only. The time the log entry was received by Logging.
52 #[prost(message, optional, tag = "24")]
53 pub receive_timestamp: ::core::option::Option<::prost_types::Timestamp>,
54 /// Optional. The severity of the log entry. The default value is
55 /// `LogSeverity.DEFAULT`.
56 #[prost(enumeration = "super::r#type::LogSeverity", tag = "10")]
57 pub severity: i32,
58 /// Optional. A unique identifier for the log entry. If you provide a value,
59 /// then Logging considers other log entries in the same project, with the same
60 /// `timestamp`, and with the same `insert_id` to be duplicates which are
61 /// removed in a single query result. However, there are no guarantees of
62 /// de-duplication in the export of logs.
63 ///
64 /// If the `insert_id` is omitted when writing a log entry, the Logging API
65 /// assigns its own unique identifier in this field.
66 ///
67 /// In queries, the `insert_id` is also used to order log entries that have
68 /// the same `log_name` and `timestamp` values.
69 #[prost(string, tag = "4")]
70 pub insert_id: ::prost::alloc::string::String,
71 /// Optional. Information about the HTTP request associated with this log
72 /// entry, if applicable.
73 #[prost(message, optional, tag = "7")]
74 pub http_request: ::core::option::Option<super::r#type::HttpRequest>,
75 /// Optional. A map of key, value pairs that provides additional information
76 /// about the log entry. The labels can be user-defined or system-defined.
77 ///
78 /// User-defined labels are arbitrary key, value pairs that you can use to
79 /// classify logs.
80 ///
81 /// System-defined labels are defined by GCP services for platform logs.
82 /// They have two components - a service namespace component and the
83 /// attribute name. For example: `compute.googleapis.com/resource_name`.
84 ///
85 /// Cloud Logging truncates label keys that exceed 512 B and label
86 /// values that exceed 64 KB upon their associated log entry being
87 /// written. The truncation is indicated by an ellipsis at the
88 /// end of the character string.
89 #[prost(map = "string, string", tag = "11")]
90 pub labels:
91 ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
92 /// Optional. Information about an operation associated with the log entry, if
93 /// applicable.
94 #[prost(message, optional, tag = "15")]
95 pub operation: ::core::option::Option<LogEntryOperation>,
96 /// Optional. The REST resource name of the trace being written to
97 /// [Cloud Trace](<https://cloud.google.com/trace>) in
98 /// association with this log entry. For example, if your trace data is stored
99 /// in the Cloud project "my-trace-project" and if the service that is creating
100 /// the log entry receives a trace header that includes the trace ID "12345",
101 /// then the service should use "projects/my-tracing-project/traces/12345".
102 ///
103 /// The `trace` field provides the link between logs and traces. By using
104 /// this field, you can navigate from a log entry to a trace.
105 #[prost(string, tag = "22")]
106 pub trace: ::prost::alloc::string::String,
107 /// Optional. The ID of the [Cloud Trace](<https://cloud.google.com/trace>) span
108 /// associated with the current operation in which the log is being written.
109 /// For example, if a span has the REST resource name of
110 /// "projects/some-project/traces/some-trace/spans/some-span-id", then the
111 /// `span_id` field is "some-span-id".
112 ///
113 /// A
114 /// [Span](<https://cloud.google.com/trace/docs/reference/v2/rest/v2/projects.traces/batchWrite#Span>)
115 /// represents a single operation within a trace. Whereas a trace may involve
116 /// multiple different microservices running on multiple different machines,
117 /// a span generally corresponds to a single logical operation being performed
118 /// in a single instance of a microservice on one specific machine. Spans
119 /// are the nodes within the tree that is a trace.
120 ///
121 /// Applications that are [instrumented for
122 /// tracing](<https://cloud.google.com/trace/docs/setup>) will generally assign a
123 /// new, unique span ID on each incoming request. It is also common to create
124 /// and record additional spans corresponding to internal processing elements
125 /// as well as issuing requests to dependencies.
126 ///
127 /// The span ID is expected to be a 16-character, hexadecimal encoding of an
128 /// 8-byte array and should not be zero. It should be unique within the trace
129 /// and should, ideally, be generated in a manner that is uniformly random.
130 ///
131 /// Example values:
132 ///
133 /// - `000000000000004a`
134 /// - `7a2190356c3fc94b`
135 /// - `0000f00300090021`
136 /// - `d39223e101960076`
137 #[prost(string, tag = "27")]
138 pub span_id: ::prost::alloc::string::String,
139 /// Optional. The sampling decision of the trace associated with the log entry.
140 ///
141 /// True means that the trace resource name in the `trace` field was sampled
142 /// for storage in a trace backend. False means that the trace was not sampled
143 /// for storage when this log entry was written, or the sampling decision was
144 /// unknown at the time. A non-sampled `trace` value is still useful as a
145 /// request correlation identifier. The default is False.
146 #[prost(bool, tag = "30")]
147 pub trace_sampled: bool,
148 /// Optional. Source code location information associated with the log entry,
149 /// if any.
150 #[prost(message, optional, tag = "23")]
151 pub source_location: ::core::option::Option<LogEntrySourceLocation>,
152 /// Optional. Information indicating this LogEntry is part of a sequence of
153 /// multiple log entries split from a single LogEntry.
154 #[prost(message, optional, tag = "35")]
155 pub split: ::core::option::Option<LogSplit>,
156 /// The log entry payload, which can be one of multiple types.
157 #[prost(oneof = "log_entry::Payload", tags = "2, 3, 6")]
158 pub payload: ::core::option::Option<log_entry::Payload>,
159}
160/// Nested message and enum types in `LogEntry`.
161pub mod log_entry {
162 /// The log entry payload, which can be one of multiple types.
163 #[derive(Clone, PartialEq, ::prost::Oneof)]
164 pub enum Payload {
165 /// The log entry payload, represented as a protocol buffer. Some Google
166 /// Cloud Platform services use this field for their log entry payloads.
167 ///
168 /// The following protocol buffer types are supported; user-defined types
169 /// are not supported:
170 ///
171 /// "type.googleapis.com/google.cloud.audit.AuditLog"
172 /// "type.googleapis.com/google.appengine.logging.v1.RequestLog"
173 #[prost(message, tag = "2")]
174 ProtoPayload(::prost_types::Any),
175 /// The log entry payload, represented as a Unicode string (UTF-8).
176 #[prost(string, tag = "3")]
177 TextPayload(::prost::alloc::string::String),
178 /// The log entry payload, represented as a structure that is
179 /// expressed as a JSON object.
180 #[prost(message, tag = "6")]
181 JsonPayload(::prost_types::Struct),
182 }
183}
184/// Additional information about a potentially long-running operation with which
185/// a log entry is associated.
186#[derive(Clone, PartialEq, ::prost::Message)]
187pub struct LogEntryOperation {
188 /// Optional. An arbitrary operation identifier. Log entries with the same
189 /// identifier are assumed to be part of the same operation.
190 #[prost(string, tag = "1")]
191 pub id: ::prost::alloc::string::String,
192 /// Optional. An arbitrary producer identifier. The combination of `id` and
193 /// `producer` must be globally unique. Examples for `producer`:
194 /// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
195 #[prost(string, tag = "2")]
196 pub producer: ::prost::alloc::string::String,
197 /// Optional. Set this to True if this is the first log entry in the operation.
198 #[prost(bool, tag = "3")]
199 pub first: bool,
200 /// Optional. Set this to True if this is the last log entry in the operation.
201 #[prost(bool, tag = "4")]
202 pub last: bool,
203}
204/// Additional information about the source code location that produced the log
205/// entry.
206#[derive(Clone, PartialEq, ::prost::Message)]
207pub struct LogEntrySourceLocation {
208 /// Optional. Source file name. Depending on the runtime environment, this
209 /// might be a simple name or a fully-qualified name.
210 #[prost(string, tag = "1")]
211 pub file: ::prost::alloc::string::String,
212 /// Optional. Line within the source file. 1-based; 0 indicates no line number
213 /// available.
214 #[prost(int64, tag = "2")]
215 pub line: i64,
216 /// Optional. Human-readable name of the function or method being invoked, with
217 /// optional context such as the class or package name. This information may be
218 /// used in contexts such as the logs viewer, where a file and line number are
219 /// less meaningful. The format can vary by language. For example:
220 /// `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
221 /// (Python).
222 #[prost(string, tag = "3")]
223 pub function: ::prost::alloc::string::String,
224}
225/// Additional information used to correlate multiple log entries. Used when a
226/// single LogEntry would exceed the Google Cloud Logging size limit and is
227/// split across multiple log entries.
228#[derive(Clone, PartialEq, ::prost::Message)]
229pub struct LogSplit {
230 /// A globally unique identifier for all log entries in a sequence of split log
231 /// entries. All log entries with the same |LogSplit.uid| are assumed to be
232 /// part of the same sequence of split log entries.
233 #[prost(string, tag = "1")]
234 pub uid: ::prost::alloc::string::String,
235 /// The index of this LogEntry in the sequence of split log entries. Log
236 /// entries are given |index| values 0, 1, ..., n-1 for a sequence of n log
237 /// entries.
238 #[prost(int32, tag = "2")]
239 pub index: i32,
240 /// The total number of log entries that the original LogEntry was split into.
241 #[prost(int32, tag = "3")]
242 pub total_splits: i32,
243}
244/// The parameters to DeleteLog.
245#[derive(Clone, PartialEq, ::prost::Message)]
246pub struct DeleteLogRequest {
247 /// Required. The resource name of the log to delete:
248 ///
249 /// * `projects/\[PROJECT_ID\]/logs/\[LOG_ID\]`
250 /// * `organizations/\[ORGANIZATION_ID\]/logs/\[LOG_ID\]`
251 /// * `billingAccounts/\[BILLING_ACCOUNT_ID\]/logs/\[LOG_ID\]`
252 /// * `folders/\[FOLDER_ID\]/logs/\[LOG_ID\]`
253 ///
254 /// `\[LOG_ID\]` must be URL-encoded. For example,
255 /// `"projects/my-project-id/logs/syslog"`,
256 /// `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`.
257 ///
258 /// For more information about log names, see
259 /// [LogEntry][google.logging.v2.LogEntry].
260 #[prost(string, tag = "1")]
261 pub log_name: ::prost::alloc::string::String,
262}
263/// The parameters to WriteLogEntries.
264#[derive(Clone, PartialEq, ::prost::Message)]
265pub struct WriteLogEntriesRequest {
266 /// Optional. A default log resource name that is assigned to all log entries
267 /// in `entries` that do not specify a value for `log_name`:
268 ///
269 /// * `projects/\[PROJECT_ID\]/logs/\[LOG_ID\]`
270 /// * `organizations/\[ORGANIZATION_ID\]/logs/\[LOG_ID\]`
271 /// * `billingAccounts/\[BILLING_ACCOUNT_ID\]/logs/\[LOG_ID\]`
272 /// * `folders/\[FOLDER_ID\]/logs/\[LOG_ID\]`
273 ///
274 /// `\[LOG_ID\]` must be URL-encoded. For example:
275 ///
276 /// "projects/my-project-id/logs/syslog"
277 /// "organizations/123/logs/cloudaudit.googleapis.com%2Factivity"
278 ///
279 /// The permission `logging.logEntries.create` is needed on each project,
280 /// organization, billing account, or folder that is receiving new log
281 /// entries, whether the resource is specified in `logName` or in an
282 /// individual log entry.
283 #[prost(string, tag = "1")]
284 pub log_name: ::prost::alloc::string::String,
285 /// Optional. A default monitored resource object that is assigned to all log
286 /// entries in `entries` that do not specify a value for `resource`. Example:
287 ///
288 /// { "type": "gce_instance",
289 /// "labels": {
290 /// "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
291 ///
292 /// See [LogEntry][google.logging.v2.LogEntry].
293 #[prost(message, optional, tag = "2")]
294 pub resource: ::core::option::Option<super::super::api::MonitoredResource>,
295 /// Optional. Default labels that are added to the `labels` field of all log
296 /// entries in `entries`. If a log entry already has a label with the same key
297 /// as a label in this parameter, then the log entry's label is not changed.
298 /// See [LogEntry][google.logging.v2.LogEntry].
299 #[prost(map = "string, string", tag = "3")]
300 pub labels:
301 ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
302 /// Required. The log entries to send to Logging. The order of log
303 /// entries in this list does not matter. Values supplied in this method's
304 /// `log_name`, `resource`, and `labels` fields are copied into those log
305 /// entries in this list that do not include values for their corresponding
306 /// fields. For more information, see the
307 /// [LogEntry][google.logging.v2.LogEntry] type.
308 ///
309 /// If the `timestamp` or `insert_id` fields are missing in log entries, then
310 /// this method supplies the current time or a unique identifier, respectively.
311 /// The supplied values are chosen so that, among the log entries that did not
312 /// supply their own values, the entries earlier in the list will sort before
313 /// the entries later in the list. See the `entries.list` method.
314 ///
315 /// Log entries with timestamps that are more than the
316 /// [logs retention period](<https://cloud.google.com/logging/quotas>) in
317 /// the past or more than 24 hours in the future will not be available when
318 /// calling `entries.list`. However, those log entries can still be [exported
319 /// with
320 /// LogSinks](<https://cloud.google.com/logging/docs/api/tasks/exporting-logs>).
321 ///
322 /// To improve throughput and to avoid exceeding the
323 /// [quota limit](<https://cloud.google.com/logging/quotas>) for calls to
324 /// `entries.write`, you should try to include several log entries in this
325 /// list, rather than calling this method for each individual log entry.
326 #[prost(message, repeated, tag = "4")]
327 pub entries: ::prost::alloc::vec::Vec<LogEntry>,
328 /// Optional. Whether a batch's valid entries should be written even if some
329 /// other entry failed due to a permanent error such as INVALID_ARGUMENT or
330 /// PERMISSION_DENIED. If any entry failed, then the response status is the
331 /// response status of one of the failed entries. The response will include
332 /// error details in `WriteLogEntriesPartialErrors.log_entry_errors` keyed by
333 /// the entries' zero-based index in the `entries`. Failed requests for which
334 /// no entries are written will not include per-entry errors.
335 #[prost(bool, tag = "5")]
336 pub partial_success: bool,
337 /// Optional. If true, the request should expect normal response, but the
338 /// entries won't be persisted nor exported. Useful for checking whether the
339 /// logging API endpoints are working properly before sending valuable data.
340 #[prost(bool, tag = "6")]
341 pub dry_run: bool,
342}
343/// Result returned from WriteLogEntries.
344#[derive(Clone, Copy, PartialEq, ::prost::Message)]
345pub struct WriteLogEntriesResponse {}
346/// Error details for WriteLogEntries with partial success.
347#[derive(Clone, PartialEq, ::prost::Message)]
348pub struct WriteLogEntriesPartialErrors {
349 /// When `WriteLogEntriesRequest.partial_success` is true, records the error
350 /// status for entries that were not written due to a permanent error, keyed
351 /// by the entry's zero-based index in `WriteLogEntriesRequest.entries`.
352 ///
353 /// Failed requests for which no entries are written will not include
354 /// per-entry errors.
355 #[prost(map = "int32, message", tag = "1")]
356 pub log_entry_errors: ::std::collections::HashMap<i32, super::super::rpc::Status>,
357}
358/// The parameters to `ListLogEntries`.
359#[derive(Clone, PartialEq, ::prost::Message)]
360pub struct ListLogEntriesRequest {
361 /// Required. Names of one or more parent resources from which to
362 /// retrieve log entries:
363 ///
364 /// * `projects/\[PROJECT_ID\]`
365 /// * `organizations/\[ORGANIZATION_ID\]`
366 /// * `billingAccounts/\[BILLING_ACCOUNT_ID\]`
367 /// * `folders/\[FOLDER_ID\]`
368 ///
369 /// May alternatively be one or more views:
370 ///
371 /// * `projects/\[PROJECT_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
372 /// * `organizations/\[ORGANIZATION_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
373 /// * `billingAccounts/\[BILLING_ACCOUNT_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
374 /// * `folders/\[FOLDER_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
375 ///
376 /// Projects listed in the `project_ids` field are added to this list.
377 /// A maximum of 100 resources may be specified in a single request.
378 #[prost(string, repeated, tag = "8")]
379 pub resource_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
380 /// Optional. Only log entries that match the filter are returned. An empty
381 /// filter matches all log entries in the resources listed in `resource_names`.
382 /// Referencing a parent resource that is not listed in `resource_names` will
383 /// cause the filter to return no results. The maximum length of a filter is
384 /// 20,000 characters.
385 #[prost(string, tag = "2")]
386 pub filter: ::prost::alloc::string::String,
387 /// Optional. How the results should be sorted. Presently, the only permitted
388 /// values are `"timestamp asc"` (default) and `"timestamp desc"`. The first
389 /// option returns entries in order of increasing values of
390 /// `LogEntry.timestamp` (oldest first), and the second option returns entries
391 /// in order of decreasing timestamps (newest first). Entries with equal
392 /// timestamps are returned in order of their `insert_id` values.
393 #[prost(string, tag = "3")]
394 pub order_by: ::prost::alloc::string::String,
395 /// Optional. The maximum number of results to return from this request.
396 /// Default is 50. If the value is negative or exceeds 1000, the request is
397 /// rejected. The presence of `next_page_token` in the response indicates that
398 /// more results might be available.
399 #[prost(int32, tag = "4")]
400 pub page_size: i32,
401 /// Optional. If present, then retrieve the next batch of results from the
402 /// preceding call to this method. `page_token` must be the value of
403 /// `next_page_token` from the previous response. The values of other method
404 /// parameters should be identical to those in the previous call.
405 #[prost(string, tag = "5")]
406 pub page_token: ::prost::alloc::string::String,
407}
408/// Result returned from `ListLogEntries`.
409#[derive(Clone, PartialEq, ::prost::Message)]
410pub struct ListLogEntriesResponse {
411 /// A list of log entries. If `entries` is empty, `nextPageToken` may still be
412 /// returned, indicating that more entries may exist. See `nextPageToken` for
413 /// more information.
414 #[prost(message, repeated, tag = "1")]
415 pub entries: ::prost::alloc::vec::Vec<LogEntry>,
416 /// If there might be more results than those appearing in this response, then
417 /// `nextPageToken` is included. To get the next set of results, call this
418 /// method again using the value of `nextPageToken` as `pageToken`.
419 ///
420 /// If a value for `next_page_token` appears and the `entries` field is empty,
421 /// it means that the search found no log entries so far but it did not have
422 /// time to search all the possible log entries. Retry the method with this
423 /// value for `page_token` to continue the search. Alternatively, consider
424 /// speeding up the search by changing your filter to specify a single log name
425 /// or resource type, or to narrow the time range of the search.
426 #[prost(string, tag = "2")]
427 pub next_page_token: ::prost::alloc::string::String,
428}
429/// The parameters to ListMonitoredResourceDescriptors
430#[derive(Clone, PartialEq, ::prost::Message)]
431pub struct ListMonitoredResourceDescriptorsRequest {
432 /// Optional. The maximum number of results to return from this request.
433 /// Non-positive values are ignored. The presence of `nextPageToken` in the
434 /// response indicates that more results might be available.
435 #[prost(int32, tag = "1")]
436 pub page_size: i32,
437 /// Optional. If present, then retrieve the next batch of results from the
438 /// preceding call to this method. `pageToken` must be the value of
439 /// `nextPageToken` from the previous response. The values of other method
440 /// parameters should be identical to those in the previous call.
441 #[prost(string, tag = "2")]
442 pub page_token: ::prost::alloc::string::String,
443}
444/// Result returned from ListMonitoredResourceDescriptors.
445#[derive(Clone, PartialEq, ::prost::Message)]
446pub struct ListMonitoredResourceDescriptorsResponse {
447 /// A list of resource descriptors.
448 #[prost(message, repeated, tag = "1")]
449 pub resource_descriptors:
450 ::prost::alloc::vec::Vec<super::super::api::MonitoredResourceDescriptor>,
451 /// If there might be more results than those appearing in this response, then
452 /// `nextPageToken` is included. To get the next set of results, call this
453 /// method again using the value of `nextPageToken` as `pageToken`.
454 #[prost(string, tag = "2")]
455 pub next_page_token: ::prost::alloc::string::String,
456}
457/// The parameters to ListLogs.
458#[derive(Clone, PartialEq, ::prost::Message)]
459pub struct ListLogsRequest {
460 /// Required. The resource name to list logs for:
461 ///
462 /// * `projects/\[PROJECT_ID\]`
463 /// * `organizations/\[ORGANIZATION_ID\]`
464 /// * `billingAccounts/\[BILLING_ACCOUNT_ID\]`
465 /// * `folders/\[FOLDER_ID\]`
466 #[prost(string, tag = "1")]
467 pub parent: ::prost::alloc::string::String,
468 /// Optional. List of resource names to list logs for:
469 ///
470 /// * `projects/\[PROJECT_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
471 /// * `organizations/\[ORGANIZATION_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
472 /// * `billingAccounts/\[BILLING_ACCOUNT_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
473 /// * `folders/\[FOLDER_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
474 ///
475 /// To support legacy queries, it could also be:
476 ///
477 /// * `projects/\[PROJECT_ID\]`
478 /// * `organizations/\[ORGANIZATION_ID\]`
479 /// * `billingAccounts/\[BILLING_ACCOUNT_ID\]`
480 /// * `folders/\[FOLDER_ID\]`
481 ///
482 /// The resource name in the `parent` field is added to this list.
483 #[prost(string, repeated, tag = "8")]
484 pub resource_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
485 /// Optional. The maximum number of results to return from this request.
486 /// Non-positive values are ignored. The presence of `nextPageToken` in the
487 /// response indicates that more results might be available.
488 #[prost(int32, tag = "2")]
489 pub page_size: i32,
490 /// Optional. If present, then retrieve the next batch of results from the
491 /// preceding call to this method. `pageToken` must be the value of
492 /// `nextPageToken` from the previous response. The values of other method
493 /// parameters should be identical to those in the previous call.
494 #[prost(string, tag = "3")]
495 pub page_token: ::prost::alloc::string::String,
496}
497/// Result returned from ListLogs.
498#[derive(Clone, PartialEq, ::prost::Message)]
499pub struct ListLogsResponse {
500 /// A list of log names. For example,
501 /// `"projects/my-project/logs/syslog"` or
502 /// `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
503 #[prost(string, repeated, tag = "3")]
504 pub log_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
505 /// If there might be more results than those appearing in this response, then
506 /// `nextPageToken` is included. To get the next set of results, call this
507 /// method again using the value of `nextPageToken` as `pageToken`.
508 #[prost(string, tag = "2")]
509 pub next_page_token: ::prost::alloc::string::String,
510}
511/// The parameters to `TailLogEntries`.
512#[derive(Clone, PartialEq, ::prost::Message)]
513pub struct TailLogEntriesRequest {
514 /// Required. Name of a parent resource from which to retrieve log entries:
515 ///
516 /// * `projects/\[PROJECT_ID\]`
517 /// * `organizations/\[ORGANIZATION_ID\]`
518 /// * `billingAccounts/\[BILLING_ACCOUNT_ID\]`
519 /// * `folders/\[FOLDER_ID\]`
520 ///
521 /// May alternatively be one or more views:
522 ///
523 /// * `projects/\[PROJECT_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
524 /// * `organizations/\[ORGANIZATION_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
525 /// * `billingAccounts/\[BILLING_ACCOUNT_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
526 /// * `folders/\[FOLDER_ID\]/locations/\[LOCATION_ID\]/buckets/\[BUCKET_ID\]/views/\[VIEW_ID\]`
527 #[prost(string, repeated, tag = "1")]
528 pub resource_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
529 /// Optional. Only log entries that match the filter are returned. An empty
530 /// filter matches all log entries in the resources listed in `resource_names`.
531 /// Referencing a parent resource that is not listed in `resource_names` will
532 /// cause the filter to return no results. The maximum length of a filter is
533 /// 20,000 characters.
534 #[prost(string, tag = "2")]
535 pub filter: ::prost::alloc::string::String,
536 /// Optional. The amount of time to buffer log entries at the server before
537 /// being returned to prevent out of order results due to late arriving log
538 /// entries. Valid values are between 0-60000 milliseconds. Defaults to 2000
539 /// milliseconds.
540 #[prost(message, optional, tag = "3")]
541 pub buffer_window: ::core::option::Option<::prost_types::Duration>,
542}
543/// Result returned from `TailLogEntries`.
544#[derive(Clone, PartialEq, ::prost::Message)]
545pub struct TailLogEntriesResponse {
546 /// A list of log entries. Each response in the stream will order entries with
547 /// increasing values of `LogEntry.timestamp`. Ordering is not guaranteed
548 /// between separate responses.
549 #[prost(message, repeated, tag = "1")]
550 pub entries: ::prost::alloc::vec::Vec<LogEntry>,
551 /// If entries that otherwise would have been included in the session were not
552 /// sent back to the client, counts of relevant entries omitted from the
553 /// session with the reason that they were not included. There will be at most
554 /// one of each reason per response. The counts represent the number of
555 /// suppressed entries since the last streamed response.
556 #[prost(message, repeated, tag = "2")]
557 pub suppression_info: ::prost::alloc::vec::Vec<tail_log_entries_response::SuppressionInfo>,
558}
559/// Nested message and enum types in `TailLogEntriesResponse`.
560pub mod tail_log_entries_response {
561 /// Information about entries that were omitted from the session.
562 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
563 pub struct SuppressionInfo {
564 /// The reason that entries were omitted from the session.
565 #[prost(enumeration = "suppression_info::Reason", tag = "1")]
566 pub reason: i32,
567 /// A lower bound on the count of entries omitted due to `reason`.
568 #[prost(int32, tag = "2")]
569 pub suppressed_count: i32,
570 }
571 /// Nested message and enum types in `SuppressionInfo`.
572 pub mod suppression_info {
573 /// An indicator of why entries were omitted.
574 #[derive(
575 Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration,
576 )]
577 #[repr(i32)]
578 pub enum Reason {
579 /// Unexpected default.
580 Unspecified = 0,
581 /// Indicates suppression occurred due to relevant entries being
582 /// received in excess of rate limits. For quotas and limits, see
583 /// [Logging API quotas and
584 /// limits](<https://cloud.google.com/logging/quotas#api-limits>).
585 RateLimit = 1,
586 /// Indicates suppression occurred due to the client not consuming
587 /// responses quickly enough.
588 NotConsumed = 2,
589 }
590 impl Reason {
591 /// String value of the enum field names used in the ProtoBuf definition.
592 ///
593 /// The values are not transformed in any way and thus are considered stable
594 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
595 pub fn as_str_name(&self) -> &'static str {
596 match self {
597 Self::Unspecified => "REASON_UNSPECIFIED",
598 Self::RateLimit => "RATE_LIMIT",
599 Self::NotConsumed => "NOT_CONSUMED",
600 }
601 }
602 /// Creates an enum from field names used in the ProtoBuf definition.
603 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
604 match value {
605 "REASON_UNSPECIFIED" => Some(Self::Unspecified),
606 "RATE_LIMIT" => Some(Self::RateLimit),
607 "NOT_CONSUMED" => Some(Self::NotConsumed),
608 _ => None,
609 }
610 }
611 }
612 }
613}
614/// Generated client implementations.
615pub mod logging_service_v2_client {
616 #![allow(
617 unused_variables,
618 dead_code,
619 missing_docs,
620 clippy::wildcard_imports,
621 clippy::let_unit_value
622 )]
623 use tonic::codegen::http::Uri;
624 use tonic::codegen::*;
625 /// Service for ingesting and querying logs.
626 #[derive(Debug, Clone)]
627 pub struct LoggingServiceV2Client<T> {
628 inner: tonic::client::Grpc<T>,
629 }
630 impl LoggingServiceV2Client<tonic::transport::Channel> {
631 /// Attempt to create a new client by connecting to a given endpoint.
632 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
633 where
634 D: TryInto<tonic::transport::Endpoint>,
635 D::Error: Into<StdError>,
636 {
637 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
638 Ok(Self::new(conn))
639 }
640 }
641 impl<T> LoggingServiceV2Client<T>
642 where
643 T: tonic::client::GrpcService<tonic::body::Body>,
644 T::Error: Into<StdError>,
645 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
646 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
647 {
648 pub fn new(inner: T) -> Self {
649 let inner = tonic::client::Grpc::new(inner);
650 Self { inner }
651 }
652 pub fn with_origin(inner: T, origin: Uri) -> Self {
653 let inner = tonic::client::Grpc::with_origin(inner, origin);
654 Self { inner }
655 }
656 pub fn with_interceptor<F>(
657 inner: T,
658 interceptor: F,
659 ) -> LoggingServiceV2Client<InterceptedService<T, F>>
660 where
661 F: tonic::service::Interceptor,
662 T::ResponseBody: Default,
663 T: tonic::codegen::Service<
664 http::Request<tonic::body::Body>,
665 Response = http::Response<
666 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
667 >,
668 >,
669 <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
670 Into<StdError> + std::marker::Send + std::marker::Sync,
671 {
672 LoggingServiceV2Client::new(InterceptedService::new(inner, interceptor))
673 }
674 /// Compress requests with the given encoding.
675 ///
676 /// This requires the server to support it otherwise it might respond with an
677 /// error.
678 #[must_use]
679 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
680 self.inner = self.inner.send_compressed(encoding);
681 self
682 }
683 /// Enable decompressing responses.
684 #[must_use]
685 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
686 self.inner = self.inner.accept_compressed(encoding);
687 self
688 }
689 /// Limits the maximum size of a decoded message.
690 ///
691 /// Default: `4MB`
692 #[must_use]
693 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
694 self.inner = self.inner.max_decoding_message_size(limit);
695 self
696 }
697 /// Limits the maximum size of an encoded message.
698 ///
699 /// Default: `usize::MAX`
700 #[must_use]
701 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
702 self.inner = self.inner.max_encoding_message_size(limit);
703 self
704 }
705 /// Deletes all the log entries in a log for the _Default Log Bucket. The log
706 /// reappears if it receives new entries. Log entries written shortly before
707 /// the delete operation might not be deleted. Entries received after the
708 /// delete operation with a timestamp before the operation will be deleted.
709 pub async fn delete_log(
710 &mut self,
711 request: impl tonic::IntoRequest<super::DeleteLogRequest>,
712 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
713 self.inner.ready().await.map_err(|e| {
714 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
715 })?;
716 let codec = tonic::codec::ProstCodec::default();
717 let path = http::uri::PathAndQuery::from_static(
718 "/google.logging.v2.LoggingServiceV2/DeleteLog",
719 );
720 let mut req = request.into_request();
721 req.extensions_mut().insert(GrpcMethod::new(
722 "google.logging.v2.LoggingServiceV2",
723 "DeleteLog",
724 ));
725 self.inner.unary(req, path, codec).await
726 }
727 /// Writes log entries to Logging. This API method is the
728 /// only way to send log entries to Logging. This method
729 /// is used, directly or indirectly, by the Logging agent
730 /// (fluentd) and all logging libraries configured to use Logging.
731 /// A single request may contain log entries for a maximum of 1000
732 /// different resources (projects, organizations, billing accounts or
733 /// folders)
734 pub async fn write_log_entries(
735 &mut self,
736 request: impl tonic::IntoRequest<super::WriteLogEntriesRequest>,
737 ) -> std::result::Result<tonic::Response<super::WriteLogEntriesResponse>, tonic::Status>
738 {
739 self.inner.ready().await.map_err(|e| {
740 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
741 })?;
742 let codec = tonic::codec::ProstCodec::default();
743 let path = http::uri::PathAndQuery::from_static(
744 "/google.logging.v2.LoggingServiceV2/WriteLogEntries",
745 );
746 let mut req = request.into_request();
747 req.extensions_mut().insert(GrpcMethod::new(
748 "google.logging.v2.LoggingServiceV2",
749 "WriteLogEntries",
750 ));
751 self.inner.unary(req, path, codec).await
752 }
753 /// Lists log entries. Use this method to retrieve log entries that originated
754 /// from a project/folder/organization/billing account. For ways to export log
755 /// entries, see [Exporting
756 /// Logs](https://cloud.google.com/logging/docs/export).
757 pub async fn list_log_entries(
758 &mut self,
759 request: impl tonic::IntoRequest<super::ListLogEntriesRequest>,
760 ) -> std::result::Result<tonic::Response<super::ListLogEntriesResponse>, tonic::Status>
761 {
762 self.inner.ready().await.map_err(|e| {
763 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
764 })?;
765 let codec = tonic::codec::ProstCodec::default();
766 let path = http::uri::PathAndQuery::from_static(
767 "/google.logging.v2.LoggingServiceV2/ListLogEntries",
768 );
769 let mut req = request.into_request();
770 req.extensions_mut().insert(GrpcMethod::new(
771 "google.logging.v2.LoggingServiceV2",
772 "ListLogEntries",
773 ));
774 self.inner.unary(req, path, codec).await
775 }
776 /// Lists the descriptors for monitored resource types used by Logging.
777 pub async fn list_monitored_resource_descriptors(
778 &mut self,
779 request: impl tonic::IntoRequest<super::ListMonitoredResourceDescriptorsRequest>,
780 ) -> std::result::Result<
781 tonic::Response<super::ListMonitoredResourceDescriptorsResponse>,
782 tonic::Status,
783 > {
784 self.inner.ready().await.map_err(|e| {
785 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
786 })?;
787 let codec = tonic::codec::ProstCodec::default();
788 let path = http::uri::PathAndQuery::from_static(
789 "/google.logging.v2.LoggingServiceV2/ListMonitoredResourceDescriptors",
790 );
791 let mut req = request.into_request();
792 req.extensions_mut().insert(GrpcMethod::new(
793 "google.logging.v2.LoggingServiceV2",
794 "ListMonitoredResourceDescriptors",
795 ));
796 self.inner.unary(req, path, codec).await
797 }
798 /// Lists the logs in projects, organizations, folders, or billing accounts.
799 /// Only logs that have entries are listed.
800 pub async fn list_logs(
801 &mut self,
802 request: impl tonic::IntoRequest<super::ListLogsRequest>,
803 ) -> std::result::Result<tonic::Response<super::ListLogsResponse>, tonic::Status> {
804 self.inner.ready().await.map_err(|e| {
805 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
806 })?;
807 let codec = tonic::codec::ProstCodec::default();
808 let path = http::uri::PathAndQuery::from_static(
809 "/google.logging.v2.LoggingServiceV2/ListLogs",
810 );
811 let mut req = request.into_request();
812 req.extensions_mut().insert(GrpcMethod::new(
813 "google.logging.v2.LoggingServiceV2",
814 "ListLogs",
815 ));
816 self.inner.unary(req, path, codec).await
817 }
818 /// Streaming read of log entries as they are ingested. Until the stream is
819 /// terminated, it will continue reading logs.
820 pub async fn tail_log_entries(
821 &mut self,
822 request: impl tonic::IntoStreamingRequest<Message = super::TailLogEntriesRequest>,
823 ) -> std::result::Result<
824 tonic::Response<tonic::codec::Streaming<super::TailLogEntriesResponse>>,
825 tonic::Status,
826 > {
827 self.inner.ready().await.map_err(|e| {
828 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
829 })?;
830 let codec = tonic::codec::ProstCodec::default();
831 let path = http::uri::PathAndQuery::from_static(
832 "/google.logging.v2.LoggingServiceV2/TailLogEntries",
833 );
834 let mut req = request.into_streaming_request();
835 req.extensions_mut().insert(GrpcMethod::new(
836 "google.logging.v2.LoggingServiceV2",
837 "TailLogEntries",
838 ));
839 self.inner.streaming(req, path, codec).await
840 }
841 }
842}