google-maps-route_optimization-v1 0.a → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +153 -8
- data/lib/google/maps/route_optimization/v1/rest.rb +37 -0
- data/lib/google/maps/route_optimization/v1/route_optimization/client.rb +1272 -0
- data/lib/google/maps/route_optimization/v1/route_optimization/credentials.rb +47 -0
- data/lib/google/maps/route_optimization/v1/route_optimization/operations.rb +843 -0
- data/lib/google/maps/route_optimization/v1/route_optimization/rest/client.rb +1201 -0
- data/lib/google/maps/route_optimization/v1/route_optimization/rest/operations.rb +927 -0
- data/lib/google/maps/route_optimization/v1/route_optimization/rest/service_stub.rb +361 -0
- data/lib/google/maps/route_optimization/v1/route_optimization/rest.rb +68 -0
- data/lib/google/maps/route_optimization/v1/route_optimization.rb +71 -0
- data/lib/google/maps/route_optimization/v1/version.rb +7 -2
- data/lib/google/maps/route_optimization/v1.rb +45 -0
- data/lib/google/maps/routeoptimization/v1/route_optimization_service_pb.rb +93 -0
- data/lib/google/maps/routeoptimization/v1/route_optimization_service_services_pb.rb +148 -0
- data/lib/google-maps-route_optimization-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +593 -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/longrunning/operations.rb +191 -0
- data/proto_docs/google/maps/routeoptimization/v1/route_optimization_service.rb +2931 -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/timestamp.rb +128 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- data/proto_docs/google/type/latlng.rb +38 -0
- metadata +66 -9
|
@@ -0,0 +1,1201 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 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/maps/routeoptimization/v1/route_optimization_service_pb"
|
|
21
|
+
require "google/maps/route_optimization/v1/route_optimization/rest/service_stub"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Maps
|
|
25
|
+
module RouteOptimization
|
|
26
|
+
module V1
|
|
27
|
+
module RouteOptimization
|
|
28
|
+
module Rest
|
|
29
|
+
##
|
|
30
|
+
# REST client for the RouteOptimization service.
|
|
31
|
+
#
|
|
32
|
+
# A service for optimizing vehicle tours.
|
|
33
|
+
#
|
|
34
|
+
# Validity of certain types of fields:
|
|
35
|
+
#
|
|
36
|
+
# * `google.protobuf.Timestamp`
|
|
37
|
+
# * Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00.
|
|
38
|
+
# * seconds must be in [0, 253402300799],
|
|
39
|
+
# i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
|
|
40
|
+
# * nanos must be unset or set to 0.
|
|
41
|
+
# * `google.protobuf.Duration`
|
|
42
|
+
# * seconds must be in [0, 253402300799],
|
|
43
|
+
# i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
|
|
44
|
+
# * nanos must be unset or set to 0.
|
|
45
|
+
# * `google.type.LatLng`
|
|
46
|
+
# * latitude must be in [-90.0, 90.0].
|
|
47
|
+
# * longitude must be in [-180.0, 180.0].
|
|
48
|
+
# * at least one of latitude and longitude must be non-zero.
|
|
49
|
+
#
|
|
50
|
+
class Client
|
|
51
|
+
# @private
|
|
52
|
+
API_VERSION = ""
|
|
53
|
+
|
|
54
|
+
# @private
|
|
55
|
+
DEFAULT_ENDPOINT_TEMPLATE = "routeoptimization.$UNIVERSE_DOMAIN$"
|
|
56
|
+
|
|
57
|
+
# @private
|
|
58
|
+
attr_reader :route_optimization_stub
|
|
59
|
+
|
|
60
|
+
##
|
|
61
|
+
# Configure the RouteOptimization Client class.
|
|
62
|
+
#
|
|
63
|
+
# See {::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client::Configuration}
|
|
64
|
+
# for a description of the configuration fields.
|
|
65
|
+
#
|
|
66
|
+
# @example
|
|
67
|
+
#
|
|
68
|
+
# # Modify the configuration for all RouteOptimization clients
|
|
69
|
+
# ::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client.configure do |config|
|
|
70
|
+
# config.timeout = 10.0
|
|
71
|
+
# end
|
|
72
|
+
#
|
|
73
|
+
# @yield [config] Configure the Client client.
|
|
74
|
+
# @yieldparam config [Client::Configuration]
|
|
75
|
+
#
|
|
76
|
+
# @return [Client::Configuration]
|
|
77
|
+
#
|
|
78
|
+
def self.configure
|
|
79
|
+
@configure ||= begin
|
|
80
|
+
namespace = ["Google", "Maps", "RouteOptimization", "V1"]
|
|
81
|
+
parent_config = while namespace.any?
|
|
82
|
+
parent_name = namespace.join "::"
|
|
83
|
+
parent_const = const_get parent_name
|
|
84
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
85
|
+
namespace.pop
|
|
86
|
+
end
|
|
87
|
+
default_config = Client::Configuration.new parent_config
|
|
88
|
+
|
|
89
|
+
default_config.rpcs.optimize_tours.timeout = 3600.0
|
|
90
|
+
default_config.rpcs.optimize_tours.retry_policy = {
|
|
91
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
default_config
|
|
95
|
+
end
|
|
96
|
+
yield @configure if block_given?
|
|
97
|
+
@configure
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
##
|
|
101
|
+
# Configure the RouteOptimization Client instance.
|
|
102
|
+
#
|
|
103
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
104
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
105
|
+
# should be made on {Client.configure}.
|
|
106
|
+
#
|
|
107
|
+
# See {::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client::Configuration}
|
|
108
|
+
# for a description of the configuration fields.
|
|
109
|
+
#
|
|
110
|
+
# @yield [config] Configure the Client client.
|
|
111
|
+
# @yieldparam config [Client::Configuration]
|
|
112
|
+
#
|
|
113
|
+
# @return [Client::Configuration]
|
|
114
|
+
#
|
|
115
|
+
def configure
|
|
116
|
+
yield @config if block_given?
|
|
117
|
+
@config
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
##
|
|
121
|
+
# The effective universe domain
|
|
122
|
+
#
|
|
123
|
+
# @return [String]
|
|
124
|
+
#
|
|
125
|
+
def universe_domain
|
|
126
|
+
@route_optimization_stub.universe_domain
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
##
|
|
130
|
+
# Create a new RouteOptimization REST client object.
|
|
131
|
+
#
|
|
132
|
+
# @example
|
|
133
|
+
#
|
|
134
|
+
# # Create a client using the default configuration
|
|
135
|
+
# client = ::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client.new
|
|
136
|
+
#
|
|
137
|
+
# # Create a client using a custom configuration
|
|
138
|
+
# client = ::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client.new do |config|
|
|
139
|
+
# config.timeout = 10.0
|
|
140
|
+
# end
|
|
141
|
+
#
|
|
142
|
+
# @yield [config] Configure the RouteOptimization client.
|
|
143
|
+
# @yieldparam config [Client::Configuration]
|
|
144
|
+
#
|
|
145
|
+
def initialize
|
|
146
|
+
# Create the configuration object
|
|
147
|
+
@config = Configuration.new Client.configure
|
|
148
|
+
|
|
149
|
+
# Yield the configuration if needed
|
|
150
|
+
yield @config if block_given?
|
|
151
|
+
|
|
152
|
+
# Create credentials
|
|
153
|
+
credentials = @config.credentials
|
|
154
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
155
|
+
# but only if the default endpoint does not have a region prefix.
|
|
156
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
157
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
158
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
159
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
160
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
161
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
162
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
@quota_project_id = @config.quota_project
|
|
166
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
167
|
+
|
|
168
|
+
@operations_client = ::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Operations.new do |config|
|
|
169
|
+
config.credentials = credentials
|
|
170
|
+
config.quota_project = @quota_project_id
|
|
171
|
+
config.endpoint = @config.endpoint
|
|
172
|
+
config.universe_domain = @config.universe_domain
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
@route_optimization_stub = ::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::ServiceStub.new(
|
|
176
|
+
endpoint: @config.endpoint,
|
|
177
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
178
|
+
universe_domain: @config.universe_domain,
|
|
179
|
+
credentials: credentials,
|
|
180
|
+
logger: @config.logger
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
@route_optimization_stub.logger(stub: true)&.info do |entry|
|
|
184
|
+
entry.set_system_name
|
|
185
|
+
entry.set_service
|
|
186
|
+
entry.message = "Created client for #{entry.service}"
|
|
187
|
+
entry.set_credentials_fields credentials
|
|
188
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
189
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
190
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
##
|
|
195
|
+
# Get the associated client for long-running operations.
|
|
196
|
+
#
|
|
197
|
+
# @return [::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Operations]
|
|
198
|
+
#
|
|
199
|
+
attr_reader :operations_client
|
|
200
|
+
|
|
201
|
+
##
|
|
202
|
+
# The logger used for request/response debug logging.
|
|
203
|
+
#
|
|
204
|
+
# @return [Logger]
|
|
205
|
+
#
|
|
206
|
+
def logger
|
|
207
|
+
@route_optimization_stub.logger
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Service calls
|
|
211
|
+
|
|
212
|
+
##
|
|
213
|
+
# Sends an `OptimizeToursRequest` containing a `ShipmentModel` and returns an
|
|
214
|
+
# `OptimizeToursResponse` containing `ShipmentRoute`s, which are a set of
|
|
215
|
+
# routes to be performed by vehicles minimizing the overall cost.
|
|
216
|
+
#
|
|
217
|
+
# A `ShipmentModel` model consists mainly of `Shipment`s that need to be
|
|
218
|
+
# carried out and `Vehicle`s that can be used to transport the `Shipment`s.
|
|
219
|
+
# The `ShipmentRoute`s assign `Shipment`s to `Vehicle`s. More specifically,
|
|
220
|
+
# they assign a series of `Visit`s to each vehicle, where a `Visit`
|
|
221
|
+
# corresponds to a `VisitRequest`, which is a pickup or delivery for a
|
|
222
|
+
# `Shipment`.
|
|
223
|
+
#
|
|
224
|
+
# The goal is to provide an assignment of `ShipmentRoute`s to `Vehicle`s that
|
|
225
|
+
# minimizes the total cost where cost has many components defined in the
|
|
226
|
+
# `ShipmentModel`.
|
|
227
|
+
#
|
|
228
|
+
# @overload optimize_tours(request, options = nil)
|
|
229
|
+
# Pass arguments to `optimize_tours` via a request object, either of type
|
|
230
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursRequest} or an equivalent Hash.
|
|
231
|
+
#
|
|
232
|
+
# @param request [::Google::Maps::RouteOptimization::V1::OptimizeToursRequest, ::Hash]
|
|
233
|
+
# A request object representing the call parameters. Required. To specify no
|
|
234
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
235
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
236
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
237
|
+
#
|
|
238
|
+
# @overload optimize_tours(parent: nil, timeout: nil, model: nil, solving_mode: nil, search_mode: nil, injected_first_solution_routes: nil, injected_solution_constraint: nil, refresh_details_routes: nil, interpret_injected_solutions_using_labels: nil, consider_road_traffic: nil, populate_polylines: nil, populate_transition_polylines: nil, allow_large_deadline_despite_interruption_risk: nil, use_geodesic_distances: nil, geodesic_meters_per_second: nil, max_validation_errors: nil, label: nil)
|
|
239
|
+
# Pass arguments to `optimize_tours` via keyword arguments. Note that at
|
|
240
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
241
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
242
|
+
#
|
|
243
|
+
# @param parent [::String]
|
|
244
|
+
# Required. Target project or location to make a call.
|
|
245
|
+
#
|
|
246
|
+
# Format:
|
|
247
|
+
# * `projects/{project-id}`
|
|
248
|
+
# * `projects/{project-id}/locations/{location-id}`
|
|
249
|
+
#
|
|
250
|
+
# If no location is specified, a region will be chosen automatically.
|
|
251
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
|
252
|
+
# If this timeout is set, the server returns a response before the timeout
|
|
253
|
+
# period has elapsed or the server deadline for synchronous requests is
|
|
254
|
+
# reached, whichever is sooner.
|
|
255
|
+
#
|
|
256
|
+
# For asynchronous requests, the server will generate a solution (if
|
|
257
|
+
# possible) before the timeout has elapsed.
|
|
258
|
+
# @param model [::Google::Maps::RouteOptimization::V1::ShipmentModel, ::Hash]
|
|
259
|
+
# Shipment model to solve.
|
|
260
|
+
# @param solving_mode [::Google::Maps::RouteOptimization::V1::OptimizeToursRequest::SolvingMode]
|
|
261
|
+
# By default, the solving mode is `DEFAULT_SOLVE` (0).
|
|
262
|
+
# @param search_mode [::Google::Maps::RouteOptimization::V1::OptimizeToursRequest::SearchMode]
|
|
263
|
+
# Search mode used to solve the request.
|
|
264
|
+
# @param injected_first_solution_routes [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute, ::Hash>]
|
|
265
|
+
# Guide the optimization algorithm in finding a first solution that is
|
|
266
|
+
# similar to a previous solution.
|
|
267
|
+
#
|
|
268
|
+
# The model is constrained when the first solution is built.
|
|
269
|
+
# Any shipments not performed on a route are implicitly skipped in the first
|
|
270
|
+
# solution, but they may be performed in successive solutions.
|
|
271
|
+
#
|
|
272
|
+
# The solution must satisfy some basic validity assumptions:
|
|
273
|
+
#
|
|
274
|
+
# * for all routes, `vehicle_index` must be in range and not be duplicated.
|
|
275
|
+
# * for all visits, `shipment_index` and `visit_request_index` must be
|
|
276
|
+
# in range.
|
|
277
|
+
# * a shipment may only be referenced on one route.
|
|
278
|
+
# * the pickup of a pickup-delivery shipment must be performed before
|
|
279
|
+
# the delivery.
|
|
280
|
+
# * no more than one pickup alternative or delivery alternative of
|
|
281
|
+
# a shipment may be performed.
|
|
282
|
+
# * for all routes, times are increasing (i.e., `vehicle_start_time
|
|
283
|
+
# <= visits[0].start_time <= visits[1].start_time ...
|
|
284
|
+
# <= vehicle_end_time`).
|
|
285
|
+
# * a shipment may only be performed on a vehicle that is allowed. A
|
|
286
|
+
# vehicle is allowed if
|
|
287
|
+
# {::Google::Maps::RouteOptimization::V1::Shipment#allowed_vehicle_indices Shipment.allowed_vehicle_indices}
|
|
288
|
+
# is empty or its `vehicle_index` is included in
|
|
289
|
+
# {::Google::Maps::RouteOptimization::V1::Shipment#allowed_vehicle_indices Shipment.allowed_vehicle_indices}.
|
|
290
|
+
#
|
|
291
|
+
# If the injected solution is not feasible, a validation error is not
|
|
292
|
+
# necessarily returned and an error indicating infeasibility may be returned
|
|
293
|
+
# instead.
|
|
294
|
+
# @param injected_solution_constraint [::Google::Maps::RouteOptimization::V1::InjectedSolutionConstraint, ::Hash]
|
|
295
|
+
# Constrain the optimization algorithm to find a final solution that is
|
|
296
|
+
# similar to a previous solution. For example, this may be used to freeze
|
|
297
|
+
# portions of routes which have already been completed or which are to be
|
|
298
|
+
# completed but must not be modified.
|
|
299
|
+
#
|
|
300
|
+
# If the injected solution is not feasible, a validation error is not
|
|
301
|
+
# necessarily returned and an error indicating infeasibility may be returned
|
|
302
|
+
# instead.
|
|
303
|
+
# @param refresh_details_routes [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute, ::Hash>]
|
|
304
|
+
# If non-empty, the given routes will be refreshed, without modifying their
|
|
305
|
+
# underlying sequence of visits or travel times: only other details will be
|
|
306
|
+
# updated. This does not solve the model.
|
|
307
|
+
#
|
|
308
|
+
# As of 2020/11, this only populates the polylines of non-empty routes and
|
|
309
|
+
# requires that `populate_polylines` is true.
|
|
310
|
+
#
|
|
311
|
+
# The `route_polyline` fields of the passed-in routes may be inconsistent
|
|
312
|
+
# with route `transitions`.
|
|
313
|
+
#
|
|
314
|
+
# This field must not be used together with `injected_first_solution_routes`
|
|
315
|
+
# or `injected_solution_constraint`.
|
|
316
|
+
#
|
|
317
|
+
# `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior.
|
|
318
|
+
# Polylines are still populated between all visits in all non-empty routes
|
|
319
|
+
# regardless of whether the related shipments or vehicles are ignored.
|
|
320
|
+
# @param interpret_injected_solutions_using_labels [::Boolean]
|
|
321
|
+
# If true:
|
|
322
|
+
#
|
|
323
|
+
# * uses
|
|
324
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_label ShipmentRoute.vehicle_label}
|
|
325
|
+
# instead of `vehicle_index` to
|
|
326
|
+
# match routes in an injected solution with vehicles in the request;
|
|
327
|
+
# reuses the mapping of original
|
|
328
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_index ShipmentRoute.vehicle_index}
|
|
329
|
+
# to new
|
|
330
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_index ShipmentRoute.vehicle_index}
|
|
331
|
+
# to update
|
|
332
|
+
# {::Google::Maps::RouteOptimization::V1::InjectedSolutionConstraint::ConstraintRelaxation#vehicle_indices ConstraintRelaxation.vehicle_indices}
|
|
333
|
+
# if non-empty, but the mapping must be unambiguous (i.e., multiple
|
|
334
|
+
# `ShipmentRoute`s must not share the same original `vehicle_index`).
|
|
335
|
+
# * uses
|
|
336
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit#shipment_label ShipmentRoute.Visit.shipment_label}
|
|
337
|
+
# instead of `shipment_index`
|
|
338
|
+
# to match visits in an injected solution with shipments in the request;
|
|
339
|
+
# * uses
|
|
340
|
+
# {::Google::Maps::RouteOptimization::V1::SkippedShipment#label SkippedShipment.label}
|
|
341
|
+
# instead of
|
|
342
|
+
# {::Google::Maps::RouteOptimization::V1::SkippedShipment#index SkippedShipment.index}
|
|
343
|
+
# to
|
|
344
|
+
# match skipped shipments in the injected solution with request
|
|
345
|
+
# shipments.
|
|
346
|
+
#
|
|
347
|
+
# This interpretation applies to the `injected_first_solution_routes`,
|
|
348
|
+
# `injected_solution_constraint`, and `refresh_details_routes` fields.
|
|
349
|
+
# It can be used when shipment or vehicle indices in the request have
|
|
350
|
+
# changed since the solution was created, perhaps because shipments or
|
|
351
|
+
# vehicles have been removed from or added to the request.
|
|
352
|
+
#
|
|
353
|
+
# If true, labels in the following categories must appear at most once in
|
|
354
|
+
# their category:
|
|
355
|
+
#
|
|
356
|
+
# * {::Google::Maps::RouteOptimization::V1::Vehicle#label Vehicle.label} in the
|
|
357
|
+
# request;
|
|
358
|
+
# * {::Google::Maps::RouteOptimization::V1::Shipment#label Shipment.label} in
|
|
359
|
+
# the request;
|
|
360
|
+
# * {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_label ShipmentRoute.vehicle_label} in the injected solution;
|
|
361
|
+
# * {::Google::Maps::RouteOptimization::V1::SkippedShipment#label SkippedShipment.label} and {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit#shipment_label ShipmentRoute.Visit.shipment_label} in
|
|
362
|
+
# the injected solution (except pickup/delivery visit pairs, whose
|
|
363
|
+
# `shipment_label` must appear twice).
|
|
364
|
+
#
|
|
365
|
+
# If a `vehicle_label` in the injected solution does not correspond to a
|
|
366
|
+
# request vehicle, the corresponding route is removed from the solution
|
|
367
|
+
# along with its visits. If a `shipment_label` in the injected solution does
|
|
368
|
+
# not correspond to a request shipment, the corresponding visit is removed
|
|
369
|
+
# from the solution. If a
|
|
370
|
+
# {::Google::Maps::RouteOptimization::V1::SkippedShipment#label SkippedShipment.label}
|
|
371
|
+
# in the injected solution does not correspond to a request shipment, the
|
|
372
|
+
# `SkippedShipment` is removed from the solution.
|
|
373
|
+
#
|
|
374
|
+
# Removing route visits or entire routes from an injected solution may
|
|
375
|
+
# have an effect on the implied constraints, which may lead to change in
|
|
376
|
+
# solution, validation errors, or infeasibility.
|
|
377
|
+
#
|
|
378
|
+
# NOTE: The caller must ensure that each
|
|
379
|
+
# {::Google::Maps::RouteOptimization::V1::Vehicle#label Vehicle.label} (resp.
|
|
380
|
+
# {::Google::Maps::RouteOptimization::V1::Shipment#label Shipment.label}) uniquely
|
|
381
|
+
# identifies a vehicle (resp. shipment) entity used across the two relevant
|
|
382
|
+
# requests: the past request that produced the `OptimizeToursResponse` used
|
|
383
|
+
# in the injected solution and the current request that includes the injected
|
|
384
|
+
# solution. The uniqueness checks described above are not enough to guarantee
|
|
385
|
+
# this requirement.
|
|
386
|
+
# @param consider_road_traffic [::Boolean]
|
|
387
|
+
# Consider traffic estimation in calculating `ShipmentRoute` fields
|
|
388
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition#travel_duration Transition.travel_duration},
|
|
389
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit#start_time Visit.start_time},
|
|
390
|
+
# and `vehicle_end_time`; in setting the
|
|
391
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#has_traffic_infeasibilities ShipmentRoute.has_traffic_infeasibilities}
|
|
392
|
+
# field, and in calculating the
|
|
393
|
+
# [OptimizeToursResponse.total_cost][google.maps.routeoptimization.v1.OptimizeToursResponse.total_cost]
|
|
394
|
+
# field.
|
|
395
|
+
# @param populate_polylines [::Boolean]
|
|
396
|
+
# If true, polylines will be populated in response `ShipmentRoute`s.
|
|
397
|
+
# @param populate_transition_polylines [::Boolean]
|
|
398
|
+
# If true, polylines and route tokens will be populated in response
|
|
399
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#transitions ShipmentRoute.transitions}.
|
|
400
|
+
# @param allow_large_deadline_despite_interruption_risk [::Boolean]
|
|
401
|
+
# If this is set, then the request can have a deadline
|
|
402
|
+
# (see https://grpc.io/blog/deadlines) of up to 60 minutes.
|
|
403
|
+
# Otherwise, the maximum deadline is only 30 minutes.
|
|
404
|
+
# Note that long-lived requests have a significantly larger (but still small)
|
|
405
|
+
# risk of interruption.
|
|
406
|
+
# @param use_geodesic_distances [::Boolean]
|
|
407
|
+
# If true, travel distances will be computed using geodesic distances instead
|
|
408
|
+
# of Google Maps distances, and travel times will be computed using geodesic
|
|
409
|
+
# distances with a speed defined by `geodesic_meters_per_second`.
|
|
410
|
+
# @param geodesic_meters_per_second [::Float]
|
|
411
|
+
# When `use_geodesic_distances` is true, this field must be set and defines
|
|
412
|
+
# the speed applied to compute travel times. Its value must be at least 1.0
|
|
413
|
+
# meters/seconds.
|
|
414
|
+
# @param max_validation_errors [::Integer]
|
|
415
|
+
# Truncates the number of validation errors returned. These errors are
|
|
416
|
+
# typically attached to an INVALID_ARGUMENT error payload as a BadRequest
|
|
417
|
+
# error detail (https://cloud.google.com/apis/design/errors#error_details),
|
|
418
|
+
# unless solving_mode=VALIDATE_ONLY: see the
|
|
419
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#validation_errors OptimizeToursResponse.validation_errors}
|
|
420
|
+
# field.
|
|
421
|
+
# This defaults to 100 and is capped at 10,000.
|
|
422
|
+
# @param label [::String]
|
|
423
|
+
# Label that may be used to identify this request, reported back in the
|
|
424
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#request_label OptimizeToursResponse.request_label}.
|
|
425
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
426
|
+
# @yieldparam result [::Google::Maps::RouteOptimization::V1::OptimizeToursResponse]
|
|
427
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
428
|
+
#
|
|
429
|
+
# @return [::Google::Maps::RouteOptimization::V1::OptimizeToursResponse]
|
|
430
|
+
#
|
|
431
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
432
|
+
#
|
|
433
|
+
# @example Basic example
|
|
434
|
+
# require "google/maps/route_optimization/v1"
|
|
435
|
+
#
|
|
436
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
437
|
+
# client = Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client.new
|
|
438
|
+
#
|
|
439
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
440
|
+
# request = Google::Maps::RouteOptimization::V1::OptimizeToursRequest.new
|
|
441
|
+
#
|
|
442
|
+
# # Call the optimize_tours method.
|
|
443
|
+
# result = client.optimize_tours request
|
|
444
|
+
#
|
|
445
|
+
# # The returned object is of type Google::Maps::RouteOptimization::V1::OptimizeToursResponse.
|
|
446
|
+
# p result
|
|
447
|
+
#
|
|
448
|
+
def optimize_tours request, options = nil
|
|
449
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
450
|
+
|
|
451
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::RouteOptimization::V1::OptimizeToursRequest
|
|
452
|
+
|
|
453
|
+
# Converts hash and nil to an options object
|
|
454
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
455
|
+
|
|
456
|
+
# Customize the options with defaults
|
|
457
|
+
call_metadata = @config.rpcs.optimize_tours.metadata.to_h
|
|
458
|
+
|
|
459
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
460
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
461
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
462
|
+
gapic_version: ::Google::Maps::RouteOptimization::V1::VERSION,
|
|
463
|
+
transports_version_send: [:rest]
|
|
464
|
+
|
|
465
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
466
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
467
|
+
|
|
468
|
+
options.apply_defaults timeout: @config.rpcs.optimize_tours.timeout,
|
|
469
|
+
metadata: call_metadata,
|
|
470
|
+
retry_policy: @config.rpcs.optimize_tours.retry_policy
|
|
471
|
+
|
|
472
|
+
options.apply_defaults timeout: @config.timeout,
|
|
473
|
+
metadata: @config.metadata,
|
|
474
|
+
retry_policy: @config.retry_policy
|
|
475
|
+
|
|
476
|
+
@route_optimization_stub.optimize_tours request, options do |result, operation|
|
|
477
|
+
yield result, operation if block_given?
|
|
478
|
+
end
|
|
479
|
+
rescue ::Gapic::Rest::Error => e
|
|
480
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
##
|
|
484
|
+
# Optimizes vehicle tours for one or more `OptimizeToursRequest`
|
|
485
|
+
# messages as a batch.
|
|
486
|
+
#
|
|
487
|
+
# This method is a Long Running Operation (LRO). The inputs for optimization
|
|
488
|
+
# (`OptimizeToursRequest` messages) and outputs (`OptimizeToursResponse`
|
|
489
|
+
# messages) are read from and written to Cloud Storage in user-specified
|
|
490
|
+
# format. Like the `OptimizeTours` method, each `OptimizeToursRequest`
|
|
491
|
+
# contains a `ShipmentModel` and returns an `OptimizeToursResponse`
|
|
492
|
+
# containing `ShipmentRoute` fields, which are a set of routes to be
|
|
493
|
+
# performed by vehicles minimizing the overall cost.
|
|
494
|
+
#
|
|
495
|
+
# The user can poll `operations.get` to check the status of the LRO:
|
|
496
|
+
#
|
|
497
|
+
# If the LRO `done` field is false, then at least one request is still
|
|
498
|
+
# being processed. Other requests may have completed successfully and their
|
|
499
|
+
# results are available in Cloud Storage.
|
|
500
|
+
#
|
|
501
|
+
# If the LRO's `done` field is true, then all requests have been processed.
|
|
502
|
+
# Any successfully processed requests will have their results available in
|
|
503
|
+
# Cloud Storage. Any requests that failed will not have their results
|
|
504
|
+
# available in Cloud Storage. If the LRO's `error` field is set, then it
|
|
505
|
+
# contains the error from one of the failed requests.
|
|
506
|
+
#
|
|
507
|
+
# @overload batch_optimize_tours(request, options = nil)
|
|
508
|
+
# Pass arguments to `batch_optimize_tours` via a request object, either of type
|
|
509
|
+
# {::Google::Maps::RouteOptimization::V1::BatchOptimizeToursRequest} or an equivalent Hash.
|
|
510
|
+
#
|
|
511
|
+
# @param request [::Google::Maps::RouteOptimization::V1::BatchOptimizeToursRequest, ::Hash]
|
|
512
|
+
# A request object representing the call parameters. Required. To specify no
|
|
513
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
514
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
515
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
516
|
+
#
|
|
517
|
+
# @overload batch_optimize_tours(parent: nil, model_configs: nil)
|
|
518
|
+
# Pass arguments to `batch_optimize_tours` via keyword arguments. Note that at
|
|
519
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
520
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
521
|
+
#
|
|
522
|
+
# @param parent [::String]
|
|
523
|
+
# Required. Target project and location to make a call.
|
|
524
|
+
#
|
|
525
|
+
# Format:
|
|
526
|
+
# * `projects/{project-id}`
|
|
527
|
+
# * `projects/{project-id}/locations/{location-id}`
|
|
528
|
+
#
|
|
529
|
+
# If no location is specified, a region will be chosen automatically.
|
|
530
|
+
# @param model_configs [::Array<::Google::Maps::RouteOptimization::V1::BatchOptimizeToursRequest::AsyncModelConfig, ::Hash>]
|
|
531
|
+
# Required. Input/Output information each purchase model, such as file paths
|
|
532
|
+
# and data formats.
|
|
533
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
534
|
+
# @yieldparam result [::Gapic::Operation]
|
|
535
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
536
|
+
#
|
|
537
|
+
# @return [::Gapic::Operation]
|
|
538
|
+
#
|
|
539
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
540
|
+
#
|
|
541
|
+
# @example Basic example
|
|
542
|
+
# require "google/maps/route_optimization/v1"
|
|
543
|
+
#
|
|
544
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
545
|
+
# client = Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client.new
|
|
546
|
+
#
|
|
547
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
548
|
+
# request = Google::Maps::RouteOptimization::V1::BatchOptimizeToursRequest.new
|
|
549
|
+
#
|
|
550
|
+
# # Call the batch_optimize_tours method.
|
|
551
|
+
# result = client.batch_optimize_tours request
|
|
552
|
+
#
|
|
553
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
554
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
555
|
+
# # Here is how to wait for a response.
|
|
556
|
+
# result.wait_until_done! timeout: 60
|
|
557
|
+
# if result.response?
|
|
558
|
+
# p result.response
|
|
559
|
+
# else
|
|
560
|
+
# puts "No response received."
|
|
561
|
+
# end
|
|
562
|
+
#
|
|
563
|
+
def batch_optimize_tours request, options = nil
|
|
564
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
565
|
+
|
|
566
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::RouteOptimization::V1::BatchOptimizeToursRequest
|
|
567
|
+
|
|
568
|
+
# Converts hash and nil to an options object
|
|
569
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
570
|
+
|
|
571
|
+
# Customize the options with defaults
|
|
572
|
+
call_metadata = @config.rpcs.batch_optimize_tours.metadata.to_h
|
|
573
|
+
|
|
574
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
575
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
576
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
577
|
+
gapic_version: ::Google::Maps::RouteOptimization::V1::VERSION,
|
|
578
|
+
transports_version_send: [:rest]
|
|
579
|
+
|
|
580
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
581
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
582
|
+
|
|
583
|
+
options.apply_defaults timeout: @config.rpcs.batch_optimize_tours.timeout,
|
|
584
|
+
metadata: call_metadata,
|
|
585
|
+
retry_policy: @config.rpcs.batch_optimize_tours.retry_policy
|
|
586
|
+
|
|
587
|
+
options.apply_defaults timeout: @config.timeout,
|
|
588
|
+
metadata: @config.metadata,
|
|
589
|
+
retry_policy: @config.retry_policy
|
|
590
|
+
|
|
591
|
+
@route_optimization_stub.batch_optimize_tours request, options do |result, operation|
|
|
592
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
593
|
+
yield result, operation if block_given?
|
|
594
|
+
throw :response, result
|
|
595
|
+
end
|
|
596
|
+
rescue ::Gapic::Rest::Error => e
|
|
597
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
##
|
|
601
|
+
# This is a variant of the
|
|
602
|
+
# {::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client#optimize_tours OptimizeTours}
|
|
603
|
+
# method designed for
|
|
604
|
+
# optimizations with large timeout values. It should be preferred over the
|
|
605
|
+
# `OptimizeTours` method for optimizations that take longer than
|
|
606
|
+
# a few minutes.
|
|
607
|
+
#
|
|
608
|
+
# The returned {::Google::Longrunning::Operation long-running operation} (LRO)
|
|
609
|
+
# will have a name of the format
|
|
610
|
+
# `<parent>/operations/<operation_id>` and can be used to track
|
|
611
|
+
# progress of the computation. The
|
|
612
|
+
# {::Google::Longrunning::Operation#metadata metadata} field type is
|
|
613
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursLongRunningMetadata OptimizeToursLongRunningMetadata}.
|
|
614
|
+
# The {::Google::Longrunning::Operation#response response} field type is
|
|
615
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse OptimizeToursResponse},
|
|
616
|
+
# if successful.
|
|
617
|
+
#
|
|
618
|
+
# Experimental: See
|
|
619
|
+
# https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request
|
|
620
|
+
# for more details.
|
|
621
|
+
#
|
|
622
|
+
# @overload optimize_tours_long_running(request, options = nil)
|
|
623
|
+
# Pass arguments to `optimize_tours_long_running` via a request object, either of type
|
|
624
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursRequest} or an equivalent Hash.
|
|
625
|
+
#
|
|
626
|
+
# @param request [::Google::Maps::RouteOptimization::V1::OptimizeToursRequest, ::Hash]
|
|
627
|
+
# A request object representing the call parameters. Required. To specify no
|
|
628
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
629
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
630
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
631
|
+
#
|
|
632
|
+
# @overload optimize_tours_long_running(parent: nil, timeout: nil, model: nil, solving_mode: nil, search_mode: nil, injected_first_solution_routes: nil, injected_solution_constraint: nil, refresh_details_routes: nil, interpret_injected_solutions_using_labels: nil, consider_road_traffic: nil, populate_polylines: nil, populate_transition_polylines: nil, allow_large_deadline_despite_interruption_risk: nil, use_geodesic_distances: nil, geodesic_meters_per_second: nil, max_validation_errors: nil, label: nil)
|
|
633
|
+
# Pass arguments to `optimize_tours_long_running` via keyword arguments. Note that at
|
|
634
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
635
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
636
|
+
#
|
|
637
|
+
# @param parent [::String]
|
|
638
|
+
# Required. Target project or location to make a call.
|
|
639
|
+
#
|
|
640
|
+
# Format:
|
|
641
|
+
# * `projects/{project-id}`
|
|
642
|
+
# * `projects/{project-id}/locations/{location-id}`
|
|
643
|
+
#
|
|
644
|
+
# If no location is specified, a region will be chosen automatically.
|
|
645
|
+
# @param timeout [::Google::Protobuf::Duration, ::Hash]
|
|
646
|
+
# If this timeout is set, the server returns a response before the timeout
|
|
647
|
+
# period has elapsed or the server deadline for synchronous requests is
|
|
648
|
+
# reached, whichever is sooner.
|
|
649
|
+
#
|
|
650
|
+
# For asynchronous requests, the server will generate a solution (if
|
|
651
|
+
# possible) before the timeout has elapsed.
|
|
652
|
+
# @param model [::Google::Maps::RouteOptimization::V1::ShipmentModel, ::Hash]
|
|
653
|
+
# Shipment model to solve.
|
|
654
|
+
# @param solving_mode [::Google::Maps::RouteOptimization::V1::OptimizeToursRequest::SolvingMode]
|
|
655
|
+
# By default, the solving mode is `DEFAULT_SOLVE` (0).
|
|
656
|
+
# @param search_mode [::Google::Maps::RouteOptimization::V1::OptimizeToursRequest::SearchMode]
|
|
657
|
+
# Search mode used to solve the request.
|
|
658
|
+
# @param injected_first_solution_routes [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute, ::Hash>]
|
|
659
|
+
# Guide the optimization algorithm in finding a first solution that is
|
|
660
|
+
# similar to a previous solution.
|
|
661
|
+
#
|
|
662
|
+
# The model is constrained when the first solution is built.
|
|
663
|
+
# Any shipments not performed on a route are implicitly skipped in the first
|
|
664
|
+
# solution, but they may be performed in successive solutions.
|
|
665
|
+
#
|
|
666
|
+
# The solution must satisfy some basic validity assumptions:
|
|
667
|
+
#
|
|
668
|
+
# * for all routes, `vehicle_index` must be in range and not be duplicated.
|
|
669
|
+
# * for all visits, `shipment_index` and `visit_request_index` must be
|
|
670
|
+
# in range.
|
|
671
|
+
# * a shipment may only be referenced on one route.
|
|
672
|
+
# * the pickup of a pickup-delivery shipment must be performed before
|
|
673
|
+
# the delivery.
|
|
674
|
+
# * no more than one pickup alternative or delivery alternative of
|
|
675
|
+
# a shipment may be performed.
|
|
676
|
+
# * for all routes, times are increasing (i.e., `vehicle_start_time
|
|
677
|
+
# <= visits[0].start_time <= visits[1].start_time ...
|
|
678
|
+
# <= vehicle_end_time`).
|
|
679
|
+
# * a shipment may only be performed on a vehicle that is allowed. A
|
|
680
|
+
# vehicle is allowed if
|
|
681
|
+
# {::Google::Maps::RouteOptimization::V1::Shipment#allowed_vehicle_indices Shipment.allowed_vehicle_indices}
|
|
682
|
+
# is empty or its `vehicle_index` is included in
|
|
683
|
+
# {::Google::Maps::RouteOptimization::V1::Shipment#allowed_vehicle_indices Shipment.allowed_vehicle_indices}.
|
|
684
|
+
#
|
|
685
|
+
# If the injected solution is not feasible, a validation error is not
|
|
686
|
+
# necessarily returned and an error indicating infeasibility may be returned
|
|
687
|
+
# instead.
|
|
688
|
+
# @param injected_solution_constraint [::Google::Maps::RouteOptimization::V1::InjectedSolutionConstraint, ::Hash]
|
|
689
|
+
# Constrain the optimization algorithm to find a final solution that is
|
|
690
|
+
# similar to a previous solution. For example, this may be used to freeze
|
|
691
|
+
# portions of routes which have already been completed or which are to be
|
|
692
|
+
# completed but must not be modified.
|
|
693
|
+
#
|
|
694
|
+
# If the injected solution is not feasible, a validation error is not
|
|
695
|
+
# necessarily returned and an error indicating infeasibility may be returned
|
|
696
|
+
# instead.
|
|
697
|
+
# @param refresh_details_routes [::Array<::Google::Maps::RouteOptimization::V1::ShipmentRoute, ::Hash>]
|
|
698
|
+
# If non-empty, the given routes will be refreshed, without modifying their
|
|
699
|
+
# underlying sequence of visits or travel times: only other details will be
|
|
700
|
+
# updated. This does not solve the model.
|
|
701
|
+
#
|
|
702
|
+
# As of 2020/11, this only populates the polylines of non-empty routes and
|
|
703
|
+
# requires that `populate_polylines` is true.
|
|
704
|
+
#
|
|
705
|
+
# The `route_polyline` fields of the passed-in routes may be inconsistent
|
|
706
|
+
# with route `transitions`.
|
|
707
|
+
#
|
|
708
|
+
# This field must not be used together with `injected_first_solution_routes`
|
|
709
|
+
# or `injected_solution_constraint`.
|
|
710
|
+
#
|
|
711
|
+
# `Shipment.ignore` and `Vehicle.ignore` have no effect on the behavior.
|
|
712
|
+
# Polylines are still populated between all visits in all non-empty routes
|
|
713
|
+
# regardless of whether the related shipments or vehicles are ignored.
|
|
714
|
+
# @param interpret_injected_solutions_using_labels [::Boolean]
|
|
715
|
+
# If true:
|
|
716
|
+
#
|
|
717
|
+
# * uses
|
|
718
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_label ShipmentRoute.vehicle_label}
|
|
719
|
+
# instead of `vehicle_index` to
|
|
720
|
+
# match routes in an injected solution with vehicles in the request;
|
|
721
|
+
# reuses the mapping of original
|
|
722
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_index ShipmentRoute.vehicle_index}
|
|
723
|
+
# to new
|
|
724
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_index ShipmentRoute.vehicle_index}
|
|
725
|
+
# to update
|
|
726
|
+
# {::Google::Maps::RouteOptimization::V1::InjectedSolutionConstraint::ConstraintRelaxation#vehicle_indices ConstraintRelaxation.vehicle_indices}
|
|
727
|
+
# if non-empty, but the mapping must be unambiguous (i.e., multiple
|
|
728
|
+
# `ShipmentRoute`s must not share the same original `vehicle_index`).
|
|
729
|
+
# * uses
|
|
730
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit#shipment_label ShipmentRoute.Visit.shipment_label}
|
|
731
|
+
# instead of `shipment_index`
|
|
732
|
+
# to match visits in an injected solution with shipments in the request;
|
|
733
|
+
# * uses
|
|
734
|
+
# {::Google::Maps::RouteOptimization::V1::SkippedShipment#label SkippedShipment.label}
|
|
735
|
+
# instead of
|
|
736
|
+
# {::Google::Maps::RouteOptimization::V1::SkippedShipment#index SkippedShipment.index}
|
|
737
|
+
# to
|
|
738
|
+
# match skipped shipments in the injected solution with request
|
|
739
|
+
# shipments.
|
|
740
|
+
#
|
|
741
|
+
# This interpretation applies to the `injected_first_solution_routes`,
|
|
742
|
+
# `injected_solution_constraint`, and `refresh_details_routes` fields.
|
|
743
|
+
# It can be used when shipment or vehicle indices in the request have
|
|
744
|
+
# changed since the solution was created, perhaps because shipments or
|
|
745
|
+
# vehicles have been removed from or added to the request.
|
|
746
|
+
#
|
|
747
|
+
# If true, labels in the following categories must appear at most once in
|
|
748
|
+
# their category:
|
|
749
|
+
#
|
|
750
|
+
# * {::Google::Maps::RouteOptimization::V1::Vehicle#label Vehicle.label} in the
|
|
751
|
+
# request;
|
|
752
|
+
# * {::Google::Maps::RouteOptimization::V1::Shipment#label Shipment.label} in
|
|
753
|
+
# the request;
|
|
754
|
+
# * {::Google::Maps::RouteOptimization::V1::ShipmentRoute#vehicle_label ShipmentRoute.vehicle_label} in the injected solution;
|
|
755
|
+
# * {::Google::Maps::RouteOptimization::V1::SkippedShipment#label SkippedShipment.label} and {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit#shipment_label ShipmentRoute.Visit.shipment_label} in
|
|
756
|
+
# the injected solution (except pickup/delivery visit pairs, whose
|
|
757
|
+
# `shipment_label` must appear twice).
|
|
758
|
+
#
|
|
759
|
+
# If a `vehicle_label` in the injected solution does not correspond to a
|
|
760
|
+
# request vehicle, the corresponding route is removed from the solution
|
|
761
|
+
# along with its visits. If a `shipment_label` in the injected solution does
|
|
762
|
+
# not correspond to a request shipment, the corresponding visit is removed
|
|
763
|
+
# from the solution. If a
|
|
764
|
+
# {::Google::Maps::RouteOptimization::V1::SkippedShipment#label SkippedShipment.label}
|
|
765
|
+
# in the injected solution does not correspond to a request shipment, the
|
|
766
|
+
# `SkippedShipment` is removed from the solution.
|
|
767
|
+
#
|
|
768
|
+
# Removing route visits or entire routes from an injected solution may
|
|
769
|
+
# have an effect on the implied constraints, which may lead to change in
|
|
770
|
+
# solution, validation errors, or infeasibility.
|
|
771
|
+
#
|
|
772
|
+
# NOTE: The caller must ensure that each
|
|
773
|
+
# {::Google::Maps::RouteOptimization::V1::Vehicle#label Vehicle.label} (resp.
|
|
774
|
+
# {::Google::Maps::RouteOptimization::V1::Shipment#label Shipment.label}) uniquely
|
|
775
|
+
# identifies a vehicle (resp. shipment) entity used across the two relevant
|
|
776
|
+
# requests: the past request that produced the `OptimizeToursResponse` used
|
|
777
|
+
# in the injected solution and the current request that includes the injected
|
|
778
|
+
# solution. The uniqueness checks described above are not enough to guarantee
|
|
779
|
+
# this requirement.
|
|
780
|
+
# @param consider_road_traffic [::Boolean]
|
|
781
|
+
# Consider traffic estimation in calculating `ShipmentRoute` fields
|
|
782
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Transition#travel_duration Transition.travel_duration},
|
|
783
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute::Visit#start_time Visit.start_time},
|
|
784
|
+
# and `vehicle_end_time`; in setting the
|
|
785
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#has_traffic_infeasibilities ShipmentRoute.has_traffic_infeasibilities}
|
|
786
|
+
# field, and in calculating the
|
|
787
|
+
# [OptimizeToursResponse.total_cost][google.maps.routeoptimization.v1.OptimizeToursResponse.total_cost]
|
|
788
|
+
# field.
|
|
789
|
+
# @param populate_polylines [::Boolean]
|
|
790
|
+
# If true, polylines will be populated in response `ShipmentRoute`s.
|
|
791
|
+
# @param populate_transition_polylines [::Boolean]
|
|
792
|
+
# If true, polylines and route tokens will be populated in response
|
|
793
|
+
# {::Google::Maps::RouteOptimization::V1::ShipmentRoute#transitions ShipmentRoute.transitions}.
|
|
794
|
+
# @param allow_large_deadline_despite_interruption_risk [::Boolean]
|
|
795
|
+
# If this is set, then the request can have a deadline
|
|
796
|
+
# (see https://grpc.io/blog/deadlines) of up to 60 minutes.
|
|
797
|
+
# Otherwise, the maximum deadline is only 30 minutes.
|
|
798
|
+
# Note that long-lived requests have a significantly larger (but still small)
|
|
799
|
+
# risk of interruption.
|
|
800
|
+
# @param use_geodesic_distances [::Boolean]
|
|
801
|
+
# If true, travel distances will be computed using geodesic distances instead
|
|
802
|
+
# of Google Maps distances, and travel times will be computed using geodesic
|
|
803
|
+
# distances with a speed defined by `geodesic_meters_per_second`.
|
|
804
|
+
# @param geodesic_meters_per_second [::Float]
|
|
805
|
+
# When `use_geodesic_distances` is true, this field must be set and defines
|
|
806
|
+
# the speed applied to compute travel times. Its value must be at least 1.0
|
|
807
|
+
# meters/seconds.
|
|
808
|
+
# @param max_validation_errors [::Integer]
|
|
809
|
+
# Truncates the number of validation errors returned. These errors are
|
|
810
|
+
# typically attached to an INVALID_ARGUMENT error payload as a BadRequest
|
|
811
|
+
# error detail (https://cloud.google.com/apis/design/errors#error_details),
|
|
812
|
+
# unless solving_mode=VALIDATE_ONLY: see the
|
|
813
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#validation_errors OptimizeToursResponse.validation_errors}
|
|
814
|
+
# field.
|
|
815
|
+
# This defaults to 100 and is capped at 10,000.
|
|
816
|
+
# @param label [::String]
|
|
817
|
+
# Label that may be used to identify this request, reported back in the
|
|
818
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursResponse#request_label OptimizeToursResponse.request_label}.
|
|
819
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
820
|
+
# @yieldparam result [::Gapic::Operation]
|
|
821
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
822
|
+
#
|
|
823
|
+
# @return [::Gapic::Operation]
|
|
824
|
+
#
|
|
825
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
826
|
+
#
|
|
827
|
+
# @example Basic example
|
|
828
|
+
# require "google/maps/route_optimization/v1"
|
|
829
|
+
#
|
|
830
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
831
|
+
# client = Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client.new
|
|
832
|
+
#
|
|
833
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
834
|
+
# request = Google::Maps::RouteOptimization::V1::OptimizeToursRequest.new
|
|
835
|
+
#
|
|
836
|
+
# # Call the optimize_tours_long_running method.
|
|
837
|
+
# result = client.optimize_tours_long_running request
|
|
838
|
+
#
|
|
839
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
840
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
841
|
+
# # Here is how to wait for a response.
|
|
842
|
+
# result.wait_until_done! timeout: 60
|
|
843
|
+
# if result.response?
|
|
844
|
+
# p result.response
|
|
845
|
+
# else
|
|
846
|
+
# puts "No response received."
|
|
847
|
+
# end
|
|
848
|
+
#
|
|
849
|
+
def optimize_tours_long_running request, options = nil
|
|
850
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
851
|
+
|
|
852
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::RouteOptimization::V1::OptimizeToursRequest
|
|
853
|
+
|
|
854
|
+
# Converts hash and nil to an options object
|
|
855
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
856
|
+
|
|
857
|
+
# Customize the options with defaults
|
|
858
|
+
call_metadata = @config.rpcs.optimize_tours_long_running.metadata.to_h
|
|
859
|
+
|
|
860
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
861
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
862
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
863
|
+
gapic_version: ::Google::Maps::RouteOptimization::V1::VERSION,
|
|
864
|
+
transports_version_send: [:rest]
|
|
865
|
+
|
|
866
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
867
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
868
|
+
|
|
869
|
+
options.apply_defaults timeout: @config.rpcs.optimize_tours_long_running.timeout,
|
|
870
|
+
metadata: call_metadata,
|
|
871
|
+
retry_policy: @config.rpcs.optimize_tours_long_running.retry_policy
|
|
872
|
+
|
|
873
|
+
options.apply_defaults timeout: @config.timeout,
|
|
874
|
+
metadata: @config.metadata,
|
|
875
|
+
retry_policy: @config.retry_policy
|
|
876
|
+
|
|
877
|
+
@route_optimization_stub.optimize_tours_long_running request, options do |result, operation|
|
|
878
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
879
|
+
yield result, operation if block_given?
|
|
880
|
+
throw :response, result
|
|
881
|
+
end
|
|
882
|
+
rescue ::Gapic::Rest::Error => e
|
|
883
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
884
|
+
end
|
|
885
|
+
|
|
886
|
+
##
|
|
887
|
+
# This is a variant of the
|
|
888
|
+
# {::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client#optimize_tours_long_running OptimizeToursLongRunning}
|
|
889
|
+
# method designed for optimizations with large timeout values and large
|
|
890
|
+
# input/output sizes.
|
|
891
|
+
#
|
|
892
|
+
# The client specifies the URI of the `OptimizeToursRequest` stored
|
|
893
|
+
# in Google Cloud Storage and the server writes the `OptimizeToursResponse`
|
|
894
|
+
# to a client-specified Google Cloud Storage URI.
|
|
895
|
+
#
|
|
896
|
+
# This method should be preferred over the `OptimizeTours` method for
|
|
897
|
+
# optimizations that take longer than a few minutes and input/output sizes
|
|
898
|
+
# that are larger than 8MB, though it can be used for shorter and smaller
|
|
899
|
+
# optimizations as well.
|
|
900
|
+
#
|
|
901
|
+
# The returned {::Google::Longrunning::Operation long-running operation} (LRO)
|
|
902
|
+
# will have a name of the format
|
|
903
|
+
# `<parent>/operations/<operation_id>` and can be used to track
|
|
904
|
+
# progress of the computation. The
|
|
905
|
+
# {::Google::Longrunning::Operation#metadata metadata} field type is
|
|
906
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursUriMetadata OptimizeToursLongRunningMetadata}.
|
|
907
|
+
# The {::Google::Longrunning::Operation#response response} field type is
|
|
908
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursUriResponse OptimizeToursUriResponse},
|
|
909
|
+
# if successful.
|
|
910
|
+
#
|
|
911
|
+
# Experimental: See
|
|
912
|
+
# https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request
|
|
913
|
+
# for more details.
|
|
914
|
+
#
|
|
915
|
+
# @overload optimize_tours_uri(request, options = nil)
|
|
916
|
+
# Pass arguments to `optimize_tours_uri` via a request object, either of type
|
|
917
|
+
# {::Google::Maps::RouteOptimization::V1::OptimizeToursUriRequest} or an equivalent Hash.
|
|
918
|
+
#
|
|
919
|
+
# @param request [::Google::Maps::RouteOptimization::V1::OptimizeToursUriRequest, ::Hash]
|
|
920
|
+
# A request object representing the call parameters. Required. To specify no
|
|
921
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
922
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
923
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
924
|
+
#
|
|
925
|
+
# @overload optimize_tours_uri(parent: nil, input: nil, output: nil)
|
|
926
|
+
# Pass arguments to `optimize_tours_uri` via keyword arguments. Note that at
|
|
927
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
928
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
929
|
+
#
|
|
930
|
+
# @param parent [::String]
|
|
931
|
+
# Required. Target project or location to make a call.
|
|
932
|
+
#
|
|
933
|
+
# Format:
|
|
934
|
+
# * `projects/{project-id}`
|
|
935
|
+
# * `projects/{project-id}/locations/{location-id}`
|
|
936
|
+
#
|
|
937
|
+
# If no location is specified, a region will be chosen automatically.
|
|
938
|
+
# @param input [::Google::Maps::RouteOptimization::V1::Uri, ::Hash]
|
|
939
|
+
# Required. The URI of the Cloud Storage object containing the
|
|
940
|
+
# `OptimizeToursRequest`.
|
|
941
|
+
# @param output [::Google::Maps::RouteOptimization::V1::Uri, ::Hash]
|
|
942
|
+
# Required. The URI of the Cloud Storage object that will contain the
|
|
943
|
+
# `OptimizeToursResponse`.
|
|
944
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
945
|
+
# @yieldparam result [::Gapic::Operation]
|
|
946
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
947
|
+
#
|
|
948
|
+
# @return [::Gapic::Operation]
|
|
949
|
+
#
|
|
950
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
951
|
+
#
|
|
952
|
+
# @example Basic example
|
|
953
|
+
# require "google/maps/route_optimization/v1"
|
|
954
|
+
#
|
|
955
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
956
|
+
# client = Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client.new
|
|
957
|
+
#
|
|
958
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
959
|
+
# request = Google::Maps::RouteOptimization::V1::OptimizeToursUriRequest.new
|
|
960
|
+
#
|
|
961
|
+
# # Call the optimize_tours_uri method.
|
|
962
|
+
# result = client.optimize_tours_uri request
|
|
963
|
+
#
|
|
964
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
|
965
|
+
# # check the status of an operation, cancel it, or wait for results.
|
|
966
|
+
# # Here is how to wait for a response.
|
|
967
|
+
# result.wait_until_done! timeout: 60
|
|
968
|
+
# if result.response?
|
|
969
|
+
# p result.response
|
|
970
|
+
# else
|
|
971
|
+
# puts "No response received."
|
|
972
|
+
# end
|
|
973
|
+
#
|
|
974
|
+
def optimize_tours_uri request, options = nil
|
|
975
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
976
|
+
|
|
977
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::RouteOptimization::V1::OptimizeToursUriRequest
|
|
978
|
+
|
|
979
|
+
# Converts hash and nil to an options object
|
|
980
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
981
|
+
|
|
982
|
+
# Customize the options with defaults
|
|
983
|
+
call_metadata = @config.rpcs.optimize_tours_uri.metadata.to_h
|
|
984
|
+
|
|
985
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
986
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
987
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
988
|
+
gapic_version: ::Google::Maps::RouteOptimization::V1::VERSION,
|
|
989
|
+
transports_version_send: [:rest]
|
|
990
|
+
|
|
991
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
992
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
993
|
+
|
|
994
|
+
options.apply_defaults timeout: @config.rpcs.optimize_tours_uri.timeout,
|
|
995
|
+
metadata: call_metadata,
|
|
996
|
+
retry_policy: @config.rpcs.optimize_tours_uri.retry_policy
|
|
997
|
+
|
|
998
|
+
options.apply_defaults timeout: @config.timeout,
|
|
999
|
+
metadata: @config.metadata,
|
|
1000
|
+
retry_policy: @config.retry_policy
|
|
1001
|
+
|
|
1002
|
+
@route_optimization_stub.optimize_tours_uri request, options do |result, operation|
|
|
1003
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
1004
|
+
yield result, operation if block_given?
|
|
1005
|
+
throw :response, result
|
|
1006
|
+
end
|
|
1007
|
+
rescue ::Gapic::Rest::Error => e
|
|
1008
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
1009
|
+
end
|
|
1010
|
+
|
|
1011
|
+
##
|
|
1012
|
+
# Configuration class for the RouteOptimization REST API.
|
|
1013
|
+
#
|
|
1014
|
+
# This class represents the configuration for RouteOptimization REST,
|
|
1015
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
1016
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
1017
|
+
# applied individually to specific RPCs. See
|
|
1018
|
+
# {::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client::Configuration::Rpcs}
|
|
1019
|
+
# for a list of RPCs that can be configured independently.
|
|
1020
|
+
#
|
|
1021
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
1022
|
+
# on construction.
|
|
1023
|
+
#
|
|
1024
|
+
# @example
|
|
1025
|
+
#
|
|
1026
|
+
# # Modify the global config, setting the timeout for
|
|
1027
|
+
# # optimize_tours to 20 seconds,
|
|
1028
|
+
# # and all remaining timeouts to 10 seconds.
|
|
1029
|
+
# ::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client.configure do |config|
|
|
1030
|
+
# config.timeout = 10.0
|
|
1031
|
+
# config.rpcs.optimize_tours.timeout = 20.0
|
|
1032
|
+
# end
|
|
1033
|
+
#
|
|
1034
|
+
# # Apply the above configuration only to a new client.
|
|
1035
|
+
# client = ::Google::Maps::RouteOptimization::V1::RouteOptimization::Rest::Client.new do |config|
|
|
1036
|
+
# config.timeout = 10.0
|
|
1037
|
+
# config.rpcs.optimize_tours.timeout = 20.0
|
|
1038
|
+
# end
|
|
1039
|
+
#
|
|
1040
|
+
# @!attribute [rw] endpoint
|
|
1041
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
1042
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
1043
|
+
# @return [::String,nil]
|
|
1044
|
+
# @!attribute [rw] credentials
|
|
1045
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
1046
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
1047
|
+
# * (`Hash`) A service account key as a Hash
|
|
1048
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
1049
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
1050
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
1051
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
1052
|
+
# * (`nil`) indicating no credentials
|
|
1053
|
+
#
|
|
1054
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
1055
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
1056
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
1057
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
1058
|
+
# For more information, refer to [Validate credential configurations from external
|
|
1059
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
1060
|
+
# @return [::Object]
|
|
1061
|
+
# @!attribute [rw] scope
|
|
1062
|
+
# The OAuth scopes
|
|
1063
|
+
# @return [::Array<::String>]
|
|
1064
|
+
# @!attribute [rw] lib_name
|
|
1065
|
+
# The library name as recorded in instrumentation and logging
|
|
1066
|
+
# @return [::String]
|
|
1067
|
+
# @!attribute [rw] lib_version
|
|
1068
|
+
# The library version as recorded in instrumentation and logging
|
|
1069
|
+
# @return [::String]
|
|
1070
|
+
# @!attribute [rw] timeout
|
|
1071
|
+
# The call timeout in seconds.
|
|
1072
|
+
# @return [::Numeric]
|
|
1073
|
+
# @!attribute [rw] metadata
|
|
1074
|
+
# Additional headers to be sent with the call.
|
|
1075
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
1076
|
+
# @!attribute [rw] retry_policy
|
|
1077
|
+
# The retry policy. The value is a hash with the following keys:
|
|
1078
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
1079
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
1080
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
1081
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
1082
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1083
|
+
# trigger a retry.
|
|
1084
|
+
# @return [::Hash]
|
|
1085
|
+
# @!attribute [rw] quota_project
|
|
1086
|
+
# A separate project against which to charge quota.
|
|
1087
|
+
# @return [::String]
|
|
1088
|
+
# @!attribute [rw] universe_domain
|
|
1089
|
+
# The universe domain within which to make requests. This determines the
|
|
1090
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
1091
|
+
# universe (usually the default "googleapis.com" universe).
|
|
1092
|
+
# @return [::String,nil]
|
|
1093
|
+
# @!attribute [rw] logger
|
|
1094
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
1095
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
1096
|
+
# explicitly disable logging.
|
|
1097
|
+
# @return [::Logger,:default,nil]
|
|
1098
|
+
#
|
|
1099
|
+
class Configuration
|
|
1100
|
+
extend ::Gapic::Config
|
|
1101
|
+
|
|
1102
|
+
# @private
|
|
1103
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
1104
|
+
DEFAULT_ENDPOINT = "routeoptimization.googleapis.com"
|
|
1105
|
+
|
|
1106
|
+
config_attr :endpoint, nil, ::String, nil
|
|
1107
|
+
config_attr :credentials, nil do |value|
|
|
1108
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
1109
|
+
allowed.any? { |klass| klass === value }
|
|
1110
|
+
end
|
|
1111
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
1112
|
+
config_attr :lib_name, nil, ::String, nil
|
|
1113
|
+
config_attr :lib_version, nil, ::String, nil
|
|
1114
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
1115
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
1116
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
1117
|
+
config_attr :quota_project, nil, ::String, nil
|
|
1118
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
1119
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
1120
|
+
|
|
1121
|
+
# @private
|
|
1122
|
+
def initialize parent_config = nil
|
|
1123
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
1124
|
+
|
|
1125
|
+
yield self if block_given?
|
|
1126
|
+
end
|
|
1127
|
+
|
|
1128
|
+
##
|
|
1129
|
+
# Configurations for individual RPCs
|
|
1130
|
+
# @return [Rpcs]
|
|
1131
|
+
#
|
|
1132
|
+
def rpcs
|
|
1133
|
+
@rpcs ||= begin
|
|
1134
|
+
parent_rpcs = nil
|
|
1135
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
1136
|
+
Rpcs.new parent_rpcs
|
|
1137
|
+
end
|
|
1138
|
+
end
|
|
1139
|
+
|
|
1140
|
+
##
|
|
1141
|
+
# Configuration RPC class for the RouteOptimization API.
|
|
1142
|
+
#
|
|
1143
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
1144
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
1145
|
+
# the following configuration fields:
|
|
1146
|
+
#
|
|
1147
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
1148
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
1149
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
1150
|
+
# include the following keys:
|
|
1151
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
1152
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
1153
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
1154
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
1155
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1156
|
+
# trigger a retry.
|
|
1157
|
+
#
|
|
1158
|
+
class Rpcs
|
|
1159
|
+
##
|
|
1160
|
+
# RPC-specific configuration for `optimize_tours`
|
|
1161
|
+
# @return [::Gapic::Config::Method]
|
|
1162
|
+
#
|
|
1163
|
+
attr_reader :optimize_tours
|
|
1164
|
+
##
|
|
1165
|
+
# RPC-specific configuration for `batch_optimize_tours`
|
|
1166
|
+
# @return [::Gapic::Config::Method]
|
|
1167
|
+
#
|
|
1168
|
+
attr_reader :batch_optimize_tours
|
|
1169
|
+
##
|
|
1170
|
+
# RPC-specific configuration for `optimize_tours_long_running`
|
|
1171
|
+
# @return [::Gapic::Config::Method]
|
|
1172
|
+
#
|
|
1173
|
+
attr_reader :optimize_tours_long_running
|
|
1174
|
+
##
|
|
1175
|
+
# RPC-specific configuration for `optimize_tours_uri`
|
|
1176
|
+
# @return [::Gapic::Config::Method]
|
|
1177
|
+
#
|
|
1178
|
+
attr_reader :optimize_tours_uri
|
|
1179
|
+
|
|
1180
|
+
# @private
|
|
1181
|
+
def initialize parent_rpcs = nil
|
|
1182
|
+
optimize_tours_config = parent_rpcs.optimize_tours if parent_rpcs.respond_to? :optimize_tours
|
|
1183
|
+
@optimize_tours = ::Gapic::Config::Method.new optimize_tours_config
|
|
1184
|
+
batch_optimize_tours_config = parent_rpcs.batch_optimize_tours if parent_rpcs.respond_to? :batch_optimize_tours
|
|
1185
|
+
@batch_optimize_tours = ::Gapic::Config::Method.new batch_optimize_tours_config
|
|
1186
|
+
optimize_tours_long_running_config = parent_rpcs.optimize_tours_long_running if parent_rpcs.respond_to? :optimize_tours_long_running
|
|
1187
|
+
@optimize_tours_long_running = ::Gapic::Config::Method.new optimize_tours_long_running_config
|
|
1188
|
+
optimize_tours_uri_config = parent_rpcs.optimize_tours_uri if parent_rpcs.respond_to? :optimize_tours_uri
|
|
1189
|
+
@optimize_tours_uri = ::Gapic::Config::Method.new optimize_tours_uri_config
|
|
1190
|
+
|
|
1191
|
+
yield self if block_given?
|
|
1192
|
+
end
|
|
1193
|
+
end
|
|
1194
|
+
end
|
|
1195
|
+
end
|
|
1196
|
+
end
|
|
1197
|
+
end
|
|
1198
|
+
end
|
|
1199
|
+
end
|
|
1200
|
+
end
|
|
1201
|
+
end
|