google-cloud-automl-v1beta1 0.11.0 → 0.12.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.
@@ -26,6 +26,9 @@ module Google
26
26
  module Rest
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ API_VERSION = ""
31
+
29
32
  # @private
30
33
  DEFAULT_ENDPOINT_TEMPLATE = "automl.$UNIVERSE_DOMAIN$"
31
34
 
@@ -112,14 +115,6 @@ module Google
112
115
  # Lists operations that match the specified filter in the request. If the
113
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
114
117
  #
115
- # NOTE: the `name` binding allows API services to override the binding
116
- # to use different resource name schemes, such as `users/*/operations`. To
117
- # override the binding, API services can add a binding such as
118
- # `"/v1/{name=users/*}/operations"` to their service configuration.
119
- # For backwards compatibility, the default name includes the operations
120
- # collection id, however overriding users must ensure the name binding
121
- # is the parent resource, without the operations collection id.
122
- #
123
118
  # @overload list_operations(request, options = nil)
124
119
  # Pass arguments to `list_operations` via a request object, either of type
125
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -181,12 +176,13 @@ module Google
181
176
  # Customize the options with defaults
182
177
  call_metadata = @config.rpcs.list_operations.metadata.to_h
183
178
 
184
- # Set x-goog-api-client and x-goog-user-project headers
179
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
185
180
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
186
181
  lib_name: @config.lib_name, lib_version: @config.lib_version,
187
182
  gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION,
188
183
  transports_version_send: [:rest]
189
184
 
185
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
190
186
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
191
187
 
192
188
  options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
@@ -200,7 +196,7 @@ module Google
200
196
  @operations_stub.list_operations request, options do |result, operation|
201
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
202
198
  yield result, operation if block_given?
203
- return result
199
+ throw :response, result
204
200
  end
205
201
  rescue ::Gapic::Rest::Error => e
206
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -269,12 +265,13 @@ module Google
269
265
  # Customize the options with defaults
270
266
  call_metadata = @config.rpcs.get_operation.metadata.to_h
271
267
 
272
- # Set x-goog-api-client and x-goog-user-project headers
268
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
273
269
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
274
270
  lib_name: @config.lib_name, lib_version: @config.lib_version,
275
271
  gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION,
276
272
  transports_version_send: [:rest]
277
273
 
274
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
278
275
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
279
276
 
280
277
  options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
@@ -288,7 +285,7 @@ module Google
288
285
  @operations_stub.get_operation request, options do |result, operation|
289
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
290
287
  yield result, operation if block_given?
291
- return result
288
+ throw :response, result
292
289
  end
293
290
  rescue ::Gapic::Rest::Error => e
294
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -351,12 +348,13 @@ module Google
351
348
  # Customize the options with defaults
352
349
  call_metadata = @config.rpcs.delete_operation.metadata.to_h
353
350
 
354
- # Set x-goog-api-client and x-goog-user-project headers
351
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
355
352
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
356
353
  lib_name: @config.lib_name, lib_version: @config.lib_version,
357
354
  gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION,
358
355
  transports_version_send: [:rest]
359
356
 
357
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
360
358
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
361
359
 
362
360
  options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
@@ -369,7 +367,6 @@ module Google
369
367
 
370
368
  @operations_stub.delete_operation request, options do |result, operation|
371
369
  yield result, operation if block_given?
372
- return result
373
370
  end
374
371
  rescue ::Gapic::Rest::Error => e
375
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -384,8 +381,9 @@ module Google
384
381
  # other methods to check whether the cancellation succeeded or whether the
385
382
  # operation completed despite cancellation. On successful cancellation,
386
383
  # the operation is not deleted; instead, it becomes an operation with
387
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
388
- # 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`.
389
387
  #
390
388
  # @overload cancel_operation(request, options = nil)
391
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -438,12 +436,13 @@ module Google
438
436
  # Customize the options with defaults
439
437
  call_metadata = @config.rpcs.cancel_operation.metadata.to_h
440
438
 
441
- # Set x-goog-api-client and x-goog-user-project headers
439
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
442
440
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
443
441
  lib_name: @config.lib_name, lib_version: @config.lib_version,
444
442
  gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION,
445
443
  transports_version_send: [:rest]
446
444
 
445
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
447
446
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
448
447
 
449
448
  options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
@@ -456,7 +455,6 @@ module Google
456
455
 
457
456
  @operations_stub.cancel_operation request, options do |result, operation|
458
457
  yield result, operation if block_given?
459
- return result
460
458
  end
461
459
  rescue ::Gapic::Rest::Error => e
462
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -535,12 +533,13 @@ module Google
535
533
  # Customize the options with defaults
536
534
  call_metadata = @config.rpcs.wait_operation.metadata.to_h
537
535
 
