google-cloud-discovery_engine-v1beta 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +32 -7
  4. data/lib/google/cloud/discovery_engine/v1beta/completion_service/operations.rb +12 -15
  5. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +32 -7
  6. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/operations.rb +43 -38
  7. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +62 -38
  8. data/lib/google/cloud/discovery_engine/v1beta/control_service/client.rb +29 -6
  9. data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/client.rb +29 -6
  10. data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/service_stub.rb +54 -32
  11. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +30 -14
  12. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +30 -14
  13. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub.rb +118 -80
  14. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/client.rb +31 -6
  15. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/operations.rb +12 -15
  16. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/client.rb +31 -6
  17. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/operations.rb +43 -38
  18. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/service_stub.rb +54 -32
  19. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +31 -9
  20. data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +12 -15
  21. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +31 -9
  22. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +43 -38
  23. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +78 -50
  24. data/lib/google/cloud/discovery_engine/v1beta/engine_service/client.rb +32 -9
  25. data/lib/google/cloud/discovery_engine/v1beta/engine_service/operations.rb +12 -15
  26. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/client.rb +32 -9
  27. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/operations.rb +43 -38
  28. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/service_stub.rb +78 -50
  29. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/client.rb +31 -5
  30. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/operations.rb +12 -15
  31. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/client.rb +31 -5
  32. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/operations.rb +43 -38
  33. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/service_stub.rb +46 -26
  34. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/client.rb +28 -4
  35. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client.rb +28 -3
  36. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/service_stub.rb +30 -14
  37. data/lib/google/cloud/discovery_engine/v1beta/project_service/client.rb +29 -2
  38. data/lib/google/cloud/discovery_engine/v1beta/project_service/operations.rb +12 -15
  39. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/client.rb +29 -2
  40. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/operations.rb +43 -38
  41. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/service_stub.rb +22 -8
  42. data/lib/google/cloud/discovery_engine/v1beta/rank_service/client.rb +28 -2
  43. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/client.rb +28 -2
  44. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/service_stub.rb +22 -8
  45. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +28 -2
  46. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +28 -2
  47. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/service_stub.rb +22 -8
  48. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/client.rb +30 -7
  49. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/operations.rb +12 -15
  50. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/client.rb +30 -7
  51. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/operations.rb +43 -38
  52. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/service_stub.rb +62 -38
  53. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/client.rb +29 -6
  54. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/client.rb +29 -6
  55. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/service_stub.rb +54 -32
  56. data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +32 -6
  57. data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +12 -15
  58. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +32 -6
  59. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +43 -38
  60. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/service_stub.rb +54 -32
  61. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +30 -3
  62. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +28 -3
  63. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +30 -14
  64. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/client.rb +29 -3
  65. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/operations.rb +12 -15
  66. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/client.rb +29 -3
  67. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/operations.rb +43 -38
  68. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/service_stub.rb +30 -14
  69. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/client.rb +29 -4
  70. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/client.rb +29 -4
  71. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/service_stub.rb +38 -20
  72. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/client.rb +40 -16
  73. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/operations.rb +12 -15
  74. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/client.rb +40 -16
  75. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/operations.rb +43 -38
  76. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/service_stub.rb +134 -92
  77. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +30 -5
  78. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +12 -15
  79. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +30 -5
  80. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +43 -38
  81. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +46 -26
  82. data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
  83. data/proto_docs/google/api/client.rb +19 -0
  84. data/proto_docs/google/longrunning/operations.rb +19 -14
  85. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03ccf808ee4fe5e65560966192cbc367522c8aaedfd4a21bfadb17a34afe5395
4
- data.tar.gz: c048a44de610ddce2da04abd17d2e97a53b2b303d820cc3cb9a9906eee562d33
3
+ metadata.gz: 6540034d790eaf9ad6165a0e6a9d2a3e9c92578ab00b8c0bb395f3ea22d73ac8
4
+ data.tar.gz: 6b5d2743325834f8580e79558a4b8466c8e515af5a614b5cf477b110fb2b5b2c
5
5
  SHA512:
