google-cloud-automl-v1 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -164,8 +164,19 @@ module Google
164
164
  endpoint: @config.endpoint,
165
165
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
166
166
  universe_domain: @config.universe_domain,
167
- credentials: credentials
167
+ credentials: credentials,
168
+ logger: @config.logger
168
169
  )
170
+
171
+ @prediction_service_stub.logger(stub: true)&.info do |entry|
172
+ entry.set_system_name
173
+ entry.set_service
174
+ entry.message = "Created client for #{entry.service}"
175
+ entry.set_credentials_fields credentials
176
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
177
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
178
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
179
+ end
169
180
  end
170
181
 
171
182
  ##
@@ -175,6 +186,15 @@ module Google
175
186
  #
176
187
  attr_reader :operations_client
177
188
 
189
+ ##
190
+ # The logger used for request/response debug logging.
191
+ #
192
+ # @return [Logger]
193
+ #
194
+ def logger
195
+ @prediction_service_stub.logger
196
+ end
197
+
178
198
  # Service calls
179
199
 
180
200
  ##
@@ -319,7 +339,6 @@ module Google
319
339
 
320
340
  @prediction_service_stub.predict request, options do |result, operation|
321
341
  yield result, operation if block_given?
322
- return result
323
342
  end
324
343
  rescue ::Gapic::Rest::Error => e
325
344
  raise ::Google::Cloud::Error.from_error(e)
@@ -509,7 +528,7 @@ module Google
509
528
  @prediction_service_stub.batch_predict request, options do |result, operation|
510
529
  result = ::Gapic::Operation.new result, @operations_client, options: options
511
530
  yield result, operation if block_given?
512
- return result
531
+ throw :response, result
513
532
  end
514
533
  rescue ::Gapic::Rest::Error => e
515
534
  raise ::Google::Cloud::Error.from_error(e)
@@ -589,6 +608,11 @@ module Google
589
608
  # default endpoint URL. The default value of nil uses the environment
590
609
  # universe (usually the default "googleapis.com" universe).
591
610
  # @return [::String,nil]
611
+ # @!attribute [rw] logger
612
+ # A custom logger to use for request/response debug logging, or the value
613
+ # `:default` (the default) to construct a default logger, or `nil` to
614
+ # explicitly disable logging.
615
+ # @return [::Logger,:default,nil]
592
616
  #
593
617
  class Configuration
594
618
  extend ::Gapic::Config
@@ -610,6 +634,7 @@ module Google
610
634
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
611
635
  config_attr :quota_project, nil, ::String, nil
612
636
  config_attr :universe_domain, nil, ::String, nil
637
+ config_attr :logger, :default, ::Logger, nil, :default
613
638
 
614
639
  # @private
615
640
  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)
@@ -562,7 +553,7 @@ module Google
562
553
  @operations_stub.wait_operation request, options do |result, operation|
563
554
  result = ::Gapic::Operation.new result, @operations_client, options: options
564
555
  yield result, operation if block_given?
565
- return result
556
+ throw :response, result
566
557
  end
567
558
  rescue ::Gapic::Rest::Error => e
568
559
  raise ::Google::Cloud::Error.from_error(e)
@@ -642,6 +633,11 @@ module Google
642
633
  # default endpoint URL. The default value of nil uses the environment
643
634
  # universe (usually the default "googleapis.com" universe).
644
635
  # @return [::String,nil]
636
+ # @!attribute [rw] logger
637
+ # A custom logger to use for request/response debug logging, or the value
638
+ # `:default` (the default) to construct a default logger, or `nil` to
639
+ # explicitly disable logging.
640
+ # @return [::Logger,:default,nil]
645
641
  #
646
642
  class Configuration
647
643
  extend ::Gapic::Config
@@ -663,6 +659,7 @@ module Google
663
659
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
664
660
  config_attr :quota_project, nil, ::String, nil
665
661
  config_attr :universe_domain, nil, ::String, nil
662
+ config_attr :logger, :default, ::Logger, nil, :default
666
663
 
667
664
  # @private
668
665
  def initialize parent_config = nil
@@ -789,16 +786,18 @@ module Google
789
786
 
790
787
  response = @client_stub.make_http_request(
791
788
  verb,
792
- uri: uri,
793
- body: body || "",
794
- params: query_string_params,
789
+ uri: uri,
790
+ body: body || "",
791
+ params: query_string_params,
792
+ method_name: "list_operations",
795
793
  options: options
796
794
  )
797
795
  operation = ::Gapic::Rest::TransportOperation.new response
798
796
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
799
-
800
- yield result, operation if block_given?
801
- result
797
+ catch :response do
798
+ yield result, operation if block_given?
799
+ result
800
+ end
802
801
  end
803
802
 
804
803
  ##
@@ -827,16 +826,18 @@ module Google
827
826
 
828
827
  response = @client_stub.make_http_request(
829
828
  verb,
830
- uri: uri,
831
- body: body || "",
832
- params: query_string_params,
829
+ uri: uri,
830
+ body: body || "",
831
+ params: query_string_params,
832
+ method_name: "get_operation",
833
833
  options: options
834
834
  )
835
835
  operation = ::Gapic::Rest::TransportOperation.new response
836
836
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
837
-
838
- yield result, operation if block_given?
839
- result
837
+ catch :response do
838
+ yield result, operation if block_given?
839
+ result
840
+ end
840
841
  end
841
842
 
842
843
  ##
