google-cloud-automl-v1 0.6.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/automl/v1/annotation_payload_pb.rb +29 -12
  4. data/lib/google/cloud/automl/v1/annotation_spec_pb.rb +24 -6
  5. data/lib/google/cloud/automl/v1/automl/client.rb +16 -5
  6. data/lib/google/cloud/automl/v1/automl/operations.rb +15 -4
  7. data/lib/google/cloud/automl/v1/automl/rest/client.rb +369 -4
  8. data/lib/google/cloud/automl/v1/automl/rest/operations.rb +108 -8
  9. data/lib/google/cloud/automl/v1/automl/rest/service_stub.rb +18 -18
  10. data/lib/google/cloud/automl/v1/classification_pb.rb +24 -41
  11. data/lib/google/cloud/automl/v1/data_items_pb.rb +27 -55
  12. data/lib/google/cloud/automl/v1/dataset_pb.rb +28 -18
  13. data/lib/google/cloud/automl/v1/detection_pb.rb +25 -21
  14. data/lib/google/cloud/automl/v1/geometry_pb.rb +24 -8
  15. data/lib/google/cloud/automl/v1/image_pb.rb +24 -29
  16. data/lib/google/cloud/automl/v1/io_pb.rb +24 -38
  17. data/lib/google/cloud/automl/v1/model_evaluation_pb.rb +30 -15
  18. data/lib/google/cloud/automl/v1/model_pb.rb +28 -24
  19. data/lib/google/cloud/automl/v1/operations_pb.rb +27 -53
  20. data/lib/google/cloud/automl/v1/prediction_service/client.rb +16 -5
  21. data/lib/google/cloud/automl/v1/prediction_service/operations.rb +15 -4
  22. data/lib/google/cloud/automl/v1/prediction_service/rest/client.rb +45 -4
  23. data/lib/google/cloud/automl/v1/prediction_service/rest/operations.rb +108 -8
  24. data/lib/google/cloud/automl/v1/prediction_service/rest/service_stub.rb +2 -2
  25. data/lib/google/cloud/automl/v1/prediction_service_pb.rb +27 -20
  26. data/lib/google/cloud/automl/v1/service_pb.rb +30 -87
  27. data/lib/google/cloud/automl/v1/text_extraction_pb.rb +25 -17
  28. data/lib/google/cloud/automl/v1/text_pb.rb +24 -16
  29. data/lib/google/cloud/automl/v1/text_segment_pb.rb +24 -6
  30. data/lib/google/cloud/automl/v1/text_sentiment_pb.rb +25 -14
  31. data/lib/google/cloud/automl/v1/translation_pb.rb +25 -17
  32. data/lib/google/cloud/automl/v1/version.rb +1 -1
  33. data/proto_docs/google/api/client.rb +67 -4
  34. data/proto_docs/google/api/field_behavior.rb +14 -0
  35. data/proto_docs/google/protobuf/any.rb +7 -4
  36. data/proto_docs/google/protobuf/timestamp.rb +1 -3
  37. metadata +5 -5
@@ -126,7 +126,7 @@ module Google
126
126
  credentials = @config.credentials
127
127
  # Use self-signed JWT if the endpoint is unchanged from default,
128
128
  # but only if the default endpoint does not have a region prefix.
129
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
129
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
130
130
  !@config.endpoint.split(".").first.include?("-")
131
131
  credentials ||= Credentials.default scope: @config.scope,
132
132
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -251,6 +251,22 @@ module Google
251
251
  # @return [::Google::Cloud::AutoML::V1::PredictResponse]
252
252
  #
253
253
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
254
+ #
255
+ # @example Basic example
256
+ # require "google/cloud/automl/v1"
257
+ #
258
+ # # Create a client object. The client can be reused for multiple calls.
259
+ # client = Google::Cloud::AutoML::V1::PredictionService::Rest::Client.new
260
+ #
261
+ # # Create a request. To set request fields, pass in keyword arguments.
262
+ # request = Google::Cloud::AutoML::V1::PredictRequest.new
263
+ #
264
+ # # Call the predict method.
265
+ # result = client.predict request
266
+ #
267
+ # # The returned object is of type Google::Cloud::AutoML::V1::PredictResponse.
268
+ # p result
269
+ #
254
270
  def predict request, options = nil
255
271
  raise ::ArgumentError, "request must be provided" if request.nil?
256
272
 
@@ -416,6 +432,29 @@ module Google
416
432
  # @return [::Gapic::Operation]
417
433
  #
418
434
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
435
+ #
436
+ # @example Basic example
437
+ # require "google/cloud/automl/v1"
438
+ #
439
+ # # Create a client object. The client can be reused for multiple calls.
440
+ # client = Google::Cloud::AutoML::V1::PredictionService::Rest::Client.new
441
+ #
442
+ # # Create a request. To set request fields, pass in keyword arguments.
443
+ # request = Google::Cloud::AutoML::V1::BatchPredictRequest.new
444
+ #
445
+ # # Call the batch_predict method.
446
+ # result = client.batch_predict request
447
+ #
448
+ # # The returned object is of type Gapic::Operation. You can use it to
449
+ # # check the status of an operation, cancel it, or wait for results.
450
+ # # Here is how to wait for a response.
451
+ # result.wait_until_done! timeout: 60
452
+ # if result.response?
453
+ # p result.response
454
+ # else
455
+ # puts "No response received."
456
+ # end
457
+ #
419
458
  def batch_predict request, options = nil
420
459
  raise ::ArgumentError, "request must be provided" if request.nil?
421
460
 
@@ -490,9 +529,9 @@ module Google
490
529
  # * (`String`) The path to a service account key file in JSON format
491
530
  # * (`Hash`) A service account key as a Hash
492
531
  # * (`Google::Auth::Credentials`) A googleauth credentials object
493
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
532
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
494
533
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
495
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
534
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
496
535
  # * (`nil`) indicating no credentials
