google-cloud-logging-v2 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::Logging::V2::MetricsService::Client::Configuration}
42
42
  # for a description of the configuration fields.
43
43
  #
44
- # ## Example
44
+ # @example
45
45
  #
46
- # To modify the configuration for all MetricsService clients:
47
- #
48
- # ::Google::Cloud::Logging::V2::MetricsService::Client.configure do |config|
49
- # config.timeout = 10.0
50
- # end
46
+ # # Modify the configuration for all MetricsService clients
47
+ # ::Google::Cloud::Logging::V2::MetricsService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
51
50
  #
52
51
  # @yield [config] Configure the Client client.
53
52
  # @yieldparam config [Client::Configuration]
@@ -116,19 +115,15 @@ module Google
116
115
  ##
117
116
  # Create a new MetricsService client object.
118
117
  #
119
- # ## Examples
120
- #
121
- # To create a new MetricsService client with the default
122
- # configuration:
123
- #
124
- # client = ::Google::Cloud::Logging::V2::MetricsService::Client.new
118
+ # @example
125
119
  #
126
- # To create a new MetricsService client with a custom
127
- # configuration:
120
+ # # Create a client using the default configuration
121
+ # client = ::Google::Cloud::Logging::V2::MetricsService::Client.new
128
122
  #
129
- # client = ::Google::Cloud::Logging::V2::MetricsService::Client.new do |config|
130
- # config.timeout = 10.0
131
- # end
123
+ # # Create a client using a custom configuration
124
+ # client = ::Google::Cloud::Logging::V2::MetricsService::Client.new do |config|
125
+ # config.timeout = 10.0
126
+ # end
132
127
  #
133
128
  # @yield [config] Configure the MetricsService client.
134
129
  # @yieldparam config [Client::Configuration]
@@ -148,10 +143,9 @@ module Google
148
143
 
149
144
  # Create credentials
150
145
  credentials = @config.credentials
151
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
146
+ # Use self-signed JWT if the endpoint is unchanged from default,
152
147
  # but only if the default endpoint does not have a region prefix.
153
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
154
- @config.endpoint == Client.configure.endpoint &&
148
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
155
149
  !@config.endpoint.split(".").first.include?("-")
156
150
  credentials ||= Credentials.default scope: @config.scope,
157
151
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -212,6 +206,27 @@ module Google
212
206
  #
213
207
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
214
208
  #
209
+ # @example Basic example
210
+ # require "google/cloud/logging/v2"
211
+ #
212
+ # # Create a client object. The client can be reused for multiple calls.
213
+ # client = Google::Cloud::Logging::V2::MetricsService::Client.new
214
+ #
215
+ # # Create a request. To set request fields, pass in keyword arguments.
216
+ # request = Google::Cloud::Logging::V2::ListLogMetricsRequest.new
217
+ #
218
+ # # Call the list_log_metrics method.
219
+ # result = client.list_log_metrics request
220
+ #
221
+ # # The returned object is of type Gapic::PagedEnumerable. You can
222
+ # # iterate over all elements by calling #each, and the enumerable
223
+ # # will lazily make API calls to fetch subsequent pages. Other
224
+ # # methods are also available for managing paging directly.
225
+ # result.each do |response|
226
+ # # Each element is of type ::Google::Cloud::Logging::V2::LogMetric.
227
+ # p response
228
+ # end
229
+ #
215
230
  def list_log_metrics request, options = nil
216
231
  raise ::ArgumentError, "request must be provided" if request.nil?
217
232
 
@@ -229,16 +244,20 @@ module Google
229
244
  gapic_version: ::Google::Cloud::Logging::V2::VERSION
230
245
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
231
246
 
232
- header_params = {
233
- "parent" => request.parent
234
- }
247
+ header_params = {}
248
+ if request.parent
249
+ header_params["parent"] = request.parent
250
+ end
251
+
235
252
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
236
253
  metadata[:"x-goog-request-params"] ||= request_params_header
237
254
 
238
255
  options.apply_defaults timeout: @config.rpcs.list_log_metrics.timeout,
239
256
  metadata: metadata,
240
257
  retry_policy: @config.rpcs.list_log_metrics.retry_policy
