google-cloud-vision_ai-v1 0.a → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +144 -8
- data/lib/google/cloud/vision_ai/v1/app_platform/client.rb +3318 -0
- data/lib/google/cloud/vision_ai/v1/app_platform/credentials.rb +47 -0
- data/lib/google/cloud/vision_ai/v1/app_platform/operations.rb +809 -0
- data/lib/google/cloud/vision_ai/v1/app_platform/paths.rb +151 -0
- data/lib/google/cloud/vision_ai/v1/app_platform/rest/client.rb +3106 -0
- data/lib/google/cloud/vision_ai/v1/app_platform/rest/operations.rb +951 -0
- data/lib/google/cloud/vision_ai/v1/app_platform/rest/service_stub.rb +1618 -0
- data/lib/google/cloud/vision_ai/v1/app_platform/rest.rb +53 -0
- data/lib/google/cloud/vision_ai/v1/app_platform.rb +56 -0
- data/lib/google/cloud/vision_ai/v1/health_check_service/client.rb +456 -0
- data/lib/google/cloud/vision_ai/v1/health_check_service/credentials.rb +47 -0
- data/lib/google/cloud/vision_ai/v1/health_check_service/paths.rb +52 -0
- data/lib/google/cloud/vision_ai/v1/health_check_service/rest/client.rb +423 -0
- data/lib/google/cloud/vision_ai/v1/health_check_service/rest/service_stub.rb +128 -0
- data/lib/google/cloud/vision_ai/v1/health_check_service/rest.rb +53 -0
- data/lib/google/cloud/vision_ai/v1/health_check_service.rb +56 -0
- data/lib/google/cloud/vision_ai/v1/live_video_analytics/client.rb +2375 -0
- data/lib/google/cloud/vision_ai/v1/live_video_analytics/credentials.rb +47 -0
- data/lib/google/cloud/vision_ai/v1/live_video_analytics/operations.rb +809 -0
- data/lib/google/cloud/vision_ai/v1/live_video_analytics/paths.rb +130 -0
- data/lib/google/cloud/vision_ai/v1/live_video_analytics/rest/client.rb +2220 -0
- data/lib/google/cloud/vision_ai/v1/live_video_analytics/rest/operations.rb +951 -0
- data/lib/google/cloud/vision_ai/v1/live_video_analytics/rest/service_stub.rb +1139 -0
- data/lib/google/cloud/vision_ai/v1/live_video_analytics/rest.rb +54 -0
- data/lib/google/cloud/vision_ai/v1/live_video_analytics.rb +57 -0
- data/lib/google/cloud/vision_ai/v1/rest.rb +42 -0
- data/lib/google/cloud/vision_ai/v1/streaming_service/client.rb +915 -0
- data/lib/google/cloud/vision_ai/v1/streaming_service/credentials.rb +47 -0
- data/lib/google/cloud/vision_ai/v1/streaming_service/paths.rb +54 -0
- data/lib/google/cloud/vision_ai/v1/streaming_service/rest/client.rb +610 -0
- data/lib/google/cloud/vision_ai/v1/streaming_service/rest/service_stub.rb +249 -0
- data/lib/google/cloud/vision_ai/v1/streaming_service/rest.rb +52 -0
- data/lib/google/cloud/vision_ai/v1/streaming_service.rb +55 -0
- data/lib/google/cloud/vision_ai/v1/streams_service/client.rb +2931 -0
- data/lib/google/cloud/vision_ai/v1/streams_service/credentials.rb +47 -0
- data/lib/google/cloud/vision_ai/v1/streams_service/operations.rb +809 -0
- data/lib/google/cloud/vision_ai/v1/streams_service/paths.rb +153 -0
- data/lib/google/cloud/vision_ai/v1/streams_service/rest/client.rb +2740 -0
- data/lib/google/cloud/vision_ai/v1/streams_service/rest/operations.rb +951 -0
- data/lib/google/cloud/vision_ai/v1/streams_service/rest/service_stub.rb +1437 -0
- data/lib/google/cloud/vision_ai/v1/streams_service/rest.rb +56 -0
- data/lib/google/cloud/vision_ai/v1/streams_service.rb +59 -0
- data/lib/google/cloud/vision_ai/v1/version.rb +8 -3
- data/lib/google/cloud/vision_ai/v1/warehouse/client.rb +6957 -0
- data/lib/google/cloud/vision_ai/v1/warehouse/credentials.rb +47 -0
- data/lib/google/cloud/vision_ai/v1/warehouse/operations.rb +809 -0
- data/lib/google/cloud/vision_ai/v1/warehouse/paths.rb +237 -0
- data/lib/google/cloud/vision_ai/v1/warehouse/rest/client.rb +6402 -0
- data/lib/google/cloud/vision_ai/v1/warehouse/rest/operations.rb +951 -0
- data/lib/google/cloud/vision_ai/v1/warehouse/rest/service_stub.rb +3760 -0
- data/lib/google/cloud/vision_ai/v1/warehouse/rest.rb +53 -0
- data/lib/google/cloud/vision_ai/v1/warehouse.rb +56 -0
- data/lib/google/cloud/vision_ai/v1.rb +50 -0
- data/lib/google/cloud/visionai/v1/annotations_pb.rb +90 -0
- data/lib/google/cloud/visionai/v1/common_pb.rb +50 -0
- data/lib/google/cloud/visionai/v1/health_service_pb.rb +48 -0
- data/lib/google/cloud/visionai/v1/health_service_services_pb.rb +46 -0
- data/lib/google/cloud/visionai/v1/lva_pb.rb +54 -0
- data/lib/google/cloud/visionai/v1/lva_resources_pb.rb +51 -0
- data/lib/google/cloud/visionai/v1/lva_service_pb.rb +80 -0
- data/lib/google/cloud/visionai/v1/lva_service_services_pb.rb +81 -0
- data/lib/google/cloud/visionai/v1/platform_pb.rb +162 -0
- data/lib/google/cloud/visionai/v1/platform_services_pb.rb +111 -0
- data/lib/google/cloud/visionai/v1/streaming_resources_pb.rb +58 -0
- data/lib/google/cloud/visionai/v1/streaming_service_pb.rb +71 -0
- data/lib/google/cloud/visionai/v1/streaming_service_services_pb.rb +55 -0
- data/lib/google/cloud/visionai/v1/streams_resources_pb.rb +53 -0
- data/lib/google/cloud/visionai/v1/streams_service_pb.rb +85 -0
- data/lib/google/cloud/visionai/v1/streams_service_services_pb.rb +92 -0
- data/lib/google/cloud/visionai/v1/warehouse_pb.rb +250 -0
- data/lib/google/cloud/visionai/v1/warehouse_services_pb.rb +227 -0
- data/lib/google-cloud-vision_ai-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +403 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +227 -0
- data/proto_docs/google/cloud/visionai/v1/annotations.rb +787 -0
- data/proto_docs/google/cloud/visionai/v1/common.rb +134 -0
- data/proto_docs/google/cloud/visionai/v1/health_service.rb +61 -0
- data/proto_docs/google/cloud/visionai/v1/lva.rb +345 -0
- data/proto_docs/google/cloud/visionai/v1/lva_resources.rb +167 -0
- data/proto_docs/google/cloud/visionai/v1/lva_service.rb +543 -0
- data/proto_docs/google/cloud/visionai/v1/platform.rb +2228 -0
- data/proto_docs/google/cloud/visionai/v1/streaming_resources.rb +178 -0
- data/proto_docs/google/cloud/visionai/v1/streaming_service.rb +393 -0
- data/proto_docs/google/cloud/visionai/v1/streams_resources.rb +229 -0
- data/proto_docs/google/cloud/visionai/v1/streams_service.rb +644 -0
- data/proto_docs/google/cloud/visionai/v1/warehouse.rb +3002 -0
- data/proto_docs/google/longrunning/operations.rb +164 -0
- data/proto_docs/google/protobuf/any.rb +145 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- data/proto_docs/google/type/datetime.rb +99 -0
- data/proto_docs/google/type/expr.rb +75 -0
- metadata +183 -10
@@ -0,0 +1,915 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/visionai/v1/streaming_service_pb"
|
21
|
+
require "google/cloud/location"
|
22
|
+
require "google/iam/v1"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module VisionAI
|
27
|
+
module V1
|
28
|
+
module StreamingService
|
29
|
+
##
|
30
|
+
# Client for the StreamingService service.
|
31
|
+
#
|
32
|
+
# Streaming service for receiving and sending packets.
|
33
|
+
#
|
34
|
+
class Client
|
35
|
+
# @private
|
36
|
+
API_VERSION = ""
|
37
|
+
|
38
|
+
# @private
|
39
|
+
DEFAULT_ENDPOINT_TEMPLATE = "visionai.$UNIVERSE_DOMAIN$"
|
40
|
+
|
41
|
+
include Paths
|
42
|
+
|
43
|
+
# @private
|
44
|
+
attr_reader :streaming_service_stub
|
45
|
+
|
46
|
+
##
|
47
|
+
# Configure the StreamingService Client class.
|
48
|
+
#
|
49
|
+
# See {::Google::Cloud::VisionAI::V1::StreamingService::Client::Configuration}
|
50
|
+
# for a description of the configuration fields.
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
#
|
54
|
+
# # Modify the configuration for all StreamingService clients
|
55
|
+
# ::Google::Cloud::VisionAI::V1::StreamingService::Client.configure do |config|
|
56
|
+
# config.timeout = 10.0
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# @yield [config] Configure the Client client.
|
60
|
+
# @yieldparam config [Client::Configuration]
|
61
|
+
#
|
62
|
+
# @return [Client::Configuration]
|
63
|
+
#
|
64
|
+
def self.configure
|
65
|
+
@configure ||= begin
|
66
|
+
namespace = ["Google", "Cloud", "VisionAI", "V1"]
|
67
|
+
parent_config = while namespace.any?
|
68
|
+
parent_name = namespace.join "::"
|
69
|
+
parent_const = const_get parent_name
|
70
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
71
|
+
namespace.pop
|
72
|
+
end
|
73
|
+
default_config = Client::Configuration.new parent_config
|
74
|
+
|
75
|
+
default_config
|
76
|
+
end
|
77
|
+
yield @configure if block_given?
|
78
|
+
@configure
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Configure the StreamingService Client instance.
|
83
|
+
#
|
84
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
85
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
86
|
+
# should be made on {Client.configure}.
|
87
|
+
#
|
88
|
+
# See {::Google::Cloud::VisionAI::V1::StreamingService::Client::Configuration}
|
89
|
+
# for a description of the configuration fields.
|
90
|
+
#
|
91
|
+
# @yield [config] Configure the Client client.
|
92
|
+
# @yieldparam config [Client::Configuration]
|
93
|
+
#
|
94
|
+
# @return [Client::Configuration]
|
95
|
+
#
|
96
|
+
def configure
|
97
|
+
yield @config if block_given?
|
98
|
+
@config
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# The effective universe domain
|
103
|
+
#
|
104
|
+
# @return [String]
|
105
|
+
#
|
106
|
+
def universe_domain
|
107
|
+
@streaming_service_stub.universe_domain
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# Create a new StreamingService client object.
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
#
|
115
|
+
# # Create a client using the default configuration
|
116
|
+
# client = ::Google::Cloud::VisionAI::V1::StreamingService::Client.new
|
117
|
+
#
|
118
|
+
# # Create a client using a custom configuration
|
119
|
+
# client = ::Google::Cloud::VisionAI::V1::StreamingService::Client.new do |config|
|
120
|
+
# config.timeout = 10.0
|
121
|
+
# end
|
122
|
+
#
|
123
|
+
# @yield [config] Configure the StreamingService client.
|
124
|
+
# @yieldparam config [Client::Configuration]
|
125
|
+
#
|
126
|
+
def initialize
|
127
|
+
# These require statements are intentionally placed here to initialize
|
128
|
+
# the gRPC module only when it's required.
|
129
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
130
|
+
require "gapic/grpc"
|
131
|
+
require "google/cloud/visionai/v1/streaming_service_services_pb"
|
132
|
+
|
133
|
+
# Create the configuration object
|
134
|
+
@config = Configuration.new Client.configure
|
135
|
+
|
136
|
+
# Yield the configuration if needed
|
137
|
+
yield @config if block_given?
|
138
|
+
|
139
|
+
# Create credentials
|
140
|
+
credentials = @config.credentials
|
141
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
142
|
+
# but only if the default endpoint does not have a region prefix.
|
143
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
144
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
145
|
+
!@config.endpoint.split(".").first.include?("-"))
|
146
|
+
credentials ||= Credentials.default scope: @config.scope,
|
147
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
148
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
149
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
150
|
+
end
|
151
|
+
@quota_project_id = @config.quota_project
|
152
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
153
|
+
|
154
|
+
@streaming_service_stub = ::Gapic::ServiceStub.new(
|
155
|
+
::Google::Cloud::VisionAI::V1::StreamingService::Stub,
|
156
|
+
credentials: credentials,
|
157
|
+
endpoint: @config.endpoint,
|
158
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
159
|
+
universe_domain: @config.universe_domain,
|
160
|
+
channel_args: @config.channel_args,
|
161
|
+
interceptors: @config.interceptors,
|
162
|
+
channel_pool_config: @config.channel_pool
|
163
|
+
)
|
164
|
+
|
165
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
166
|
+
config.credentials = credentials
|
167
|
+
config.quota_project = @quota_project_id
|
168
|
+
config.endpoint = @streaming_service_stub.endpoint
|
169
|
+
config.universe_domain = @streaming_service_stub.universe_domain
|
170
|
+
end
|
171
|
+
|
172
|
+
@iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
|
173
|
+
config.credentials = credentials
|
174
|
+
config.quota_project = @quota_project_id
|
175
|
+
config.endpoint = @streaming_service_stub.endpoint
|
176
|
+
config.universe_domain = @streaming_service_stub.universe_domain
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# Get the associated client for mix-in of the Locations.
|
182
|
+
#
|
183
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
184
|
+
#
|
185
|
+
attr_reader :location_client
|
186
|
+
|
187
|
+
##
|
188
|
+
# Get the associated client for mix-in of the IAMPolicy.
|
189
|
+
#
|
190
|
+
# @return [Google::Iam::V1::IAMPolicy::Client]
|
191
|
+
#
|
192
|
+
attr_reader :iam_policy_client
|
193
|
+
|
194
|
+
# Service calls
|
195
|
+
|
196
|
+
##
|
197
|
+
# Send packets to the series.
|
198
|
+
#
|
199
|
+
# @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::VisionAI::V1::SendPacketsRequest, ::Hash>]
|
200
|
+
# An enumerable of {::Google::Cloud::VisionAI::V1::SendPacketsRequest} instances.
|
201
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
202
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
203
|
+
#
|
204
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
205
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::VisionAI::V1::SendPacketsResponse>]
|
206
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
207
|
+
#
|
208
|
+
# @return [::Enumerable<::Google::Cloud::VisionAI::V1::SendPacketsResponse>]
|
209
|
+
#
|
210
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
211
|
+
#
|
212
|
+
# @example Basic example
|
213
|
+
# require "google/cloud/vision_ai/v1"
|
214
|
+
#
|
215
|
+
# # Create a client object. The client can be reused for multiple calls.
|
216
|
+
# client = Google::Cloud::VisionAI::V1::StreamingService::Client.new
|
217
|
+
#
|
218
|
+
# # Create an input stream.
|
219
|
+
# input = Gapic::StreamInput.new
|
220
|
+
#
|
221
|
+
# # Call the send_packets method to start streaming.
|
222
|
+
# output = client.send_packets input
|
223
|
+
#
|
224
|
+
# # Send requests on the stream. For each request object, set fields by
|
225
|
+
# # passing keyword arguments. Be sure to close the stream when done.
|
226
|
+
# input << Google::Cloud::VisionAI::V1::SendPacketsRequest.new
|
227
|
+
# input << Google::Cloud::VisionAI::V1::SendPacketsRequest.new
|
228
|
+
# input.close
|
229
|
+
#
|
230
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
231
|
+
# # ::Google::Cloud::VisionAI::V1::SendPacketsResponse
|
232
|
+
# output.each do |current_response|
|
233
|
+
# p current_response
|
234
|
+
# end
|
235
|
+
#
|
236
|
+
def send_packets request, options = nil
|
237
|
+
unless request.is_a? ::Enumerable
|
238
|
+
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
239
|
+
request = request.to_enum
|
240
|
+
end
|
241
|
+
|
242
|
+
request = request.lazy.map do |req|
|
243
|
+
::Gapic::Protobuf.coerce req, to: ::Google::Cloud::VisionAI::V1::SendPacketsRequest
|
244
|
+
end
|
245
|
+
|
246
|
+
# Converts hash and nil to an options object
|
247
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
248
|
+
|
249
|
+
# Customize the options with defaults
|
250
|
+
metadata = @config.rpcs.send_packets.metadata.to_h
|
251
|
+
|
252
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
253
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
254
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
255
|
+
gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
|
256
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
257
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
258
|
+
|
259
|
+
options.apply_defaults timeout: @config.rpcs.send_packets.timeout,
|
260
|
+
metadata: metadata,
|
261
|
+
retry_policy: @config.rpcs.send_packets.retry_policy
|
262
|
+
|
263
|
+
options.apply_defaults timeout: @config.timeout,
|
264
|
+
metadata: @config.metadata,
|
265
|
+
retry_policy: @config.retry_policy
|
266
|
+
|
267
|
+
@streaming_service_stub.call_rpc :send_packets, request, options: options do |response, operation|
|
268
|
+
yield response, operation if block_given?
|
269
|
+
return response
|
270
|
+
end
|
271
|
+
rescue ::GRPC::BadStatus => e
|
272
|
+
raise ::Google::Cloud::Error.from_error(e)
|
273
|
+
end
|
274
|
+
|
275
|
+
##
|
276
|
+
# Receive packets from the series.
|
277
|
+
#
|
278
|
+
# @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::VisionAI::V1::ReceivePacketsRequest, ::Hash>]
|
279
|
+
# An enumerable of {::Google::Cloud::VisionAI::V1::ReceivePacketsRequest} instances.
|
280
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
281
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
282
|
+
#
|
283
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
284
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::VisionAI::V1::ReceivePacketsResponse>]
|
285
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
286
|
+
#
|
287
|
+
# @return [::Enumerable<::Google::Cloud::VisionAI::V1::ReceivePacketsResponse>]
|
288
|
+
#
|
289
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
290
|
+
#
|
291
|
+
# @example Basic example
|
292
|
+
# require "google/cloud/vision_ai/v1"
|
293
|
+
#
|
294
|
+
# # Create a client object. The client can be reused for multiple calls.
|
295
|
+
# client = Google::Cloud::VisionAI::V1::StreamingService::Client.new
|
296
|
+
#
|
297
|
+
# # Create an input stream.
|
298
|
+
# input = Gapic::StreamInput.new
|
299
|
+
#
|
300
|
+
# # Call the receive_packets method to start streaming.
|
301
|
+
# output = client.receive_packets input
|
302
|
+
#
|
303
|
+
# # Send requests on the stream. For each request object, set fields by
|
304
|
+
# # passing keyword arguments. Be sure to close the stream when done.
|
305
|
+
# input << Google::Cloud::VisionAI::V1::ReceivePacketsRequest.new
|
306
|
+
# input << Google::Cloud::VisionAI::V1::ReceivePacketsRequest.new
|
307
|
+
# input.close
|
308
|
+
#
|
309
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
310
|
+
# # ::Google::Cloud::VisionAI::V1::ReceivePacketsResponse
|
311
|
+
# output.each do |current_response|
|
312
|
+
# p current_response
|
313
|
+
# end
|
314
|
+
#
|
315
|
+
def receive_packets request, options = nil
|
316
|
+
unless request.is_a? ::Enumerable
|
317
|
+
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
318
|
+
request = request.to_enum
|
319
|
+
end
|
320
|
+
|
321
|
+
request = request.lazy.map do |req|
|
322
|
+
::Gapic::Protobuf.coerce req, to: ::Google::Cloud::VisionAI::V1::ReceivePacketsRequest
|
323
|
+
end
|
324
|
+
|
325
|
+
# Converts hash and nil to an options object
|
326
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
327
|
+
|
328
|
+
# Customize the options with defaults
|
329
|
+
metadata = @config.rpcs.receive_packets.metadata.to_h
|
330
|
+
|
331
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
332
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
333
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
334
|
+
gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
|
335
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
336
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
337
|
+
|
338
|
+
options.apply_defaults timeout: @config.rpcs.receive_packets.timeout,
|
339
|
+
metadata: metadata,
|
340
|
+
retry_policy: @config.rpcs.receive_packets.retry_policy
|
341
|
+
|
342
|
+
options.apply_defaults timeout: @config.timeout,
|
343
|
+
metadata: @config.metadata,
|
344
|
+
retry_policy: @config.retry_policy
|
345
|
+
|
346
|
+
@streaming_service_stub.call_rpc :receive_packets, request, options: options do |response, operation|
|
347
|
+
yield response, operation if block_given?
|
348
|
+
return response
|
349
|
+
end
|
350
|
+
rescue ::GRPC::BadStatus => e
|
351
|
+
raise ::Google::Cloud::Error.from_error(e)
|
352
|
+
end
|
353
|
+
|
354
|
+
##
|
355
|
+
# Receive events given the stream name.
|
356
|
+
#
|
357
|
+
# @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::VisionAI::V1::ReceiveEventsRequest, ::Hash>]
|
358
|
+
# An enumerable of {::Google::Cloud::VisionAI::V1::ReceiveEventsRequest} instances.
|
359
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
360
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
361
|
+
#
|
362
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
363
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::VisionAI::V1::ReceiveEventsResponse>]
|
364
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
365
|
+
#
|
366
|
+
# @return [::Enumerable<::Google::Cloud::VisionAI::V1::ReceiveEventsResponse>]
|
367
|
+
#
|
368
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
369
|
+
#
|
370
|
+
# @example Basic example
|
371
|
+
# require "google/cloud/vision_ai/v1"
|
372
|
+
#
|
373
|
+
# # Create a client object. The client can be reused for multiple calls.
|
374
|
+
# client = Google::Cloud::VisionAI::V1::StreamingService::Client.new
|
375
|
+
#
|
376
|
+
# # Create an input stream.
|
377
|
+
# input = Gapic::StreamInput.new
|
378
|
+
#
|
379
|
+
# # Call the receive_events method to start streaming.
|
380
|
+
# output = client.receive_events input
|
381
|
+
#
|
382
|
+
# # Send requests on the stream. For each request object, set fields by
|
383
|
+
# # passing keyword arguments. Be sure to close the stream when done.
|
384
|
+
# input << Google::Cloud::VisionAI::V1::ReceiveEventsRequest.new
|
385
|
+
# input << Google::Cloud::VisionAI::V1::ReceiveEventsRequest.new
|
386
|
+
# input.close
|
387
|
+
#
|
388
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
389
|
+
# # ::Google::Cloud::VisionAI::V1::ReceiveEventsResponse
|
390
|
+
# output.each do |current_response|
|
391
|
+
# p current_response
|
392
|
+
# end
|
393
|
+
#
|
394
|
+
def receive_events request, options = nil
|
395
|
+
unless request.is_a? ::Enumerable
|
396
|
+
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
397
|
+
request = request.to_enum
|
398
|
+
end
|
399
|
+
|
400
|
+
request = request.lazy.map do |req|
|
401
|
+
::Gapic::Protobuf.coerce req, to: ::Google::Cloud::VisionAI::V1::ReceiveEventsRequest
|
402
|
+
end
|
403
|
+
|
404
|
+
# Converts hash and nil to an options object
|
405
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
406
|
+
|
407
|
+
# Customize the options with defaults
|
408
|
+
metadata = @config.rpcs.receive_events.metadata.to_h
|
409
|
+
|
410
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
411
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
412
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
413
|
+
gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
|
414
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
415
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
416
|
+
|
417
|
+
options.apply_defaults timeout: @config.rpcs.receive_events.timeout,
|
418
|
+
metadata: metadata,
|
419
|
+
retry_policy: @config.rpcs.receive_events.retry_policy
|
420
|
+
|
421
|
+
options.apply_defaults timeout: @config.timeout,
|
422
|
+
metadata: @config.metadata,
|
423
|
+
retry_policy: @config.retry_policy
|
424
|
+
|
425
|
+
@streaming_service_stub.call_rpc :receive_events, request, options: options do |response, operation|
|
426
|
+
yield response, operation if block_given?
|
427
|
+
return response
|
428
|
+
end
|
429
|
+
rescue ::GRPC::BadStatus => e
|
430
|
+
raise ::Google::Cloud::Error.from_error(e)
|
431
|
+
end
|
432
|
+
|
433
|
+
##
|
434
|
+
# AcquireLease acquires a lease.
|
435
|
+
#
|
436
|
+
# @overload acquire_lease(request, options = nil)
|
437
|
+
# Pass arguments to `acquire_lease` via a request object, either of type
|
438
|
+
# {::Google::Cloud::VisionAI::V1::AcquireLeaseRequest} or an equivalent Hash.
|
439
|
+
#
|
440
|
+
# @param request [::Google::Cloud::VisionAI::V1::AcquireLeaseRequest, ::Hash]
|
441
|
+
# A request object representing the call parameters. Required. To specify no
|
442
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
443
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
444
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
445
|
+
#
|
446
|
+
# @overload acquire_lease(series: nil, owner: nil, term: nil, lease_type: nil)
|
447
|
+
# Pass arguments to `acquire_lease` via keyword arguments. Note that at
|
448
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
449
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
450
|
+
#
|
451
|
+
# @param series [::String]
|
452
|
+
# The series name.
|
453
|
+
# @param owner [::String]
|
454
|
+
# The owner name.
|
455
|
+
# @param term [::Google::Protobuf::Duration, ::Hash]
|
456
|
+
# The lease term.
|
457
|
+
# @param lease_type [::Google::Cloud::VisionAI::V1::LeaseType]
|
458
|
+
# The lease type.
|
459
|
+
#
|
460
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
461
|
+
# @yieldparam response [::Google::Cloud::VisionAI::V1::Lease]
|
462
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
463
|
+
#
|
464
|
+
# @return [::Google::Cloud::VisionAI::V1::Lease]
|
465
|
+
#
|
466
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
467
|
+
#
|
468
|
+
# @example Basic example
|
469
|
+
# require "google/cloud/vision_ai/v1"
|
470
|
+
#
|
471
|
+
# # Create a client object. The client can be reused for multiple calls.
|
472
|
+
# client = Google::Cloud::VisionAI::V1::StreamingService::Client.new
|
473
|
+
#
|
474
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
475
|
+
# request = Google::Cloud::VisionAI::V1::AcquireLeaseRequest.new
|
476
|
+
#
|
477
|
+
# # Call the acquire_lease method.
|
478
|
+
# result = client.acquire_lease request
|
479
|
+
#
|
480
|
+
# # The returned object is of type Google::Cloud::VisionAI::V1::Lease.
|
481
|
+
# p result
|
482
|
+
#
|
483
|
+
def acquire_lease request, options = nil
|
484
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
485
|
+
|
486
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::AcquireLeaseRequest
|
487
|
+
|
488
|
+
# Converts hash and nil to an options object
|
489
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
490
|
+
|
491
|
+
# Customize the options with defaults
|
492
|
+
metadata = @config.rpcs.acquire_lease.metadata.to_h
|
493
|
+
|
494
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
495
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
496
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
497
|
+
gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
|
498
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
499
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
500
|
+
|
501
|
+
header_params = {}
|
502
|
+
if request.series
|
503
|
+
header_params["series"] = request.series
|
504
|
+
end
|
505
|
+
|
506
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
507
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
508
|
+
|
509
|
+
options.apply_defaults timeout: @config.rpcs.acquire_lease.timeout,
|
510
|
+
metadata: metadata,
|
511
|
+
retry_policy: @config.rpcs.acquire_lease.retry_policy
|
512
|
+
|
513
|
+
options.apply_defaults timeout: @config.timeout,
|
514
|
+
metadata: @config.metadata,
|
515
|
+
retry_policy: @config.retry_policy
|
516
|
+
|
517
|
+
@streaming_service_stub.call_rpc :acquire_lease, request, options: options do |response, operation|
|
518
|
+
yield response, operation if block_given?
|
519
|
+
return response
|
520
|
+
end
|
521
|
+
rescue ::GRPC::BadStatus => e
|
522
|
+
raise ::Google::Cloud::Error.from_error(e)
|
523
|
+
end
|
524
|
+
|
525
|
+
##
|
526
|
+
# RenewLease renews a lease.
|
527
|
+
#
|
528
|
+
# @overload renew_lease(request, options = nil)
|
529
|
+
# Pass arguments to `renew_lease` via a request object, either of type
|
530
|
+
# {::Google::Cloud::VisionAI::V1::RenewLeaseRequest} or an equivalent Hash.
|
531
|
+
#
|
532
|
+
# @param request [::Google::Cloud::VisionAI::V1::RenewLeaseRequest, ::Hash]
|
533
|
+
# A request object representing the call parameters. Required. To specify no
|
534
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
535
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
536
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
537
|
+
#
|
538
|
+
# @overload renew_lease(id: nil, series: nil, owner: nil, term: nil)
|
539
|
+
# Pass arguments to `renew_lease` via keyword arguments. Note that at
|
540
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
541
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
542
|
+
#
|
543
|
+
# @param id [::String]
|
544
|
+
# Lease id.
|
545
|
+
# @param series [::String]
|
546
|
+
# Series name.
|
547
|
+
# @param owner [::String]
|
548
|
+
# Lease owner.
|
549
|
+
# @param term [::Google::Protobuf::Duration, ::Hash]
|
550
|
+
# Lease term.
|
551
|
+
#
|
552
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
553
|
+
# @yieldparam response [::Google::Cloud::VisionAI::V1::Lease]
|
554
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
555
|
+
#
|
556
|
+
# @return [::Google::Cloud::VisionAI::V1::Lease]
|
557
|
+
#
|
558
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
559
|
+
#
|
560
|
+
# @example Basic example
|
561
|
+
# require "google/cloud/vision_ai/v1"
|
562
|
+
#
|
563
|
+
# # Create a client object. The client can be reused for multiple calls.
|
564
|
+
# client = Google::Cloud::VisionAI::V1::StreamingService::Client.new
|
565
|
+
#
|
566
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
567
|
+
# request = Google::Cloud::VisionAI::V1::RenewLeaseRequest.new
|
568
|
+
#
|
569
|
+
# # Call the renew_lease method.
|
570
|
+
# result = client.renew_lease request
|
571
|
+
#
|
572
|
+
# # The returned object is of type Google::Cloud::VisionAI::V1::Lease.
|
573
|
+
# p result
|
574
|
+
#
|
575
|
+
def renew_lease request, options = nil
|
576
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
577
|
+
|
578
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::RenewLeaseRequest
|
579
|
+
|
580
|
+
# Converts hash and nil to an options object
|
581
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
582
|
+
|
583
|
+
# Customize the options with defaults
|
584
|
+
metadata = @config.rpcs.renew_lease.metadata.to_h
|
585
|
+
|
586
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
587
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
588
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
589
|
+
gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
|
590
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
591
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
592
|
+
|
593
|
+
header_params = {}
|
594
|
+
if request.series
|
595
|
+
header_params["series"] = request.series
|
596
|
+
end
|
597
|
+
|
598
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
599
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
600
|
+
|
601
|
+
options.apply_defaults timeout: @config.rpcs.renew_lease.timeout,
|
602
|
+
metadata: metadata,
|
603
|
+
retry_policy: @config.rpcs.renew_lease.retry_policy
|
604
|
+
|
605
|
+
options.apply_defaults timeout: @config.timeout,
|
606
|
+
metadata: @config.metadata,
|
607
|
+
retry_policy: @config.retry_policy
|
608
|
+
|
609
|
+
@streaming_service_stub.call_rpc :renew_lease, request, options: options do |response, operation|
|
610
|
+
yield response, operation if block_given?
|
611
|
+
return response
|
612
|
+
end
|
613
|
+
rescue ::GRPC::BadStatus => e
|
614
|
+
raise ::Google::Cloud::Error.from_error(e)
|
615
|
+
end
|
616
|
+
|
617
|
+
##
|
618
|
+
# RleaseLease releases a lease.
|
619
|
+
#
|
620
|
+
# @overload release_lease(request, options = nil)
|
621
|
+
# Pass arguments to `release_lease` via a request object, either of type
|
622
|
+
# {::Google::Cloud::VisionAI::V1::ReleaseLeaseRequest} or an equivalent Hash.
|
623
|
+
#
|
624
|
+
# @param request [::Google::Cloud::VisionAI::V1::ReleaseLeaseRequest, ::Hash]
|
625
|
+
# A request object representing the call parameters. Required. To specify no
|
626
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
627
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
628
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
629
|
+
#
|
630
|
+
# @overload release_lease(id: nil, series: nil, owner: nil)
|
631
|
+
# Pass arguments to `release_lease` via keyword arguments. Note that at
|
632
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
633
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
634
|
+
#
|
635
|
+
# @param id [::String]
|
636
|
+
# Lease id.
|
637
|
+
# @param series [::String]
|
638
|
+
# Series name.
|
639
|
+
# @param owner [::String]
|
640
|
+
# Lease owner.
|
641
|
+
#
|
642
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
643
|
+
# @yieldparam response [::Google::Cloud::VisionAI::V1::ReleaseLeaseResponse]
|
644
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
645
|
+
#
|
646
|
+
# @return [::Google::Cloud::VisionAI::V1::ReleaseLeaseResponse]
|
647
|
+
#
|
648
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
649
|
+
#
|
650
|
+
# @example Basic example
|
651
|
+
# require "google/cloud/vision_ai/v1"
|
652
|
+
#
|
653
|
+
# # Create a client object. The client can be reused for multiple calls.
|
654
|
+
# client = Google::Cloud::VisionAI::V1::StreamingService::Client.new
|
655
|
+
#
|
656
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
657
|
+
# request = Google::Cloud::VisionAI::V1::ReleaseLeaseRequest.new
|
658
|
+
#
|
659
|
+
# # Call the release_lease method.
|
660
|
+
# result = client.release_lease request
|
661
|
+
#
|
662
|
+
# # The returned object is of type Google::Cloud::VisionAI::V1::ReleaseLeaseResponse.
|
663
|
+
# p result
|
664
|
+
#
|
665
|
+
def release_lease request, options = nil
|
666
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
667
|
+
|
668
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VisionAI::V1::ReleaseLeaseRequest
|
669
|
+
|
670
|
+
# Converts hash and nil to an options object
|
671
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
672
|
+
|
673
|
+
# Customize the options with defaults
|
674
|
+
metadata = @config.rpcs.release_lease.metadata.to_h
|
675
|
+
|
676
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
677
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
678
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
679
|
+
gapic_version: ::Google::Cloud::VisionAI::V1::VERSION
|
680
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
681
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
682
|
+
|
683
|
+
header_params = {}
|
684
|
+
if request.series
|
685
|
+
header_params["series"] = request.series
|
686
|
+
end
|
687
|
+
|
688
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
689
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
690
|
+
|
691
|
+
options.apply_defaults timeout: @config.rpcs.release_lease.timeout,
|
692
|
+
metadata: metadata,
|
693
|
+
retry_policy: @config.rpcs.release_lease.retry_policy
|
694
|
+
|
695
|
+
options.apply_defaults timeout: @config.timeout,
|
696
|
+
metadata: @config.metadata,
|
697
|
+
retry_policy: @config.retry_policy
|
698
|
+
|
699
|
+
@streaming_service_stub.call_rpc :release_lease, request, options: options do |response, operation|
|
700
|
+
yield response, operation if block_given?
|
701
|
+
return response
|
702
|
+
end
|
703
|
+
rescue ::GRPC::BadStatus => e
|
704
|
+
raise ::Google::Cloud::Error.from_error(e)
|
705
|
+
end
|
706
|
+
|
707
|
+
##
|
708
|
+
# Configuration class for the StreamingService API.
|
709
|
+
#
|
710
|
+
# This class represents the configuration for StreamingService,
|
711
|
+
# providing control over timeouts, retry behavior, logging, transport
|
712
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
713
|
+
# applied individually to specific RPCs. See
|
714
|
+
# {::Google::Cloud::VisionAI::V1::StreamingService::Client::Configuration::Rpcs}
|
715
|
+
# for a list of RPCs that can be configured independently.
|
716
|
+
#
|
717
|
+
# Configuration can be applied globally to all clients, or to a single client
|
718
|
+
# on construction.
|
719
|
+
#
|
720
|
+
# @example
|
721
|
+
#
|
722
|
+
# # Modify the global config, setting the timeout for
|
723
|
+
# # send_packets to 20 seconds,
|
724
|
+
# # and all remaining timeouts to 10 seconds.
|
725
|
+
# ::Google::Cloud::VisionAI::V1::StreamingService::Client.configure do |config|
|
726
|
+
# config.timeout = 10.0
|
727
|
+
# config.rpcs.send_packets.timeout = 20.0
|
728
|
+
# end
|
729
|
+
#
|
730
|
+
# # Apply the above configuration only to a new client.
|
731
|
+
# client = ::Google::Cloud::VisionAI::V1::StreamingService::Client.new do |config|
|
732
|
+
# config.timeout = 10.0
|
733
|
+
# config.rpcs.send_packets.timeout = 20.0
|
734
|
+
# end
|
735
|
+
#
|
736
|
+
# @!attribute [rw] endpoint
|
737
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
738
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
739
|
+
# @return [::String,nil]
|
740
|
+
# @!attribute [rw] credentials
|
741
|
+
# Credentials to send with calls. You may provide any of the following types:
|
742
|
+
# * (`String`) The path to a service account key file in JSON format
|
743
|
+
# * (`Hash`) A service account key as a Hash
|
744
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
745
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
746
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
747
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
748
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
749
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
750
|
+
# * (`nil`) indicating no credentials
|
751
|
+
# @return [::Object]
|
752
|
+
# @!attribute [rw] scope
|
753
|
+
# The OAuth scopes
|
754
|
+
# @return [::Array<::String>]
|
755
|
+
# @!attribute [rw] lib_name
|
756
|
+
# The library name as recorded in instrumentation and logging
|
757
|
+
# @return [::String]
|
758
|
+
# @!attribute [rw] lib_version
|
759
|
+
# The library version as recorded in instrumentation and logging
|
760
|
+
# @return [::String]
|
761
|
+
# @!attribute [rw] channel_args
|
762
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
763
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
764
|
+
# @return [::Hash]
|
765
|
+
# @!attribute [rw] interceptors
|
766
|
+
# An array of interceptors that are run before calls are executed.
|
767
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
768
|
+
# @!attribute [rw] timeout
|
769
|
+
# The call timeout in seconds.
|
770
|
+
# @return [::Numeric]
|
771
|
+
# @!attribute [rw] metadata
|
772
|
+
# Additional gRPC headers to be sent with the call.
|
773
|
+
# @return [::Hash{::Symbol=>::String}]
|
774
|
+
# @!attribute [rw] retry_policy
|
775
|
+
# The retry policy. The value is a hash with the following keys:
|
776
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
777
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
778
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
779
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
780
|
+
# trigger a retry.
|
781
|
+
# @return [::Hash]
|
782
|
+
# @!attribute [rw] quota_project
|
783
|
+
# A separate project against which to charge quota.
|
784
|
+
# @return [::String]
|
785
|
+
# @!attribute [rw] universe_domain
|
786
|
+
# The universe domain within which to make requests. This determines the
|
787
|
+
# default endpoint URL. The default value of nil uses the environment
|
788
|
+
# universe (usually the default "googleapis.com" universe).
|
789
|
+
# @return [::String,nil]
|
790
|
+
#
|
791
|
+
class Configuration
|
792
|
+
extend ::Gapic::Config
|
793
|
+
|
794
|
+
# @private
|
795
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
796
|
+
DEFAULT_ENDPOINT = "visionai.googleapis.com"
|
797
|
+
|
798
|
+
config_attr :endpoint, nil, ::String, nil
|
799
|
+
config_attr :credentials, nil do |value|
|
800
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
801
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
802
|
+
allowed.any? { |klass| klass === value }
|
803
|
+
end
|
804
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
805
|
+
config_attr :lib_name, nil, ::String, nil
|
806
|
+
config_attr :lib_version, nil, ::String, nil
|
807
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
808
|
+
config_attr :interceptors, nil, ::Array, nil
|
809
|
+
config_attr :timeout, nil, ::Numeric, nil
|
810
|
+
config_attr :metadata, nil, ::Hash, nil
|
811
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
812
|
+
config_attr :quota_project, nil, ::String, nil
|
813
|
+
config_attr :universe_domain, nil, ::String, nil
|
814
|
+
|
815
|
+
# @private
|
816
|
+
def initialize parent_config = nil
|
817
|
+
@parent_config = parent_config unless parent_config.nil?
|
818
|
+
|
819
|
+
yield self if block_given?
|
820
|
+
end
|
821
|
+
|
822
|
+
##
|
823
|
+
# Configurations for individual RPCs
|
824
|
+
# @return [Rpcs]
|
825
|
+
#
|
826
|
+
def rpcs
|
827
|
+
@rpcs ||= begin
|
828
|
+
parent_rpcs = nil
|
829
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
830
|
+
Rpcs.new parent_rpcs
|
831
|
+
end
|
832
|
+
end
|
833
|
+
|
834
|
+
##
|
835
|
+
# Configuration for the channel pool
|
836
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
837
|
+
#
|
838
|
+
def channel_pool
|
839
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
840
|
+
end
|
841
|
+
|
842
|
+
##
|
843
|
+
# Configuration RPC class for the StreamingService API.
|
844
|
+
#
|
845
|
+
# Includes fields providing the configuration for each RPC in this service.
|
846
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
847
|
+
# the following configuration fields:
|
848
|
+
#
|
849
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
850
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
851
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
852
|
+
# include the following keys:
|
853
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
854
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
855
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
856
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
857
|
+
# trigger a retry.
|
858
|
+
#
|
859
|
+
class Rpcs
|
860
|
+
##
|
861
|
+
# RPC-specific configuration for `send_packets`
|
862
|
+
# @return [::Gapic::Config::Method]
|
863
|
+
#
|
864
|
+
attr_reader :send_packets
|
865
|
+
##
|
866
|
+
# RPC-specific configuration for `receive_packets`
|
867
|
+
# @return [::Gapic::Config::Method]
|
868
|
+
#
|
869
|
+
attr_reader :receive_packets
|
870
|
+
##
|
871
|
+
# RPC-specific configuration for `receive_events`
|
872
|
+
# @return [::Gapic::Config::Method]
|
873
|
+
#
|
874
|
+
attr_reader :receive_events
|
875
|
+
##
|
876
|
+
# RPC-specific configuration for `acquire_lease`
|
877
|
+
# @return [::Gapic::Config::Method]
|
878
|
+
#
|
879
|
+
attr_reader :acquire_lease
|
880
|
+
##
|
881
|
+
# RPC-specific configuration for `renew_lease`
|
882
|
+
# @return [::Gapic::Config::Method]
|
883
|
+
#
|
884
|
+
attr_reader :renew_lease
|
885
|
+
##
|
886
|
+
# RPC-specific configuration for `release_lease`
|
887
|
+
# @return [::Gapic::Config::Method]
|
888
|
+
#
|
889
|
+
attr_reader :release_lease
|
890
|
+
|
891
|
+
# @private
|
892
|
+
def initialize parent_rpcs = nil
|
893
|
+
send_packets_config = parent_rpcs.send_packets if parent_rpcs.respond_to? :send_packets
|
894
|
+
@send_packets = ::Gapic::Config::Method.new send_packets_config
|
895
|
+
receive_packets_config = parent_rpcs.receive_packets if parent_rpcs.respond_to? :receive_packets
|
896
|
+
@receive_packets = ::Gapic::Config::Method.new receive_packets_config
|
897
|
+
receive_events_config = parent_rpcs.receive_events if parent_rpcs.respond_to? :receive_events
|
898
|
+
@receive_events = ::Gapic::Config::Method.new receive_events_config
|
899
|
+
acquire_lease_config = parent_rpcs.acquire_lease if parent_rpcs.respond_to? :acquire_lease
|
900
|
+
@acquire_lease = ::Gapic::Config::Method.new acquire_lease_config
|
901
|
+
renew_lease_config = parent_rpcs.renew_lease if parent_rpcs.respond_to? :renew_lease
|
902
|
+
@renew_lease = ::Gapic::Config::Method.new renew_lease_config
|
903
|
+
release_lease_config = parent_rpcs.release_lease if parent_rpcs.respond_to? :release_lease
|
904
|
+
@release_lease = ::Gapic::Config::Method.new release_lease_config
|
905
|
+
|
906
|
+
yield self if block_given?
|
907
|
+
end
|
908
|
+
end
|
909
|
+
end
|
910
|
+
end
|
911
|
+
end
|
912
|
+
end
|
913
|
+
end
|
914
|
+
end
|
915
|
+
end
|