google-cloud-logging-v2 0.2.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,3 +35,6 @@ module Google
35
35
  end
36
36
  end
37
37
  end
38
+
39
+ helper_path = ::File.join __dir__, "v2", "_helpers.rb"
40
+ require "google/cloud/logging/v2/_helpers" if ::File.file? helper_path
@@ -60,7 +60,7 @@ module Google
60
60
  parent_config = while namespace.any?
61
61
  parent_name = namespace.join "::"
62
62
  parent_const = const_get parent_name
63
- break parent_const.configure if parent_const&.respond_to? :configure
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
64
  namespace.pop
65
65
  end
66
66
  default_config = Client::Configuration.new parent_config
@@ -68,17 +68,17 @@ module Google
68
68
  default_config.rpcs.list_sinks.timeout = 60.0
69
69
  default_config.rpcs.list_sinks.retry_policy = {
70
70
  initial_delay: 0.1,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: [4, 13, 14]
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [4, 13, 14]
74
74
  }
75
75
 
76
76
  default_config.rpcs.get_sink.timeout = 60.0
77
77
  default_config.rpcs.get_sink.retry_policy = {
78
78
  initial_delay: 0.1,
79
- max_delay: 60.0,
80
- multiplier: 1.3,
81
- retry_codes: [4, 13, 14]
79
+ max_delay: 60.0,
80
+ multiplier: 1.3,
81
+ retry_codes: [4, 13, 14]
82
82
  }
83
83
 
84
84
  default_config.rpcs.create_sink.timeout = 120.0
@@ -86,33 +86,33 @@ module Google
86
86
  default_config.rpcs.update_sink.timeout = 60.0
87
87
  default_config.rpcs.update_sink.retry_policy = {
88
88
  initial_delay: 0.1,
89
- max_delay: 60.0,
90
- multiplier: 1.3,
91
- retry_codes: [4, 13, 14]
89
+ max_delay: 60.0,
90
+ multiplier: 1.3,
91
+ retry_codes: [4, 13, 14]
92
92
  }
93
93
 
94
94
  default_config.rpcs.delete_sink.timeout = 60.0
95
95
  default_config.rpcs.delete_sink.retry_policy = {
96
96
  initial_delay: 0.1,
97
- max_delay: 60.0,
98
- multiplier: 1.3,
99
- retry_codes: [4, 13, 14]
97
+ max_delay: 60.0,
98
+ multiplier: 1.3,
99
+ retry_codes: [4, 13, 14]
100
100
  }
101
101
 
102
102
  default_config.rpcs.list_exclusions.timeout = 60.0
103
103
  default_config.rpcs.list_exclusions.retry_policy = {
104
104
  initial_delay: 0.1,
105
- max_delay: 60.0,
106
- multiplier: 1.3,
107
- retry_codes: [4, 13, 14]
105
+ max_delay: 60.0,
106
+ multiplier: 1.3,
107
+ retry_codes: [4, 13, 14]
108
108
  }
109
109
 
110
110
  default_config.rpcs.get_exclusion.timeout = 60.0
111
111
  default_config.rpcs.get_exclusion.retry_policy = {
112
112
  initial_delay: 0.1,
113
- max_delay: 60.0,
114
- multiplier: 1.3,
115
- retry_codes: [4, 13, 14]
113
+ max_delay: 60.0,
114
+ multiplier: 1.3,
115
+ retry_codes: [4, 13, 14]
116
116
  }
117
117
 
118
118
  default_config.rpcs.create_exclusion.timeout = 120.0
@@ -122,9 +122,9 @@ module Google
122
122
  default_config.rpcs.delete_exclusion.timeout = 60.0
123
123
  default_config.rpcs.delete_exclusion.retry_policy = {
124
124
  initial_delay: 0.1,
125
- max_delay: 60.0,
126
- multiplier: 1.3,
127
- retry_codes: [4, 13, 14]
125
+ max_delay: 60.0,
126
+ multiplier: 1.3,
127
+ retry_codes: [4, 13, 14]
128
128
  }
129
129
 
130
130
  default_config
@@ -188,7 +188,13 @@ module Google
188
188
 
189
189
  # Create credentials
190
190
  credentials = @config.credentials