497
536
  # @return [::Object]
498
537
  # @!attribute [rw] scope
@@ -525,7 +564,9 @@ module Google
525
564
  class Configuration
526
565
  extend ::Gapic::Config
527
566
 
528
- config_attr :endpoint, "automl.googleapis.com", ::String
567
+ DEFAULT_ENDPOINT = "automl.googleapis.com"
568
+
569
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
529
570
  config_attr :credentials, nil do |value|
530
571
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
531
572
  allowed.any? { |klass| klass === value }
@@ -136,6 +136,26 @@ module Google
136
136
  # @return [::Gapic::Operation]
137
137
  #
138
138
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
139
+ #
140
+ # @example Basic example
141
+ # require "google/longrunning"
142
+ #
143
+ # # Create a client object. The client can be reused for multiple calls.
144
+ # client = Google::Longrunning::Operations::Rest::Client.new
145
+ #
146
+ # # Create a request. To set request fields, pass in keyword arguments.
147
+ # request = Google::Longrunning::ListOperationsRequest.new
148
+ #
149
+ # # Call the list_operations method.
150
+ # result = client.list_operations request
151
+ #
152
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
153
+ # # over elements, and API calls will be issued to fetch pages as needed.
154
+ # result.each do |item|
155
+ # # Each element is of type ::Google::Longrunning::Operation.
156
+ # p item
157
+ # end
158
+ #
139
159
  def list_operations request, options = nil
140
160
  raise ::ArgumentError, "request must be provided" if request.nil?
141
161
 
@@ -201,6 +221,29 @@ module Google
201
221
  # @return [::Gapic::Operation]
202
222
  #
203
223
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
224
+ #
225
+ # @example Basic example
226
+ # require "google/longrunning"
227
+ #
228
+ # # Create a client object. The client can be reused for multiple calls.
229
+ # client = Google::Longrunning::Operations::Rest::Client.new
230
+ #
231
+ # # Create a request. To set request fields, pass in keyword arguments.
232
+ # request = Google::Longrunning::GetOperationRequest.new
233
+ #
234
+ # # Call the get_operation method.
235
+ # result = client.get_operation request
236
+ #
237
+ # # The returned object is of type Gapic::Operation. You can use it to
238
+ # # check the status of an operation, cancel it, or wait for results.
239
+ # # Here is how to wait for a response.
240
+ # result.wait_until_done! timeout: 60
241
+ # if result.response?
242
+ # p result.response
243
+ # else
244
+ # puts "No response received."
245
+ # end
246
+ #
204
247
  def get_operation request, options = nil
205
248
  raise ::ArgumentError, "request must be provided" if request.nil?
206
249
 
@@ -267,6 +310,22 @@ module Google
267
310
  # @return [::Google::Protobuf::Empty]
268
311
  #
269
312
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
313
+ #
314
+ # @example Basic example
315
+ # require "google/longrunning"
316
+ #
317
+ # # Create a client object. The client can be reused for multiple calls.
318
+ # client = Google::Longrunning::Operations::Rest::Client.new
319
+ #
320
+ # # Create a request. To set request fields, pass in keyword arguments.
321
+ # request = Google::Longrunning::DeleteOperationRequest.new
322
+ #
323
+ # # Call the delete_operation method.
324
+ # result = client.delete_operation request
325
+ #
326
+ # # The returned object is of type Google::Protobuf::Empty.
327
+ # p result
328
+ #
270
329
  def delete_operation request, options = nil
271
330
  raise ::ArgumentError, "request must be provided" if request.nil?
272
331
 
@@ -338,6 +397,22 @@ module Google
338
397
  # @return [::Google::Protobuf::Empty]
339
398
  #
340
399
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
400
+ #
401
+ # @example Basic example
402
+ # require "google/longrunning"
403
+ #
404
+ # # Create a client object. The client can be reused for multiple calls.
405
+ # client = Google::Longrunning::Operations::Rest::Client.new
406
+ #
407
+ # # Create a request. To set request fields, pass in keyword arguments.
408
+ # request = Google::Longrunning::CancelOperationRequest.new
409
+ #
410
+ # # Call the cancel_operation method.
411
+ # result = client.cancel_operation request
412
+ #
413
+ # # The returned object is of type Google::Protobuf::Empty.
414
+ # p result
415
+ #
341
416
  def cancel_operation request, options = nil
342
417
  raise ::ArgumentError, "request must be provided" if request.nil?
343
418
 
@@ -412,6 +487,29 @@ module Google
412
487
  # @return [::Gapic::Operation]
413
488
  #
414
489
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
490
+ #
491
+ # @example Basic example
492
+ # require "google/longrunning"
493
+ #
494
+ # # Create a client object. The client can be reused for multiple calls.
495
+ # client = Google::Longrunning::Operations::Rest::Client.new
496
+ #
497
+ # # Create a request. To set request fields, pass in keyword arguments.
498
+ # request = Google::Longrunning::WaitOperationRequest.new
499
+ #
500
+ # # Call the wait_operation method.
501
+ # result = client.wait_operation request
502
+ #
503
+ # # The returned object is of type Gapic::Operation. You can use it to
504
+ # # check the status of an operation, cancel it, or wait for results.
505
+ # # Here is how to wait for a response.
506
+ # result.wait_until_done! timeout: 60
507
+ # if result.response?
508
+ # p result.response
509
+ # else
510
+ # puts "No response received."
511
+ # end
512
+ #
415
513
  def wait_operation request, options = nil
416
514
  raise ::ArgumentError, "request must be provided" if request.nil?
417
515
 
@@ -486,9 +584,9 @@ module Google
486
584
  # * (`String`) The path to a service account key file in JSON format
487
585
  # * (`Hash`) A service account key as a Hash
488
586
  # * (`Google::Auth::Credentials`) A googleauth credentials object
489
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
587
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
490
588
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
491
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
589
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
492
590
  # * (`nil`) indicating no credentials