6
- metadata.gz: 5479fd924bf38180abed0eef647521985fcb9bbc9af2c8870d5d5ea131ede9d5c3b7dd326c480ad0a1b491a352ea0d769ea5b46ade241cba7d320252fad341c1
7
- data.tar.gz: 6a945dbda3267553c018174928bd1b346474933d8239e064265d07e46061642f376061fd806ac7aef047ca2d5cffe39f27b64dbf25e2125a52ec2fe90263d791
6
+ metadata.gz: b4c19df302f96bccb055320c5768b6d0b0e4f22378c8c7f2f971984c5c48e27e315f2929ea2cabe01bcaa5d4ffe361c7ad204f1515c65c9a9b4a79220050d039
7
+ data.tar.gz: 7aa167d0d3f5ab7adb85e794db98332d844078d39135d1567092927b1e6b6b63a4888d052b55638e1faa29c154247ee0e92291807b8aea8da56074ba6e984885
data/README.md CHANGED
@@ -42,33 +42,43 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/generative-ai-app-builder/docs)
43
43
  for general usage information.
44
44
 
45
- ## Enabling Logging
46
-
47
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
48
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
49
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
50
- 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)
51
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
52
-
53
- Configuring a Ruby stdlib logger:
45
+ ## Debug Logging
46
+
47
+ This library comes with opt-in Debug Logging that can help you troubleshoot
48
+ your application's integration with the API. When logging is activated, key
49
+ events such as requests and responses, along with data payloads and metadata
50
+ such as headers and client configuration, are logged to the standard error
51
+ stream.
52
+
53
+ **WARNING:** Client Library Debug Logging includes your data payloads in
54
+ plaintext, which could include sensitive data such as PII for yourself or your
55
+ customers, private keys, or other security data that could be compromising if
56
+ leaked. Always practice good data hygiene with your application logs, and follow
57
+ the principle of least access. Google also recommends that Client Library Debug
58
+ Logging be enabled only temporarily during active debugging, and not used
59
+ permanently in production.
60
+
61
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
62
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
63
+ list of client library gem names. This will select the default logging behavior,
64
+ which writes logs to the standard error stream. On a local workstation, this may
65
+ result in logs appearing on the console. When running on a Google Cloud hosting
66
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
67
+ results in logs appearing alongside your application logs in the
68
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
69
+
70
+ You can customize logging by modifying the `logger` configuration when
71
+ constructing a client object. For example:
54
72
 
55
73
  ```ruby
74
+ require "google/cloud/discovery_engine/v1beta"
56
75
  require "logger"
57
76
 
58
- module MyLogger
59
- LOGGER = Logger.new $stderr, level: Logger::WARN
60
- def logger
61
- LOGGER
62
- end
63
- end
64
-
65
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
66
- module GRPC
67
- extend MyLogger
77
+ client = ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new do |config|
78
+ config.logger = Logger.new "my-app.log"
68
79
  end
69
80
  ```
70
81
 
71
-
72
82
  ## Google Cloud Samples
73
83
 
74
84
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -170,14 +170,26 @@ module Google
170
170
  universe_domain: @config.universe_domain,
171
171
  channel_args: @config.channel_args,
172
172
  interceptors: @config.interceptors,
173
- channel_pool_config: @config.channel_pool
173
+ channel_pool_config: @config.channel_pool,
174
+ logger: @config.logger
174
175
  )
175
176
 
177
+ @completion_service_stub.stub_logger&.info do |entry|
178
+ entry.set_system_name
179
+ entry.set_service
180
+ entry.message = "Created client for #{entry.service}"
181
+ entry.set_credentials_fields credentials
182
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
183
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
184
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
185
+ end
186
+
176
187
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
177
188
  config.credentials = credentials
