google-cloud-logging-v2 0.5.2 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/AUTHENTICATION.md +10 -28
- data/lib/google/cloud/logging/v2/config_service/client.rb +582 -128
- data/lib/google/cloud/logging/v2/logging_service/client.rb +168 -48
- data/lib/google/cloud/logging/v2/metrics_service/client.rb +150 -56
- data/lib/google/cloud/logging/v2/version.rb +1 -1
- data/lib/google/logging/v2/log_entry_pb.rb +2 -2
- data/lib/google/logging/v2/logging_config_pb.rb +2 -2
- data/lib/google/logging/v2/logging_config_services_pb.rb +1 -1
- data/lib/google/logging/v2/logging_metrics_pb.rb +2 -2
- data/lib/google/logging/v2/logging_metrics_services_pb.rb +1 -1
- data/lib/google/logging/v2/logging_pb.rb +2 -2
- data/lib/google/logging/v2/logging_services_pb.rb +1 -1
- data/proto_docs/google/api/resource.rb +10 -71
- metadata +5 -5
@@ -41,13 +41,12 @@ module Google
|
|
41
41
|
# See {::Google::Cloud::Logging::V2::LoggingService::Client::Configuration}
|
42
42
|
# for a description of the configuration fields.
|
43
43
|
#
|
44
|
-
#
|
44
|
+
# @example
|
45
45
|
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# end
|
46
|
+
# # Modify the configuration for all LoggingService clients
|
47
|
+
# ::Google::Cloud::Logging::V2::LoggingService::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]
|
@@ -124,19 +123,15 @@ module Google
|
|
124
123
|
##
|
125
124
|
# Create a new LoggingService client object.
|
126
125
|
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
# To create a new LoggingService client with the default
|
130
|
-
# configuration:
|
131
|
-
#
|
132
|
-
# client = ::Google::Cloud::Logging::V2::LoggingService::Client.new
|
126
|
+
# @example
|
133
127
|
#
|
134
|
-
#
|
135
|
-
#
|
128
|
+
# # Create a client using the default configuration
|
129
|
+
# client = ::Google::Cloud::Logging::V2::LoggingService::Client.new
|
136
130
|
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
131
|
+
# # Create a client using a custom configuration
|
132
|
+
# client = ::Google::Cloud::Logging::V2::LoggingService::Client.new do |config|
|
133
|
+
# config.timeout = 10.0
|
134
|
+
# end
|
140
135
|
#
|
141
136
|
# @yield [config] Configure the LoggingService client.
|
142
137
|
# @yieldparam config [Client::Configuration]
|
@@ -156,10 +151,9 @@ module Google
|
|
156
151
|
|
157
152
|
# Create credentials
|
158
153
|
credentials = @config.credentials
|
159
|
-
# Use self-signed JWT if the
|
154
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
160
155
|
# but only if the default endpoint does not have a region prefix.
|
161
|
-
enable_self_signed_jwt = @config.
|
162
|
-
@config.endpoint == Client.configure.endpoint &&
|
156
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
163
157
|
!@config.endpoint.split(".").first.include?("-")
|
164
158
|
credentials ||= Credentials.default scope: @config.scope,
|
165
159
|
enable_self_signed_jwt: enable_self_signed_jwt
|
@@ -223,6 +217,21 @@ module Google
|
|
223
217
|
#
|
224
218
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
225
219
|
#
|
220
|
+
# @example Basic example
|
221
|
+
# require "google/cloud/logging/v2"
|
222
|
+
#
|
223
|
+
# # Create a client object. The client can be reused for multiple calls.
|
224
|
+
# client = Google::Cloud::Logging::V2::LoggingService::Client.new
|
225
|
+
#
|
226
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
227
|
+
# request = Google::Cloud::Logging::V2::DeleteLogRequest.new
|
228
|
+
#
|
229
|
+
# # Call the delete_log method.
|
230
|
+
# result = client.delete_log request
|
231
|
+
#
|
232
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
233
|
+
# p result
|
234
|
+
#
|
226
235
|
def delete_log request, options = nil
|
227
236
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
228
237
|
|
@@ -240,16 +249,20 @@ module Google
|
|
240
249
|
gapic_version: ::Google::Cloud::Logging::V2::VERSION
|
241
250
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
242
251
|
|
243
|
-
header_params = {
|
244
|
-
|
245
|
-
|
252
|
+
header_params = {}
|
253
|
+
if request.log_name
|
254
|
+
header_params["log_name"] = request.log_name
|
255
|
+
end
|
256
|
+
|
246
257
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
247
258
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
248
259
|
|
249
260
|
options.apply_defaults timeout: @config.rpcs.delete_log.timeout,
|
250
261
|
metadata: metadata,
|
251
262
|
retry_policy: @config.rpcs.delete_log.retry_policy
|
252
|
-
|
263
|
+
|
264
|
+
options.apply_defaults timeout: @config.timeout,
|
265
|
+
metadata: @config.metadata,
|
253
266
|
retry_policy: @config.retry_policy
|
254
267
|
|
255
268
|
@logging_service_stub.call_rpc :delete_log, request, options: options do |response, operation|
|
@@ -360,6 +373,21 @@ module Google
|
|
360
373
|
#
|
361
374
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
362
375
|
#
|
376
|
+
# @example Basic example
|
377
|
+
# require "google/cloud/logging/v2"
|
378
|
+
#
|
379
|
+
# # Create a client object. The client can be reused for multiple calls.
|
380
|
+
# client = Google::Cloud::Logging::V2::LoggingService::Client.new
|
381
|
+
#
|
382
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
383
|
+
# request = Google::Cloud::Logging::V2::WriteLogEntriesRequest.new
|
384
|
+
#
|
385
|
+
# # Call the write_log_entries method.
|
386
|
+
# result = client.write_log_entries request
|
387
|
+
#
|
388
|
+
# # The returned object is of type Google::Cloud::Logging::V2::WriteLogEntriesResponse.
|
389
|
+
# p result
|
390
|
+
#
|
363
391
|
def write_log_entries request, options = nil
|
364
392
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
365
393
|
|
@@ -380,7 +408,9 @@ module Google
|
|
380
408
|
options.apply_defaults timeout: @config.rpcs.write_log_entries.timeout,
|
381
409
|
metadata: metadata,
|
382
410
|
retry_policy: @config.rpcs.write_log_entries.retry_policy
|
383
|
-
|
411
|
+
|
412
|
+
options.apply_defaults timeout: @config.timeout,
|
413
|
+
metadata: @config.metadata,
|
384
414
|
retry_policy: @config.retry_policy
|
385
415
|
|
386
416
|
@logging_service_stub.call_rpc :write_log_entries, request, options: options do |response, operation|
|
@@ -462,6 +492,27 @@ module Google
|
|
462
492
|
#
|
463
493
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
464
494
|
#
|
495
|
+
# @example Basic example
|
496
|
+
# require "google/cloud/logging/v2"
|
497
|
+
#
|
498
|
+
# # Create a client object. The client can be reused for multiple calls.
|
499
|
+
# client = Google::Cloud::Logging::V2::LoggingService::Client.new
|
500
|
+
#
|
501
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
502
|
+
# request = Google::Cloud::Logging::V2::ListLogEntriesRequest.new
|
503
|
+
#
|
504
|
+
# # Call the list_log_entries method.
|
505
|
+
# result = client.list_log_entries request
|
506
|
+
#
|
507
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
508
|
+
# # iterate over all elements by calling #each, and the enumerable
|
509
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
510
|
+
# # methods are also available for managing paging directly.
|
511
|
+
# result.each do |response|
|
512
|
+
# # Each element is of type ::Google::Cloud::Logging::V2::LogEntry.
|
513
|
+
# p response
|
514
|
+
# end
|
515
|
+
#
|
465
516
|
def list_log_entries request, options = nil
|
466
517
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
467
518
|
|
@@ -482,7 +533,9 @@ module Google
|
|
482
533
|
options.apply_defaults timeout: @config.rpcs.list_log_entries.timeout,
|
483
534
|
metadata: metadata,
|
484
535
|
retry_policy: @config.rpcs.list_log_entries.retry_policy
|
485
|
-
|
536
|
+
|
537
|
+
options.apply_defaults timeout: @config.timeout,
|
538
|
+
metadata: @config.metadata,
|
486
539
|
retry_policy: @config.retry_policy
|
487
540
|
|
488
541
|
@logging_service_stub.call_rpc :list_log_entries, request, options: options do |response, operation|
|
@@ -530,6 +583,27 @@ module Google
|
|
530
583
|
#
|
531
584
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
532
585
|
#
|
586
|
+
# @example Basic example
|
587
|
+
# require "google/cloud/logging/v2"
|
588
|
+
#
|
589
|
+
# # Create a client object. The client can be reused for multiple calls.
|
590
|
+
# client = Google::Cloud::Logging::V2::LoggingService::Client.new
|
591
|
+
#
|
592
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
593
|
+
# request = Google::Cloud::Logging::V2::ListMonitoredResourceDescriptorsRequest.new
|
594
|
+
#
|
595
|
+
# # Call the list_monitored_resource_descriptors method.
|
596
|
+
# result = client.list_monitored_resource_descriptors request
|
597
|
+
#
|
598
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
599
|
+
# # iterate over all elements by calling #each, and the enumerable
|
600
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
601
|
+
# # methods are also available for managing paging directly.
|
602
|
+
# result.each do |response|
|
603
|
+
# # Each element is of type ::Google::Api::MonitoredResourceDescriptor.
|
604
|
+
# p response
|
605
|
+
# end
|
606
|
+
#
|
533
607
|
def list_monitored_resource_descriptors request, options = nil
|
534
608
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
535
609
|
|
@@ -550,7 +624,9 @@ module Google
|
|
550
624
|
options.apply_defaults timeout: @config.rpcs.list_monitored_resource_descriptors.timeout,
|
551
625
|
metadata: metadata,
|
552
626
|
retry_policy: @config.rpcs.list_monitored_resource_descriptors.retry_policy
|
553
|
-
|
627
|
+
|
628
|
+
options.apply_defaults timeout: @config.timeout,
|
629
|
+
metadata: @config.metadata,
|
554
630
|
retry_policy: @config.retry_policy
|
555
631
|
|
556
632
|
@logging_service_stub.call_rpc :list_monitored_resource_descriptors, request, options: options do |response, operation|
|
@@ -618,6 +694,21 @@ module Google
|
|
618
694
|
#
|
619
695
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
620
696
|
#
|
697
|
+
# @example Basic example
|
698
|
+
# require "google/cloud/logging/v2"
|
699
|
+
#
|
700
|
+
# # Create a client object. The client can be reused for multiple calls.
|
701
|
+
# client = Google::Cloud::Logging::V2::LoggingService::Client.new
|
702
|
+
#
|
703
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
704
|
+
# request = Google::Cloud::Logging::V2::ListLogsRequest.new
|
705
|
+
#
|
706
|
+
# # Call the list_logs method.
|
707
|
+
# result = client.list_logs request
|
708
|
+
#
|
709
|
+
# # The returned object is of type Google::Cloud::Logging::V2::ListLogsResponse.
|
710
|
+
# p result
|
711
|
+
#
|
621
712
|
def list_logs request, options = nil
|
622
713
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
623
714
|
|
@@ -635,16 +726,20 @@ module Google
|
|
635
726
|
gapic_version: ::Google::Cloud::Logging::V2::VERSION
|
636
727
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
637
728
|
|
638
|
-
header_params = {
|
639
|
-
|
640
|
-
|
729
|
+
header_params = {}
|
730
|
+
if request.parent
|
731
|
+
header_params["parent"] = request.parent
|
732
|
+
end
|
733
|
+
|
641
734
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
642
735
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
643
736
|
|
644
737
|
options.apply_defaults timeout: @config.rpcs.list_logs.timeout,
|
645
738
|
metadata: metadata,
|
646
739
|
retry_policy: @config.rpcs.list_logs.retry_policy
|
647
|
-
|
740
|
+
|
741
|
+
options.apply_defaults timeout: @config.timeout,
|
742
|
+
metadata: @config.metadata,
|
648
743
|
retry_policy: @config.retry_policy
|
649
744
|
|
650
745
|
@logging_service_stub.call_rpc :list_logs, request, options: options do |response, operation|
|
@@ -672,6 +767,30 @@ module Google
|
|
672
767
|
#
|
673
768
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
674
769
|
#
|
770
|
+
# @example Basic example
|
771
|
+
# require "google/cloud/logging/v2"
|
772
|
+
#
|
773
|
+
# # Create a client object. The client can be reused for multiple calls.
|
774
|
+
# client = Google::Cloud::Logging::V2::LoggingService::Client.new
|
775
|
+
#
|
776
|
+
# # Create an input stream
|
777
|
+
# input = Gapic::StreamInput.new
|
778
|
+
#
|
779
|
+
# # Call the tail_log_entries method to start streaming.
|
780
|
+
# output = client.tail_log_entries input
|
781
|
+
#
|
782
|
+
# # Send requests on the stream. For each request, pass in keyword
|
783
|
+
# # arguments to set fields. Be sure to close the stream when done.
|
784
|
+
# input << Google::Cloud::Logging::V2::TailLogEntriesRequest.new
|
785
|
+
# input << Google::Cloud::Logging::V2::TailLogEntriesRequest.new
|
786
|
+
# input.close
|
787
|
+
#
|
788
|
+
# # Handle streamed responses. These may be interleaved with inputs.
|
789
|
+
# # Each response is of type ::Google::Cloud::Logging::V2::TailLogEntriesResponse.
|
790
|
+
# output.each do |response|
|
791
|
+
# p response
|
792
|
+
# end
|
793
|
+
#
|
675
794
|
def tail_log_entries request, options = nil
|
676
795
|
unless request.is_a? ::Enumerable
|
677
796
|
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
@@ -697,7 +816,9 @@ module Google
|
|
697
816
|
options.apply_defaults timeout: @config.rpcs.tail_log_entries.timeout,
|
698
817
|
metadata: metadata,
|
699
818
|
retry_policy: @config.rpcs.tail_log_entries.retry_policy
|
700
|
-
|
819
|
+
|
820
|
+
options.apply_defaults timeout: @config.timeout,
|
821
|
+
metadata: @config.metadata,
|
701
822
|
retry_policy: @config.retry_policy
|
702
823
|
|
703
824
|
@logging_service_stub.call_rpc :tail_log_entries, request, options: options do |response, operation|
|
@@ -721,22 +842,21 @@ module Google
|
|
721
842
|
# Configuration can be applied globally to all clients, or to a single client
|
722
843
|
# on construction.
|
723
844
|
#
|
724
|
-
#
|
725
|
-
#
|
726
|
-
#
|
727
|
-
# to 20 seconds,
|
728
|
-
#
|
729
|
-
#
|
730
|
-
#
|
731
|
-
#
|
732
|
-
#
|
733
|
-
#
|
734
|
-
#
|
735
|
-
#
|
736
|
-
#
|
737
|
-
#
|
738
|
-
#
|
739
|
-
# end
|
845
|
+
# @example
|
846
|
+
#
|
847
|
+
# # Modify the global config, setting the timeout for
|
848
|
+
# # delete_log to 20 seconds,
|
849
|
+
# # and all remaining timeouts to 10 seconds.
|
850
|
+
# ::Google::Cloud::Logging::V2::LoggingService::Client.configure do |config|
|
851
|
+
# config.timeout = 10.0
|
852
|
+
# config.rpcs.delete_log.timeout = 20.0
|
853
|
+
# end
|
854
|
+
#
|
855
|
+
# # Apply the above configuration only to a new client.
|
856
|
+
# client = ::Google::Cloud::Logging::V2::LoggingService::Client.new do |config|
|
857
|
+
# config.timeout = 10.0
|
858
|
+
# config.rpcs.delete_log.timeout = 20.0
|
859
|
+
# end
|
740
860
|
#
|
741
861
|
# @!attribute [rw] endpoint
|
742
862
|
# The hostname or hostname:port of the service endpoint.
|