191
- credentials ||= Credentials.default scope: @config.scope
191
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
192
+ # but only if the default endpoint does not have a region prefix.
193
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
194
+ @config.endpoint == Client.configure.endpoint &&
195
+ !@config.endpoint.split(".").first.include?("-")
196
+ credentials ||= Credentials.default scope: @config.scope,
197
+ enable_self_signed_jwt: enable_self_signed_jwt
192
198
  if credentials.is_a?(String) || credentials.is_a?(Hash)
193
199
  credentials = Credentials.new credentials, scope: @config.scope
194
200
  end
@@ -2170,7 +2176,7 @@ module Google
2170
2176
  config_attr :scope, nil, ::String, ::Array, nil
2171
2177
  config_attr :lib_name, nil, ::String, nil
2172
2178
  config_attr :lib_version, nil, ::String, nil
2173
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
2179
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
2174
2180
  config_attr :interceptors, nil, ::Array, nil
2175
2181
  config_attr :timeout, nil, ::Numeric, nil
2176
2182
  config_attr :metadata, nil, ::Hash, nil
@@ -2191,7 +2197,7 @@ module Google
2191
2197
  def rpcs
2192
2198
  @rpcs ||= begin
2193
2199
  parent_rpcs = nil
2194
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
2200
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
2195
2201
  Rpcs.new parent_rpcs
2196
2202
  end
2197
2203
  end
@@ -2203,7 +2209,7 @@ module Google
2203
2209
  # Each configuration object is of type `Gapic::Config::Method` and includes
2204
2210
  # the following configuration fields:
2205
2211
  #
2206
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
2212
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
2207
2213
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
2208
2214
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
2209
2215
  # include the following keys:
@@ -2332,51 +2338,51 @@ module Google
2332
2338
 
2333
2339
  # @private
2334
2340
  def initialize parent_rpcs = nil
2335
- list_buckets_config = parent_rpcs&.list_buckets if parent_rpcs&.respond_to? :list_buckets
2341
+ list_buckets_config = parent_rpcs.list_buckets if parent_rpcs.respond_to? :list_buckets
2336
2342
  @list_buckets = ::Gapic::Config::Method.new list_buckets_config
2337
- get_bucket_config = parent_rpcs&.get_bucket if parent_rpcs&.respond_to? :get_bucket
2343
+ get_bucket_config = parent_rpcs.get_bucket if parent_rpcs.respond_to? :get_bucket
2338
2344
  @get_bucket = ::Gapic::Config::Method.new get_bucket_config
2339
- create_bucket_config = parent_rpcs&.create_bucket if parent_rpcs&.respond_to? :create_bucket
2345
+ create_bucket_config = parent_rpcs.create_bucket if parent_rpcs.respond_to? :create_bucket
2340
2346
  @create_bucket = ::Gapic::Config::Method.new create_bucket_config
2341
- update_bucket_config = parent_rpcs&.update_bucket if parent_rpcs&.respond_to? :update_bucket
2347
+ update_bucket_config = parent_rpcs.update_bucket if parent_rpcs.respond_to? :update_bucket
2342
2348
  @update_bucket = ::Gapic::Config::Method.new update_bucket_config
2343
- delete_bucket_config = parent_rpcs&.delete_bucket if parent_rpcs&.respond_to? :delete_bucket
2349
+ delete_bucket_config = parent_rpcs.delete_bucket if parent_rpcs.respond_to? :delete_bucket
2344
2350
  @delete_bucket = ::Gapic::Config::Method.new delete_bucket_config
2345
- undelete_bucket_config = parent_rpcs&.undelete_bucket if parent_rpcs&.respond_to? :undelete_bucket
2351
+ undelete_bucket_config = parent_rpcs.undelete_bucket if parent_rpcs.respond_to? :undelete_bucket
2346
2352
  @undelete_bucket = ::Gapic::Config::Method.new undelete_bucket_config
2347
- list_views_config = parent_rpcs&.list_views if parent_rpcs&.respond_to? :list_views
2353
+ list_views_config = parent_rpcs.list_views if parent_rpcs.respond_to? :list_views
2348
2354
  @list_views = ::Gapic::Config::Method.new list_views_config
2349
- get_view_config = parent_rpcs&.get_view if parent_rpcs&.respond_to? :get_view
2355
+ get_view_config = parent_rpcs.get_view if parent_rpcs.respond_to? :get_view
2350
2356
  @get_view = ::Gapic::Config::Method.new get_view_config
