google-apps-events-subscriptions-v1 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0fb611c3d455b50917a9ec9f6d04323e3d086a8f9b46488314c134fd6cf6702
4
- data.tar.gz: 68fad11a689bc9cd440ec20e76d49384f415204edf8869c6b12fdf7a2fe7d600
3
+ metadata.gz: 527835ad3b3dd98a71fefb8c49a7957955ad56828324205d8464214998674c45
4
+ data.tar.gz: e54b23e36e91966d64135563663c4706e66e53c23da76f68049be3fc0e1f7f61
5
5
  SHA512:
6
- metadata.gz: c887293fb9c668c0180ffe5d2ba262e59dc6a9b104a45310175c427abd447b768c72218cfb0becafeb95350f4013775f9a32c291a7d2c43102dd96b8fa081850
7
- data.tar.gz: 6e0a713db2f1e753b2871fbfe7318801ec6a10723831aae1820478d38f7b3781179320cf2dd855279d58ae28e0b6bb1869339878a85ea98c0561caabde41403b
6
+ metadata.gz: 3a2682edfff8574d0b8161742fbeedf26e44c1929633065c691b9eff47d58ecf706b119ace403482a8a52987b99ac278a6491de6152a771f5309dde0e7c283be
7
+ data.tar.gz: 6a7ded0996701e736186a5a28a83a89e80f2e3be1691210fc6720fe0dd94bc9e090972904973bd7aaed7dcc48ad494590fb80e18cf9ae632bf7f940224f1a18e
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://developers.google.com/workspace/events)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/apps/events/subscriptions/v1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Apps::Events::Subscriptions::V1::SubscriptionsService::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -31,6 +31,9 @@ module Google
31
31
  # A service that manages subscriptions to Google Workspace events.
32
32
  #
33
33
  class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
34
37
  # @private
35
38
  DEFAULT_ENDPOINT_TEMPLATE = "workspaceevents.$UNIVERSE_DOMAIN$"
36
39
 
@@ -180,8 +183,19 @@ module Google
180
183
  universe_domain: @config.universe_domain,
181
184
  channel_args: @config.channel_args,
182
185
  interceptors: @config.interceptors,
183
- channel_pool_config: @config.channel_pool
186
+ channel_pool_config: @config.channel_pool,
187
+ logger: @config.logger
184
188
  )
189
+
190
+ @subscriptions_service_stub.stub_logger&.info do |entry|
191
+ entry.set_system_name
192
+ entry.set_service
193
+ entry.message = "Created client for #{entry.service}"
194
+ entry.set_credentials_fields credentials
195
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
196
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
197
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
198
+ end
185
199
  end
186
200
 
187
201
  ##
@@ -191,6 +205,15 @@ module Google
191
205
  #
192
206
  attr_reader :operations_client
193
207
 
208
+ ##
209
+ # The logger used for request/response debug logging.
210
+ #
211
+ # @return [Logger]
212
+ #
213
+ def logger
214
+ @subscriptions_service_stub.logger
215
+ end
216
+
194
217
  # Service calls
195
218
 
196
219
  ##
@@ -260,10 +283,11 @@ module Google
260
283
  # Customize the options with defaults
261
284
  metadata = @config.rpcs.create_subscription.metadata.to_h
262
285
 
263
- # Set x-goog-api-client and x-goog-user-project headers
286
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
264
287
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
265
288
  lib_name: @config.lib_name, lib_version: @config.lib_version,
266
289
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
290
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
267
291
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
268
292
 
269
293
  options.apply_defaults timeout: @config.rpcs.create_subscription.timeout,
@@ -277,7 +301,7 @@ module Google
277
301
  @subscriptions_service_stub.call_rpc :create_subscription, request, options: options do |response, operation|
278
302
  response = ::Gapic::Operation.new response, @operations_client, options: options
279
303
  yield response, operation if block_given?
280
- return response
304
+ throw :response, response
281
305
  end
282
306
  rescue ::GRPC::BadStatus => e
283
307
  raise ::Google::Cloud::Error.from_error(e)