493
591
  # @return [::Object]
494
592
  # @!attribute [rw] scope
@@ -521,7 +619,9 @@ module Google
521
619
  class Configuration
522
620
  extend ::Gapic::Config
523
621
 
524
- config_attr :endpoint, "automl.googleapis.com", ::String
622
+ DEFAULT_ENDPOINT = "automl.googleapis.com"
623
+
624
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
525
625
  config_attr :credentials, nil do |value|
526
626
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
527
627
  allowed.any? { |klass| klass === value }
@@ -649,7 +749,7 @@ module Google
649
749
 
650
750
  verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
651
751
  query_string_params = if query_string_params.any?
652
- query_string_params.to_h { |p| p.split("=", 2) }
752
+ query_string_params.to_h { |p| p.split "=", 2 }
653
753
  else
654
754
  {}
655
755
  end
@@ -687,7 +787,7 @@ module Google
687
787
 
688
788
  verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
689
789
  query_string_params = if query_string_params.any?
690
- query_string_params.to_h { |p| p.split("=", 2) }
790
+ query_string_params.to_h { |p| p.split "=", 2 }
691
791
  else
692
792
  {}
693
793
  end
@@ -725,7 +825,7 @@ module Google
725
825
 
726
826
  verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
727
827
  query_string_params = if query_string_params.any?
728
- query_string_params.to_h { |p| p.split("=", 2) }
828
+ query_string_params.to_h { |p| p.split "=", 2 }
729
829
  else
730
830
  {}
731
831
  end
@@ -763,7 +863,7 @@ module Google
763
863
 
764
864
  verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
765
865
  query_string_params = if query_string_params.any?
766
- query_string_params.to_h { |p| p.split("=", 2) }
866
+ query_string_params.to_h { |p| p.split "=", 2 }
767
867
  else
768
868
  {}
769
869
  end
@@ -801,7 +901,7 @@ module Google
801
901
 
802
902
  verb, uri, query_string_params, body = OperationsServiceStub.transcode_wait_operation_request request_pb
803
903
  query_string_params = if query_string_params.any?
804
- query_string_params.to_h { |p| p.split("=", 2) }
904
+ query_string_params.to_h { |p| p.split "=", 2 }
805
905
  else
806
906
  {}
807
907
  end
@@ -59,7 +59,7 @@ module Google
59
59
 
60
60
  verb, uri, query_string_params, body = ServiceStub.transcode_predict_request request_pb
61
61
  query_string_params = if query_string_params.any?
62
- query_string_params.to_h { |p| p.split("=", 2) }
62
+ query_string_params.to_h { |p| p.split "=", 2 }
63
63
  else
64
64
  {}
65
65
  end
@@ -97,7 +97,7 @@ module Google
97
97
 
98
98
  verb, uri, query_string_params, body = ServiceStub.transcode_batch_predict_request request_pb
99
99
  query_string_params = if query_string_params.any?
100
- query_string_params.to_h { |p| p.split("=", 2) }
100
+ query_string_params.to_h { |p| p.split "=", 2 }
101
101
  else
102
102
  {}
103
103
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: google/cloud/automl/v1/prediction_service.proto
3
4
 
@@ -12,28 +13,34 @@ require 'google/cloud/automl/v1/data_items_pb'
12
13
  require 'google/cloud/automl/v1/io_pb'
13
14
  require 'google/longrunning/operations_pb'
14
15
 
