google-cloud-logging 0.20.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,18 +41,18 @@ module Google
41
41
  # Permissions for writing exported logs
42
42
  #
43
43
  # @example
44
- # require "google/cloud"
45
- #
46
- # gcloud = Google::Cloud.new
47
- # logging = gcloud.logging
48
- # storage = gcloud.storage
44
+ # require "google/cloud/storage"
49
45
  #
46
+ # storage = Google::Cloud::Storage.new
50
47
  # bucket = storage.create_bucket "my-logs-bucket"
51
48
  #
52
49
  # # Grant owner permission to Stackdriver Logging service
53
50
  # email = "cloud-logs@google.com"
54
51
  # bucket.acl.add_owner "group-#{email}"
55
52
  #
53
+ # require "google/cloud/logging"
54
+ #
55
+ # logging = Google::Cloud::Logging.new
56
56
  # sink = logging.create_sink "my-sink",
57
57
  # "storage.googleapis.com/#{bucket.id}"
58
58
  #
@@ -156,10 +156,9 @@ module Google
156
156
  # Updates the logs-based sink.
157
157
  #
158
158
  # @example
159
- # require "google/cloud"
159
+ # require "google/cloud/logging"
160
160
  #
161
- # gcloud = Google::Cloud.new
162
- # logging = gcloud.logging
161
+ # logging = Google::Cloud::Logging.new
163
162
  # sink = logging.sink "severe_errors"
164
163
  # sink.filter = "logName:syslog AND severity>=ERROR"
165
164
  # sink.save
@@ -184,10 +183,9 @@ module Google
184
183
  # @return [Boolean] Returns `true` if the sink was deleted.
185
184
  #
186
185
  # @example
187
- # require "google/cloud"
186
+ # require "google/cloud/logging"
188
187
  #
189
- # gcloud = Google::Cloud.new
190
- # logging = gcloud.logging
188
+ # logging = Google::Cloud::Logging.new
191
189
  # sink = logging.sink "severe_errors"
192
190
  # sink.delete
193
191
  #
@@ -39,10 +39,9 @@ module Google
39
39
  # @return [Boolean]
40
40
  #
41
41
  # @example
42
- # require "google/cloud"
42
+ # require "google/cloud/logging"
43
43
  #
44
- # gcloud = Google::Cloud.new
45
- # logging = gcloud.logging
44
+ # logging = Google::Cloud::Logging.new
46
45
  #
47
46
  # sinks = logging.sinks
48
47
  # if sinks.next?
@@ -59,10 +58,9 @@ module Google
59
58
  # @return [Sink::List]
60
59
  #
61
60
  # @example
62
- # require "google/cloud"
61
+ # require "google/cloud/logging"
63
62
  #
64
- # gcloud = Google::Cloud.new
65
- # logging = gcloud.logging
63
+ # logging = Google::Cloud::Logging.new
66
64
  #
67
65
  # sinks = dataset.sinks
68
66
  # if sinks.next?
@@ -95,10 +93,9 @@ module Google
95
93
  # @return [Enumerator]
96
94
  #
97
95
  # @example Iterating each sink by passing a block:
98
- # require "google/cloud"
96
+ # require "google/cloud/logging"
99
97
  #
100
- # gcloud = Google::Cloud.new
101
- # logging = gcloud.logging
98
+ # logging = Google::Cloud::Logging.new
102
99
  # sinks = logging.sinks
103
100
  #
104
101
  # sinks.all do |sink|
@@ -106,10 +103,9 @@ module Google
106
103
  # end
107
104
  #
108
105
  # @example Using the enumerator by not passing a block:
109
- # require "google/cloud"
106
+ # require "google/cloud/logging"
110
107
  #
111
- # gcloud = Google::Cloud.new
112
- # logging = gcloud.logging
108
+ # logging = Google::Cloud::Logging.new
113
109
  # sinks = logging.sinks
114
110
  #
115
111
  # all_names = sinks.all.map do |sink|