@@ -360,10 +384,11 @@ module Google
360
384
  # Customize the options with defaults
361
385
  metadata = @config.rpcs.delete_subscription.metadata.to_h
362
386
 
363
- # Set x-goog-api-client and x-goog-user-project headers
387
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
364
388
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
365
389
  lib_name: @config.lib_name, lib_version: @config.lib_version,
366
390
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
391
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
367
392
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
368
393
 
369
394
  header_params = {}
@@ -385,7 +410,7 @@ module Google
385
410
  @subscriptions_service_stub.call_rpc :delete_subscription, request, options: options do |response, operation|
386
411
  response = ::Gapic::Operation.new response, @operations_client, options: options
387
412
  yield response, operation if block_given?
388
- return response
413
+ throw :response, response
389
414
  end
390
415
  rescue ::GRPC::BadStatus => e
391
416
  raise ::Google::Cloud::Error.from_error(e)
@@ -450,10 +475,11 @@ module Google
450
475
  # Customize the options with defaults
451
476
  metadata = @config.rpcs.get_subscription.metadata.to_h
452
477
 
453
- # Set x-goog-api-client and x-goog-user-project headers
478
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
454
479
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
455
480
  lib_name: @config.lib_name, lib_version: @config.lib_version,
456
481
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
482
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
457
483
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
458
484
 
459
485
  header_params = {}
@@ -474,7 +500,6 @@ module Google
474
500
 
475
501
  @subscriptions_service_stub.call_rpc :get_subscription, request, options: options do |response, operation|
476
502
  yield response, operation if block_given?
477
- return response
478
503
  end
479
504
  rescue ::GRPC::BadStatus => e
480
505
  raise ::Google::Cloud::Error.from_error(e)
@@ -582,10 +607,11 @@ module Google
582
607
  # Customize the options with defaults
583
608
  metadata = @config.rpcs.list_subscriptions.metadata.to_h
584
609
 
585
- # Set x-goog-api-client and x-goog-user-project headers
610
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
586
611
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
587
612
  lib_name: @config.lib_name, lib_version: @config.lib_version,
588
613
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
614
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
589
615
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
590
616
 
591
617
  options.apply_defaults timeout: @config.rpcs.list_subscriptions.timeout,
@@ -599,7 +625,7 @@ module Google
599
625
  @subscriptions_service_stub.call_rpc :list_subscriptions, request, options: options do |response, operation|
600
626
  response = ::Gapic::PagedEnumerable.new @subscriptions_service_stub, :list_subscriptions, request, response, operation, options
601
627
  yield response, operation if block_given?
602
- return response
628
+ throw :response, response
603
629
  end
604
630
  rescue ::GRPC::BadStatus => e
605
631
  raise ::Google::Cloud::Error.from_error(e)
@@ -685,10 +711,11 @@ module Google
685
711
  # Customize the options with defaults
686
712
  metadata = @config.rpcs.update_subscription.metadata.to_h
687
713
 
688
- # Set x-goog-api-client and x-goog-user-project headers
714
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
689
715
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
690
716
  lib_name: @config.lib_name, lib_version: @config.lib_version,
691
717
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
718
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
692
719
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
693
720
 
694
721
  header_params = {}
@@ -710,7 +737,7 @@ module Google
710
737
  @subscriptions_service_stub.call_rpc :update_subscription, request, options: options do |response, operation|
711
738
  response = ::Gapic::Operation.new response, @operations_client, options: options
712
739
  yield response, operation if block_given?
713
- return response
740
+ throw :response, response
714
741
  end
715
742
  rescue ::GRPC::BadStatus => e
716
743
  raise ::Google::Cloud::Error.from_error(e)
@@ -786,10 +813,11 @@ module Google
786
813
  # Customize the options with defaults
787
814
  metadata = @config.rpcs.reactivate_subscription.metadata.to_h
788
815
 
789
- # Set x-goog-api-client and x-goog-user-project headers
816
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
790
817
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
791
818
  lib_name: @config.lib_name, lib_version: @config.lib_version,