15
- Google::Protobuf::DescriptorPool.generated_pool.build do
16
- add_file("google/cloud/automl/v1/prediction_service.proto", :syntax => :proto3) do
17
- add_message "google.cloud.automl.v1.PredictRequest" do
18
- optional :name, :string, 1
19
- optional :payload, :message, 2, "google.cloud.automl.v1.ExamplePayload"
20
- map :params, :string, :string, 3
21
- end
22
- add_message "google.cloud.automl.v1.PredictResponse" do
23
- repeated :payload, :message, 1, "google.cloud.automl.v1.AnnotationPayload"
24
- optional :preprocessed_input, :message, 3, "google.cloud.automl.v1.ExamplePayload"
25
- map :metadata, :string, :string, 2
26
- end
27
- add_message "google.cloud.automl.v1.BatchPredictRequest" do
28
- optional :name, :string, 1
29
- optional :input_config, :message, 3, "google.cloud.automl.v1.BatchPredictInputConfig"
30
- optional :output_config, :message, 4, "google.cloud.automl.v1.BatchPredictOutputConfig"
31
- map :params, :string, :string, 5
32
- end
33
- add_message "google.cloud.automl.v1.BatchPredictResult" do
34
- map :metadata, :string, :string, 1
16
+
17
+ descriptor_data = "\n/google/cloud/automl/v1/prediction_service.proto\x12\x16google.cloud.automl.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a/google/cloud/automl/v1/annotation_payload.proto\x1a\'google/cloud/automl/v1/data_items.proto\x1a\x1fgoogle/cloud/automl/v1/io.proto\x1a#google/longrunning/operations.proto\"\xf4\x01\n\x0ePredictRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1b\x61utoml.googleapis.com/Model\x12<\n\x07payload\x18\x02 \x01(\x0b\x32&.google.cloud.automl.v1.ExamplePayloadB\x03\xe0\x41\x02\x12\x42\n\x06params\x18\x03 \x03(\x0b\x32\x32.google.cloud.automl.v1.PredictRequest.ParamsEntry\x1a-\n\x0bParamsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x8b\x02\n\x0fPredictResponse\x12:\n\x07payload\x18\x01 \x03(\x0b\x32).google.cloud.automl.v1.AnnotationPayload\x12\x42\n\x12preprocessed_input\x18\x03 \x01(\x0b\x32&.google.cloud.automl.v1.ExamplePayload\x12G\n\x08metadata\x18\x02 \x03(\x0b\x32\x35.google.cloud.automl.v1.PredictResponse.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xda\x02\n\x13\x42\x61tchPredictRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1b\x61utoml.googleapis.com/Model\x12J\n\x0cinput_config\x18\x03 \x01(\x0b\x32/.google.cloud.automl.v1.BatchPredictInputConfigB\x03\xe0\x41\x02\x12L\n\routput_config\x18\x04 \x01(\x0b\x32\x30.google.cloud.automl.v1.BatchPredictOutputConfigB\x03\xe0\x41\x02\x12G\n\x06params\x18\x05 \x03(\x0b\x32\x37.google.cloud.automl.v1.BatchPredictRequest.ParamsEntry\x1a-\n\x0bParamsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x91\x01\n\x12\x42\x61tchPredictResult\x12J\n\x08metadata\x18\x01 \x03(\x0b\x32\x38.google.cloud.automl.v1.BatchPredictResult.MetadataEntry\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x32\x85\x04\n\x11PredictionService\x12\xaf\x01\n\x07Predict\x12&.google.cloud.automl.v1.PredictRequest\x1a\'.google.cloud.automl.v1.PredictResponse\"S\x82\xd3\xe4\x93\x02\x37\"2/v1/{name=projects/*/locations/*/models/*}:predict:\x01*\xda\x41\x13name,payload,params\x12\xf2\x01\n\x0c\x42\x61tchPredict\x12+.google.cloud.automl.v1.BatchPredictRequest\x1a\x1d.google.longrunning.Operation\"\x95\x01\x82\xd3\xe4\x93\x02<\"7/v1/{name=projects/*/locations/*/models/*}:batchPredict:\x01*\xda\x41&name,input_config,output_config,params\xca\x41\'\n\x12\x42\x61tchPredictResult\x12\x11OperationMetadata\x1aI\xca\x41\x15\x61utoml.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xb8\x01\n\x1a\x63om.google.cloud.automl.v1B\x16PredictionServiceProtoP\x01Z2cloud.google.com/go/automl/apiv1/automlpb;automlpb\xaa\x02\x16Google.Cloud.AutoML.V1\xca\x02\x16Google\\Cloud\\AutoMl\\V1\xea\x02\x19Google::Cloud::AutoML::V1b\x06proto3"
18
+
19
+ pool = Google::Protobuf::DescriptorPool.generated_pool
20
+
21
+ begin
22
+ pool.add_serialized_file(descriptor_data)
23
+ rescue TypeError => e
24
+ # Compatibility code: will be removed in the next major version.
25
+ require 'google/protobuf/descriptor_pb'
26
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
27
+ parsed.clear_dependency
28
+ serialized = parsed.class.encode(parsed)
29
+ file = pool.add_serialized_file(serialized)
30
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
31
+ imports = [
32
+ ["google.cloud.automl.v1.ExamplePayload", "google/cloud/automl/v1/data_items.proto"],
33
+ ["google.cloud.automl.v1.AnnotationPayload", "google/cloud/automl/v1/annotation_payload.proto"],
34
+ ["google.cloud.automl.v1.BatchPredictInputConfig", "google/cloud/automl/v1/io.proto"],
35
+ ]
36
+ imports.each do |type_name, expected_filename|
37
+ import_file = pool.lookup(type_name).file_descriptor
38
+ if import_file.name != expected_filename
39
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
35
40
  end
36
41
  end
42
+ warn "Each proto file must use a consistent fully-qualified name."
43
+ warn "This will become an error in the next major version."
37
44
  end
38
45
 
39
46
  module Google
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: google/cloud/automl/v1/service.proto
3
4
 
@@ -17,95 +18,37 @@ require 'google/cloud/automl/v1/model_evaluation_pb'
17
18
  require 'google/longrunning/operations_pb'
18
19
  require 'google/protobuf/field_mask_pb'
19
20
 