2351
- create_view_config = parent_rpcs&.create_view if parent_rpcs&.respond_to? :create_view
2357
+ create_view_config = parent_rpcs.create_view if parent_rpcs.respond_to? :create_view
2352
2358
  @create_view = ::Gapic::Config::Method.new create_view_config
2353
- update_view_config = parent_rpcs&.update_view if parent_rpcs&.respond_to? :update_view
2359
+ update_view_config = parent_rpcs.update_view if parent_rpcs.respond_to? :update_view
2354
2360
  @update_view = ::Gapic::Config::Method.new update_view_config
2355
- delete_view_config = parent_rpcs&.delete_view if parent_rpcs&.respond_to? :delete_view
2361
+ delete_view_config = parent_rpcs.delete_view if parent_rpcs.respond_to? :delete_view
2356
2362
  @delete_view = ::Gapic::Config::Method.new delete_view_config
2357
- list_sinks_config = parent_rpcs&.list_sinks if parent_rpcs&.respond_to? :list_sinks
2363
+ list_sinks_config = parent_rpcs.list_sinks if parent_rpcs.respond_to? :list_sinks
2358
2364
  @list_sinks = ::Gapic::Config::Method.new list_sinks_config
2359
- get_sink_config = parent_rpcs&.get_sink if parent_rpcs&.respond_to? :get_sink
2365
+ get_sink_config = parent_rpcs.get_sink if parent_rpcs.respond_to? :get_sink
2360
2366
  @get_sink = ::Gapic::Config::Method.new get_sink_config
2361
- create_sink_config = parent_rpcs&.create_sink if parent_rpcs&.respond_to? :create_sink
2367
+ create_sink_config = parent_rpcs.create_sink if parent_rpcs.respond_to? :create_sink
2362
2368
  @create_sink = ::Gapic::Config::Method.new create_sink_config
2363
- update_sink_config = parent_rpcs&.update_sink if parent_rpcs&.respond_to? :update_sink
2369
+ update_sink_config = parent_rpcs.update_sink if parent_rpcs.respond_to? :update_sink
2364
2370
  @update_sink = ::Gapic::Config::Method.new update_sink_config
2365
- delete_sink_config = parent_rpcs&.delete_sink if parent_rpcs&.respond_to? :delete_sink
2371
+ delete_sink_config = parent_rpcs.delete_sink if parent_rpcs.respond_to? :delete_sink
2366
2372
  @delete_sink = ::Gapic::Config::Method.new delete_sink_config
2367
- list_exclusions_config = parent_rpcs&.list_exclusions if parent_rpcs&.respond_to? :list_exclusions
2373
+ list_exclusions_config = parent_rpcs.list_exclusions if parent_rpcs.respond_to? :list_exclusions
2368
2374
  @list_exclusions = ::Gapic::Config::Method.new list_exclusions_config
2369
- get_exclusion_config = parent_rpcs&.get_exclusion if parent_rpcs&.respond_to? :get_exclusion
2375
+ get_exclusion_config = parent_rpcs.get_exclusion if parent_rpcs.respond_to? :get_exclusion
2370
2376
  @get_exclusion = ::Gapic::Config::Method.new get_exclusion_config
2371
- create_exclusion_config = parent_rpcs&.create_exclusion if parent_rpcs&.respond_to? :create_exclusion
2377
+ create_exclusion_config = parent_rpcs.create_exclusion if parent_rpcs.respond_to? :create_exclusion
2372
2378
  @create_exclusion = ::Gapic::Config::Method.new create_exclusion_config
2373
- update_exclusion_config = parent_rpcs&.update_exclusion if parent_rpcs&.respond_to? :update_exclusion
2379
+ update_exclusion_config = parent_rpcs.update_exclusion if parent_rpcs.respond_to? :update_exclusion
2374
2380
  @update_exclusion = ::Gapic::Config::Method.new update_exclusion_config
2375
- delete_exclusion_config = parent_rpcs&.delete_exclusion if parent_rpcs&.respond_to? :delete_exclusion
2381
+ delete_exclusion_config = parent_rpcs.delete_exclusion if parent_rpcs.respond_to? :delete_exclusion
2376
2382
  @delete_exclusion = ::Gapic::Config::Method.new delete_exclusion_config