792
819
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
820
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
793
821
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
794
822
 
795
823
  header_params = {}
@@ -811,7 +839,7 @@ module Google
811
839
  @subscriptions_service_stub.call_rpc :reactivate_subscription, request, options: options do |response, operation|
812
840
  response = ::Gapic::Operation.new response, @operations_client, options: options
813
841
  yield response, operation if block_given?
814
- return response
842
+ throw :response, response
815
843
  end
816
844
  rescue ::GRPC::BadStatus => e
817
845
  raise ::Google::Cloud::Error.from_error(e)
@@ -900,6 +928,11 @@ module Google
900
928
  # default endpoint URL. The default value of nil uses the environment
901
929
  # universe (usually the default "googleapis.com" universe).
902
930
  # @return [::String,nil]
931
+ # @!attribute [rw] logger
932
+ # A custom logger to use for request/response debug logging, or the value
933
+ # `:default` (the default) to construct a default logger, or `nil` to
934
+ # explicitly disable logging.
935
+ # @return [::Logger,:default,nil]
903
936
  #
904
937
  class Configuration
905
938
  extend ::Gapic::Config
@@ -924,6 +957,7 @@ module Google
924
957
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
925
958
  config_attr :quota_project, nil, ::String, nil
926
959
  config_attr :universe_domain, nil, ::String, nil
960
+ config_attr :logger, :default, ::Logger, nil, :default
927
961
 
928
962
  # @private
929
963
  def initialize parent_config = nil
@@ -27,6 +27,9 @@ module Google
27
27
  module SubscriptionsService
28
28
  # Service that implements Longrunning Operations API.
29
29
  class Operations
30
+ # @private
31
+ API_VERSION = ""
32
+
30
33
  # @private
31
34
  DEFAULT_ENDPOINT_TEMPLATE = "workspaceevents.$UNIVERSE_DOMAIN$"
32
35
 
@@ -122,14 +125,6 @@ module Google
122
125
  # Lists operations that match the specified filter in the request. If the
123
126
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
124
127
  #
125
- # NOTE: the `name` binding allows API services to override the binding
126
- # to use different resource name schemes, such as `users/*/operations`. To
127
- # override the binding, API services can add a binding such as
128
- # `"/v1/{name=users/*}/operations"` to their service configuration.
129
- # For backwards compatibility, the default name includes the operations
130
- # collection id, however overriding users must ensure the name binding
131
- # is the parent resource, without the operations collection id.
132
- #
133
128
  # @overload list_operations(request, options = nil)
134
129
  # Pass arguments to `list_operations` via a request object, either of type
135
130
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -192,10 +187,11 @@ module Google
192
187
  # Customize the options with defaults
193
188
  metadata = @config.rpcs.list_operations.metadata.to_h
194
189
 
195
- # Set x-goog-api-client and x-goog-user-project headers
190
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
196
191
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
197
192
  lib_name: @config.lib_name, lib_version: @config.lib_version,
198
193
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
194
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
199
195
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
200
196
 
201
197
  header_params = {}
@@ -218,7 +214,7 @@ module Google
218
214
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
219
215
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
220
216
  yield response, operation if block_given?
221
- return response
217
+ throw :response, response
222
218
  end
223
219
  rescue ::GRPC::BadStatus => e
224
220
  raise ::Google::Cloud::Error.from_error(e)
@@ -288,10 +284,11 @@ module Google
288
284
  # Customize the options with defaults
289
285
  metadata = @config.rpcs.get_operation.metadata.to_h
290
286
 
291
- # Set x-goog-api-client and x-goog-user-project headers
287
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
292
288
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
293
289
  lib_name: @config.lib_name, lib_version: @config.lib_version,
294
290
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
291
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
295
292
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
296
293
 
297
294
  header_params = {}
@@ -313,7 +310,7 @@ module Google
313
310
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
314
311
  response = ::Gapic::Operation.new response, @operations_client, options: options
315
312
  yield response, operation if block_given?
316
- return response
313
+ throw :response, response
317
314
  end
318
315
  rescue ::GRPC::BadStatus => e