20
- Google::Protobuf::DescriptorPool.generated_pool.build do
21
- add_file("google/cloud/automl/v1/service.proto", :syntax => :proto3) do
22
- add_message "google.cloud.automl.v1.CreateDatasetRequest" do
23
- optional :parent, :string, 1
24
- optional :dataset, :message, 2, "google.cloud.automl.v1.Dataset"
25
- end
26
- add_message "google.cloud.automl.v1.GetDatasetRequest" do
27
- optional :name, :string, 1
28
- end
29
- add_message "google.cloud.automl.v1.ListDatasetsRequest" do
30
- optional :parent, :string, 1
31
- optional :filter, :string, 3
32
- optional :page_size, :int32, 4
33
- optional :page_token, :string, 6
34
- end
35
- add_message "google.cloud.automl.v1.ListDatasetsResponse" do
36
- repeated :datasets, :message, 1, "google.cloud.automl.v1.Dataset"
37
- optional :next_page_token, :string, 2
38
- end
39
- add_message "google.cloud.automl.v1.UpdateDatasetRequest" do
40
- optional :dataset, :message, 1, "google.cloud.automl.v1.Dataset"
41
- optional :update_mask, :message, 2, "google.protobuf.FieldMask"
42
- end
43
- add_message "google.cloud.automl.v1.DeleteDatasetRequest" do
44
- optional :name, :string, 1
45
- end
46
- add_message "google.cloud.automl.v1.ImportDataRequest" do
47
- optional :name, :string, 1
48
- optional :input_config, :message, 3, "google.cloud.automl.v1.InputConfig"
49
- end
50
- add_message "google.cloud.automl.v1.ExportDataRequest" do
51
- optional :name, :string, 1
52
- optional :output_config, :message, 3, "google.cloud.automl.v1.OutputConfig"
53
- end
54
- add_message "google.cloud.automl.v1.GetAnnotationSpecRequest" do
55
- optional :name, :string, 1
56
- end
57
- add_message "google.cloud.automl.v1.CreateModelRequest" do
58
- optional :parent, :string, 1
59
- optional :model, :message, 4, "google.cloud.automl.v1.Model"
60
- end
61
- add_message "google.cloud.automl.v1.GetModelRequest" do
62
- optional :name, :string, 1
63
- end
64
- add_message "google.cloud.automl.v1.ListModelsRequest" do
65
- optional :parent, :string, 1
66
- optional :filter, :string, 3
67
- optional :page_size, :int32, 4
68
- optional :page_token, :string, 6
69
- end
70
- add_message "google.cloud.automl.v1.ListModelsResponse" do
71
- repeated :model, :message, 1, "google.cloud.automl.v1.Model"
72
- optional :next_page_token, :string, 2
73
- end
74
- add_message "google.cloud.automl.v1.DeleteModelRequest" do
75
- optional :name, :string, 1
76
- end
77
- add_message "google.cloud.automl.v1.UpdateModelRequest" do
78
- optional :model, :message, 1, "google.cloud.automl.v1.Model"
79
- optional :update_mask, :message, 2, "google.protobuf.FieldMask"
80
- end
81
- add_message "google.cloud.automl.v1.DeployModelRequest" do
82
- optional :name, :string, 1
83
- oneof :model_deployment_metadata do
84
- optional :image_object_detection_model_deployment_metadata, :message, 2, "google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata"
85
- optional :image_classification_model_deployment_metadata, :message, 4, "google.cloud.automl.v1.ImageClassificationModelDeploymentMetadata"
86
- end
87
- end
88
- add_message "google.cloud.automl.v1.UndeployModelRequest" do
89
- optional :name, :string, 1
90
- end
91
- add_message "google.cloud.automl.v1.ExportModelRequest" do
92
- optional :name, :string, 1
93
- optional :output_config, :message, 3, "google.cloud.automl.v1.ModelExportOutputConfig"
94
- end
95
- add_message "google.cloud.automl.v1.GetModelEvaluationRequest" do
96
- optional :name, :string, 1
97
- end
98
- add_message "google.cloud.automl.v1.ListModelEvaluationsRequest" do
99
- optional :parent, :string, 1
100
- optional :filter, :string, 3
101
- optional :page_size, :int32, 4
102
- optional :page_token, :string, 6
103
- end
104
- add_message "google.cloud.automl.v1.ListModelEvaluationsResponse" do
105
- repeated :model_evaluation, :message, 1, "google.cloud.automl.v1.ModelEvaluation"
106
- optional :next_page_token, :string, 2
21
+
22
+ descriptor_data = "\n$google/cloud/automl/v1/service.proto\x12\x16google.cloud.automl.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a/google/cloud/automl/v1/annotation_payload.proto\x1a,google/cloud/automl/v1/annotation_spec.proto\x1a$google/cloud/automl/v1/dataset.proto\x1a\"google/cloud/automl/v1/image.proto\x1a\x1fgoogle/cloud/automl/v1/io.proto\x1a\"google/cloud/automl/v1/model.proto\x1a-google/cloud/automl/v1/model_evaluation.proto\x1a#google/longrunning/operations.proto\x1a google/protobuf/field_mask.proto\"\x88\x01\n\x14\x43reateDatasetRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x35\n\x07\x64\x61taset\x18\x02 \x01(\x0b\x32\x1f.google.cloud.automl.v1.DatasetB\x03\xe0\x41\x02\"H\n\x11GetDatasetRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x61utoml.googleapis.com/Dataset\"\x87\x01\n\x13ListDatasetsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x0e\n\x06\x66ilter\x18\x03 \x01(\t\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x12\n\npage_token\x18\x06 \x01(\t\"b\n\x14ListDatasetsResponse\x12\x31\n\x08\x64\x61tasets\x18\x01 \x03(\x0b\x32\x1f.google.cloud.automl.v1.Dataset\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\x83\x01\n\x14UpdateDatasetRequest\x12\x35\n\x07\x64\x61taset\x18\x01 \x01(\x0b\x32\x1f.google.cloud.automl.v1.DatasetB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02\"K\n\x14\x44\x65leteDatasetRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x61utoml.googleapis.com/Dataset\"\x88\x01\n\x11ImportDataRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x61utoml.googleapis.com/Dataset\x12>\n\x0cinput_config\x18\x03 \x01(\x0b\x32#.google.cloud.automl.v1.InputConfigB\x03\xe0\x41\x02\"\x8a\x01\n\x11\x45xportDataRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x61utoml.googleapis.com/Dataset\x12@\n\routput_config\x18\x03 \x01(\x0b\x32$.google.cloud.automl.v1.OutputConfigB\x03\xe0\x41\x02\"V\n\x18GetAnnotationSpecRequest\x12:\n\x04name\x18\x01 \x01(\tB,\xe0\x41\x02\xfa\x41&\n$automl.googleapis.com/AnnotationSpec\"\x82\x01\n\x12\x43reateModelRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x31\n\x05model\x18\x04 \x01(\x0b\x32\x1d.google.cloud.automl.v1.ModelB\x03\xe0\x41\x02\"D\n\x0fGetModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1b\x61utoml.googleapis.com/Model\"\x85\x01\n\x11ListModelsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x0e\n\x06\x66ilter\x18\x03 \x01(\t\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x12\n\npage_token\x18\x06 \x01(\t\"[\n\x12ListModelsResponse\x12,\n\x05model\x18\x01 \x03(\x0b\x32\x1d.google.cloud.automl.v1.Model\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"G\n\x12\x44\x65leteModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1b\x61utoml.googleapis.com/Model\"}\n\x12UpdateModelRequest\x12\x31\n\x05model\x18\x01 \x01(\x0b\x32\x1d.google.cloud.automl.v1.ModelB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02\"\xe3\x02\n\x12\x44\x65ployModelRequest\x12\x7f\n0image_object_detection_model_deployment_metadata\x18\x02 \x01(\x0b\x32\x43.google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadataH\x00\x12|\n.image_classification_model_deployment_metadata\x18\x04 \x01(\x0b\x32\x42.google.cloud.automl.v1.ImageClassificationModelDeploymentMetadataH\x00\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1b\x61utoml.googleapis.com/ModelB\x1b\n\x19model_deployment_metadata\"I\n\x14UndeployModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1b\x61utoml.googleapis.com/Model\"\x94\x01\n\x12\x45xportModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1b\x61utoml.googleapis.com/Model\x12K\n\routput_config\x18\x03 \x01(\x0b\x32/.google.cloud.automl.v1.ModelExportOutputConfigB\x03\xe0\x41\x02\"X\n\x19GetModelEvaluationRequest\x12;\n\x04name\x18\x01 \x01(\tB-\xe0\x41\x02\xfa\x41\'\n%automl.googleapis.com/ModelEvaluation\"\x8e\x01\n\x1bListModelEvaluationsRequest\x12\x33\n\x06parent\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1b\x61utoml.googleapis.com/Model\x12\x13\n\x06\x66ilter\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x12\n\npage_token\x18\x06 \x01(\t\"z\n\x1cListModelEvaluationsResponse\x12\x41\n\x10model_evaluation\x18\x01 \x03(\x0b\x32\'.google.cloud.automl.v1.ModelEvaluation\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t2\xe8\x1b\n\x06\x41utoMl\x12\xcb\x01\n\rCreateDataset\x12,.google.cloud.automl.v1.CreateDatasetRequest\x1a\x1d.google.longrunning.Operation\"m\x82\xd3\xe4\x93\x02\x37\",/v1/{parent=projects/*/locations/*}/datasets:\x07\x64\x61taset\xda\x41\x0eparent,dataset\xca\x41\x1c\n\x07\x44\x61taset\x12\x11OperationMetadata\x12\x95\x01\n\nGetDataset\x12).google.cloud.automl.v1.GetDatasetRequest\x1a\x1f.google.cloud.automl.v1.Dataset\";\x82\xd3\xe4\x93\x02.\x12,/v1/{name=projects/*/locations/*/datasets/*}\xda\x41\x04name\x12\xa8\x01\n\x0cListDatasets\x12+.google.cloud.automl.v1.ListDatasetsRequest\x1a,.google.cloud.automl.v1.ListDatasetsResponse\"=\x82\xd3\xe4\x93\x02.\x12,/v1/{parent=projects/*/locations/*}/datasets\xda\x41\x06parent\x12\xbb\x01\n\rUpdateDataset\x12,.google.cloud.automl.v1.UpdateDatasetRequest\x1a\x1f.google.cloud.automl.v1.Dataset\"[\x82\xd3\xe4\x93\x02?24/v1/{dataset.name=projects/*/locations/*/datasets/*}:\x07\x64\x61taset\xda\x41\x13\x64\x61taset,update_mask\x12\xc6\x01\n\rDeleteDataset\x12,.google.cloud.automl.v1.DeleteDatasetRequest\x1a\x1d.google.longrunning.Operation\"h\x82\xd3\xe4\x93\x02.*,/v1/{name=projects/*/locations/*/datasets/*}\xda\x41\x04name\xca\x41*\n\x15google.protobuf.Empty\x12\x11OperationMetadata\x12\xdc\x01\n\nImportData\x12).google.cloud.automl.v1.ImportDataRequest\x1a\x1d.google.longrunning.Operation\"\x83\x01\x82\xd3\xe4\x93\x02<\"7/v1/{name=projects/*/locations/*/datasets/*}:importData:\x01*\xda\x41\x11name,input_config\xca\x41*\n\x15google.protobuf.Empty\x12\x11OperationMetadata\x12\xdd\x01\n\nExportData\x12).google.cloud.automl.v1.ExportDataRequest\x1a\x1d.google.longrunning.Operation\"\x84\x01\x82\xd3\xe4\x93\x02<\"7/v1/{name=projects/*/locations/*/datasets/*}:exportData:\x01*\xda\x41\x12name,output_config\xca\x41*\n\x15google.protobuf.Empty\x12\x11OperationMetadata\x12\xbc\x01\n\x11GetAnnotationSpec\x12\x30.google.cloud.automl.v1.GetAnnotationSpecRequest\x1a&.google.cloud.automl.v1.AnnotationSpec\"M\x82\xd3\xe4\x93\x02@\x12>/v1/{name=projects/*/locations/*/datasets/*/annotationSpecs/*}\xda\x41\x04name\x12\xbf\x01\n\x0b\x43reateModel\x12*.google.cloud.automl.v1.CreateModelRequest\x1a\x1d.google.longrunning.Operation\"e\x82\xd3\xe4\x93\x02\x33\"*/v1/{parent=projects/*/locations/*}/models:\x05model\xda\x41\x0cparent,model\xca\x41\x1a\n\x05Model\x12\x11OperationMetadata\x12\x8d\x01\n\x08GetModel\x12\'.google.cloud.automl.v1.GetModelRequest\x1a\x1d.google.cloud.automl.v1.Model\"9\x82\xd3\xe4\x93\x02,\x12*/v1/{name=projects/*/locations/*/models/*}\xda\x41\x04name\x12\xa0\x01\n\nListModels\x12).google.cloud.automl.v1.ListModelsRequest\x1a*.google.cloud.automl.v1.ListModelsResponse\";\x82\xd3\xe4\x93\x02,\x12*/v1/{parent=projects/*/locations/*}/models\xda\x41\x06parent\x12\xc0\x01\n\x0b\x44\x65leteModel\x12*.google.cloud.automl.v1.DeleteModelRequest\x1a\x1d.google.longrunning.Operation\"f\x82\xd3\xe4\x93\x02,**/v1/{name=projects/*/locations/*/models/*}\xda\x41\x04name\xca\x41*\n\x15google.protobuf.Empty\x12\x11OperationMetadata\x12\xad\x01\n\x0bUpdateModel\x12*.google.cloud.automl.v1.UpdateModelRequest\x1a\x1d.google.cloud.automl.v1.Model\"S\x82\xd3\xe4\x93\x02\x39\x32\x30/v1/{model.name=projects/*/locations/*/models/*}:\x05model\xda\x41\x11model,update_mask\x12\xca\x01\n\x0b\x44\x65ployModel\x12*.google.cloud.automl.v1.DeployModelRequest\x1a\x1d.google.longrunning.Operation\"p\x82\xd3\xe4\x93\x02\x36\"1/v1/{name=projects/*/locations/*/models/*}:deploy:\x01*\xda\x41\x04name\xca\x41*\n\x15google.protobuf.Empty\x12\x11OperationMetadata\x12\xd0\x01\n\rUndeployModel\x12,.google.cloud.automl.v1.UndeployModelRequest\x1a\x1d.google.longrunning.Operation\"r\x82\xd3\xe4\x93\x02\x38\"3/v1/{name=projects/*/locations/*/models/*}:undeploy:\x01*\xda\x41\x04name\xca\x41*\n\x15google.protobuf.Empty\x12\x11OperationMetadata\x12\xd8\x01\n\x0b\x45xportModel\x12*.google.cloud.automl.v1.ExportModelRequest\x1a\x1d.google.longrunning.Operation\"~\x82\xd3\xe4\x93\x02\x36\"1/v1/{name=projects/*/locations/*/models/*}:export:\x01*\xda\x41\x12name,output_config\xca\x41*\n\x15google.protobuf.Empty\x12\x11OperationMetadata\x12\xbe\x01\n\x12GetModelEvaluation\x12\x31.google.cloud.automl.v1.GetModelEvaluationRequest\x1a\'.google.cloud.automl.v1.ModelEvaluation\"L\x82\xd3\xe4\x93\x02?\x12=/v1/{name=projects/*/locations/*/models/*/modelEvaluations/*}\xda\x41\x04name\x12\xd8\x01\n\x14ListModelEvaluations\x12\x33.google.cloud.automl.v1.ListModelEvaluationsRequest\x1a\x34.google.cloud.automl.v1.ListModelEvaluationsResponse\"U\x82\xd3\xe4\x93\x02?\x12=/v1/{parent=projects/*/locations/*/models/*}/modelEvaluations\xda\x41\rparent,filter\x1aI\xca\x41\x15\x61utoml.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xad\x01\n\x1a\x63om.google.cloud.automl.v1B\x0b\x41utoMlProtoP\x01Z2cloud.google.com/go/automl/apiv1/automlpb;automlpb\xaa\x02\x16Google.Cloud.AutoML.V1\xca\x02\x16Google\\Cloud\\AutoMl\\V1\xea\x02\x19Google::Cloud::AutoML::V1b\x06proto3"
23
+
24
+ pool = Google::Protobuf::DescriptorPool.generated_pool
25
+
26
+ begin
27
+ pool.add_serialized_file(descriptor_data)
28
+ rescue TypeError => e
29
+ # Compatibility code: will be removed in the next major version.
30
+ require 'google/protobuf/descriptor_pb'
31
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
32
+ parsed.clear_dependency
33
+ serialized = parsed.class.encode(parsed)
34
+ file = pool.add_serialized_file(serialized)
35
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
36
+ imports = [
37
+ ["google.cloud.automl.v1.Dataset", "google/cloud/automl/v1/dataset.proto"],
38
+ ["google.protobuf.FieldMask", "google/protobuf/field_mask.proto"],
39
+ ["google.cloud.automl.v1.InputConfig", "google/cloud/automl/v1/io.proto"],
40
+ ["google.cloud.automl.v1.Model", "google/cloud/automl/v1/model.proto"],
41
+ ["google.cloud.automl.v1.ImageObjectDetectionModelDeploymentMetadata", "google/cloud/automl/v1/image.proto"],
42
+ ["google.cloud.automl.v1.ModelEvaluation", "google/cloud/automl/v1/model_evaluation.proto"],
43
+ ]
44
+ imports.each do |type_name, expected_filename|
45
+ import_file = pool.lookup(type_name).file_descriptor
46
+ if import_file.name != expected_filename
47
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
107
48
  end
