google-cloud-automl-v1 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +72 -101
- data/lib/google/cloud/automl/v1/automl/client.rb +42 -9
- data/lib/google/cloud/automl/v1/automl/operations.rb +38 -7
- data/lib/google/cloud/automl/v1/automl/rest/client.rb +397 -7
- data/lib/google/cloud/automl/v1/automl/rest/operations.rb +131 -8
- data/lib/google/cloud/automl/v1/automl/rest/service_stub.rb +14 -2
- data/lib/google/cloud/automl/v1/prediction_service/client.rb +42 -9
- data/lib/google/cloud/automl/v1/prediction_service/operations.rb +38 -7
- data/lib/google/cloud/automl/v1/prediction_service/rest/client.rb +73 -7
- data/lib/google/cloud/automl/v1/prediction_service/rest/operations.rb +131 -8
- data/lib/google/cloud/automl/v1/prediction_service/rest/service_stub.rb +14 -2
- data/lib/google/cloud/automl/v1/version.rb +1 -1
- data/proto_docs/google/api/client.rb +14 -0
- data/proto_docs/google/api/field_behavior.rb +14 -0
- metadata +5 -5
@@ -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
|
+
DEFAULT_ENDPOINT_TEMPLATE = "automl.$UNIVERSE_DOMAIN$"
|
31
|
+
|
29
32
|
# @private
|
30
33
|
attr_reader :operations_stub
|
31
34
|
|
@@ -60,6 +63,15 @@ module Google
|
|
60
63
|
@config
|
61
64
|
end
|
62
65
|
|
66
|
+
##
|
67
|
+
# The effective universe domain
|
68
|
+
#
|
69
|
+
# @return [String]
|
70
|
+
#
|
71
|
+
def universe_domain
|
72
|
+
@operations_stub.universe_domain
|
73
|
+
end
|
74
|
+
|
63
75
|
##
|
64
76
|
# Create a new Operations client object.
|
65
77
|
#
|
@@ -84,8 +96,10 @@ module Google
|
|
84
96
|
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
85
97
|
|
86
98
|
@operations_stub = OperationsServiceStub.new(
|
87
|
-
endpoint:
|
88
|
-
|
99
|
+
endpoint: @config.endpoint,
|
100
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
101
|
+
universe_domain: @config.universe_domain,
|
102
|
+
credentials: credentials
|
89
103
|
)
|
90
104
|
|
91
105
|
# Used by an LRO wrapper for some methods of this service
|
@@ -136,6 +150,26 @@ module Google
|
|
136
150
|
# @return [::Gapic::Operation]
|
137
151
|
#
|
138
152
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
153
|
+
#
|
154
|
+
# @example Basic example
|
155
|
+
# require "google/longrunning"
|
156
|
+
#
|
157
|
+
# # Create a client object. The client can be reused for multiple calls.
|
158
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
159
|
+
#
|
160
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
161
|
+
# request = Google::Longrunning::ListOperationsRequest.new
|
162
|
+
#
|
163
|
+
# # Call the list_operations method.
|
164
|
+
# result = client.list_operations request
|
165
|
+
#
|
166
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
167
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
168
|
+
# result.each do |item|
|
169
|
+
# # Each element is of type ::Google::Longrunning::Operation.
|
170
|
+
# p item
|
171
|
+
# end
|
172
|
+
#
|
139
173
|
def list_operations request, options = nil
|
140
174
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
141
175
|
|
@@ -201,6 +235,29 @@ module Google
|
|
201
235
|
# @return [::Gapic::Operation]
|
202
236
|
#
|
203
237
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
238
|
+
#
|
239
|
+
# @example Basic example
|
240
|
+
# require "google/longrunning"
|
241
|
+
#
|
242
|
+
# # Create a client object. The client can be reused for multiple calls.
|
243
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
244
|
+
#
|
245
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
246
|
+
# request = Google::Longrunning::GetOperationRequest.new
|
247
|
+
#
|
248
|
+
# # Call the get_operation method.
|
249
|
+
# result = client.get_operation request
|
250
|
+
#
|
251
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
252
|
+
# # check the status of an operation, cancel it, or wait for results.
|
253
|
+
# # Here is how to wait for a response.
|
254
|
+
# result.wait_until_done! timeout: 60
|
255
|
+
# if result.response?
|
256
|
+
# p result.response
|
257
|
+
# else
|
258
|
+
# puts "No response received."
|
259
|
+
# end
|
260
|
+
#
|
204
261
|
def get_operation request, options = nil
|
205
262
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
206
263
|
|
@@ -267,6 +324,22 @@ module Google
|
|
267
324
|
# @return [::Google::Protobuf::Empty]
|
268
325
|
#
|
269
326
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
327
|
+
#
|
328
|
+
# @example Basic example
|
329
|
+
# require "google/longrunning"
|
330
|
+
#
|
331
|
+
# # Create a client object. The client can be reused for multiple calls.
|
332
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
333
|
+
#
|
334
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
335
|
+
# request = Google::Longrunning::DeleteOperationRequest.new
|
336
|
+
#
|
337
|
+
# # Call the delete_operation method.
|
338
|
+
# result = client.delete_operation request
|
339
|
+
#
|
340
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
341
|
+
# p result
|
342
|
+
#
|
270
343
|
def delete_operation request, options = nil
|
271
344
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
272
345
|
|
@@ -338,6 +411,22 @@ module Google
|
|
338
411
|
# @return [::Google::Protobuf::Empty]
|
339
412
|
#
|
340
413
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
414
|
+
#
|
415
|
+
# @example Basic example
|
416
|
+
# require "google/longrunning"
|
417
|
+
#
|
418
|
+
# # Create a client object. The client can be reused for multiple calls.
|
419
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
420
|
+
#
|
421
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
422
|
+
# request = Google::Longrunning::CancelOperationRequest.new
|
423
|
+
#
|
424
|
+
# # Call the cancel_operation method.
|
425
|
+
# result = client.cancel_operation request
|
426
|
+
#
|
427
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
428
|
+
# p result
|
429
|
+
#
|
341
430
|
def cancel_operation request, options = nil
|
342
431
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
343
432
|
|
@@ -412,6 +501,29 @@ module Google
|
|
412
501
|
# @return [::Gapic::Operation]
|
413
502
|
#
|
414
503
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
504
|
+
#
|
505
|
+
# @example Basic example
|
506
|
+
# require "google/longrunning"
|
507
|
+
#
|
508
|
+
# # Create a client object. The client can be reused for multiple calls.
|
509
|
+
# client = Google::Longrunning::Operations::Rest::Client.new
|
510
|
+
#
|
511
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
512
|
+
# request = Google::Longrunning::WaitOperationRequest.new
|
513
|
+
#
|
514
|
+
# # Call the wait_operation method.
|
515
|
+
# result = client.wait_operation request
|
516
|
+
#
|
517
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
518
|
+
# # check the status of an operation, cancel it, or wait for results.
|
519
|
+
# # Here is how to wait for a response.
|
520
|
+
# result.wait_until_done! timeout: 60
|
521
|
+
# if result.response?
|
522
|
+
# p result.response
|
523
|
+
# else
|
524
|
+
# puts "No response received."
|
525
|
+
# end
|
526
|
+
#
|
415
527
|
def wait_operation request, options = nil
|
416
528
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
417
529
|
|
@@ -478,9 +590,9 @@ module Google
|
|
478
590
|
# end
|
479
591
|
#
|
480
592
|
# @!attribute [rw] endpoint
|
481
|
-
#
|
482
|
-
#
|
483
|
-
# @return [::String]
|
593
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
594
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
595
|
+
# @return [::String,nil]
|
484
596
|
# @!attribute [rw] credentials
|
485
597
|
# Credentials to send with calls. You may provide any of the following types:
|
486
598
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -517,13 +629,20 @@ module Google
|
|
517
629
|
# @!attribute [rw] quota_project
|
518
630
|
# A separate project against which to charge quota.
|
519
631
|
# @return [::String]
|
632
|
+
# @!attribute [rw] universe_domain
|
633
|
+
# The universe domain within which to make requests. This determines the
|
634
|
+
# default endpoint URL. The default value of nil uses the environment
|
635
|
+
# universe (usually the default "googleapis.com" universe).
|
636
|
+
# @return [::String,nil]
|
520
637
|
#
|
521
638
|
class Configuration
|
522
639
|
extend ::Gapic::Config
|
523
640
|
|
641
|
+
# @private
|
642
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
524
643
|
DEFAULT_ENDPOINT = "automl.googleapis.com"
|
525
644
|
|
526
|
-
config_attr :endpoint,
|
645
|
+
config_attr :endpoint, nil, ::String, nil
|
527
646
|
config_attr :credentials, nil do |value|
|
528
647
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
529
648
|
allowed.any? { |klass| klass === value }
|
@@ -535,6 +654,7 @@ module Google
|
|
535
654
|
config_attr :metadata, nil, ::Hash, nil
|
536
655
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
537
656
|
config_attr :quota_project, nil, ::String, nil
|
657
|
+
config_attr :universe_domain, nil, ::String, nil
|
538
658
|
|
539
659
|
# @private
|
540
660
|
def initialize parent_config = nil
|
@@ -624,12 +744,15 @@ module Google
|
|
624
744
|
# Service stub contains baseline method implementations
|
625
745
|
# including transcoding, making the REST call, and deserialing the response.
|
626
746
|
class OperationsServiceStub
|
627
|
-
def initialize endpoint:, credentials:
|
747
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
|
628
748
|
# These require statements are intentionally placed here to initialize
|
629
749
|
# the REST modules only when it's required.
|
630
750
|
require "gapic/rest"
|
631
751
|
|
632
|
-
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
752
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
753
|
+
endpoint_template: endpoint_template,
|
754
|
+
universe_domain: universe_domain,
|
755
|
+
credentials: credentials
|
633
756
|
end
|
634
757
|
|
635
758
|
##
|
@@ -30,16 +30,28 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
def initialize endpoint:, credentials:
|
33
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
|
34
34
|
# These require statements are intentionally placed here to initialize
|
35
35
|
# the REST modules only when it's required.
|
36
36
|
require "gapic/rest"
|
37
37
|
|
38
|
-
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
39
|
+
endpoint_template: endpoint_template,
|
40
|
+
universe_domain: universe_domain,
|
41
|
+
credentials: credentials,
|
39
42
|
numeric_enums: true,
|
40
43
|
raise_faraday_errors: false
|
41
44
|
end
|
42
45
|
|
46
|
+
##
|
47
|
+
# The effective universe domain
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
#
|
51
|
+
def universe_domain
|
52
|
+
@client_stub.universe_domain
|
53
|
+
end
|
54
|
+
|
43
55
|
##
|
44
56
|
# Baseline implementation for the create_dataset REST call
|
45
57
|
#
|
@@ -33,6 +33,9 @@ module Google
|
|
33
33
|
# snake_case or dash-case, either of those cases is accepted.
|
34
34
|
#
|
35
35
|
class Client
|
36
|
+
# @private
|
37
|
+
DEFAULT_ENDPOINT_TEMPLATE = "automl.$UNIVERSE_DOMAIN$"
|
38
|
+
|
36
39
|
include Paths
|
37
40
|
|
38
41
|
# @private
|
@@ -97,6 +100,15 @@ module Google
|
|
97
100
|
@config
|
98
101
|
end
|
99
102
|
|
103
|
+
##
|
104
|
+
# The effective universe domain
|
105
|
+
#
|
106
|
+
# @return [String]
|
107
|
+
#
|
108
|
+
def universe_domain
|
109
|
+
@prediction_service_stub.universe_domain
|
110
|
+
end
|
111
|
+
|
100
112
|
##
|
101
113
|
# Create a new PredictionService client object.
|
102
114
|
#
|
@@ -130,8 +142,9 @@ module Google
|
|
130
142
|
credentials = @config.credentials
|
131
143
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
132
144
|
# but only if the default endpoint does not have a region prefix.
|
133
|
-
enable_self_signed_jwt = @config.endpoint
|
134
|
-
|
145
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
146
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
147
|
+
!@config.endpoint.split(".").first.include?("-"))
|
135
148
|
credentials ||= Credentials.default scope: @config.scope,
|
136
149
|
enable_self_signed_jwt: enable_self_signed_jwt
|
137
150
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -144,14 +157,18 @@ module Google
|
|
144
157
|
config.credentials = credentials
|
145
158
|
config.quota_project = @quota_project_id
|
146
159
|
config.endpoint = @config.endpoint
|
160
|
+
config.universe_domain = @config.universe_domain
|
147
161
|
end
|
148
162
|
|
149
163
|
@prediction_service_stub = ::Gapic::ServiceStub.new(
|
150
164
|
::Google::Cloud::AutoML::V1::PredictionService::Stub,
|
151
|
-
credentials:
|
152
|
-
endpoint:
|
165
|
+
credentials: credentials,
|
166
|
+
endpoint: @config.endpoint,
|
167
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
168
|
+
universe_domain: @config.universe_domain,
|
153
169
|
channel_args: @config.channel_args,
|
154
|
-
interceptors: @config.interceptors
|
170
|
+
interceptors: @config.interceptors,
|
171
|
+
channel_pool_config: @config.channel_pool
|
155
172
|
)
|
156
173
|
end
|
157
174
|
|
@@ -544,9 +561,9 @@ module Google
|
|
544
561
|
# end
|
545
562
|
#
|
546
563
|
# @!attribute [rw] endpoint
|
547
|
-
#
|
548
|
-
#
|
549
|
-
# @return [::String]
|
564
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
565
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
566
|
+
# @return [::String,nil]
|
550
567
|
# @!attribute [rw] credentials
|
551
568
|
# Credentials to send with calls. You may provide any of the following types:
|
552
569
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -592,13 +609,20 @@ module Google
|
|
592
609
|
# @!attribute [rw] quota_project
|
593
610
|
# A separate project against which to charge quota.
|
594
611
|
# @return [::String]
|
612
|
+
# @!attribute [rw] universe_domain
|
613
|
+
# The universe domain within which to make requests. This determines the
|
614
|
+
# default endpoint URL. The default value of nil uses the environment
|
615
|
+
# universe (usually the default "googleapis.com" universe).
|
616
|
+
# @return [::String,nil]
|
595
617
|
#
|
596
618
|
class Configuration
|
597
619
|
extend ::Gapic::Config
|
598
620
|
|
621
|
+
# @private
|
622
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
599
623
|
DEFAULT_ENDPOINT = "automl.googleapis.com"
|
600
624
|
|
601
|
-
config_attr :endpoint,
|
625
|
+
config_attr :endpoint, nil, ::String, nil
|
602
626
|
config_attr :credentials, nil do |value|
|
603
627
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
604
628
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -613,6 +637,7 @@ module Google
|
|
613
637
|
config_attr :metadata, nil, ::Hash, nil
|
614
638
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
615
639
|
config_attr :quota_project, nil, ::String, nil
|
640
|
+
config_attr :universe_domain, nil, ::String, nil
|
616
641
|
|
617
642
|
# @private
|
618
643
|
def initialize parent_config = nil
|
@@ -633,6 +658,14 @@ module Google
|
|
633
658
|
end
|
634
659
|
end
|
635
660
|
|
661
|
+
##
|
662
|
+
# Configuration for the channel pool
|
663
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
664
|
+
#
|
665
|
+
def channel_pool
|
666
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
667
|
+
end
|
668
|
+
|
636
669
|
##
|
637
670
|
# Configuration RPC class for the PredictionService API.
|
638
671
|
#
|
@@ -26,6 +26,9 @@ module Google
|
|
26
26
|
module PredictionService
|
27
27
|
# Service that implements Longrunning Operations API.
|
28
28
|
class Operations
|
29
|
+
# @private
|
30
|
+
DEFAULT_ENDPOINT_TEMPLATE = "automl.$UNIVERSE_DOMAIN$"
|
31
|
+
|
29
32
|
# @private
|
30
33
|
attr_reader :operations_stub
|
31
34
|
|
@@ -60,6 +63,15 @@ module Google
|
|
60
63
|
@config
|
61
64
|
end
|
62
65
|
|
66
|
+
##
|
67
|
+
# The effective universe domain
|
68
|
+
#
|
69
|
+
# @return [String]
|
70
|
+
#
|
71
|
+
def universe_domain
|
72
|
+
@operations_stub.universe_domain
|
73
|
+
end
|
74
|
+
|
63
75
|
##
|
64
76
|
# Create a new Operations client object.
|
65
77
|
#
|
@@ -90,10 +102,13 @@ module Google
|
|
90
102
|
|
91
103
|
@operations_stub = ::Gapic::ServiceStub.new(
|
92
104
|
::Google::Longrunning::Operations::Stub,
|
93
|
-
credentials:
|
94
|
-
endpoint:
|
105
|
+
credentials: credentials,
|
106
|
+
endpoint: @config.endpoint,
|
107
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
108
|
+
universe_domain: @config.universe_domain,
|
95
109
|
channel_args: @config.channel_args,
|
96
|
-
interceptors: @config.interceptors
|
110
|
+
interceptors: @config.interceptors,
|
111
|
+
channel_pool_config: @config.channel_pool
|
97
112
|
)
|
98
113
|
|
99
114
|
# Used by an LRO wrapper for some methods of this service
|
@@ -620,9 +635,9 @@ module Google
|
|
620
635
|
# end
|
621
636
|
#
|
622
637
|
# @!attribute [rw] endpoint
|
623
|
-
#
|
624
|
-
#
|
625
|
-
# @return [::String]
|
638
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
639
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
640
|
+
# @return [::String,nil]
|
626
641
|
# @!attribute [rw] credentials
|
627
642
|
# Credentials to send with calls. You may provide any of the following types:
|
628
643
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -668,13 +683,20 @@ module Google
|
|
668
683
|
# @!attribute [rw] quota_project
|
669
684
|
# A separate project against which to charge quota.
|
670
685
|
# @return [::String]
|
686
|
+
# @!attribute [rw] universe_domain
|
687
|
+
# The universe domain within which to make requests. This determines the
|
688
|
+
# default endpoint URL. The default value of nil uses the environment
|
689
|
+
# universe (usually the default "googleapis.com" universe).
|
690
|
+
# @return [::String,nil]
|
671
691
|
#
|
672
692
|
class Configuration
|
673
693
|
extend ::Gapic::Config
|
674
694
|
|
695
|
+
# @private
|
696
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
675
697
|
DEFAULT_ENDPOINT = "automl.googleapis.com"
|
676
698
|
|
677
|
-
config_attr :endpoint,
|
699
|
+
config_attr :endpoint, nil, ::String, nil
|
678
700
|
config_attr :credentials, nil do |value|
|
679
701
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
680
702
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -689,6 +711,7 @@ module Google
|
|
689
711
|
config_attr :metadata, nil, ::Hash, nil
|
690
712
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
691
713
|
config_attr :quota_project, nil, ::String, nil
|
714
|
+
config_attr :universe_domain, nil, ::String, nil
|
692
715
|
|
693
716
|
# @private
|
694
717
|
def initialize parent_config = nil
|
@@ -709,6 +732,14 @@ module Google
|
|
709
732
|
end
|
710
733
|
end
|
711
734
|
|
735
|
+
##
|
736
|
+
# Configuration for the channel pool
|
737
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
738
|
+
#
|
739
|
+
def channel_pool
|
740
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
741
|
+
end
|
742
|
+
|
712
743
|
##
|
713
744
|
# Configuration RPC class for the Operations API.
|
714
745
|
#
|
@@ -35,6 +35,9 @@ module Google
|
|
35
35
|
# snake_case or dash-case, either of those cases is accepted.
|
36
36
|
#
|
37
37
|
class Client
|
38
|
+
# @private
|
39
|
+
DEFAULT_ENDPOINT_TEMPLATE = "automl.$UNIVERSE_DOMAIN$"
|
40
|
+
|
38
41
|
include Paths
|
39
42
|
|
40
43
|
# @private
|
@@ -99,6 +102,15 @@ module Google
|
|
99
102
|
@config
|
100
103
|
end
|
101
104
|
|
105
|
+
##
|
106
|
+
# The effective universe domain
|
107
|
+
#
|
108
|
+
# @return [String]
|
109
|
+
#
|
110
|
+
def universe_domain
|
111
|
+
@prediction_service_stub.universe_domain
|
112
|
+
end
|
113
|
+
|
102
114
|
##
|
103
115
|
# Create a new PredictionService REST client object.
|
104
116
|
#
|
@@ -126,8 +138,9 @@ module Google
|
|
126
138
|
credentials = @config.credentials
|
127
139
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
128
140
|
# but only if the default endpoint does not have a region prefix.
|
129
|
-
enable_self_signed_jwt = @config.endpoint
|
130
|
-
|
141
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
142
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
143
|
+
!@config.endpoint.split(".").first.include?("-"))
|
131
144
|
credentials ||= Credentials.default scope: @config.scope,
|
132
145
|
enable_self_signed_jwt: enable_self_signed_jwt
|
133
146
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -141,9 +154,15 @@ module Google
|
|
141
154
|
config.credentials = credentials
|
142
155
|
config.quota_project = @quota_project_id
|
143
156
|
config.endpoint = @config.endpoint
|
157
|
+
config.universe_domain = @config.universe_domain
|
144
158
|
end
|
145
159
|
|
146
|
-
@prediction_service_stub = ::Google::Cloud::AutoML::V1::PredictionService::Rest::ServiceStub.new
|
160
|
+
@prediction_service_stub = ::Google::Cloud::AutoML::V1::PredictionService::Rest::ServiceStub.new(
|
161
|
+
endpoint: @config.endpoint,
|
162
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
163
|
+
universe_domain: @config.universe_domain,
|
164
|
+
credentials: credentials
|
165
|
+
)
|
147
166
|
end
|
148
167
|
|
149
168
|
##
|
@@ -251,6 +270,22 @@ module Google
|
|
251
270
|
# @return [::Google::Cloud::AutoML::V1::PredictResponse]
|
252
271
|
#
|
253
272
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
273
|
+
#
|
274
|
+
# @example Basic example
|
275
|
+
# require "google/cloud/automl/v1"
|
276
|
+
#
|
277
|
+
# # Create a client object. The client can be reused for multiple calls.
|
278
|
+
# client = Google::Cloud::AutoML::V1::PredictionService::Rest::Client.new
|
279
|
+
#
|
280
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
281
|
+
# request = Google::Cloud::AutoML::V1::PredictRequest.new
|
282
|
+
#
|
283
|
+
# # Call the predict method.
|
284
|
+
# result = client.predict request
|
285
|
+
#
|
286
|
+
# # The returned object is of type Google::Cloud::AutoML::V1::PredictResponse.
|
287
|
+
# p result
|
288
|
+
#
|
254
289
|
def predict request, options = nil
|
255
290
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
256
291
|
|
@@ -416,6 +451,29 @@ module Google
|
|
416
451
|
# @return [::Gapic::Operation]
|
417
452
|
#
|
418
453
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
454
|
+
#
|
455
|
+
# @example Basic example
|
456
|
+
# require "google/cloud/automl/v1"
|
457
|
+
#
|
458
|
+
# # Create a client object. The client can be reused for multiple calls.
|
459
|
+
# client = Google::Cloud::AutoML::V1::PredictionService::Rest::Client.new
|
460
|
+
#
|
461
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
462
|
+
# request = Google::Cloud::AutoML::V1::BatchPredictRequest.new
|
463
|
+
#
|
464
|
+
# # Call the batch_predict method.
|
465
|
+
# result = client.batch_predict request
|
466
|
+
#
|
467
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
468
|
+
# # check the status of an operation, cancel it, or wait for results.
|
469
|
+
# # Here is how to wait for a response.
|
470
|
+
# result.wait_until_done! timeout: 60
|
471
|
+
# if result.response?
|
472
|
+
# p result.response
|
473
|
+
# else
|
474
|
+
# puts "No response received."
|
475
|
+
# end
|
476
|
+
#
|
419
477
|
def batch_predict request, options = nil
|
420
478
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
421
479
|
|
@@ -482,9 +540,9 @@ module Google
|
|
482
540
|
# end
|
483
541
|
#
|
484
542
|
# @!attribute [rw] endpoint
|
485
|
-
#
|
486
|
-
#
|
487
|
-
# @return [::String]
|
543
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
544
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
545
|
+
# @return [::String,nil]
|
488
546
|
# @!attribute [rw] credentials
|
489
547
|
# Credentials to send with calls. You may provide any of the following types:
|
490
548
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -521,13 +579,20 @@ module Google
|
|
521
579
|
# @!attribute [rw] quota_project
|
522
580
|
# A separate project against which to charge quota.
|
523
581
|
# @return [::String]
|
582
|
+
# @!attribute [rw] universe_domain
|
583
|
+
# The universe domain within which to make requests. This determines the
|
584
|
+
# default endpoint URL. The default value of nil uses the environment
|
585
|
+
# universe (usually the default "googleapis.com" universe).
|
586
|
+
# @return [::String,nil]
|
524
587
|
#
|
525
588
|
class Configuration
|
526
589
|
extend ::Gapic::Config
|
527
590
|
|
591
|
+
# @private
|
592
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
528
593
|
DEFAULT_ENDPOINT = "automl.googleapis.com"
|
529
594
|
|
530
|
-
config_attr :endpoint,
|
595
|
+
config_attr :endpoint, nil, ::String, nil
|
531
596
|
config_attr :credentials, nil do |value|
|
532
597
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
533
598
|
allowed.any? { |klass| klass === value }
|
@@ -539,6 +604,7 @@ module Google
|
|
539
604
|
config_attr :metadata, nil, ::Hash, nil
|
540
605
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
541
606
|
config_attr :quota_project, nil, ::String, nil
|
607
|
+
config_attr :universe_domain, nil, ::String, nil
|
542
608
|
|
543
609
|
# @private
|
544
610
|
def initialize parent_config = nil
|