319
316
  raise ::Google::Cloud::Error.from_error(e)
@@ -377,10 +374,11 @@ module Google
377
374
  # Customize the options with defaults
378
375
  metadata = @config.rpcs.delete_operation.metadata.to_h
379
376
 
380
- # Set x-goog-api-client and x-goog-user-project headers
377
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
381
378
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
382
379
  lib_name: @config.lib_name, lib_version: @config.lib_version,
383
380
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
381
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
384
382
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
385
383
 
386
384
  header_params = {}
@@ -401,7 +399,6 @@ module Google
401
399
 
402
400
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
403
401
  yield response, operation if block_given?
404
- return response
405
402
  end
406
403
  rescue ::GRPC::BadStatus => e
407
404
  raise ::Google::Cloud::Error.from_error(e)
@@ -416,8 +413,9 @@ module Google
416
413
  # other methods to check whether the cancellation succeeded or whether the
417
414
  # operation completed despite cancellation. On successful cancellation,
418
415
  # the operation is not deleted; instead, it becomes an operation with
419
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
420
- # corresponding to `Code.CANCELLED`.
416
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
417
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
418
+ # `Code.CANCELLED`.
421
419
  #
422
420
  # @overload cancel_operation(request, options = nil)
423
421
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -471,10 +469,11 @@ module Google
471
469
  # Customize the options with defaults
472
470
  metadata = @config.rpcs.cancel_operation.metadata.to_h
473
471
 
474
- # Set x-goog-api-client and x-goog-user-project headers
472
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
475
473
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
476
474
  lib_name: @config.lib_name, lib_version: @config.lib_version,
477
475
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
476
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
478
477
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
479
478
 
480
479
  header_params = {}
@@ -495,7 +494,6 @@ module Google
495
494
 
496
495
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
497
496
  yield response, operation if block_given?
498
- return response
499
497
  end
500
498
  rescue ::GRPC::BadStatus => e
501
499
  raise ::Google::Cloud::Error.from_error(e)
@@ -575,10 +573,11 @@ module Google
575
573
  # Customize the options with defaults
576
574
  metadata = @config.rpcs.wait_operation.metadata.to_h
577
575
 
578
- # Set x-goog-api-client and x-goog-user-project headers
576
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
579
577
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
580
578
  lib_name: @config.lib_name, lib_version: @config.lib_version,
581
579
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION
580
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
582
581
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
583
582
 
584
583
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
@@ -592,7 +591,7 @@ module Google
592
591
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
593
592
  response = ::Gapic::Operation.new response, @operations_client, options: options
594
593
  yield response, operation if block_given?
595
- return response
594
+ throw :response, response
596
595
  end
597
596
  rescue ::GRPC::BadStatus => e
598
597
  raise ::Google::Cloud::Error.from_error(e)
@@ -681,6 +680,11 @@ module Google
681
680
  # default endpoint URL. The default value of nil uses the environment
682
681
  # universe (usually the default "googleapis.com" universe).
683
682
  # @return [::String,nil]
683
+ # @!attribute [rw] logger
684
+ # A custom logger to use for request/response debug logging, or the value
685
+ # `:default` (the default) to construct a default logger, or `nil` to
686
+ # explicitly disable logging.
687
+ # @return [::Logger,:default,nil]
684
688
  #
685
689
  class Configuration
686
690
  extend ::Gapic::Config
@@ -705,6 +709,7 @@ module Google
705
709
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
706
710
  config_attr :quota_project, nil, ::String, nil
707
711
  config_attr :universe_domain, nil, ::String, nil
712
+ config_attr :logger, :default, ::Logger, nil, :default
708
713
 
709
714
  # @private
710
715
  def initialize parent_config = nil
@@ -33,6 +33,9 @@ module Google
33
33
  # A service that manages subscriptions to Google Workspace events.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
36
39
  # @private
37
40
  DEFAULT_ENDPOINT_TEMPLATE = "workspaceevents.$UNIVERSE_DOMAIN$"
38
41
 