178
189
  config.quota_project = @quota_project_id
179
190
  config.endpoint = @completion_service_stub.endpoint
180
191
  config.universe_domain = @completion_service_stub.universe_domain
192
+ config.logger = @completion_service_stub.logger if config.respond_to? :logger=
181
193
  end
182
194
  end
183
195
 
@@ -195,6 +207,15 @@ module Google
195
207
  #
196
208
  attr_reader :location_client
197
209
 
210
+ ##
211
+ # The logger used for request/response debug logging.
212
+ #
213
+ # @return [Logger]
214
+ #
215
+ def logger
216
+ @completion_service_stub.logger
217
+ end
218
+
198
219
  # Service calls
199
220
 
200
221
  ##
@@ -320,7 +341,6 @@ module Google
320
341
 
321
342
  @completion_service_stub.call_rpc :complete_query, request, options: options do |response, operation|
322
343
  yield response, operation if block_given?
323
- return response
324
344
  end
325
345
  rescue ::GRPC::BadStatus => e
326
346
  raise ::Google::Cloud::Error.from_error(e)
@@ -468,7 +488,6 @@ module Google
468
488
 
469
489
  @completion_service_stub.call_rpc :advanced_complete_query, request, options: options do |response, operation|
470
490
  yield response, operation if block_given?
471
- return response
472
491
  end
473
492
  rescue ::GRPC::BadStatus => e
474
493
  raise ::Google::Cloud::Error.from_error(e)
@@ -576,7 +595,7 @@ module Google
576
595
  @completion_service_stub.call_rpc :import_suggestion_deny_list_entries, request, options: options do |response, operation|
577
596
  response = ::Gapic::Operation.new response, @operations_client, options: options
578
597
  yield response, operation if block_given?
579
- return response
598
+ throw :response, response
580
599
  end
581
600
  rescue ::GRPC::BadStatus => e
582
601
  raise ::Google::Cloud::Error.from_error(e)
@@ -673,7 +692,7 @@ module Google
673
692
  @completion_service_stub.call_rpc :purge_suggestion_deny_list_entries, request, options: options do |response, operation|
674
693
  response = ::Gapic::Operation.new response, @operations_client, options: options
675
694
  yield response, operation if block_given?
676
- return response
695
+ throw :response, response
677
696
  end
678
697
  rescue ::GRPC::BadStatus => e
679
698
  raise ::Google::Cloud::Error.from_error(e)
@@ -780,7 +799,7 @@ module Google
780
799
  @completion_service_stub.call_rpc :import_completion_suggestions, request, options: options do |response, operation|
781
800
  response = ::Gapic::Operation.new response, @operations_client, options: options
782
801
  yield response, operation if block_given?
783
- return response
802
+ throw :response, response
784
803
  end
785
804
  rescue ::GRPC::BadStatus => e
786
805
  raise ::Google::Cloud::Error.from_error(e)
@@ -878,7 +897,7 @@ module Google
878
897
  @completion_service_stub.call_rpc :purge_completion_suggestions, request, options: options do |response, operation|
879
898
  response = ::Gapic::Operation.new response, @operations_client, options: options
880
899
  yield response, operation if block_given?
881
- return response
900
+ throw :response, response
882
901
  end
883
902
  rescue ::GRPC::BadStatus => e
884
903
  raise ::Google::Cloud::Error.from_error(e)
@@ -967,6 +986,11 @@ module Google
967
986
  # default endpoint URL. The default value of nil uses the environment
968
987
  # universe (usually the default "googleapis.com" universe).
969
988
  # @return [::String,nil]
989
+ # @!attribute [rw] logger
990
+ # A custom logger to use for request/response debug logging, or the value
991
+ # `:default` (the default) to construct a default logger, or `nil` to
992
+ # explicitly disable logging.
993
+ # @return [::Logger,:default,nil]
970
994
  #
971
995
  class Configuration
972
996
  extend ::Gapic::Config