538
- # Set x-goog-api-client and x-goog-user-project headers
536
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
539
537
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
540
538
  lib_name: @config.lib_name, lib_version: @config.lib_version,
541
539
  gapic_version: ::Google::Cloud::AutoML::V1beta1::VERSION,
542
540
  transports_version_send: [:rest]
543
541
 
542
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
544
543
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
545
544
 
546
545
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
@@ -554,7 +553,7 @@ module Google
554
553
  @operations_stub.wait_operation request, options do |result, operation|
555
554
  result = ::Gapic::Operation.new result, @operations_client, options: options
556
555
  yield result, operation if block_given?
557
- return result
556
+ throw :response, result
558
557
  end
559
558
  rescue ::Gapic::Rest::Error => e
560
559
  raise ::Google::Cloud::Error.from_error(e)
@@ -634,6 +633,11 @@ module Google
634
633
  # default endpoint URL. The default value of nil uses the environment
635
634
  # universe (usually the default "googleapis.com" universe).
636
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]
637
641
  #
638
642
  class Configuration
639
643
  extend ::Gapic::Config
@@ -655,6 +659,7 @@ module Google
655
659
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
656
660
  config_attr :quota_project, nil, ::String, nil
657
661
  config_attr :universe_domain, nil, ::String, nil
662
+ config_attr :logger, :default, ::Logger, nil, :default
658
663
 
659
664
  # @private
660
665
  def initialize parent_config = nil
@@ -781,16 +786,18 @@ module Google
781
786
 
782
787
  response = @client_stub.make_http_request(
783
788
  verb,
784
- uri: uri,
785
- body: body || "",
786
- params: query_string_params,
789
+ uri: uri,
790
+ body: body || "",
791
+ params: query_string_params,
792
+ method_name: "list_operations",
787
793
  options: options
788
794
  )
789
795
  operation = ::Gapic::Rest::TransportOperation.new response
790
796
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
791
-
792
- yield result, operation if block_given?
793
- result
797
+ catch :response do
798
+ yield result, operation if block_given?
799
+ result
800
+ end
794
801
  end
795
802
 
796
803
  ##
@@ -819,16 +826,18 @@ module Google
819
826
 
820
827
  response = @client_stub.make_http_request(
821
828
  verb,
822
- uri: uri,
823
- body: body || "",
824
- params: query_string_params,
829
+ uri: uri,
830
+ body: body || "",
831
+ params: query_string_params,
832
+ method_name: "get_operation",
825
833
  options: options
826
834
  )
827
835
  operation = ::Gapic::Rest::TransportOperation.new response
828
836
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
829
-
830
- yield result, operation if block_given?
831
- result
837
+ catch :response do
838
+ yield result, operation if block_given?
839
+ result
840
+ end
832
841
  end
833
842
 
834
843
  ##
@@ -857,16 +866,18 @@ module Google
857
866
 
858
867
  response = @client_stub.make_http_request(
859
868
  verb,
860
- uri: uri,
861
- body: body || "",
862
- params: query_string_params,
869
+ uri: uri,
870
+ body: body || "",
871
+ params: query_string_params,
872
+ method_name: "delete_operation",
863
873
  options: options
864
874
  )
865
875
  operation = ::Gapic::Rest::TransportOperation.new response
866
876
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
867
-
868
- yield result, operation if block_given?
869
- result
877
+ catch :response do
878
+ yield result, operation if block_given?
879
+ result
880
+ end
870
881
  end
871
882
 
872
883
  ##
@@ -895,16 +906,18 @@ module Google
895
906
 
896
907
  response = @client_stub.make_http_request(
897
908
  verb,
898
- uri: uri,
899
- body: body || "",
900
- params: query_string_params,
909
+ uri: uri,
910
+ body: body || "",
911
+ params: query_string_params,
912
+ method_name: "cancel_operation",
901
913
  options: options
902
914
  )
903
915
  operation = ::Gapic::Rest::TransportOperation.new response
904
916
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
905
-
906
- yield result, operation if block_given?
907
- result
917
+ catch :response do
918
+ yield result, operation if block_given?
919
+ result
920
+ end
908
921
  end
909
922
 
910
923
  ##
@@ -933,16 +946,18 @@ module Google
933
946
 
934
947
  response = @client_stub.make_http_request(
935
948
  verb,
936
- uri: uri,
937
- body: body || "",
938
- params: query_string_params,
949
+ uri: uri,
950
+ body: body || "",
951
+ params: query_string_params,
952
+ method_name: "wait_operation",
939
953
  options: options
940
954
  )
941
955
  operation = ::Gapic::Rest::TransportOperation.new response
942
956
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
943
-
944
- yield result, operation if block_given?
945
- result
957
+ catch :response do
958
+ yield result, operation if block_given?
959
+ result
960
+ end
946
961
  end
947
962
 
948
963
  ##