2377
- get_cmek_settings_config = parent_rpcs&.get_cmek_settings if parent_rpcs&.respond_to? :get_cmek_settings
2383
+ get_cmek_settings_config = parent_rpcs.get_cmek_settings if parent_rpcs.respond_to? :get_cmek_settings
2378
2384
  @get_cmek_settings = ::Gapic::Config::Method.new get_cmek_settings_config
2379
- update_cmek_settings_config = parent_rpcs&.update_cmek_settings if parent_rpcs&.respond_to? :update_cmek_settings
2385
+ update_cmek_settings_config = parent_rpcs.update_cmek_settings if parent_rpcs.respond_to? :update_cmek_settings
2380
2386
  @update_cmek_settings = ::Gapic::Config::Method.new update_cmek_settings_config
2381
2387
 
2382
2388
  yield self if block_given?
@@ -89,13 +89,13 @@ module Google
89
89
  # @return [::String]
90
90
  def cmek_settings_path **args
91
91
  resources = {
92
- "project" => (proc do |project:|
92
+ "project" => (proc do |project:|
93
93
  "projects/#{project}/cmekSettings"
94
94
  end),
95
- "organization" => (proc do |organization:|
95
+ "organization" => (proc do |organization:|
96
96
  "organizations/#{organization}/cmekSettings"
97
97
  end),
98
- "folder" => (proc do |folder:|
98
+ "folder" => (proc do |folder:|
99
99
  "folders/#{folder}/cmekSettings"
100
100
  end),
101
101
  "billing_account" => (proc do |billing_account:|
@@ -198,19 +198,19 @@ module Google
198
198
  # @return [::String]
199
199
  def log_bucket_path **args
200
200
  resources = {
201
- "bucket:location:project" => (proc do |project:, location:, bucket:|
201
+ "bucket:location:project" => (proc do |project:, location:, bucket:|
202
202
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
203
203
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
204
204
 
205
205
  "projects/#{project}/locations/#{location}/buckets/#{bucket}"
206
206
  end),
207
- "bucket:location:organization" => (proc do |organization:, location:, bucket:|
207
+ "bucket:location:organization" => (proc do |organization:, location:, bucket:|
208
208
  raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
209
209
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
210
210
 
211
211
  "organizations/#{organization}/locations/#{location}/buckets/#{bucket}"
212
212
  end),
213
- "bucket:folder:location" => (proc do |folder:, location:, bucket:|
213
+ "bucket:folder:location" => (proc do |folder:, location:, bucket:|
214
214
  raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
215
215
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
216
216
 
@@ -267,17 +267,17 @@ module Google
267
267
  # @return [::String]
268
268
  def log_exclusion_path **args
269
269
  resources = {
270
- "exclusion:project" => (proc do |project:, exclusion:|
270
+ "exclusion:project" => (proc do |project:, exclusion:|
271
271
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
272
272
 
273
273
  "projects/#{project}/exclusions/#{exclusion}"
274
274
  end),
275
- "exclusion:organization" => (proc do |organization:, exclusion:|
275
+ "exclusion:organization" => (proc do |organization:, exclusion:|
276
276
  raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
277
277
 
278
278
  "organizations/#{organization}/exclusions/#{exclusion}"
279
279
  end),
280
- "exclusion:folder" => (proc do |folder:, exclusion:|
280
+ "exclusion:folder" => (proc do |folder:, exclusion:|
281
281
  raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
282
282
 
283
283
  "folders/#{folder}/exclusions/#{exclusion}"
@@ -332,17 +332,17 @@ module Google
332
332
  # @return [::String]
333
333
  def log_sink_path **args
334
334
  resources = {
335
- "project:sink" => (proc do |project:, sink:|
335
+ "project:sink" => (proc do |project:, sink:|
336
336
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
337
337
 
338
338
  "projects/#{project}/sinks/#{sink}"
339
339
  end),
340
- "organization:sink" => (proc do |organization:, sink:|
340
+ "organization:sink" => (proc do |organization:, sink:|
341
341
  raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
342
342
 
343
343
  "organizations/#{organization}/sinks/#{sink}"
344
344
  end),
345
- "folder:sink" => (proc do |folder:, sink:|
345
+ "folder:sink" => (proc do |folder:, sink:|
346
346
  raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
347
347
 
348
348
  "folders/#{folder}/sinks/#{sink}"
@@ -405,21 +405,21 @@ module Google
405
405
  # @return [::String]
406
406
  def log_view_path **args
407
407
  resources = {
408
- "bucket:location:project:view" => (proc do |project:, location:, bucket:, view:|
408
+ "bucket:location:project:view" => (proc do |project:, location:, bucket:, view:|
409
409
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
410
410
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
411
411
  raise ::ArgumentError, "bucket cannot contain /" if bucket.to_s.include? "/"
412
412
 
413
413
  "projects/#{project}/locations/#{location}/buckets/#{bucket}/views/#{view}"
414
414
  end),
415
- "bucket:location:organization:view" => (proc do |organization:, location:, bucket:, view:|
415
+ "bucket:location:organization:view" => (proc do |organization:, location:, bucket:, view:|
416
416
  raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
417
417
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
418
418
  raise ::ArgumentError, "bucket cannot contain /" if bucket.to_s.include? "/"
419
419
 
420
420
  "organizations/#{organization}/locations/#{location}/buckets/#{bucket}/views/#{view}"
421
421
  end),
422
- "bucket:folder:location:view" => (proc do |folder:, location:, bucket:, view:|
422
+ "bucket:folder:location:view" => (proc do |folder:, location:, bucket:, view:|
423
423
  raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
424
424
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
425
425
  raise ::ArgumentError, "bucket cannot contain /" if bucket.to_s.include? "/"
@@ -60,7 +60,7 @@ module Google
60
60
  parent_config = while namespace.any?
61
61
  parent_name = namespace.join "::"
62
62
  parent_const = const_get parent_name
63
- break parent_const.configure if parent_const&.respond_to? :configure
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
64
  namespace.pop
65
65
  end
66
66
  default_config = Client::Configuration.new parent_config
@@ -68,41 +68,49 @@ module Google
68
68
  default_config.rpcs.delete_log.timeout = 60.0
69
69
  default_config.rpcs.delete_log.retry_policy = {
70
70
  initial_delay: 0.1,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: [4, 13, 14]
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [4, 13, 14]
74
74
  }
75
75
 
76
76
  default_config.rpcs.write_log_entries.timeout = 60.0
77
77
  default_config.rpcs.write_log_entries.retry_policy = {
78
78
  initial_delay: 0.1,
79
- max_delay: 60.0,
80
- multiplier: 1.3,
81
- retry_codes: [4, 13, 14]
79
+ max_delay: 60.0,
80
+ multiplier: 1.3,
81
+ retry_codes: [4, 13, 14]
82
82
  }
83
83
 
84
84
  default_config.rpcs.list_log_entries.timeout = 60.0
85
85
  default_config.rpcs.list_log_entries.retry_policy = {
86
86
  initial_delay: 0.1,
87
- max_delay: 60.0,
88
- multiplier: 1.3,
89
- retry_codes: [4, 13, 14]
87
+ max_delay: 60.0,
88
+ multiplier: 1.3,
89
+ retry_codes: [4, 13, 14]
90
90
  }
91
91
 
92
92
  default_config.rpcs.list_monitored_resource_descriptors.timeout = 60.0
93
93
  default_config.rpcs.list_monitored_resource_descriptors.retry_policy = {
94
94
  initial_delay: 0.1,
95
- max_delay: 60.0,
96
- multiplier: 1.3,
97
- retry_codes: [4, 13, 14]
95
+ max_delay: 60.0,
96
+ multiplier: 1.3,
97
+ retry_codes: [4, 13, 14]
98
98
  }
99
99
 
100
100
  default_config.rpcs.list_logs.timeout = 60.0
101
101
  default_config.rpcs.list_logs.retry_policy = {
102
102
  initial_delay: 0.1,
103
- max_delay: 60.0,
104
- multiplier: 1.3,
105
- retry_codes: [4, 13, 14]
103
+ max_delay: 60.0,
104
+ multiplier: 1.3,
105
+ retry_codes: [4, 13, 14]
106
+ }
107
+
108
+ default_config.rpcs.tail_log_entries.timeout = 3600.0
109
+ default_config.rpcs.tail_log_entries.retry_policy = {
110
+ initial_delay: 0.1,
111
+ max_delay: 60.0,
112
+ multiplier: 1.3,
113
+ retry_codes: [4, 13, 14]
106
114
  }
107
115
 
108
116
  default_config
@@ -166,7 +174,13 @@ module Google
166
174
 
167
175
  # Create credentials
168
176
  credentials = @config.credentials
169
- credentials ||= Credentials.default scope: @config.scope
177
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
178
+ # but only if the default endpoint does not have a region prefix.
179
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
180
+ @config.endpoint == Client.configure.endpoint &&
181
+ !@config.endpoint.split(".").first.include?("-")
182
+ credentials ||= Credentials.default scope: @config.scope,
183
+ enable_self_signed_jwt: enable_self_signed_jwt
170
184
  if credentials.is_a?(String) || credentials.is_a?(Hash)
171
185
  credentials = Credentials.new credentials, scope: @config.scope
172
186
  end
@@ -425,6 +439,11 @@ module Google
425
439
  # "billingAccounts/[BILLING_ACCOUNT_ID]"
426
440
  # "folders/[FOLDER_ID]"
427
441
  #
442
+ # May alternatively be one or more views
443
+ # projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
444
+ # organization/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
445
+ # billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
446
+ # folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
428
447
  #
429
448
  # Projects listed in the `project_ids` field are added to this list.
430
449
  # @param filter [::String]
@@ -575,7 +594,7 @@ module Google
575
594
  # @param options [::Gapic::CallOptions, ::Hash]
576
595
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
577
596
  #
578
- # @overload list_logs(parent: nil, page_size: nil, page_token: nil)
597
+ # @overload list_logs(parent: nil, page_size: nil, page_token: nil, resource_names: nil)
579
598
  # Pass arguments to `list_logs` via keyword arguments. Note that at
580
599
  # least one keyword argument is required. To specify no parameters, or to keep all
581
600
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -596,6 +615,18 @@ module Google
596
615
  # preceding call to this method. `pageToken` must be the value of
597
616
  # `nextPageToken` from the previous response. The values of other method
598
617
  # parameters should be identical to those in the previous call.
618
+ # @param resource_names [::Array<::String>]
619
+ # Optional. The resource name that owns the logs:
620
+ # projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
621
+ # organization/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
622
+ # billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
623
+ # folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
624
+ #
625
+ # To support legacy queries, it could also be:
626
+ # "projects/[PROJECT_ID]"
627
+ # "organizations/[ORGANIZATION_ID]"
628
+ # "billingAccounts/[BILLING_ACCOUNT_ID]"
629
+ # "folders/[FOLDER_ID]"
599
630
  #
600
631
  # @yield [response, operation] Access the result along with the RPC operation
601
632
  # @yieldparam response [::Google::Cloud::Logging::V2::ListLogsResponse]
@@ -642,6 +673,59 @@ module Google
642
673
  raise ::Google::Cloud::Error.from_error(e)
643
674
  end
644
675
 
676
+ ##
677
+ # Streaming read of log entries as they are ingested. Until the stream is
678
+ # terminated, it will continue reading logs.
679
+ #
680
+ # @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Logging::V2::TailLogEntriesRequest, ::Hash>]
681
+ # An enumerable of {::Google::Cloud::Logging::V2::TailLogEntriesRequest} instances.
682
+ # @param options [::Gapic::CallOptions, ::Hash]
683
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
684
+ #
685
+ # @yield [response, operation] Access the result along with the RPC operation
686
+ # @yieldparam response [::Enumerable<::Google::Cloud::Logging::V2::TailLogEntriesResponse>]
687
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
688
+ #
689
+ # @return [::Enumerable<::Google::Cloud::Logging::V2::TailLogEntriesResponse>]
690
+ #
691
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
692
+ #
693
+ def tail_log_entries request, options = nil
694
+ unless request.is_a? ::Enumerable
695
+ raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
696
+ request = request.to_enum
697
+ end
698
+
699
+ request = request.lazy.map do |req|
700
+ ::Gapic::Protobuf.coerce req, to: ::Google::Cloud::Logging::V2::TailLogEntriesRequest
701
+ end
702
+
703
+ # Converts hash and nil to an options object
704
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
705
+
706
+ # Customize the options with defaults
707
+ metadata = @config.rpcs.tail_log_entries.metadata.to_h
708
+
709
+ # Set x-goog-api-client and x-goog-user-project headers
710
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
711
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
712
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
713
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
714
+
715
+ options.apply_defaults timeout: @config.rpcs.tail_log_entries.timeout,
716
+ metadata: metadata,
717
+ retry_policy: @config.rpcs.tail_log_entries.retry_policy
718
+ options.apply_defaults metadata: @config.metadata,
719
+ retry_policy: @config.retry_policy
720
+
721
+ @logging_service_stub.call_rpc :tail_log_entries, request, options: options do |response, operation|
722
+ yield response, operation if block_given?
723
+ return response
724
+ end
725
+ rescue ::GRPC::BadStatus => e
726
+ raise ::Google::Cloud::Error.from_error(e)
727
+ end
728
+
645
729
  ##
646
730
  # Configuration class for the LoggingService API.
647
731
  #
@@ -734,7 +818,7 @@ module Google
734
818
  config_attr :scope, nil, ::String, ::Array, nil
735
819
  config_attr :lib_name, nil, ::String, nil
736
820
  config_attr :lib_version, nil, ::String, nil
737
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
821
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
738
822
  config_attr :interceptors, nil, ::Array, nil
739
823
  config_attr :timeout, nil, ::Numeric, nil
740
824
  config_attr :metadata, nil, ::Hash, nil
@@ -755,7 +839,7 @@ module Google
755
839
  def rpcs
756
840
  @rpcs ||= begin
757
841
  parent_rpcs = nil
758
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
842
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
759
843
  Rpcs.new parent_rpcs
760
844
  end
761
845
  end
@@ -767,7 +851,7 @@ module Google
767
851
  # Each configuration object is of type `Gapic::Config::Method` and includes
768
852
  # the following configuration fields:
769
853
  #
770
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
854
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
771
855
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
772
856
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
773
857
  # include the following keys:
@@ -803,19 +887,26 @@ module Google
803
887
  # @return [::Gapic::Config::Method]
804
888
  #
805
889
  attr_reader :list_logs
890
+ ##
891
+ # RPC-specific configuration for `tail_log_entries`
892
+ # @return [::Gapic::Config::Method]
893
+ #
894
+ attr_reader :tail_log_entries
806
895
 
807
896
  # @private
808
897
  def initialize parent_rpcs = nil
809
- delete_log_config = parent_rpcs&.delete_log if parent_rpcs&.respond_to? :delete_log
898
+ delete_log_config = parent_rpcs.delete_log if parent_rpcs.respond_to? :delete_log
810
899
  @delete_log = ::Gapic::Config::Method.new delete_log_config
811
- write_log_entries_config = parent_rpcs&.write_log_entries if parent_rpcs&.respond_to? :write_log_entries
900
+ write_log_entries_config = parent_rpcs.write_log_entries if parent_rpcs.respond_to? :write_log_entries
812
901
  @write_log_entries = ::Gapic::Config::Method.new write_log_entries_config
813
- list_log_entries_config = parent_rpcs&.list_log_entries if parent_rpcs&.respond_to? :list_log_entries
902
+ list_log_entries_config = parent_rpcs.list_log_entries if parent_rpcs.respond_to? :list_log_entries
814
903
  @list_log_entries = ::Gapic::Config::Method.new list_log_entries_config
815
- list_monitored_resource_descriptors_config = parent_rpcs&.list_monitored_resource_descriptors if parent_rpcs&.respond_to? :list_monitored_resource_descriptors
904
+ list_monitored_resource_descriptors_config = parent_rpcs.list_monitored_resource_descriptors if parent_rpcs.respond_to? :list_monitored_resource_descriptors
816
905
  @list_monitored_resource_descriptors = ::Gapic::Config::Method.new list_monitored_resource_descriptors_config
817
- list_logs_config = parent_rpcs&.list_logs if parent_rpcs&.respond_to? :list_logs
906
+ list_logs_config = parent_rpcs.list_logs if parent_rpcs.respond_to? :list_logs
818
907
  @list_logs = ::Gapic::Config::Method.new list_logs_config
908
+ tail_log_entries_config = parent_rpcs.tail_log_entries if parent_rpcs.respond_to? :tail_log_entries
909
+ @tail_log_entries = ::Gapic::Config::Method.new tail_log_entries_config
819
910
 
820
911
  yield self if block_given?
821
912
  end