241
- options.apply_defaults metadata: @config.metadata,
258
+
259
+ options.apply_defaults timeout: @config.timeout,
260
+ metadata: @config.metadata,
242
261
  retry_policy: @config.retry_policy
243
262
 
244
263
  @metrics_service_stub.call_rpc :list_log_metrics, request, options: options do |response, operation|
@@ -281,6 +300,21 @@ module Google
281
300
  #
282
301
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
283
302
  #
303
+ # @example Basic example
304
+ # require "google/cloud/logging/v2"
305
+ #
306
+ # # Create a client object. The client can be reused for multiple calls.
307
+ # client = Google::Cloud::Logging::V2::MetricsService::Client.new
308
+ #
309
+ # # Create a request. To set request fields, pass in keyword arguments.
310
+ # request = Google::Cloud::Logging::V2::GetLogMetricRequest.new
311
+ #
312
+ # # Call the get_log_metric method.
313
+ # result = client.get_log_metric request
314
+ #
315
+ # # The returned object is of type Google::Cloud::Logging::V2::LogMetric.
316
+ # p result
317
+ #
284
318
  def get_log_metric request, options = nil
285
319
  raise ::ArgumentError, "request must be provided" if request.nil?
286
320
 
@@ -298,16 +332,20 @@ module Google
298
332
  gapic_version: ::Google::Cloud::Logging::V2::VERSION
299
333
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
300
334
 
301
- header_params = {
302
- "metric_name" => request.metric_name
303
- }
335
+ header_params = {}
336
+ if request.metric_name
337
+ header_params["metric_name"] = request.metric_name
338
+ end
339
+
304
340
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
305
341
  metadata[:"x-goog-request-params"] ||= request_params_header
306
342
 
307
343
  options.apply_defaults timeout: @config.rpcs.get_log_metric.timeout,
308
344
  metadata: metadata,
309
345
  retry_policy: @config.rpcs.get_log_metric.retry_policy
310
- options.apply_defaults metadata: @config.metadata,
346
+
347
+ options.apply_defaults timeout: @config.timeout,
348
+ metadata: @config.metadata,
311
349
  retry_policy: @config.retry_policy
312
350
 
313
351
  @metrics_service_stub.call_rpc :get_log_metric, request, options: options do |response, operation|
@@ -354,6 +392,21 @@ module Google
354
392
  #
355
393
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
356
394
  #
395
+ # @example Basic example
396
+ # require "google/cloud/logging/v2"
397
+ #
398
+ # # Create a client object. The client can be reused for multiple calls.
399
+ # client = Google::Cloud::Logging::V2::MetricsService::Client.new
400
+ #
401
+ # # Create a request. To set request fields, pass in keyword arguments.
402
+ # request = Google::Cloud::Logging::V2::CreateLogMetricRequest.new
403
+ #
404
+ # # Call the create_log_metric method.
405
+ # result = client.create_log_metric request
406
+ #
407
+ # # The returned object is of type Google::Cloud::Logging::V2::LogMetric.
408
+ # p result
409
+ #
357
410
  def create_log_metric request, options = nil
358
411
  raise ::ArgumentError, "request must be provided" if request.nil?
359
412
 
@@ -371,16 +424,20 @@ module Google
371
424
  gapic_version: ::Google::Cloud::Logging::V2::VERSION
372
425
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
373
426
 
374
- header_params = {
375
- "parent" => request.parent
376
- }
427
+ header_params = {}
428
+ if request.parent
429
+ header_params["parent"] = request.parent
430
+ end
431
+
377
432
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
378
433
  metadata[:"x-goog-request-params"] ||= request_params_header
379
434
 
380
435
  options.apply_defaults timeout: @config.rpcs.create_log_metric.timeout,
381
436
  metadata: metadata,
382
437
  retry_policy: @config.rpcs.create_log_metric.retry_policy
383
- options.apply_defaults metadata: @config.metadata,
438
+
439
+ options.apply_defaults timeout: @config.timeout,
440
+ metadata: @config.metadata,
384
441
  retry_policy: @config.retry_policy
385
442
 
386
443
  @metrics_service_stub.call_rpc :create_log_metric, request, options: options do |response, operation|
@@ -428,6 +485,21 @@ module Google
428
485
  #
429
486
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
430
487
  #