@@ -117,10 +113,9 @@ module Google
117
113
  # end
118
114
  #
119
115
  # @example Limit the number of API calls made:
120
- # require "google/cloud"
116
+ # require "google/cloud/logging"
121
117
  #
122
- # gcloud = Google::Cloud.new
123
- # logging = gcloud.logging
118
+ # logging = Google::Cloud::Logging.new
124
119
  # sinks = logging.sinks
125
120
  #
126
121
  # sinks.all(request_limit: 10) do |sink|
@@ -26,7 +26,7 @@ require "json"
26
26
  require "pathname"
27
27
 
28
28
  require "google/gax"
29
- require "google/logging/v2/logging_config_services_pb"
29
+ require "google/logging/v2/logging_config_pb"
30
30
 
31
31
  module Google
32
32
  module Cloud
@@ -35,10 +35,10 @@ module Google
35
35
  # Service for configuring sinks used to export log entries outside Stackdriver
36
36
  # Logging.
37
37
  #
38
- # @!attribute [r] stub
38
+ # @!attribute [r] config_service_v2_stub
39
39
  # @return [Google::Logging::V2::ConfigServiceV2::Stub]
40
40
  class ConfigServiceV2Api
41
- attr_reader :stub
41
+ attr_reader :config_service_v2_stub
42
42
 
43
43
  # The default address of the service.
44
44
  SERVICE_ADDRESS = "logging.googleapis.com".freeze
@@ -151,8 +151,15 @@ module Google
151
151
  timeout: DEFAULT_TIMEOUT,
152
152
  app_name: "gax",
153
153
  app_version: Google::Gax::VERSION
154
+ # These require statements are intentionally placed here to initialize
155
+ # the gRPC module only when it's required.
156
+ # See https://github.com/googleapis/toolkit/issues/446
157
+ require "google/gax/grpc"
158
+ require "google/logging/v2/logging_config_services_pb"
159
+
154
160
  google_api_client = "#{app_name}/#{app_version} " \
155
- "#{CODE_GEN_NAME_VERSION} ruby/#{RUBY_VERSION}".freeze
161
+ "#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
162
+ "ruby/#{RUBY_VERSION}".freeze
156
163
  headers = { :"x-goog-api-client" => google_api_client }
157
164
  client_config_file = Pathname.new(__dir__).join(
158
165
  "config_service_v2_client_config.json"
@@ -169,7 +176,7 @@ module Google
169
176
  kwargs: headers
170
177
  )
171
178
  end
