google-cloud-logging 1.5.1 → 1.5.2
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.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/README.md +8 -8
- data/lib/google/cloud/logging/credentials.rb +2 -15
- data/lib/google/cloud/logging/v2/config_service_v2_client.rb +126 -65
- data/lib/google/cloud/logging/v2/config_service_v2_client_config.json +13 -13
- data/lib/google/cloud/logging/v2/credentials.rb +38 -0
- data/lib/google/cloud/logging/v2/doc/google/api/distribution.rb +1 -1
- data/lib/google/cloud/logging/v2/doc/google/api/label.rb +1 -1
- data/lib/google/cloud/logging/v2/doc/google/api/metric.rb +8 -12
- data/lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb +28 -4
- data/lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb +1 -1
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +18 -10
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +11 -19
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +3 -18
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +1 -16
- data/lib/google/cloud/logging/v2/doc/google/protobuf/any.rb +1 -1
- data/lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb +1 -1
- data/lib/google/cloud/logging/v2/doc/google/protobuf/empty.rb +28 -0
- data/lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb +1 -1
- data/lib/google/cloud/logging/v2/doc/google/protobuf/struct.rb +73 -0
- data/lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb +1 -1
- data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +106 -67
- data/lib/google/cloud/logging/v2/logging_service_v2_client_config.json +12 -12
- data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +75 -45
- data/lib/google/cloud/logging/v2/metrics_service_v2_client_config.json +6 -6
- data/lib/google/cloud/logging/version.rb +1 -1
- data/lib/google/logging/v2/log_entry_pb.rb +1 -0
- data/lib/google/logging/v2/logging_config_services_pb.rb +2 -2
- data/lib/google/logging/v2/logging_metrics_services_pb.rb +2 -2
- data/lib/google/logging/v2/logging_pb.rb +1 -0
- data/lib/google/logging/v2/logging_services_pb.rb +5 -4
- metadata +35 -5
- data/lib/google/cloud/logging/v2/doc/overview.rb +0 -66
@@ -0,0 +1,73 @@
|
|
1
|
+
# Copyright 2018 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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# +Struct+ represents a structured data value, consisting of fields
|
18
|
+
# which map to dynamically typed values. In some languages, +Struct+
|
19
|
+
# might be supported by a native representation. For example, in
|
20
|
+
# scripting languages like JS a struct is represented as an
|
21
|
+
# object. The details of that representation are described together
|
22
|
+
# with the proto support for the language.
|
23
|
+
#
|
24
|
+
# The JSON representation for +Struct+ is JSON object.
|
25
|
+
# @!attribute [rw] fields
|
26
|
+
# @return [Hash{String => Google::Protobuf::Value}]
|
27
|
+
# Unordered map of dynamically typed values.
|
28
|
+
class Struct; end
|
29
|
+
|
30
|
+
# +Value+ represents a dynamically typed value which can be either
|
31
|
+
# null, a number, a string, a boolean, a recursive struct value, or a
|
32
|
+
# list of values. A producer of value is expected to set one of that
|
33
|
+
# variants, absence of any variant indicates an error.
|
34
|
+
#
|
35
|
+
# The JSON representation for +Value+ is JSON value.
|
36
|
+
# @!attribute [rw] null_value
|
37
|
+
# @return [Google::Protobuf::NullValue]
|
38
|
+
# Represents a null value.
|
39
|
+
# @!attribute [rw] number_value
|
40
|
+
# @return [Float]
|
41
|
+
# Represents a double value.
|
42
|
+
# @!attribute [rw] string_value
|
43
|
+
# @return [String]
|
44
|
+
# Represents a string value.
|
45
|
+
# @!attribute [rw] bool_value
|
46
|
+
# @return [true, false]
|
47
|
+
# Represents a boolean value.
|
48
|
+
# @!attribute [rw] struct_value
|
49
|
+
# @return [Google::Protobuf::Struct]
|
50
|
+
# Represents a structured value.
|
51
|
+
# @!attribute [rw] list_value
|
52
|
+
# @return [Google::Protobuf::ListValue]
|
53
|
+
# Represents a repeated +Value+.
|
54
|
+
class Value; end
|
55
|
+
|
56
|
+
# +ListValue+ is a wrapper around a repeated field of values.
|
57
|
+
#
|
58
|
+
# The JSON representation for +ListValue+ is JSON array.
|
59
|
+
# @!attribute [rw] values
|
60
|
+
# @return [Array<Google::Protobuf::Value>]
|
61
|
+
# Repeated field of dynamically typed values.
|
62
|
+
class ListValue; end
|
63
|
+
|
64
|
+
# +NullValue+ is a singleton enumeration to represent the null value for the
|
65
|
+
# +Value+ type union.
|
66
|
+
#
|
67
|
+
# The JSON representation for +NullValue+ is JSON +null+.
|
68
|
+
module NullValue
|
69
|
+
# Null value.
|
70
|
+
NULL_VALUE = 0
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -18,9 +18,6 @@
|
|
18
18
|
# and updates to that file get reflected here through a refresh process.
|
19
19
|
# For the short term, the refresh process will only be runnable by Google
|
20
20
|
# engineers.
|
21
|
-
#
|
22
|
-
# The only allowed edits are to method and file documentation. A 3-way
|
23
|
-
# merge preserves those additions if the generated source changes.
|
24
21
|
|
25
22
|
require "json"
|
26
23
|
require "pathname"
|
@@ -28,7 +25,7 @@ require "pathname"
|
|
28
25
|
require "google/gax"
|
29
26
|
|
30
27
|
require "google/logging/v2/logging_pb"
|
31
|
-
require "google/cloud/logging/credentials"
|
28
|
+
require "google/cloud/logging/v2/credentials"
|
32
29
|
|
33
30
|
module Google
|
34
31
|
module Cloud
|
@@ -47,6 +44,9 @@ module Google
|
|
47
44
|
# The default port of the service.
|
48
45
|
DEFAULT_SERVICE_PORT = 443
|
49
46
|
|
47
|
+
# The default set of gRPC interceptors.
|
48
|
+
GRPC_INTERCEPTORS = []
|
49
|
+
|
50
50
|
DEFAULT_TIMEOUT = 30
|
51
51
|
|
52
52
|
PAGE_DESCRIPTORS = {
|
@@ -88,11 +88,6 @@ module Google
|
|
88
88
|
"https://www.googleapis.com/auth/logging.write"
|
89
89
|
].freeze
|
90
90
|
|
91
|
-
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
92
|
-
"projects/{project}"
|
93
|
-
)
|
94
|
-
|
95
|
-
private_constant :PROJECT_PATH_TEMPLATE
|
96
91
|
|
97
92
|
LOG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
98
93
|
"projects/{project}/logs/{log}"
|
@@ -100,14 +95,11 @@ module Google
|
|
100
95
|
|
101
96
|
private_constant :LOG_PATH_TEMPLATE
|
102
97
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
:"project" => project
|
109
|
-
)
|
110
|
-
end
|
98
|
+
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
99
|
+
"projects/{project}"
|
100
|
+
)
|
101
|
+
|
102
|
+
private_constant :PROJECT_PATH_TEMPLATE
|
111
103
|
|
112
104
|
# Returns a fully-qualified log resource name string.
|
113
105
|
# @param project [String]
|
@@ -120,6 +112,15 @@ module Google
|
|
120
112
|
)
|
121
113
|
end
|
122
114
|
|
115
|
+
# Returns a fully-qualified project resource name string.
|
116
|
+
# @param project [String]
|
117
|
+
# @return [String]
|
118
|
+
def self.project_path project
|
119
|
+
PROJECT_PATH_TEMPLATE.render(
|
120
|
+
:"project" => project
|
121
|
+
)
|
122
|
+
end
|
123
|
+
|
123
124
|
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
124
125
|
# Provides the means for authenticating requests made by the client. This parameter can
|
125
126
|
# be many types.
|
@@ -144,16 +145,18 @@ module Google
|
|
144
145
|
# or the specified config is missing data points.
|
145
146
|
# @param timeout [Numeric]
|
146
147
|
# The default timeout, in seconds, for calls made through this client.
|
148
|
+
# @param metadata [Hash]
|
149
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
150
|
+
# @param exception_transformer [Proc]
|
151
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
152
|
+
# custom error handling.
|
147
153
|
def initialize \
|
148
|
-
service_path: SERVICE_ADDRESS,
|
149
|
-
port: DEFAULT_SERVICE_PORT,
|
150
|
-
channel: nil,
|
151
|
-
chan_creds: nil,
|
152
|
-
updater_proc: nil,
|
153
154
|
credentials: nil,
|
154
155
|
scopes: ALL_SCOPES,
|
155
156
|
client_config: {},
|
156
157
|
timeout: DEFAULT_TIMEOUT,
|
158
|
+
metadata: nil,
|
159
|
+
exception_transformer: nil,
|
157
160
|
lib_name: nil,
|
158
161
|
lib_version: ""
|
159
162
|
# These require statements are intentionally placed here to initialize
|
@@ -162,21 +165,10 @@ module Google
|
|
162
165
|
require "google/gax/grpc"
|
163
166
|
require "google/logging/v2/logging_services_pb"
|
164
167
|
|
165
|
-
|
166
|
-
warn "The `channel`, `chan_creds`, and `updater_proc` parameters will be removed " \
|
167
|
-
"on 2017/09/08"
|
168
|
-
credentials ||= channel
|
169
|
-
credentials ||= chan_creds
|
170
|
-
credentials ||= updater_proc
|
171
|
-
end
|
172
|
-
if service_path != SERVICE_ADDRESS || port != DEFAULT_SERVICE_PORT
|
173
|
-
warn "`service_path` and `port` parameters are deprecated and will be removed"
|
174
|
-
end
|
175
|
-
|
176
|
-
credentials ||= Google::Cloud::Logging::Credentials.default
|
168
|
+
credentials ||= Google::Cloud::Logging::V2::Credentials.default
|
177
169
|
|
178
170
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
179
|
-
updater_proc = Google::Cloud::Logging::Credentials.new(credentials).updater_proc
|
171
|
+
updater_proc = Google::Cloud::Logging::V2::Credentials.new(credentials).updater_proc
|
180
172
|
end
|
181
173
|
if credentials.is_a?(GRPC::Core::Channel)
|
182
174
|
channel = credentials
|
@@ -191,13 +183,16 @@ module Google
|
|
191
183
|
updater_proc = credentials.updater_proc
|
192
184
|
end
|
193
185
|
|
186
|
+
package_version = Gem.loaded_specs['google-cloud-logging'].version.version
|
187
|
+
|
194
188
|
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
195
189
|
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
196
|
-
google_api_client << " gapic
|
190
|
+
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
197
191
|
google_api_client << " grpc/#{GRPC::VERSION}"
|
198
192
|
google_api_client.freeze
|
199
193
|
|
200
194
|
headers = { :"x-goog-api-client" => google_api_client }
|
195
|
+
headers.merge!(metadata) unless metadata.nil?
|
201
196
|
client_config_file = Pathname.new(__dir__).join(
|
202
197
|
"logging_service_v2_client_config.json"
|
203
198
|
)
|
@@ -211,9 +206,14 @@ module Google
|
|
211
206
|
bundle_descriptors: BUNDLE_DESCRIPTORS,
|
212
207
|
page_descriptors: PAGE_DESCRIPTORS,
|
213
208
|
errors: Google::Gax::Grpc::API_ERRORS,
|
214
|
-
|
209
|
+
metadata: headers
|
215
210
|
)
|
216
211
|
end
|
212
|
+
|
213
|
+
# Allow overriding the service path/port in subclasses.
|
214
|
+
service_path = self.class::SERVICE_ADDRESS
|
215
|
+
port = self.class::DEFAULT_SERVICE_PORT
|
216
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
217
217
|
@logging_service_v2_stub = Google::Gax::Grpc.create_stub(
|
218
218
|
service_path,
|
219
219
|
port,
|
@@ -221,28 +221,34 @@ module Google
|
|
221
221
|
channel: channel,
|
222
222
|
updater_proc: updater_proc,
|
223
223
|
scopes: scopes,
|
224
|
+
interceptors: interceptors,
|
224
225
|
&Google::Logging::V2::LoggingServiceV2::Stub.method(:new)
|
225
226
|
)
|
226
227
|
|
227
228
|
@delete_log = Google::Gax.create_api_call(
|
228
229
|
@logging_service_v2_stub.method(:delete_log),
|
229
|
-
defaults["delete_log"]
|
230
|
+
defaults["delete_log"],
|
231
|
+
exception_transformer: exception_transformer
|
230
232
|
)
|
231
233
|
@write_log_entries = Google::Gax.create_api_call(
|
232
234
|
@logging_service_v2_stub.method(:write_log_entries),
|
233
|
-
defaults["write_log_entries"]
|
235
|
+
defaults["write_log_entries"],
|
236
|
+
exception_transformer: exception_transformer
|
234
237
|
)
|
235
238
|
@list_log_entries = Google::Gax.create_api_call(
|
236
239
|
@logging_service_v2_stub.method(:list_log_entries),
|
237
|
-
defaults["list_log_entries"]
|
240
|
+
defaults["list_log_entries"],
|
241
|
+
exception_transformer: exception_transformer
|
238
242
|
)
|
239
243
|
@list_monitored_resource_descriptors = Google::Gax.create_api_call(
|
240
244
|
@logging_service_v2_stub.method(:list_monitored_resource_descriptors),
|
241
|
-
defaults["list_monitored_resource_descriptors"]
|
245
|
+
defaults["list_monitored_resource_descriptors"],
|
246
|
+
exception_transformer: exception_transformer
|
242
247
|
)
|
243
248
|
@list_logs = Google::Gax.create_api_call(
|
244
249
|
@logging_service_v2_stub.method(:list_logs),
|
245
|
-
defaults["list_logs"]
|
250
|
+
defaults["list_logs"],
|
251
|
+
exception_transformer: exception_transformer
|
246
252
|
)
|
247
253
|
end
|
248
254
|
|
@@ -269,39 +275,45 @@ module Google
|
|
269
275
|
# @param options [Google::Gax::CallOptions]
|
270
276
|
# Overrides the default settings for this call, e.g, timeout,
|
271
277
|
# retries, etc.
|
278
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
279
|
+
# @yieldparam result []
|
280
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
272
281
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
273
282
|
# @example
|
274
283
|
# require "google/cloud/logging/v2"
|
275
284
|
#
|
276
|
-
# logging_service_v2_client = Google::Cloud::Logging::V2::
|
285
|
+
# logging_service_v2_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
277
286
|
# formatted_log_name = Google::Cloud::Logging::V2::LoggingServiceV2Client.log_path("[PROJECT]", "[LOG]")
|
278
287
|
# logging_service_v2_client.delete_log(formatted_log_name)
|
279
288
|
|
280
289
|
def delete_log \
|
281
290
|
log_name,
|
282
|
-
options: nil
|
291
|
+
options: nil,
|
292
|
+
&block
|
283
293
|
req = {
|
284
294
|
log_name: log_name
|
285
295
|
}.delete_if { |_, v| v.nil? }
|
286
296
|
req = Google::Gax::to_proto(req, Google::Logging::V2::DeleteLogRequest)
|
287
|
-
@delete_log.call(req, options)
|
297
|
+
@delete_log.call(req, options, &block)
|
288
298
|
nil
|
289
299
|
end
|
290
300
|
|
291
|
-
# == Log entry resources
|
292
|
-
#
|
293
301
|
# Writes log entries to Stackdriver Logging. This API method is the
|
294
302
|
# only way to send log entries to Stackdriver Logging. This method
|
295
303
|
# is used, directly or indirectly, by the Stackdriver Logging agent
|
296
304
|
# (fluentd) and all logging libraries configured to use Stackdriver
|
297
305
|
# Logging.
|
306
|
+
# A single request may contain log entries for a maximum of 1000
|
307
|
+
# different resources (projects, organizations, billing accounts or
|
308
|
+
# folders)
|
298
309
|
#
|
299
310
|
# @param entries [Array<Google::Logging::V2::LogEntry | Hash>]
|
300
311
|
# Required. The log entries to send to Stackdriver Logging. The order of log
|
301
312
|
# entries in this list does not matter. Values supplied in this method's
|
302
313
|
# +log_name+, +resource+, and +labels+ fields are copied into those log
|
303
314
|
# entries in this list that do not include values for their corresponding
|
304
|
-
# fields. For more information, see the
|
315
|
+
# fields. For more information, see the
|
316
|
+
# {Google::Logging::V2::LogEntry LogEntry} type.
|
305
317
|
#
|
306
318
|
# If the +timestamp+ or +insert_id+ fields are missing in log entries, then
|
307
319
|
# this method supplies the current time or a unique identifier, respectively.
|
@@ -311,8 +323,9 @@ module Google
|
|
311
323
|
#
|
312
324
|
# Log entries with timestamps that are more than the
|
313
325
|
# [logs retention period](https://cloud.google.com/logging/quota-policy) in the past or more than
|
314
|
-
# 24 hours in the future
|
315
|
-
#
|
326
|
+
# 24 hours in the future will not be available when calling +entries.list+.
|
327
|
+
# However, those log entries can still be exported with
|
328
|
+
# [LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
|
316
329
|
#
|
317
330
|
# To improve throughput and to avoid exceeding the
|
318
331
|
# [quota limit](https://cloud.google.com/logging/quota-policy) for calls to +entries.write+,
|
@@ -356,15 +369,24 @@ module Google
|
|
356
369
|
# entry is not written, then the response status is the error associated
|
357
370
|
# with one of the failed entries and the response includes error details
|
358
371
|
# keyed by the entries' zero-based index in the +entries.write+ method.
|
372
|
+
# @param dry_run [true, false]
|
373
|
+
# Optional. If true, the request should expect normal response, but the
|
374
|
+
# entries won't be persisted nor exported. Useful for checking whether the
|
375
|
+
# logging API endpoints are working properly before sending valuable data.
|
359
376
|
# @param options [Google::Gax::CallOptions]
|
360
377
|
# Overrides the default settings for this call, e.g, timeout,
|
361
378
|
# retries, etc.
|
379
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
380
|
+
# @yieldparam result [Google::Logging::V2::WriteLogEntriesResponse]
|
381
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
362
382
|
# @return [Google::Logging::V2::WriteLogEntriesResponse]
|
363
383
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
364
384
|
# @example
|
365
385
|
# require "google/cloud/logging/v2"
|
366
386
|
#
|
367
|
-
# logging_service_v2_client = Google::Cloud::Logging::V2::
|
387
|
+
# logging_service_v2_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
388
|
+
#
|
389
|
+
# # TODO: Initialize +entries+:
|
368
390
|
# entries = []
|
369
391
|
# response = logging_service_v2_client.write_log_entries(entries)
|
370
392
|
|
@@ -374,16 +396,19 @@ module Google
|
|
374
396
|
resource: nil,
|
375
397
|
labels: nil,
|
376
398
|
partial_success: nil,
|
377
|
-
|
399
|
+
dry_run: nil,
|
400
|
+
options: nil,
|
401
|
+
&block
|
378
402
|
req = {
|
379
403
|
entries: entries,
|
380
404
|
log_name: log_name,
|
381
405
|
resource: resource,
|
382
406
|
labels: labels,
|
383
|
-
partial_success: partial_success
|
407
|
+
partial_success: partial_success,
|
408
|
+
dry_run: dry_run
|
384
409
|
}.delete_if { |_, v| v.nil? }
|
385
410
|
req = Google::Gax::to_proto(req, Google::Logging::V2::WriteLogEntriesRequest)
|
386
|
-
@write_log_entries.call(req, options)
|
411
|
+
@write_log_entries.call(req, options, &block)
|
387
412
|
end
|
388
413
|
|
389
414
|
# Lists log entries. Use this method to retrieve log entries from
|
@@ -430,6 +455,9 @@ module Google
|
|
430
455
|
# @param options [Google::Gax::CallOptions]
|
431
456
|
# Overrides the default settings for this call, e.g, timeout,
|
432
457
|
# retries, etc.
|
458
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
459
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Logging::V2::LogEntry>]
|
460
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
433
461
|
# @return [Google::Gax::PagedEnumerable<Google::Logging::V2::LogEntry>]
|
434
462
|
# An enumerable of Google::Logging::V2::LogEntry instances.
|
435
463
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -439,16 +467,18 @@ module Google
|
|
439
467
|
# @example
|
440
468
|
# require "google/cloud/logging/v2"
|
441
469
|
#
|
442
|
-
# logging_service_v2_client = Google::Cloud::Logging::V2::
|
443
|
-
#
|
470
|
+
# logging_service_v2_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
471
|
+
#
|
472
|
+
# # TODO: Initialize +formatted_resource_names+:
|
473
|
+
# formatted_resource_names = []
|
444
474
|
#
|
445
475
|
# # Iterate over all results.
|
446
|
-
# logging_service_v2_client.list_log_entries(
|
476
|
+
# logging_service_v2_client.list_log_entries(formatted_resource_names).each do |element|
|
447
477
|
# # Process element.
|
448
478
|
# end
|
449
479
|
#
|
450
480
|
# # Or iterate over results one page at a time.
|
451
|
-
# logging_service_v2_client.list_log_entries(
|
481
|
+
# logging_service_v2_client.list_log_entries(formatted_resource_names).each_page do |page|
|
452
482
|
# # Process each page at a time.
|
453
483
|
# page.each do |element|
|
454
484
|
# # Process element.
|
@@ -461,7 +491,8 @@ module Google
|
|
461
491
|
filter: nil,
|
462
492
|
order_by: nil,
|
463
493
|
page_size: nil,
|
464
|
-
options: nil
|
494
|
+
options: nil,
|
495
|
+
&block
|
465
496
|
req = {
|
466
497
|
resource_names: resource_names,
|
467
498
|
project_ids: project_ids,
|
@@ -470,7 +501,7 @@ module Google
|
|
470
501
|
page_size: page_size
|
471
502
|
}.delete_if { |_, v| v.nil? }
|
472
503
|
req = Google::Gax::to_proto(req, Google::Logging::V2::ListLogEntriesRequest)
|
473
|
-
@list_log_entries.call(req, options)
|
504
|
+
@list_log_entries.call(req, options, &block)
|
474
505
|
end
|
475
506
|
|
476
507
|
# Lists the descriptors for monitored resource types used by Stackdriver
|
@@ -485,6 +516,9 @@ module Google
|
|
485
516
|
# @param options [Google::Gax::CallOptions]
|
486
517
|
# Overrides the default settings for this call, e.g, timeout,
|
487
518
|
# retries, etc.
|
519
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
520
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Api::MonitoredResourceDescriptor>]
|
521
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
488
522
|
# @return [Google::Gax::PagedEnumerable<Google::Api::MonitoredResourceDescriptor>]
|
489
523
|
# An enumerable of Google::Api::MonitoredResourceDescriptor instances.
|
490
524
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -494,7 +528,7 @@ module Google
|
|
494
528
|
# @example
|
495
529
|
# require "google/cloud/logging/v2"
|
496
530
|
#
|
497
|
-
# logging_service_v2_client = Google::Cloud::Logging::V2::
|
531
|
+
# logging_service_v2_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
498
532
|
#
|
499
533
|
# # Iterate over all results.
|
500
534
|
# logging_service_v2_client.list_monitored_resource_descriptors.each do |element|
|
@@ -511,12 +545,13 @@ module Google
|
|
511
545
|
|
512
546
|
def list_monitored_resource_descriptors \
|
513
547
|
page_size: nil,
|
514
|
-
options: nil
|
548
|
+
options: nil,
|
549
|
+
&block
|
515
550
|
req = {
|
516
551
|
page_size: page_size
|
517
552
|
}.delete_if { |_, v| v.nil? }
|
518
553
|
req = Google::Gax::to_proto(req, Google::Logging::V2::ListMonitoredResourceDescriptorsRequest)
|
519
|
-
@list_monitored_resource_descriptors.call(req, options)
|
554
|
+
@list_monitored_resource_descriptors.call(req, options, &block)
|
520
555
|
end
|
521
556
|
|
522
557
|
# Lists the logs in projects, organizations, folders, or billing accounts.
|
@@ -538,6 +573,9 @@ module Google
|
|
538
573
|
# @param options [Google::Gax::CallOptions]
|
539
574
|
# Overrides the default settings for this call, e.g, timeout,
|
540
575
|
# retries, etc.
|
576
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
577
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<String>]
|
578
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
541
579
|
# @return [Google::Gax::PagedEnumerable<String>]
|
542
580
|
# An enumerable of String instances.
|
543
581
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -547,7 +585,7 @@ module Google
|
|
547
585
|
# @example
|
548
586
|
# require "google/cloud/logging/v2"
|
549
587
|
#
|
550
|
-
# logging_service_v2_client = Google::Cloud::Logging::V2::
|
588
|
+
# logging_service_v2_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
551
589
|
# formatted_parent = Google::Cloud::Logging::V2::LoggingServiceV2Client.project_path("[PROJECT]")
|
552
590
|
#
|
553
591
|
# # Iterate over all results.
|
@@ -566,13 +604,14 @@ module Google
|
|
566
604
|
def list_logs \
|
567
605
|
parent,
|
568
606
|
page_size: nil,
|
569
|
-
options: nil
|
607
|
+
options: nil,
|
608
|
+
&block
|
570
609
|
req = {
|
571
610
|
parent: parent,
|
572
611
|
page_size: page_size
|
573
612
|
}.delete_if { |_, v| v.nil? }
|
574
613
|
req = Google::Gax::to_proto(req, Google::Logging::V2::ListLogsRequest)
|
575
|
-
@list_logs.call(req, options)
|
614
|
+
@list_logs.call(req, options, &block)
|
576
615
|
end
|
577
616
|
end
|
578
617
|
end
|