488
+ # @example Basic example
489
+ # require "google/cloud/logging/v2"
490
+ #
491
+ # # Create a client object. The client can be reused for multiple calls.
492
+ # client = Google::Cloud::Logging::V2::MetricsService::Client.new
493
+ #
494
+ # # Create a request. To set request fields, pass in keyword arguments.
495
+ # request = Google::Cloud::Logging::V2::UpdateLogMetricRequest.new
496
+ #
497
+ # # Call the update_log_metric method.
498
+ # result = client.update_log_metric request
499
+ #
500
+ # # The returned object is of type Google::Cloud::Logging::V2::LogMetric.
501
+ # p result
502
+ #
431
503
  def update_log_metric request, options = nil
432
504
  raise ::ArgumentError, "request must be provided" if request.nil?
433
505
 
@@ -445,16 +517,20 @@ module Google
445
517
  gapic_version: ::Google::Cloud::Logging::V2::VERSION
446
518
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
447
519
 
448
- header_params = {
449
- "metric_name" => request.metric_name
450
- }
520
+ header_params = {}
521
+ if request.metric_name
522
+ header_params["metric_name"] = request.metric_name
523
+ end
524
+
451
525
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
452
526
  metadata[:"x-goog-request-params"] ||= request_params_header
453
527
 
454
528
  options.apply_defaults timeout: @config.rpcs.update_log_metric.timeout,
455
529
  metadata: metadata,
456
530
  retry_policy: @config.rpcs.update_log_metric.retry_policy
457
- options.apply_defaults metadata: @config.metadata,
531
+
532
+ options.apply_defaults timeout: @config.timeout,
533
+ metadata: @config.metadata,
458
534
  retry_policy: @config.retry_policy
459
535
 
460
536
  @metrics_service_stub.call_rpc :update_log_metric, request, options: options do |response, operation|
@@ -496,6 +572,21 @@ module Google
496
572
  #
497
573
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
498
574
  #
575
+ # @example Basic example
576
+ # require "google/cloud/logging/v2"
577
+ #
578
+ # # Create a client object. The client can be reused for multiple calls.
579
+ # client = Google::Cloud::Logging::V2::MetricsService::Client.new
580
+ #
581
+ # # Create a request. To set request fields, pass in keyword arguments.
582
+ # request = Google::Cloud::Logging::V2::DeleteLogMetricRequest.new
583
+ #
584
+ # # Call the delete_log_metric method.
585
+ # result = client.delete_log_metric request
586
+ #
587
+ # # The returned object is of type Google::Protobuf::Empty.
588
+ # p result
589
+ #
499
590
  def delete_log_metric request, options = nil
500
591
  raise ::ArgumentError, "request must be provided" if request.nil?
501
592
 
@@ -513,16 +604,20 @@ module Google
513
604
  gapic_version: ::Google::Cloud::Logging::V2::VERSION
514
605
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
515
606
 
516
- header_params = {
517
- "metric_name" => request.metric_name
518
- }
607
+ header_params = {}
608
+ if request.metric_name
609
+ header_params["metric_name"] = request.metric_name
610
+ end
611
+
519
612
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
520
613
  metadata[:"x-goog-request-params"] ||= request_params_header
521
614
 
522
615
  options.apply_defaults timeout: @config.rpcs.delete_log_metric.timeout,
523
616
  metadata: metadata,
524
617
  retry_policy: @config.rpcs.delete_log_metric.retry_policy
525
- options.apply_defaults metadata: @config.metadata,
618
+
619
+ options.apply_defaults timeout: @config.timeout,
620
+ metadata: @config.metadata,
526
621
  retry_policy: @config.retry_policy
527
622
 
528
623
  @metrics_service_stub.call_rpc :delete_log_metric, request, options: options do |response, operation|
@@ -546,22 +641,21 @@ module Google
546
641
  # Configuration can be applied globally to all clients, or to a single client
547
642
  # on construction.
548
643
  #