108
49
  end
50
+ warn "Each proto file must use a consistent fully-qualified name."
51
+ warn "This will become an error in the next major version."
109
52
  end
110
53
 
111
54
  module Google
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: google/cloud/automl/v1/text_extraction.proto
3
4
 
@@ -5,25 +6,32 @@ require 'google/protobuf'
5
6
 
6
7
  require 'google/cloud/automl/v1/text_segment_pb'
7
8
 
8
- Google::Protobuf::DescriptorPool.generated_pool.build do
9
- add_file("google/cloud/automl/v1/text_extraction.proto", :syntax => :proto3) do
10
- add_message "google.cloud.automl.v1.TextExtractionAnnotation" do
11
- optional :score, :float, 1
12
- oneof :annotation do
13
- optional :text_segment, :message, 3, "google.cloud.automl.v1.TextSegment"
14
- end
15
- end
16
- add_message "google.cloud.automl.v1.TextExtractionEvaluationMetrics" do
17
- optional :au_prc, :float, 1
18
- repeated :confidence_metrics_entries, :message, 2, "google.cloud.automl.v1.TextExtractionEvaluationMetrics.ConfidenceMetricsEntry"
19
- end
20
- add_message "google.cloud.automl.v1.TextExtractionEvaluationMetrics.ConfidenceMetricsEntry" do
21
- optional :confidence_threshold, :float, 1
22
- optional :recall, :float, 3
23
- optional :precision, :float, 4
24
- optional :f1_score, :float, 5
9
+
10
+ descriptor_data = "\n,google/cloud/automl/v1/text_extraction.proto\x12\x16google.cloud.automl.v1\x1a)google/cloud/automl/v1/text_segment.proto\"t\n\x18TextExtractionAnnotation\x12;\n\x0ctext_segment\x18\x03 \x01(\x0b\x32#.google.cloud.automl.v1.TextSegmentH\x00\x12\r\n\x05score\x18\x01 \x01(\x02\x42\x0c\n\nannotation\"\x92\x02\n\x1fTextExtractionEvaluationMetrics\x12\x0e\n\x06\x61u_prc\x18\x01 \x01(\x02\x12r\n\x1a\x63onfidence_metrics_entries\x18\x02 \x03(\x0b\x32N.google.cloud.automl.v1.TextExtractionEvaluationMetrics.ConfidenceMetricsEntry\x1ak\n\x16\x43onfidenceMetricsEntry\x12\x1c\n\x14\x63onfidence_threshold\x18\x01 \x01(\x02\x12\x0e\n\x06recall\x18\x03 \x01(\x02\x12\x11\n\tprecision\x18\x04 \x01(\x02\x12\x10\n\x08\x66\x31_score\x18\x05 \x01(\x02\x42\xa0\x01\n\x1a\x63om.google.cloud.automl.v1P\x01Z2cloud.google.com/go/automl/apiv1/automlpb;automlpb\xaa\x02\x16Google.Cloud.AutoML.V1\xca\x02\x16Google\\Cloud\\AutoMl\\V1\xea\x02\x19Google::Cloud::AutoML::V1b\x06proto3"
11
+
12
+ pool = Google::Protobuf::DescriptorPool.generated_pool
13
+
14
+ begin
15
+ pool.add_serialized_file(descriptor_data)
16
+ rescue TypeError => e
17
+ # Compatibility code: will be removed in the next major version.
18
+ require 'google/protobuf/descriptor_pb'
19
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
20
+ parsed.clear_dependency
21
+ serialized = parsed.class.encode(parsed)
22
+ file = pool.add_serialized_file(serialized)
23
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
24
+ imports = [
25
+ ["google.cloud.automl.v1.TextSegment", "google/cloud/automl/v1/text_segment.proto"],
26
+ ]
27
+ imports.each do |type_name, expected_filename|
28
+ import_file = pool.lookup(type_name).file_descriptor
29
+ if import_file.name != expected_filename
30
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
25
31
  end