@@ -865,16 +866,18 @@ module Google
865
866
 
866
867
  response = @client_stub.make_http_request(
867
868
  verb,
868
- uri: uri,
869
- body: body || "",
870
- params: query_string_params,
869
+ uri: uri,
870
+ body: body || "",
871
+ params: query_string_params,
872
+ method_name: "delete_operation",
871
873
  options: options
872
874
  )
873
875
  operation = ::Gapic::Rest::TransportOperation.new response
874
876
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
875
-
876
- yield result, operation if block_given?
877
- result
877
+ catch :response do
878
+ yield result, operation if block_given?
879
+ result
880
+ end
878
881
  end
879
882
 
880
883
  ##
@@ -903,16 +906,18 @@ module Google
903
906
 
904
907
  response = @client_stub.make_http_request(
905
908
  verb,
906
- uri: uri,
907
- body: body || "",
908
- params: query_string_params,
909
+ uri: uri,
910
+ body: body || "",
911
+ params: query_string_params,
912
+ method_name: "cancel_operation",
909
913
  options: options
910
914
  )
911
915
  operation = ::Gapic::Rest::TransportOperation.new response
912
916
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
913
-
914
- yield result, operation if block_given?
915
- result
917
+ catch :response do
918
+ yield result, operation if block_given?
919
+ result
920
+ end
916
921
  end
917
922
 
918
923
  ##
@@ -941,16 +946,18 @@ module Google
941
946
 
942
947
  response = @client_stub.make_http_request(
943
948
  verb,
944
- uri: uri,
945
- body: body || "",
946
- params: query_string_params,
949
+ uri: uri,
950
+ body: body || "",
951
+ params: query_string_params,
952
+ method_name: "wait_operation",
947
953
  options: options
948
954
  )
949
955
  operation = ::Gapic::Rest::TransportOperation.new response
950
956
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
951
-
952
- yield result, operation if block_given?
953
- result
957
+ catch :response do
958
+ yield result, operation if block_given?
959
+ result
960
+ end
954
961
  end
955
962
 
956
963
  ##
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the predict REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "predict",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::AutoML::V1::PredictResponse.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "batch_predict",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module AutoML
23
23
  module V1
24
- VERSION = "1.0.1"
24
+ VERSION = "1.1.0"
25
25
  end
26
26
  end
27
27
  end
@@ -28,6 +28,9 @@ module Google
28
28
  # @!attribute [rw] destinations
29
29
  # @return [::Array<::Google::Api::ClientLibraryDestination>]
30
30
  # The destination where API teams want this client library to be published.
31
+ # @!attribute [rw] selective_gapic_generation
32
+ # @return [::Google::Api::SelectiveGapicGeneration]
33
+ # Configuration for which RPCs should be generated in the GAPIC client.
31
34
  class CommonLanguageSettings
32
35
  include ::Google::Protobuf::MessageExts
33
36
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -212,6 +215,12 @@ module Google
212
215
  # enabled. By default, asynchronous REST clients will not be generated.
213
216
  # This feature will be enabled by default 1 month after launching the
214
217
  # feature in preview packages.
218
+ # @!attribute [rw] protobuf_pythonic_types_enabled
219
+ # @return [::Boolean]
220
+ # Enables generation of protobuf code using new types that are more
221
+ # Pythonic which are included in `protobuf>=5.29.x`. This feature will be
222
+ # enabled by default 1 month after launching the feature in preview
223
+ # packages.
215
224
  class ExperimentalFeatures
216
225
  include ::Google::Protobuf::MessageExts
217
226
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -297,9 +306,28 @@ module Google
297
306
  # @!attribute [rw] common
298
307
  # @return [::Google::Api::CommonLanguageSettings]
299
308
  # Some settings.
309
+ # @!attribute [rw] renamed_services
310
+ # @return [::Google::Protobuf::Map{::String => ::String}]
311
+ # Map of service names to renamed services. Keys are the package relative
312
+ # service names and values are the name to be used for the service client
313
+ # and call options.
314
+ #
315
+ # publishing:
316
+ # go_settings:
317
+ # renamed_services:
318
+ # Publisher: TopicAdmin
300
319
  class GoSettings
301
320
  include ::Google::Protobuf::MessageExts
302
321
  extend ::Google::Protobuf::MessageExts::ClassMethods
322
+
323
+ # @!attribute [rw] key
324
+ # @return [::String]
325
+ # @!attribute [rw] value
326
+ # @return [::String]
327
+ class RenamedServicesEntry
328
+ include ::Google::Protobuf::MessageExts
329
+ extend ::Google::Protobuf::MessageExts::ClassMethods
330
+ end
303
331
  end
304
332
 
305
333
  # Describes the generator configuration for a method.
@@ -375,6 +403,17 @@ module Google
375
403
  end
376
404
  end
377
405
 
406
+ # This message is used to configure the generation of a subset of the RPCs in
407
+ # a service for client libraries.
408
+ # @!attribute [rw] methods
409
+ # @return [::Array<::String>]
410
+ # An allowlist of the fully qualified names of RPCs that should be included
411
+ # on public client surfaces.
412
+ class SelectiveGapicGeneration
413
+ include ::Google::Protobuf::MessageExts
414
+ extend ::Google::Protobuf::MessageExts::ClassMethods
415
+ end
416
+
378
417
  # The organization for which the client libraries are being published.
379
418
  # Affects the url where generated docs are published, etc.
380
419
  module ClientLibraryOrganization