549
- # # Examples
550
- #
551
- # To modify the global config, setting the timeout for list_log_metrics
552
- # to 20 seconds, and all remaining timeouts to 10 seconds:
553
- #
554
- # ::Google::Cloud::Logging::V2::MetricsService::Client.configure do |config|
555
- # config.timeout = 10.0
556
- # config.rpcs.list_log_metrics.timeout = 20.0
557
- # end
558
- #
559
- # To apply the above configuration only to a new client:
560
- #
561
- # client = ::Google::Cloud::Logging::V2::MetricsService::Client.new do |config|
562
- # config.timeout = 10.0
563
- # config.rpcs.list_log_metrics.timeout = 20.0
564
- # end
644
+ # @example
645
+ #
646
+ # # Modify the global config, setting the timeout for
647
+ # # list_log_metrics to 20 seconds,
648
+ # # and all remaining timeouts to 10 seconds.
649
+ # ::Google::Cloud::Logging::V2::MetricsService::Client.configure do |config|
650
+ # config.timeout = 10.0
651
+ # config.rpcs.list_log_metrics.timeout = 20.0
652
+ # end
653
+ #
654
+ # # Apply the above configuration only to a new client.
655
+ # client = ::Google::Cloud::Logging::V2::MetricsService::Client.new do |config|
656
+ # config.timeout = 10.0
657
+ # config.rpcs.list_log_metrics.timeout = 20.0
658
+ # end
565
659
  #
566
660
  # @!attribute [rw] endpoint
567
661
  # The hostname or hostname:port of the service endpoint.
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Logging
23
23
  module V2
24
- VERSION = "0.5.3"
24
+ VERSION = "0.6.0"
25
25
  end
26
26
  end
27
27
  end
@@ -1,8 +1,7 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/logging/v2/log_entry.proto
3
3
 
4
- require 'google/protobuf'
5
-
4
+ require 'google/api/annotations_pb'
6
5
  require 'google/api/field_behavior_pb'
7
6
  require 'google/api/monitored_resource_pb'
8
7
  require 'google/api/resource_pb'
@@ -11,8 +10,8 @@ require 'google/logging/type/log_severity_pb'
11
10
  require 'google/protobuf/any_pb'
12
11
  require 'google/protobuf/struct_pb'
13
12
  require 'google/protobuf/timestamp_pb'
14
- require 'google/rpc/status_pb'
15
- require 'google/api/annotations_pb'
13
+ require 'google/protobuf'
14
+
16
15
  Google::Protobuf::DescriptorPool.generated_pool.build do
17
16
  add_file("google/logging/v2/log_entry.proto", :syntax => :proto3) do
18
17
  add_message "google.logging.v2.LogEntry" do
@@ -29,6 +28,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
29
28
  optional :span_id, :string, 27
30
29
  optional :trace_sampled, :bool, 30
31
30
  optional :source_location, :message, 23, "google.logging.v2.LogEntrySourceLocation"
31
+ optional :split, :message, 35, "google.logging.v2.LogSplit"
32
32
  oneof :payload do
33
33
  optional :proto_payload, :message, 2, "google.protobuf.Any"
34
34
  optional :text_payload, :string, 3
@@ -46,6 +46,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
46
46
  optional :line, :int64, 2
47
47
  optional :function, :string, 3
48
48
  end
49
+ add_message "google.logging.v2.LogSplit" do
50
+ optional :uid, :string, 1
51
+ optional :index, :int32, 2
52
+ optional :total_splits, :int32, 3
53
+ end
49
54
  end
50
55
  end
51
56
 
@@ -56,6 +61,7 @@ module Google
56
61
  LogEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogEntry").msgclass
57
62
  LogEntryOperation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogEntryOperation").msgclass
58
63
  LogEntrySourceLocation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogEntrySourceLocation").msgclass
64
+ LogSplit = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogSplit").msgclass
59
65
  end
60
66
  end
61
67
  end
@@ -1,16 +1,17 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/logging/v2/logging_config.proto
3
3
 
4
- require 'google/protobuf'
5
-
4
+ require 'google/api/annotations_pb'
6
5
  require 'google/api/client_pb'
7
6
  require 'google/api/field_behavior_pb'
8
7
  require 'google/api/resource_pb'
8
+ require 'google/longrunning/operations_pb'
9
9
  require 'google/protobuf/duration_pb'
10
10
  require 'google/protobuf/empty_pb'
11
11
  require 'google/protobuf/field_mask_pb'
12
12
  require 'google/protobuf/timestamp_pb'