@@ -991,6 +1015,7 @@ module Google
991
1015
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
992
1016
  config_attr :quota_project, nil, ::String, nil
993
1017
  config_attr :universe_domain, nil, ::String, nil
1018
+ config_attr :logger, :default, ::Logger, nil, :default
994
1019
 
995
1020
  # @private
996
1021
  def initialize parent_config = nil
@@ -124,14 +124,6 @@ module Google
124
124
  # Lists operations that match the specified filter in the request. If the
125
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
126
126
  #
127
- # NOTE: the `name` binding allows API services to override the binding
128
- # to use different resource name schemes, such as `users/*/operations`. To
129
- # override the binding, API services can add a binding such as
130
- # `"/v1/{name=users/*}/operations"` to their service configuration.
131
- # For backwards compatibility, the default name includes the operations
132
- # collection id, however overriding users must ensure the name binding
133
- # is the parent resource, without the operations collection id.
134
- #
135
127
  # @overload list_operations(request, options = nil)
136
128
  # Pass arguments to `list_operations` via a request object, either of type
137
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -221,7 +213,7 @@ module Google
221
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
222
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
223
215
  yield response, operation if block_given?
224
- return response
216
+ throw :response, response
225
217
  end
226
218
  rescue ::GRPC::BadStatus => e
227
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +309,7 @@ module Google
317
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
318
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
319
311
  yield response, operation if block_given?
320
- return response
312
+ throw :response, response
321
313
  end
322
314
  rescue ::GRPC::BadStatus => e
323
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +398,6 @@ module Google
406
398
 
407
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
408
400
  yield response, operation if block_given?
409
- return response
410
401
  end
411
402
  rescue ::GRPC::BadStatus => e
412
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,8 +412,9 @@ module Google
421
412
  # other methods to check whether the cancellation succeeded or whether the
422
413
  # operation completed despite cancellation. On successful cancellation,
423
414
  # the operation is not deleted; instead, it becomes an operation with
424
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # corresponding to `Code.CANCELLED`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
426
418
  #
427
419
  # @overload cancel_operation(request, options = nil)
428
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -501,7 +493,6 @@ module Google
501
493
 
502
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
503
495
  yield response, operation if block_given?
504
- return response
505
496
  end
506
497
  rescue ::GRPC::BadStatus => e
507
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,7 +590,7 @@ module Google
599
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
600
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
601
592
  yield response, operation if block_given?
602
- return response
593
+ throw :response, response
603
594
  end
604
595
  rescue ::GRPC::BadStatus => e
605
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -688,6 +679,11 @@ module Google
688
679
  # default endpoint URL. The default value of nil uses the environment
689
680
  # universe (usually the default "googleapis.com" universe).
690
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
691
687
  #
692
688
  class Configuration
693
689
  extend ::Gapic::Config
@@ -712,6 +708,7 @@ module Google
712
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
709
  config_attr :quota_project, nil, ::String, nil
714
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
715
712
 
716
713
  # @private
717
714
  def initialize parent_config = nil
@@ -163,14 +163,26 @@ module Google
163
163
  endpoint: @config.endpoint,
164
164
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
165
165
  universe_domain: @config.universe_domain,
166
- credentials: credentials
166
+ credentials: credentials,
167
+ logger: @config.logger
167
168
  )
168
169
 
170
+ @completion_service_stub.logger(stub: true)&.info do |entry|
171
+ entry.set_system_name
172
+ entry.set_service
173
+ entry.message = "Created client for #{entry.service}"
174
+ entry.set_credentials_fields credentials
175
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
176
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
177
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
178
+ end
179
+
169
180
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
170
181
  config.credentials = credentials
171
182
  config.quota_project = @quota_project_id
172
183
  config.endpoint = @completion_service_stub.endpoint
173
184
  config.universe_domain = @completion_service_stub.universe_domain
185
+ config.logger = @completion_service_stub.logger if config.respond_to? :logger=
174
186
  end