172
- @stub = Google::Gax::Grpc.create_stub(
179
+ @config_service_v2_stub = Google::Gax::Grpc.create_stub(
173
180
  service_path,
174
181
  port,
175
182
  chan_creds: chan_creds,
@@ -179,23 +186,23 @@ module Google
179
186
  )
180
187
 
181
188
  @list_sinks = Google::Gax.create_api_call(
182
- @stub.method(:list_sinks),
189
+ @config_service_v2_stub.method(:list_sinks),
183
190
  defaults["list_sinks"]
184
191
  )
185
192
  @get_sink = Google::Gax.create_api_call(
186
- @stub.method(:get_sink),
193
+ @config_service_v2_stub.method(:get_sink),
187
194
  defaults["get_sink"]
188
195
  )
189
196
  @create_sink = Google::Gax.create_api_call(
190
- @stub.method(:create_sink),
197
+ @config_service_v2_stub.method(:create_sink),
191
198
  defaults["create_sink"]
192
199
  )
193
200
  @update_sink = Google::Gax.create_api_call(
194
- @stub.method(:update_sink),
201
+ @config_service_v2_stub.method(:update_sink),
195
202
  defaults["update_sink"]
196
203
  )
197
204
  @delete_sink = Google::Gax.create_api_call(
198
- @stub.method(:delete_sink),
205
+ @config_service_v2_stub.method(:delete_sink),
199
206
  defaults["delete_sink"]
200
207
  )
201
208
  end
@@ -205,7 +212,7 @@ module Google
205
212
  # Lists sinks.
206
213
  #
207
214
  # @param parent [String]
208
- # Required. The resource name containing the sinks.
215
+ # Required. The cloud resource containing the sinks.
209
216
  # Example: +"projects/my-logging-project"+.
210
217
  # @param page_size [Integer]
211
218
  # The maximum number of resources contained in the underlying API
@@ -222,6 +229,27 @@ module Google
222
229
  # operations such as per-page iteration or access to the response
223
230
  # object.
224
231
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
232
+ # @example
233
+ # require "google/cloud/logging/v2/config_service_v2_api"
234
+ #
235
+ # ConfigServiceV2Api = Google::Cloud::Logging::V2::ConfigServiceV2Api
236
+ #
237
+ # config_service_v2_api = ConfigServiceV2Api.new
238
+ # formatted_parent = ConfigServiceV2Api.parent_path("[PROJECT]")
239
+ #
240
+ # # Iterate over all results.
241
+ # config_service_v2_api.list_sinks(formatted_parent).each do |element|
242
+ # # Process element.
243
+ # end
244
+ #
245
+ # # Or iterate over results one page at a time.
246
+ # config_service_v2_api.list_sinks(formatted_parent).each_page do |page|
247
+ # # Process each page at a time.
248
+ # page.each do |element|
249
+ # # Process element.
250
+ # end
251
+ # end
252
+
225
253
  def list_sinks \
226
254
  parent,
227
255
  page_size: nil,
@@ -236,13 +264,22 @@ module Google
236
264
  # Gets a sink.
237
265
  #
238
266
  # @param sink_name [String]
239
- # The resource name of the sink to return.
267
+ # Required. The resource name of the sink to return.
240
268
  # Example: +"projects/my-project-id/sinks/my-sink-id"+.
241
269
  # @param options [Google::Gax::CallOptions]
242
270
  # Overrides the default settings for this call, e.g, timeout,
243
271
  # retries, etc.
244
272
  # @return [Google::Logging::V2::LogSink]
245
273
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
274
+ # @example
275
+ # require "google/cloud/logging/v2/config_service_v2_api"
276
+ #
277
+ # ConfigServiceV2Api = Google::Cloud::Logging::V2::ConfigServiceV2Api
278
+ #
279
+ # config_service_v2_api = ConfigServiceV2Api.new
280
+ # formatted_sink_name = ConfigServiceV2Api.sink_path("[PROJECT]", "[SINK]")
281
+ # response = config_service_v2_api.get_sink(formatted_sink_name)
282
+
246
283
  def get_sink \
247
284
  sink_name,
248
285
  options: nil
@@ -255,18 +292,28 @@ module Google
255
292
  # Creates a sink.
256
293
  #
257
294
  # @param parent [String]
258
- # The resource in which to create the sink.
295
+ # Required. The resource in which to create the sink.
259
296
  # Example: +"projects/my-project-id"+.
260
- #
261
297
  # The new sink must be provided in the request.
262
298
  # @param sink [Google::Logging::V2::LogSink]
263
- # The new sink, which must not have an identifier that already
264
- # exists.
299
+ # Required. The new sink, whose +name+ parameter is a sink identifier that
300
+ # is not already in use.
265
301
  # @param options [Google::Gax::CallOptions]
266
302
  # Overrides the default settings for this call, e.g, timeout,
267
303
  # retries, etc.
268
304
  # @return [Google::Logging::V2::LogSink]
269
305
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
306
+ # @example
307
+ # require "google/cloud/logging/v2/config_service_v2_api"
308
+ #
309
+ # ConfigServiceV2Api = Google::Cloud::Logging::V2::ConfigServiceV2Api
310
+ # LogSink = Google::Logging::V2::LogSink
311
+ #
312
+ # config_service_v2_api = ConfigServiceV2Api.new
313
+ # formatted_parent = ConfigServiceV2Api.parent_path("[PROJECT]")
314
+ # sink = LogSink.new
315
+ # response = config_service_v2_api.create_sink(formatted_parent, sink)
316
+
270
317
  def create_sink \
271
318
  parent,
272
319
  sink,
@@ -278,24 +325,32 @@ module Google
278
325
  @create_sink.call(req, options)
279
326
  end
280
327
 
281
- # Creates or updates a sink.
328
+ # Updates or creates a sink.
282
329
  #
283
330
  # @param sink_name [String]
284
- # The resource name of the sink to update.
285
- # Example: +"projects/my-project-id/sinks/my-sink-id"+.
286
- #
287
- # The updated sink must be provided in the request and have the
288
- # same name that is specified in +sinkName+. If the sink does not
289
- # exist, it is created.
331
+ # Required. The resource name of the sink to update, including the parent
332
+ # resource and the sink identifier. If the sink does not exist, this method
333
+ # creates the sink. Example: +"projects/my-project-id/sinks/my-sink-id"+.
290
334
  # @param sink [Google::Logging::V2::LogSink]
291
- # The updated sink, whose name must be the same as the sink
292
- # identifier in +sinkName+. If +sinkName+ does not exist, then
335
+ # Required. The updated sink, whose name is the same identifier that appears
336
+ # as part of +sinkName+. If +sinkName+ does not exist, then
293
337
  # this method creates a new sink.
294
338
  # @param options [Google::Gax::CallOptions]
295
339
  # Overrides the default settings for this call, e.g, timeout,
296
340
  # retries, etc.
297
341
  # @return [Google::Logging::V2::LogSink]
298
342
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
343
+ # @example
344
+ # require "google/cloud/logging/v2/config_service_v2_api"
345
+ #
346
+ # ConfigServiceV2Api = Google::Cloud::Logging::V2::ConfigServiceV2Api
347
+ # LogSink = Google::Logging::V2::LogSink
348
+ #
349
+ # config_service_v2_api = ConfigServiceV2Api.new
350
+ # formatted_sink_name = ConfigServiceV2Api.sink_path("[PROJECT]", "[SINK]")
351
+ # sink = LogSink.new
352
+ # response = config_service_v2_api.update_sink(formatted_sink_name, sink)
353
+
299
354
  def update_sink \
300
355
  sink_name,
301
356
  sink,
@@ -310,12 +365,23 @@ module Google
310
365
  # Deletes a sink.
311
366
  #
312
367
  # @param sink_name [String]
313
- # The resource name of the sink to delete.
314
- # Example: +"projects/my-project-id/sinks/my-sink-id"+.
368
+ # Required. The resource name of the sink to delete, including the parent
369
+ # resource and the sink identifier. Example:
370
+ # +"projects/my-project-id/sinks/my-sink-id"+. It is an error if the sink
371
+ # does not exist.
315
372
  # @param options [Google::Gax::CallOptions]
316
373
  # Overrides the default settings for this call, e.g, timeout,
317
374
  # retries, etc.
318
375
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
376
+ # @example
377
+ # require "google/cloud/logging/v2/config_service_v2_api"
378
+ #
379
+ # ConfigServiceV2Api = Google::Cloud::Logging::V2::ConfigServiceV2Api
380
+ #
381
+ # config_service_v2_api = ConfigServiceV2Api.new
382
+ # formatted_sink_name = ConfigServiceV2Api.sink_path("[PROJECT]", "[SINK]")
383
+ # config_service_v2_api.delete_sink(formatted_sink_name)
384
+
319
385
  def delete_sink \
320
386
  sink_name,
321
387
  options: nil
@@ -26,7 +26,7 @@ require "json"
26
26
  require "pathname"
27
27
 
28
28
  require "google/gax"
29
- require "google/logging/v2/logging_services_pb"
29
+ require "google/logging/v2/logging_pb"
30
30
 
31
31
  module Google
32
32
  module Cloud
@@ -34,10 +34,10 @@ module Google
34
34
  module V2
35
35
  # Service for ingesting and querying logs.
36
36
  #
37
- # @!attribute [r] stub
37
+ # @!attribute [r] logging_service_v2_stub
38
38
  # @return [Google::Logging::V2::LoggingServiceV2::Stub]
39
39
  class LoggingServiceV2Api
40
- attr_reader :stub
40
+ attr_reader :logging_service_v2_stub
41
41
 
42
42
  # The default address of the service.
43
43
  SERVICE_ADDRESS = "logging.googleapis.com".freeze
@@ -154,8 +154,15 @@ module Google
154
154
  timeout: DEFAULT_TIMEOUT,
155
155
  app_name: "gax",
156
156
  app_version: Google::Gax::VERSION
157
+ # These require statements are intentionally placed here to initialize
158
+ # the gRPC module only when it's required.
159
+ # See https://github.com/googleapis/toolkit/issues/446
160
+ require "google/gax/grpc"
161
+ require "google/logging/v2/logging_services_pb"
162
+
157
163
  google_api_client = "#{app_name}/#{app_version} " \
158
- "#{CODE_GEN_NAME_VERSION} ruby/#{RUBY_VERSION}".freeze
164
+ "#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
165
+ "ruby/#{RUBY_VERSION}".freeze
159
166
  headers = { :"x-goog-api-client" => google_api_client }
160
167
  client_config_file = Pathname.new(__dir__).join(
161
168
  "logging_service_v2_client_config.json"
@@ -172,7 +179,7 @@ module Google
172
179
  kwargs: headers
173
180
  )
174
181
  end
175
- @stub = Google::Gax::Grpc.create_stub(
182
+ @logging_service_v2_stub = Google::Gax::Grpc.create_stub(
176
183
  service_path,
177
184
  port,
178
185
  chan_creds: chan_creds,
@@ -182,19 +189,19 @@ module Google
182
189
  )
183
190
 
184
191
  @delete_log = Google::Gax.create_api_call(
185
- @stub.method(:delete_log),
192
+ @logging_service_v2_stub.method(:delete_log),
186
193
  defaults["delete_log"]
187
194
  )
188
195
  @write_log_entries = Google::Gax.create_api_call(
189
- @stub.method(:write_log_entries),
196
+ @logging_service_v2_stub.method(:write_log_entries),
190
197
  defaults["write_log_entries"]
191
198
  )
192
199
  @list_log_entries = Google::Gax.create_api_call(
193
- @stub.method(:list_log_entries),
200
+ @logging_service_v2_stub.method(:list_log_entries),
194
201
  defaults["list_log_entries"]
195
202
  )
196
203
  @list_monitored_resource_descriptors = Google::Gax.create_api_call(
197
- @stub.method(:list_monitored_resource_descriptors),
204
+ @logging_service_v2_stub.method(:list_monitored_resource_descriptors),
198
205
  defaults["list_monitored_resource_descriptors"]
199
206
  )
200
207
  end
@@ -211,6 +218,15 @@ module Google
211
218
  # Overrides the default settings for this call, e.g, timeout,
212
219
  # retries, etc.
213
220
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
221
+ # @example
222
+ # require "google/cloud/logging/v2/logging_service_v2_api"
223
+ #
224
+ # LoggingServiceV2Api = Google::Cloud::Logging::V2::LoggingServiceV2Api
225
+ #
226
+ # logging_service_v2_api = LoggingServiceV2Api.new
227
+ # formatted_log_name = LoggingServiceV2Api.log_path("[PROJECT]", "[LOG]")
228
+ # logging_service_v2_api.delete_log(formatted_log_name)
229
+
214
230
  def delete_log \
215
231
  log_name,
216
232
  options: nil
@@ -224,25 +240,34 @@ module Google
224
240
  # written by this method.
225
241
  #
226
242
  # @param log_name [String]
227
- # Optional. A default log resource name for those log entries in +entries+
228
- # that do not specify their own +logName+. Example:
243
+ # Optional. A default log resource name that is assigned to all log entries
244
+ # in +entries+ that do not specify a value for +log_name+. Example:
229
245
  # +"projects/my-project/logs/syslog"+. See
230
246
  # LogEntry.
231
247
  # @param resource [Google::Api::MonitoredResource]
232
- # Optional. A default monitored resource for those log entries in +entries+
233
- # that do not specify their own +resource+.
248
+ # Optional. A default monitored resource object that is assigned to all log
249
+ # entries in +entries+ that do not specify a value for +resource+. Example:
250
+ #
251
+ # { "type": "gce_instance",
252
+ # "labels": {
253
+ # "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
254
+ #
255
+ # See LogEntry.
234
256
  # @param labels [Hash{String => String}]
235
- # Optional. User-defined +key:value+ items that are added to
236
- # the +labels+ field of each log entry in +entries+, except when a log
237
- # entry specifies its own +key:value+ item with the same key.
238
- # Example: +{ "size": "large", "color":"red" }+
257
+ # Optional. Default labels that are added to the +labels+ field of all log
258
+ # entries in +entries+. If a log entry already has a label with the same key
259
+ # as a label in this parameter, then the log entry's label is not changed.
260
+ # See LogEntry.
239
261
  # @param entries [Array<Google::Logging::V2::LogEntry>]
240
- # Required. The log entries to write. The log entries must have values for
241
- # all required fields.
262
+ # Required. The log entries to write. Values supplied for the fields
263
+ # +log_name+, +resource+, and +labels+ in this +entries.write+ request are
264
+ # added to those log entries that do not provide their own values for the
265
+ # fields.
242
266
  #
243
- # To improve throughput and to avoid exceeding the quota limit for calls
244
- # to +entries.write+, use this field to write multiple log entries at once
245
- # rather than // calling this method for each log entry.
267
+ # To improve throughput and to avoid exceeding the
268
+ # {quota limit}[https://cloud.google.com/logging/quota-policy] for calls to +entries.write+,
269
+ # you should write multiple log entries at once rather than
270
+ # calling this method for each individual log entry.
246
271
  # @param partial_success [true, false]
247
272
  # Optional. Whether valid entries should be written even if some other
248
273
  # entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any
@@ -254,6 +279,15 @@ module Google
254
279
  # retries, etc.
255
280
  # @return [Google::Logging::V2::WriteLogEntriesResponse]
256
281
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
282
+ # @example
283
+ # require "google/cloud/logging/v2/logging_service_v2_api"
284
+ #
285
+ # LoggingServiceV2Api = Google::Cloud::Logging::V2::LoggingServiceV2Api
286
+ #
287
+ # logging_service_v2_api = LoggingServiceV2Api.new
288
+ # entries = []
289
+ # response = logging_service_v2_api.write_log_entries(entries)
290
+
257
291
  def write_log_entries \
258
292
  entries,
259
293
  log_name: nil,
@@ -266,7 +300,13 @@ module Google
266
300
  )
267
301
  req.log_name = log_name unless log_name.nil?
268
302
  req.resource = resource unless resource.nil?
269
- req.labels = labels unless labels.nil?
303
+ # Custom code here to work around setting a Hash where a Map is expected.
304
+ # If a future PR removes this code then ensure that the bug is fixed.
305
+ unless labels.nil?
306
+ labels_map = Google::Protobuf::Map.new(:string, :string)
307
+ labels.each { |k, v| labels_map[String(k)] = String(v) }
308
+ req.labels = labels_map
309
+ end
270
310
  req.partial_success = partial_success unless partial_success.nil?
271
311
  @write_log_entries.call(req, options)
272
312
  end
@@ -276,13 +316,19 @@ module Google
276
316
  # {Exporting Logs}[https://cloud.google.com/logging/docs/export].
277
317
  #
278
318
  # @param project_ids [Array<String>]
279
- # Required. One or more project IDs or project numbers from which to retrieve
280
- # log entries. Examples of a project ID: +"my-project-1A"+, +"1234567890"+.
319
+ # Deprecated. One or more project identifiers or project numbers from which
320
+ # to retrieve log entries. Examples: +"my-project-1A"+, +"1234567890"+. If
321
+ # present, these project identifiers are converted to resource format and
322
+ # added to the list of resources in +resourceNames+. Callers should use
323
+ # +resourceNames+ rather than this parameter.
324
+ # @param resource_names [Array<String>]
325
+ # Optional. One or more cloud resources from which to retrieve log entries.
326
+ # Example: +"projects/my-project-1A"+, +"projects/1234567890"+. Projects
327
+ # listed in +projectIds+ are added to this list.
281
328
  # @param filter [String]
282
- # Optional. An {advanced logs filter}[https://cloud.google.com/logging/docs/view/advanced_filters].
283
- # The filter is compared against all log entries in the projects specified by
284
- # +projectIds+. Only entries that match the filter are retrieved. An empty
285
- # filter matches all log entries.
329
+ # Optional. A filter that chooses which log entries to return. See {Advanced
330
+ # Logs Filters}[https://cloud.google.com/logging/docs/view/advanced_filters]. Only log entries that
331
+ # match the filter are returned. An empty filter matches all log entries.
286
332
  # @param order_by [String]
287
333
  # Optional. How the results should be sorted. Presently, the only permitted
288
334
  # values are +"timestamp asc"+ (default) and +"timestamp desc"+. The first
@@ -305,8 +351,30 @@ module Google
305
351
  # operations such as per-page iteration or access to the response
306
352
  # object.
307
353
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
354
+ # @example
355
+ # require "google/cloud/logging/v2/logging_service_v2_api"
356
+ #
357
+ # LoggingServiceV2Api = Google::Cloud::Logging::V2::LoggingServiceV2Api
358
+ #
359
+ # logging_service_v2_api = LoggingServiceV2Api.new
360
+ # project_ids = []
361
+ #
362
+ # # Iterate over all results.
363
+ # logging_service_v2_api.list_log_entries(project_ids).each do |element|
364
+ # # Process element.
365
+ # end
366
+ #
367
+ # # Or iterate over results one page at a time.
368
+ # logging_service_v2_api.list_log_entries(project_ids).each_page do |page|
369
+ # # Process each page at a time.
370
+ # page.each do |element|
371
+ # # Process element.
372
+ # end
373
+ # end
374
+
308
375
  def list_log_entries \
309
376
  project_ids,
377
+ resource_names: nil,
310
378
  filter: nil,
311
379
  order_by: nil,
312
380
  page_size: nil,
@@ -314,6 +382,7 @@ module Google
314
382
  req = Google::Logging::V2::ListLogEntriesRequest.new(
315
383
  project_ids: project_ids
316
384
  )
385
+ req.resource_names = resource_names unless resource_names.nil?
317
386
  req.filter = filter unless filter.nil?
318
387
  req.order_by = order_by unless order_by.nil?
319
388
  req.page_size = page_size unless page_size.nil?
@@ -337,6 +406,26 @@ module Google
337
406
  # operations such as per-page iteration or access to the response
338
407
  # object.
339
408
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
409
+ # @example
410
+ # require "google/cloud/logging/v2/logging_service_v2_api"
411
+ #
412
+ # LoggingServiceV2Api = Google::Cloud::Logging::V2::LoggingServiceV2Api
413
+ #
414
+ # logging_service_v2_api = LoggingServiceV2Api.new
415
+ #
416
+ # # Iterate over all results.
417
+ # logging_service_v2_api.list_monitored_resource_descriptors.each do |element|
418
+ # # Process element.
419
+ # end
420
+ #
421
+ # # Or iterate over results one page at a time.
422
+ # logging_service_v2_api.list_monitored_resource_descriptors.each_page do |page|
423
+ # # Process each page at a time.
424
+ # page.each do |element|
425
+ # # Process element.
426
+ # end
427
+ # end
428
+
340
429
  def list_monitored_resource_descriptors \
341
430
  page_size: nil,
342
431
  options: nil