13
- require 'google/api/annotations_pb'
13
+ require 'google/protobuf'
14
+
14
15
  Google::Protobuf::DescriptorPool.generated_pool.build do
15
16
  add_file("google/logging/v2/logging_config.proto", :syntax => :proto3) do
16
17
  add_message "google.logging.v2.LogBucket" do
@@ -21,6 +22,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
21
22
  optional :retention_days, :int32, 11
22
23
  optional :locked, :bool, 9
23
24
  optional :lifecycle_state, :enum, 12, "google.logging.v2.LifecycleState"
25
+ repeated :restricted_fields, :string, 15
26
+ optional :cmek_settings, :message, 19, "google.logging.v2.CmekSettings"
24
27
  end
25
28
  add_message "google.logging.v2.LogView" do
26
29
  optional :name, :string, 1
@@ -178,11 +181,50 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
178
181
  optional :kms_key_name, :string, 2
179
182
  optional :service_account_id, :string, 3
180
183
  end
184
+ add_message "google.logging.v2.GetSettingsRequest" do
185
+ optional :name, :string, 1
186
+ end
187
+ add_message "google.logging.v2.UpdateSettingsRequest" do
188
+ optional :name, :string, 1
189
+ optional :settings, :message, 2, "google.logging.v2.Settings"
190
+ optional :update_mask, :message, 3, "google.protobuf.FieldMask"
191
+ end
192
+ add_message "google.logging.v2.Settings" do
193
+ optional :name, :string, 1
194
+ optional :storage_location, :string, 4
195
+ optional :disable_default_sink, :bool, 5
196
+ end
197
+ add_message "google.logging.v2.CopyLogEntriesRequest" do
198
+ optional :name, :string, 1
199
+ optional :filter, :string, 3
200
+ optional :destination, :string, 4
201
+ end
202
+ add_message "google.logging.v2.CopyLogEntriesMetadata" do
203
+ optional :start_time, :message, 1, "google.protobuf.Timestamp"
204
+ optional :end_time, :message, 2, "google.protobuf.Timestamp"
205
+ optional :state, :enum, 3, "google.logging.v2.OperationState"
206
+ optional :cancellation_requested, :bool, 4
207
+ optional :request, :message, 5, "google.logging.v2.CopyLogEntriesRequest"
208
+ optional :progress, :int32, 6
209
+ optional :writer_identity, :string, 7
210
+ end
211
+ add_message "google.logging.v2.CopyLogEntriesResponse" do
212
+ optional :log_entries_copied_count, :int64, 1
213
+ end
181
214
  add_enum "google.logging.v2.LifecycleState" do
182
215
  value :LIFECYCLE_STATE_UNSPECIFIED, 0
183
216
  value :ACTIVE, 1
184
217
  value :DELETE_REQUESTED, 2
185
218
  end
219
+ add_enum "google.logging.v2.OperationState" do
220
+ value :OPERATION_STATE_UNSPECIFIED, 0
221
+ value :OPERATION_STATE_SCHEDULED, 1
222
+ value :OPERATION_STATE_WAITING_FOR_PERMISSIONS, 2
223
+ value :OPERATION_STATE_RUNNING, 3
224
+ value :OPERATION_STATE_SUCCEEDED, 4
225
+ value :OPERATION_STATE_FAILED, 5
226
+ value :OPERATION_STATE_CANCELLED, 6
227
+ end
186
228
  end
187
229
  end
188
230
 
@@ -224,7 +266,14 @@ module Google
224
266
  GetCmekSettingsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.GetCmekSettingsRequest").msgclass
225
267
  UpdateCmekSettingsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.UpdateCmekSettingsRequest").msgclass
226
268
  CmekSettings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.CmekSettings").msgclass
269
+ GetSettingsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.GetSettingsRequest").msgclass
270
+ UpdateSettingsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.UpdateSettingsRequest").msgclass
271
+ Settings = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.Settings").msgclass
272
+ CopyLogEntriesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.CopyLogEntriesRequest").msgclass
273
+ CopyLogEntriesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.CopyLogEntriesMetadata").msgclass
274
+ CopyLogEntriesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.CopyLogEntriesResponse").msgclass
227
275
  LifecycleState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LifecycleState").enummodule
276
+ OperationState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.OperationState").enummodule
228
277
  end
229
278
  end
230
279
  end