26
32
  end
33
+ warn "Each proto file must use a consistent fully-qualified name."
34
+ warn "This will become an error in the next major version."
27
35
  end
28
36
 
29
37
  module Google
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: google/cloud/automl/v1/text.proto
3
4
 
@@ -5,24 +6,31 @@ require 'google/protobuf'
5
6
 
6
7
  require 'google/cloud/automl/v1/classification_pb'
7
8
 
8
- Google::Protobuf::DescriptorPool.generated_pool.build do
9
- add_file("google/cloud/automl/v1/text.proto", :syntax => :proto3) do
10
- add_message "google.cloud.automl.v1.TextClassificationDatasetMetadata" do
11
- optional :classification_type, :enum, 1, "google.cloud.automl.v1.ClassificationType"
12
- end
13
- add_message "google.cloud.automl.v1.TextClassificationModelMetadata" do
14
- optional :classification_type, :enum, 3, "google.cloud.automl.v1.ClassificationType"
15
- end
16
- add_message "google.cloud.automl.v1.TextExtractionDatasetMetadata" do
17
- end
18
- add_message "google.cloud.automl.v1.TextExtractionModelMetadata" do
19
- end
20
- add_message "google.cloud.automl.v1.TextSentimentDatasetMetadata" do
21
- optional :sentiment_max, :int32, 1
22
- end
23
- add_message "google.cloud.automl.v1.TextSentimentModelMetadata" do
9
+
10
+ descriptor_data = "\n!google/cloud/automl/v1/text.proto\x12\x16google.cloud.automl.v1\x1a+google/cloud/automl/v1/classification.proto\"l\n!TextClassificationDatasetMetadata\x12G\n\x13\x63lassification_type\x18\x01 \x01(\x0e\x32*.google.cloud.automl.v1.ClassificationType\"j\n\x1fTextClassificationModelMetadata\x12G\n\x13\x63lassification_type\x18\x03 \x01(\x0e\x32*.google.cloud.automl.v1.ClassificationType\"\x1f\n\x1dTextExtractionDatasetMetadata\"\x1d\n\x1bTextExtractionModelMetadata\"5\n\x1cTextSentimentDatasetMetadata\x12\x15\n\rsentiment_max\x18\x01 \x01(\x05\"\x1c\n\x1aTextSentimentModelMetadataB\xab\x01\n\x1a\x63om.google.cloud.automl.v1B\tTextProtoP\x01Z2cloud.google.com/go/automl/apiv1/automlpb;automlpb\xaa\x02\x16Google.Cloud.AutoML.V1\xca\x02\x16Google\\Cloud\\AutoMl\\V1\xea\x02\x19Google::Cloud::AutoML::V1b\x06proto3"
11
+
12
+ pool = Google::Protobuf::DescriptorPool.generated_pool
13
+
14
+ begin
15
+ pool.add_serialized_file(descriptor_data)
16
+ rescue TypeError => e
17
+ # Compatibility code: will be removed in the next major version.
18
+ require 'google/protobuf/descriptor_pb'
19
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
20
+ parsed.clear_dependency
21
+ serialized = parsed.class.encode(parsed)
22
+ file = pool.add_serialized_file(serialized)
23
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
24
+ imports = [
25
+ ]
26
+ imports.each do |type_name, expected_filename|
27
+ import_file = pool.lookup(type_name).file_descriptor
28
+ if import_file.name != expected_filename
29
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
24
30
  end
25
31
  end
32
+ warn "Each proto file must use a consistent fully-qualified name."
33
+ warn "This will become an error in the next major version."
26
34
  end
27
35
 
28
36
  module Google