@@ -173,8 +176,19 @@ module Google
173
176
  endpoint: @config.endpoint,
174
177
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
175
178
  universe_domain: @config.universe_domain,
176
- credentials: credentials
179
+ credentials: credentials,
180
+ logger: @config.logger
177
181
  )
182
+
183
+ @subscriptions_service_stub.logger(stub: true)&.info do |entry|
184
+ entry.set_system_name
185
+ entry.set_service
186
+ entry.message = "Created client for #{entry.service}"
187
+ entry.set_credentials_fields credentials
188
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
189
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
190
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
191
+ end
178
192
  end
179
193
 
180
194
  ##
@@ -184,6 +198,15 @@ module Google
184
198
  #
185
199
  attr_reader :operations_client
186
200
 
201
+ ##
202
+ # The logger used for request/response debug logging.
203
+ #
204
+ # @return [Logger]
205
+ #
206
+ def logger
207
+ @subscriptions_service_stub.logger
208
+ end
209
+
187
210
  # Service calls
188
211
 
189
212
  ##
@@ -252,12 +275,13 @@ module Google
252
275
  # Customize the options with defaults
253
276
  call_metadata = @config.rpcs.create_subscription.metadata.to_h
254
277
 
255
- # Set x-goog-api-client and x-goog-user-project headers
278
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
256
279
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
257
280
  lib_name: @config.lib_name, lib_version: @config.lib_version,
258
281
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION,
259
282
  transports_version_send: [:rest]
260
283
 
284
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
261
285
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
262
286
 
263
287
  options.apply_defaults timeout: @config.rpcs.create_subscription.timeout,
@@ -271,7 +295,7 @@ module Google
271
295
  @subscriptions_service_stub.create_subscription request, options do |result, operation|
272
296
  result = ::Gapic::Operation.new result, @operations_client, options: options
273
297
  yield result, operation if block_given?
274
- return result
298
+ throw :response, result
275
299
  end
276
300
  rescue ::Gapic::Rest::Error => e
277
301
  raise ::Google::Cloud::Error.from_error(e)
@@ -353,12 +377,13 @@ module Google
353
377
  # Customize the options with defaults
354
378
  call_metadata = @config.rpcs.delete_subscription.metadata.to_h
355
379
 
356
- # Set x-goog-api-client and x-goog-user-project headers
380
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
357
381
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
358
382
  lib_name: @config.lib_name, lib_version: @config.lib_version,
359
383
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION,
360
384
  transports_version_send: [:rest]
361
385
 
386
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
362
387
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
363
388
 
364
389
  options.apply_defaults timeout: @config.rpcs.delete_subscription.timeout,
@@ -372,7 +397,7 @@ module Google
372
397
  @subscriptions_service_stub.delete_subscription request, options do |result, operation|
373
398
  result = ::Gapic::Operation.new result, @operations_client, options: options
374
399
  yield result, operation if block_given?
375
- return result
400
+ throw :response, result
376
401
  end
377
402
  rescue ::Gapic::Rest::Error => e
378
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -436,12 +461,13 @@ module Google
436
461
  # Customize the options with defaults
437
462
  call_metadata = @config.rpcs.get_subscription.metadata.to_h
438
463
 
439
- # Set x-goog-api-client and x-goog-user-project headers
464
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
440
465
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
441
466
  lib_name: @config.lib_name, lib_version: @config.lib_version,
442
467
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION,
443
468
  transports_version_send: [:rest]
444
469
 
470
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
445
471
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
446
472
 
447
473
  options.apply_defaults timeout: @config.rpcs.get_subscription.timeout,
@@ -454,7 +480,6 @@ module Google
454
480
 
455
481
  @subscriptions_service_stub.get_subscription request, options do |result, operation|
456
482
  yield result, operation if block_given?
457
- return result
458
483
  end
459
484
  rescue ::Gapic::Rest::Error => e
460
485
  raise ::Google::Cloud::Error.from_error(e)
@@ -561,12 +586,13 @@ module Google
561
586
  # Customize the options with defaults