175
187
  end
176
188
 
@@ -188,6 +200,15 @@ module Google
188
200
  #
189
201
  attr_reader :location_client
190
202
 
203
+ ##
204
+ # The logger used for request/response debug logging.
205
+ #
206
+ # @return [Logger]
207
+ #
208
+ def logger
209
+ @completion_service_stub.logger
210
+ end
211
+
191
212
  # Service calls
192
213
 
193
214
  ##
@@ -306,7 +327,6 @@ module Google
306
327
 
307
328
  @completion_service_stub.complete_query request, options do |result, operation|
308
329
  yield result, operation if block_given?
309
- return result
310
330
  end
311
331
  rescue ::Gapic::Rest::Error => e
312
332
  raise ::Google::Cloud::Error.from_error(e)
@@ -447,7 +467,6 @@ module Google
447
467
 
448
468
  @completion_service_stub.advanced_complete_query request, options do |result, operation|
449
469
  yield result, operation if block_given?
450
- return result
451
470
  end
452
471
  rescue ::Gapic::Rest::Error => e
453
472
  raise ::Google::Cloud::Error.from_error(e)
@@ -548,7 +567,7 @@ module Google
548
567
  @completion_service_stub.import_suggestion_deny_list_entries request, options do |result, operation|
549
568
  result = ::Gapic::Operation.new result, @operations_client, options: options
550
569
  yield result, operation if block_given?
551
- return result
570
+ throw :response, result
552
571
  end
553
572
  rescue ::Gapic::Rest::Error => e
554
573
  raise ::Google::Cloud::Error.from_error(e)
@@ -638,7 +657,7 @@ module Google
638
657
  @completion_service_stub.purge_suggestion_deny_list_entries request, options do |result, operation|
639
658
  result = ::Gapic::Operation.new result, @operations_client, options: options
640
659
  yield result, operation if block_given?
641
- return result
660
+ throw :response, result
642
661
  end
643
662
  rescue ::Gapic::Rest::Error => e
644
663
  raise ::Google::Cloud::Error.from_error(e)
@@ -738,7 +757,7 @@ module Google
738
757
  @completion_service_stub.import_completion_suggestions request, options do |result, operation|
739
758
  result = ::Gapic::Operation.new result, @operations_client, options: options
740
759
  yield result, operation if block_given?
741
- return result
760
+ throw :response, result
742
761
  end
743
762
  rescue ::Gapic::Rest::Error => e
744
763
  raise ::Google::Cloud::Error.from_error(e)
@@ -829,7 +848,7 @@ module Google
829
848
  @completion_service_stub.purge_completion_suggestions request, options do |result, operation|
830
849
  result = ::Gapic::Operation.new result, @operations_client, options: options
831
850
  yield result, operation if block_given?
832
- return result
851
+ throw :response, result
833
852
  end
834
853
  rescue ::Gapic::Rest::Error => e
835
854
  raise ::Google::Cloud::Error.from_error(e)
@@ -909,6 +928,11 @@ module Google
909
928
  # default endpoint URL. The default value of nil uses the environment
910
929
  # universe (usually the default "googleapis.com" universe).
911
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]
912
936
  #
913
937
  class Configuration
914
938
  extend ::Gapic::Config
@@ -930,6 +954,7 @@ module Google
930
954
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
931
955
  config_attr :quota_project, nil, ::String, nil
932
956
  config_attr :universe_domain, nil, ::String, nil
957
+ config_attr :logger, :default, ::Logger, nil, :default
933
958
 
934
959
  # @private
935
960
  def initialize parent_config = nil
@@ -115,14 +115,6 @@ module Google
115
115
  # Lists operations that match the specified filter in the request. If the
116
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
117
  #