562
587
  call_metadata = @config.rpcs.list_subscriptions.metadata.to_h
563
588
 
564
- # Set x-goog-api-client and x-goog-user-project headers
589
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
565
590
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
566
591
  lib_name: @config.lib_name, lib_version: @config.lib_version,
567
592
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION,
568
593
  transports_version_send: [:rest]
569
594
 
595
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
570
596
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
571
597
 
572
598
  options.apply_defaults timeout: @config.rpcs.list_subscriptions.timeout,
@@ -580,7 +606,7 @@ module Google
580
606
  @subscriptions_service_stub.list_subscriptions request, options do |result, operation|
581
607
  result = ::Gapic::Rest::PagedEnumerable.new @subscriptions_service_stub, :list_subscriptions, "subscriptions", request, result, options
582
608
  yield result, operation if block_given?
583
- return result
609
+ throw :response, result
584
610
  end
585
611
  rescue ::Gapic::Rest::Error => e
586
612
  raise ::Google::Cloud::Error.from_error(e)
@@ -665,12 +691,13 @@ module Google
665
691
  # Customize the options with defaults
666
692
  call_metadata = @config.rpcs.update_subscription.metadata.to_h
667
693
 
668
- # Set x-goog-api-client and x-goog-user-project headers
694
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
669
695
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
670
696
  lib_name: @config.lib_name, lib_version: @config.lib_version,
671
697
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION,
672
698
  transports_version_send: [:rest]
673
699
 
700
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
674
701
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
675
702
 
676
703
  options.apply_defaults timeout: @config.rpcs.update_subscription.timeout,
@@ -684,7 +711,7 @@ module Google
684
711
  @subscriptions_service_stub.update_subscription request, options do |result, operation|
685
712
  result = ::Gapic::Operation.new result, @operations_client, options: options
686
713
  yield result, operation if block_given?
687
- return result
714
+ throw :response, result
688
715
  end
689
716
  rescue ::Gapic::Rest::Error => e
690
717
  raise ::Google::Cloud::Error.from_error(e)
@@ -759,12 +786,13 @@ module Google
759
786
  # Customize the options with defaults
760
787
  call_metadata = @config.rpcs.reactivate_subscription.metadata.to_h
761
788
 
762
- # Set x-goog-api-client and x-goog-user-project headers
789
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
763
790
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
764
791
  lib_name: @config.lib_name, lib_version: @config.lib_version,
765
792
  gapic_version: ::Google::Apps::Events::Subscriptions::V1::VERSION,
766
793
  transports_version_send: [:rest]
767
794
 
795
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
768
796
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
769
797
 
770
798
  options.apply_defaults timeout: @config.rpcs.reactivate_subscription.timeout,
@@ -778,7 +806,7 @@ module Google
778
806
  @subscriptions_service_stub.reactivate_subscription request, options do |result, operation|
779
807
  result = ::Gapic::Operation.new result, @operations_client, options: options
780
808
  yield result, operation if block_given?
781
- return result
809
+ throw :response, result
782
810
  end
783
811
  rescue ::Gapic::Rest::Error => e
784
812
  raise ::Google::Cloud::Error.from_error(e)
@@ -858,6 +886,11 @@ module Google
858
886
  # default endpoint URL. The default value of nil uses the environment
859
887
  # universe (usually the default "googleapis.com" universe).
860
888
  # @return [::String,nil]
889
+ # @!attribute [rw] logger
890
+ # A custom logger to use for request/response debug logging, or the value
891
+ # `:default` (the default) to construct a default logger, or `nil` to
892
+ # explicitly disable logging.
893
+ # @return [::Logger,:default,nil]
861
894
  #
862
895
  class Configuration
863
896
  extend ::Gapic::Config
@@ -879,6 +912,7 @@ module Google
879
912
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
880
913
  config_attr :quota_project, nil, ::String, nil
881
914
  config_attr :universe_domain, nil, ::String, nil
915
+ config_attr :logger, :default, ::Logger, nil, :default
882
916
 
883
917
  # @private
884
918
  def initialize parent_config = nil