118
- # NOTE: the `name` binding allows API services to override the binding
119
- # to use different resource name schemes, such as `users/*/operations`. To
120
- # override the binding, API services can add a binding such as
121
- # `"/v1/{name=users/*}/operations"` to their service configuration.
122
- # For backwards compatibility, the default name includes the operations
123
- # collection id, however overriding users must ensure the name binding
124
- # is the parent resource, without the operations collection id.
125
- #
126
118
  # @overload list_operations(request, options = nil)
127
119
  # Pass arguments to `list_operations` via a request object, either of type
128
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -204,7 +196,7 @@ module Google
204
196
  @operations_stub.list_operations request, options do |result, operation|
205
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
206
198
  yield result, operation if block_given?
207
- return result
199
+ throw :response, result
208
200
  end
209
201
  rescue ::Gapic::Rest::Error => e
210
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -293,7 +285,7 @@ module Google
293
285
  @operations_stub.get_operation request, options do |result, operation|
294
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
295
287
  yield result, operation if block_given?
296
- return result
288
+ throw :response, result
297
289
  end
298
290
  rescue ::Gapic::Rest::Error => e
299
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -375,7 +367,6 @@ module Google
375
367
 
376
368
  @operations_stub.delete_operation request, options do |result, operation|
377
369
  yield result, operation if block_given?
378
- return result
379
370
  end
380
371
  rescue ::Gapic::Rest::Error => e
381
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -390,8 +381,9 @@ module Google
390
381
  # other methods to check whether the cancellation succeeded or whether the
391
382
  # operation completed despite cancellation. On successful cancellation,
392
383
  # the operation is not deleted; instead, it becomes an operation with
393
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
394
- # corresponding to `Code.CANCELLED`.
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
395
387
  #
396
388
  # @overload cancel_operation(request, options = nil)
397
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -463,7 +455,6 @@ module Google
463
455
 
464
456
  @operations_stub.cancel_operation request, options do |result, operation|
465
457
  yield result, operation if block_given?
466
- return result
467
458
  end
468
459
  rescue ::Gapic::Rest::Error => e
469
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -543,6 +534,11 @@ module Google
543
534
  # default endpoint URL. The default value of nil uses the environment
544
535
  # universe (usually the default "googleapis.com" universe).
545
536
  # @return [::String,nil]
537
+ # @!attribute [rw] logger
538
+ # A custom logger to use for request/response debug logging, or the value
539
+ # `:default` (the default) to construct a default logger, or `nil` to
540
+ # explicitly disable logging.
541
+ # @return [::Logger,:default,nil]
546
542
  #
547
543
  class Configuration
548
544
  extend ::Gapic::Config
@@ -564,6 +560,7 @@ module Google
564
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
561
  config_attr :quota_project, nil, ::String, nil
566
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
567
564
 
568
565
  # @private
569
566
  def initialize parent_config = nil
@@ -683,16 +680,18 @@ module Google
683
680
 
684
681
  response = @client_stub.make_http_request(
685
682
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
689
687
  options: options
690
688
  )
691
689
  operation = ::Gapic::Rest::TransportOperation.new response
692
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
696
695
  end
697
696
 
698
697
  ##
@@ -721,16 +720,18 @@ module Google
721
720
 
722
721
  response = @client_stub.make_http_request(
723
722
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
727
727
  options: options
728
728
  )
729
729
  operation = ::Gapic::Rest::TransportOperation.new response
730
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
734
735
  end
735
736
 
736
737
  ##
@@ -759,16 +760,18 @@ module Google
759
760
 
760
761
  response = @client_stub.make_http_request(
761
762
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
765
767
  options: options
766
768
  )
767
769
  operation = ::Gapic::Rest::TransportOperation.new response
768
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
772
775
  end
773
776
 
774
777
  ##
@@ -797,16 +800,18 @@ module Google
797
800
 
798
801
  response = @client_stub.make_http_request(
799
802
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
803
807
  options: options
804
808
  )
805
809
  operation = ::Gapic::Rest::TransportOperation.new response
806
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
810
815
  end
811
816
 
812
817
  ##