google-maps-fleet_engine-v1 0.a → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +144 -8
  5. data/lib/google/maps/fleet_engine/v1/rest.rb +38 -0
  6. data/lib/google/maps/fleet_engine/v1/trip_service/client.rb +996 -0
  7. data/lib/google/maps/fleet_engine/v1/trip_service/credentials.rb +47 -0
  8. data/lib/google/maps/fleet_engine/v1/trip_service/paths.rb +50 -0
  9. data/lib/google/maps/fleet_engine/v1/trip_service/rest/client.rb +930 -0
  10. data/lib/google/maps/fleet_engine/v1/trip_service/rest/service_stub.rb +368 -0
  11. data/lib/google/maps/fleet_engine/v1/trip_service/rest.rb +52 -0
  12. data/lib/google/maps/fleet_engine/v1/trip_service.rb +55 -0
  13. data/lib/google/maps/fleet_engine/v1/vehicle_service/client.rb +1639 -0
  14. data/lib/google/maps/fleet_engine/v1/vehicle_service/credentials.rb +47 -0
  15. data/lib/google/maps/fleet_engine/v1/vehicle_service/paths.rb +50 -0
  16. data/lib/google/maps/fleet_engine/v1/vehicle_service/rest/client.rb +1545 -0
  17. data/lib/google/maps/fleet_engine/v1/vehicle_service/rest/service_stub.rb +547 -0
  18. data/lib/google/maps/fleet_engine/v1/vehicle_service/rest.rb +52 -0
  19. data/lib/google/maps/fleet_engine/v1/vehicle_service.rb +55 -0
  20. data/lib/google/maps/fleet_engine/v1/version.rb +8 -3
  21. data/lib/google/maps/fleet_engine/v1.rb +46 -0
  22. data/lib/google/maps/fleetengine/v1/fleetengine_pb.rb +63 -0
  23. data/lib/google/maps/fleetengine/v1/header_pb.rb +46 -0
  24. data/lib/google/maps/fleetengine/v1/traffic_pb.rb +44 -0
  25. data/lib/google/maps/fleetengine/v1/trip_api_pb.rb +66 -0
  26. data/lib/google/maps/fleetengine/v1/trip_api_services_pb.rb +53 -0
  27. data/lib/google/maps/fleetengine/v1/trips_pb.rb +61 -0
  28. data/lib/google/maps/fleetengine/v1/vehicle_api_pb.rb +81 -0
  29. data/lib/google/maps/fleetengine/v1/vehicle_api_services_pb.rb +108 -0
  30. data/lib/google/maps/fleetengine/v1/vehicles_pb.rb +64 -0
  31. data/lib/google-maps-fleet_engine-v1.rb +21 -0
  32. data/proto_docs/README.md +4 -0
  33. data/proto_docs/google/api/client.rb +399 -0
  34. data/proto_docs/google/api/field_behavior.rb +85 -0
  35. data/proto_docs/google/api/launch_stage.rb +71 -0
  36. data/proto_docs/google/api/resource.rb +222 -0
  37. data/proto_docs/google/api/routing.rb +459 -0
  38. data/proto_docs/google/geo/type/viewport.rb +70 -0
  39. data/proto_docs/google/maps/fleetengine/v1/fleetengine.rb +342 -0
  40. data/proto_docs/google/maps/fleetengine/v1/header.rb +111 -0
  41. data/proto_docs/google/maps/fleetengine/v1/traffic.rb +76 -0
  42. data/proto_docs/google/maps/fleetengine/v1/trip_api.rb +296 -0
  43. data/proto_docs/google/maps/fleetengine/v1/trips.rb +286 -0
  44. data/proto_docs/google/maps/fleetengine/v1/vehicle_api.rb +684 -0
  45. data/proto_docs/google/maps/fleetengine/v1/vehicles.rb +358 -0
  46. data/proto_docs/google/protobuf/duration.rb +98 -0
  47. data/proto_docs/google/protobuf/empty.rb +34 -0
  48. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  49. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  50. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  51. data/proto_docs/google/type/latlng.rb +38 -0
  52. metadata +119 -13
@@ -0,0 +1,1545 @@
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/maps/fleetengine/v1/vehicle_api_pb"
21
+ require "google/maps/fleet_engine/v1/vehicle_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Maps
25
+ module FleetEngine
26
+ module V1
27
+ module VehicleService
28
+ module Rest
29
+ ##
30
+ # REST client for the VehicleService service.
31
+ #
32
+ # Vehicle management service.
33
+ #
34
+ class Client
35
+ # @private
36
+ DEFAULT_ENDPOINT_TEMPLATE = "fleetengine.$UNIVERSE_DOMAIN$"
37
+
38
+ include Paths
39
+
40
+ # @private
41
+ attr_reader :vehicle_service_stub
42
+
43
+ ##
44
+ # Configure the VehicleService Client class.
45
+ #
46
+ # See {::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client::Configuration}
47
+ # for a description of the configuration fields.
48
+ #
49
+ # @example
50
+ #
51
+ # # Modify the configuration for all VehicleService clients
52
+ # ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.configure do |config|
53
+ # config.timeout = 10.0
54
+ # end
55
+ #
56
+ # @yield [config] Configure the Client client.
57
+ # @yieldparam config [Client::Configuration]
58
+ #
59
+ # @return [Client::Configuration]
60
+ #
61
+ def self.configure
62
+ @configure ||= begin
63
+ namespace = ["Google", "Maps", "FleetEngine", "V1"]
64
+ parent_config = while namespace.any?
65
+ parent_name = namespace.join "::"
66
+ parent_const = const_get parent_name
67
+ break parent_const.configure if parent_const.respond_to? :configure
68
+ namespace.pop
69
+ end
70
+ default_config = Client::Configuration.new parent_config
71
+
72
+ default_config.rpcs.create_vehicle.timeout = 15.0
73
+ default_config.rpcs.create_vehicle.retry_policy = {
74
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
75
+ }
76
+
77
+ default_config.rpcs.get_vehicle.timeout = 15.0
78
+ default_config.rpcs.get_vehicle.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
80
+ }
81
+
82
+ default_config.rpcs.update_vehicle.timeout = 15.0
83
+ default_config.rpcs.update_vehicle.retry_policy = {
84
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
85
+ }
86
+
87
+ default_config.rpcs.update_vehicle_attributes.timeout = 15.0
88
+ default_config.rpcs.update_vehicle_attributes.retry_policy = {
89
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
90
+ }
91
+
92
+ default_config.rpcs.search_vehicles.timeout = 15.0
93
+ default_config.rpcs.search_vehicles.retry_policy = {
94
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
95
+ }
96
+
97
+ default_config
98
+ end
99
+ yield @configure if block_given?
100
+ @configure
101
+ end
102
+
103
+ ##
104
+ # Configure the VehicleService Client instance.
105
+ #
106
+ # The configuration is set to the derived mode, meaning that values can be changed,
107
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
108
+ # should be made on {Client.configure}.
109
+ #
110
+ # See {::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client::Configuration}
111
+ # for a description of the configuration fields.
112
+ #
113
+ # @yield [config] Configure the Client client.
114
+ # @yieldparam config [Client::Configuration]
115
+ #
116
+ # @return [Client::Configuration]
117
+ #
118
+ def configure
119
+ yield @config if block_given?
120
+ @config
121
+ end
122
+
123
+ ##
124
+ # The effective universe domain
125
+ #
126
+ # @return [String]
127
+ #
128
+ def universe_domain
129
+ @vehicle_service_stub.universe_domain
130
+ end
131
+
132
+ ##
133
+ # Create a new VehicleService REST client object.
134
+ #
135
+ # @example
136
+ #
137
+ # # Create a client using the default configuration
138
+ # client = ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
139
+ #
140
+ # # Create a client using a custom configuration
141
+ # client = ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new do |config|
142
+ # config.timeout = 10.0
143
+ # end
144
+ #
145
+ # @yield [config] Configure the VehicleService client.
146
+ # @yieldparam config [Client::Configuration]
147
+ #
148
+ def initialize
149
+ # Create the configuration object
150
+ @config = Configuration.new Client.configure
151
+
152
+ # Yield the configuration if needed
153
+ yield @config if block_given?
154
+
155
+ # Create credentials
156
+ credentials = @config.credentials
157
+ # Use self-signed JWT if the endpoint is unchanged from default,
158
+ # but only if the default endpoint does not have a region prefix.
159
+ enable_self_signed_jwt = @config.endpoint.nil? ||
160
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
161
+ !@config.endpoint.split(".").first.include?("-"))
162
+ credentials ||= Credentials.default scope: @config.scope,
163
+ enable_self_signed_jwt: enable_self_signed_jwt
164
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
165
+ credentials = Credentials.new credentials, scope: @config.scope
166
+ end
167
+
168
+ @quota_project_id = @config.quota_project
169
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
170
+
171
+ @vehicle_service_stub = ::Google::Maps::FleetEngine::V1::VehicleService::Rest::ServiceStub.new(
172
+ endpoint: @config.endpoint,
173
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
174
+ universe_domain: @config.universe_domain,
175
+ credentials: credentials
176
+ )
177
+ end
178
+
179
+ # Service calls
180
+
181
+ ##
182
+ # Instantiates a new vehicle associated with an on-demand rideshare or
183
+ # deliveries provider. Each `Vehicle` must have a unique vehicle ID.
184
+ #
185
+ # The following `Vehicle` fields are required when creating a `Vehicle`:
186
+ #
187
+ # * `vehicleState`
188
+ # * `supportedTripTypes`
189
+ # * `maximumCapacity`
190
+ # * `vehicleType`
191
+ #
192
+ # The following `Vehicle` fields are ignored when creating a `Vehicle`:
193
+ #
194
+ # * `name`
195
+ # * `currentTrips`
196
+ # * `availableCapacity`
197
+ # * `current_route_segment`
198
+ # * `current_route_segment_end_point`
199
+ # * `current_route_segment_version`
200
+ # * `current_route_segment_traffic`
201
+ # * `route`
202
+ # * `waypoints`
203
+ # * `waypoints_version`
204
+ # * `remaining_distance_meters`
205
+ # * `remaining_time_seconds`
206
+ # * `eta_to_next_waypoint`
207
+ # * `navigation_status`
208
+ #
209
+ # All other fields are optional and used if provided.
210
+ #
211
+ # @overload create_vehicle(request, options = nil)
212
+ # Pass arguments to `create_vehicle` via a request object, either of type
213
+ # {::Google::Maps::FleetEngine::V1::CreateVehicleRequest} or an equivalent Hash.
214
+ #
215
+ # @param request [::Google::Maps::FleetEngine::V1::CreateVehicleRequest, ::Hash]
216
+ # A request object representing the call parameters. Required. To specify no
217
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
218
+ # @param options [::Gapic::CallOptions, ::Hash]
219
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
220
+ #
221
+ # @overload create_vehicle(header: nil, parent: nil, vehicle_id: nil, vehicle: nil)
222
+ # Pass arguments to `create_vehicle` via keyword arguments. Note that at
223
+ # least one keyword argument is required. To specify no parameters, or to keep all
224
+ # the default parameter values, pass an empty Hash as a request object (see above).
225
+ #
226
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
227
+ # The standard Fleet Engine request header.
228
+ # @param parent [::String]
229
+ # Required. Must be in the format `providers/{provider}`.
230
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
231
+ # of the Google Cloud Project of which the service account making
232
+ # this call is a member.
233
+ # @param vehicle_id [::String]
234
+ # Required. Unique Vehicle ID.
235
+ # Subject to the following restrictions:
236
+ #
237
+ # * Must be a valid Unicode string.
238
+ # * Limited to a maximum length of 64 characters.
239
+ # * Normalized according to [Unicode Normalization Form C]
240
+ # (http://www.unicode.org/reports/tr15/).
241
+ # * May not contain any of the following ASCII characters: '/', ':', '?',
242
+ # ',', or '#'.
243
+ # @param vehicle [::Google::Maps::FleetEngine::V1::Vehicle, ::Hash]
244
+ # Required. The Vehicle entity to create. When creating a Vehicle, the
245
+ # following fields are required:
246
+ #
247
+ # * `vehicleState`
248
+ # * `supportedTripTypes`
249
+ # * `maximumCapacity`
250
+ # * `vehicleType`
251
+ #
252
+ # When creating a Vehicle, the following fields are ignored:
253
+ #
254
+ # * `name`
255
+ # * `currentTrips`
256
+ # * `availableCapacity`
257
+ # * `current_route_segment`
258
+ # * `current_route_segment_end_point`
259
+ # * `current_route_segment_version`
260
+ # * `current_route_segment_traffic`
261
+ # * `route`
262
+ # * `waypoints`
263
+ # * `waypoints_version`
264
+ # * `remaining_distance_meters`
265
+ # * `remaining_time_seconds`
266
+ # * `eta_to_next_waypoint`
267
+ # * `navigation_status`
268
+ #
269
+ # All other fields are optional and used if provided.
270
+ # @yield [result, operation] Access the result along with the TransportOperation object
271
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::Vehicle]
272
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
273
+ #
274
+ # @return [::Google::Maps::FleetEngine::V1::Vehicle]
275
+ #
276
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
277
+ #
278
+ # @example Basic example
279
+ # require "google/maps/fleet_engine/v1"
280
+ #
281
+ # # Create a client object. The client can be reused for multiple calls.
282
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
283
+ #
284
+ # # Create a request. To set request fields, pass in keyword arguments.
285
+ # request = Google::Maps::FleetEngine::V1::CreateVehicleRequest.new
286
+ #
287
+ # # Call the create_vehicle method.
288
+ # result = client.create_vehicle request
289
+ #
290
+ # # The returned object is of type Google::Maps::FleetEngine::V1::Vehicle.
291
+ # p result
292
+ #
293
+ def create_vehicle request, options = nil
294
+ raise ::ArgumentError, "request must be provided" if request.nil?
295
+
296
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::CreateVehicleRequest
297
+
298
+ # Converts hash and nil to an options object
299
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
300
+
301
+ # Customize the options with defaults
302
+ call_metadata = @config.rpcs.create_vehicle.metadata.to_h
303
+
304
+ # Set x-goog-api-client and x-goog-user-project headers
305
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
306
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
307
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
308
+ transports_version_send: [:rest]
309
+
310
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
311
+
312
+ options.apply_defaults timeout: @config.rpcs.create_vehicle.timeout,
313
+ metadata: call_metadata,
314
+ retry_policy: @config.rpcs.create_vehicle.retry_policy
315
+
316
+ options.apply_defaults timeout: @config.timeout,
317
+ metadata: @config.metadata,
318
+ retry_policy: @config.retry_policy
319
+
320
+ @vehicle_service_stub.create_vehicle request, options do |result, operation|
321
+ yield result, operation if block_given?
322
+ return result
323
+ end
324
+ rescue ::Gapic::Rest::Error => e
325
+ raise ::Google::Cloud::Error.from_error(e)
326
+ end
327
+
328
+ ##
329
+ # Returns a vehicle from the Fleet Engine.
330
+ #
331
+ # @overload get_vehicle(request, options = nil)
332
+ # Pass arguments to `get_vehicle` via a request object, either of type
333
+ # {::Google::Maps::FleetEngine::V1::GetVehicleRequest} or an equivalent Hash.
334
+ #
335
+ # @param request [::Google::Maps::FleetEngine::V1::GetVehicleRequest, ::Hash]
336
+ # A request object representing the call parameters. Required. To specify no
337
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
338
+ # @param options [::Gapic::CallOptions, ::Hash]
339
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
340
+ #
341
+ # @overload get_vehicle(header: nil, name: nil, current_route_segment_version: nil, waypoints_version: nil)
342
+ # Pass arguments to `get_vehicle` via keyword arguments. Note that at
343
+ # least one keyword argument is required. To specify no parameters, or to keep all
344
+ # the default parameter values, pass an empty Hash as a request object (see above).
345
+ #
346
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
347
+ # The standard Fleet Engine request header.
348
+ # @param name [::String]
349
+ # Required. Must be in the format
350
+ # `providers/{provider}/vehicles/{vehicle}`.
351
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
352
+ # of the Google Cloud Project of which the service account making
353
+ # this call is a member.
354
+ # @param current_route_segment_version [::Google::Protobuf::Timestamp, ::Hash]
355
+ # Indicates the minimum timestamp (exclusive) for which
356
+ # `Vehicle.current_route_segment` is retrieved.
357
+ # If the route is unchanged since this timestamp, the `current_route_segment`
358
+ # field is not set in the response. If a minimum is unspecified, the
359
+ # `current_route_segment` is always retrieved.
360
+ # @param waypoints_version [::Google::Protobuf::Timestamp, ::Hash]
361
+ # Indicates the minimum timestamp (exclusive) for which `Vehicle.waypoints`
362
+ # data is retrieved. If the waypoints are unchanged since this timestamp, the
363
+ # `vehicle.waypoints` data is not set in the response. If this field is
364
+ # unspecified, `vehicle.waypoints` is always retrieved.
365
+ # @yield [result, operation] Access the result along with the TransportOperation object
366
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::Vehicle]
367
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
368
+ #
369
+ # @return [::Google::Maps::FleetEngine::V1::Vehicle]
370
+ #
371
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
372
+ #
373
+ # @example Basic example
374
+ # require "google/maps/fleet_engine/v1"
375
+ #
376
+ # # Create a client object. The client can be reused for multiple calls.
377
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
378
+ #
379
+ # # Create a request. To set request fields, pass in keyword arguments.
380
+ # request = Google::Maps::FleetEngine::V1::GetVehicleRequest.new
381
+ #
382
+ # # Call the get_vehicle method.
383
+ # result = client.get_vehicle request
384
+ #
385
+ # # The returned object is of type Google::Maps::FleetEngine::V1::Vehicle.
386
+ # p result
387
+ #
388
+ def get_vehicle request, options = nil
389
+ raise ::ArgumentError, "request must be provided" if request.nil?
390
+
391
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::GetVehicleRequest
392
+
393
+ # Converts hash and nil to an options object
394
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
395
+
396
+ # Customize the options with defaults
397
+ call_metadata = @config.rpcs.get_vehicle.metadata.to_h
398
+
399
+ # Set x-goog-api-client and x-goog-user-project headers
400
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
401
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
402
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
403
+ transports_version_send: [:rest]
404
+
405
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
406
+
407
+ options.apply_defaults timeout: @config.rpcs.get_vehicle.timeout,
408
+ metadata: call_metadata,
409
+ retry_policy: @config.rpcs.get_vehicle.retry_policy
410
+
411
+ options.apply_defaults timeout: @config.timeout,
412
+ metadata: @config.metadata,
413
+ retry_policy: @config.retry_policy
414
+
415
+ @vehicle_service_stub.get_vehicle request, options do |result, operation|
416
+ yield result, operation if block_given?
417
+ return result
418
+ end
419
+ rescue ::Gapic::Rest::Error => e
420
+ raise ::Google::Cloud::Error.from_error(e)
421
+ end
422
+
423
+ ##
424
+ # Writes updated vehicle data to the Fleet Engine.
425
+ #
426
+ # When updating a `Vehicle`, the following fields cannot be updated since
427
+ # they are managed by the server:
428
+ #
429
+ # * `currentTrips`
430
+ # * `availableCapacity`
431
+ # * `current_route_segment_version`
432
+ # * `waypoints_version`
433
+ #
434
+ # The vehicle `name` also cannot be updated.
435
+ #
436
+ # If the `attributes` field is updated, **all** the vehicle's attributes are
437
+ # replaced with the attributes provided in the request. If you want to update
438
+ # only some attributes, see the `UpdateVehicleAttributes` method. Likewise,
439
+ # the `waypoints` field can be updated, but must contain all the waypoints
440
+ # currently on the vehicle, and no other waypoints.
441
+ #
442
+ # @overload update_vehicle(request, options = nil)
443
+ # Pass arguments to `update_vehicle` via a request object, either of type
444
+ # {::Google::Maps::FleetEngine::V1::UpdateVehicleRequest} or an equivalent Hash.
445
+ #
446
+ # @param request [::Google::Maps::FleetEngine::V1::UpdateVehicleRequest, ::Hash]
447
+ # A request object representing the call parameters. Required. To specify no
448
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
449
+ # @param options [::Gapic::CallOptions, ::Hash]
450
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
451
+ #
452
+ # @overload update_vehicle(header: nil, name: nil, vehicle: nil, update_mask: nil)
453
+ # Pass arguments to `update_vehicle` via keyword arguments. Note that at
454
+ # least one keyword argument is required. To specify no parameters, or to keep all
455
+ # the default parameter values, pass an empty Hash as a request object (see above).
456
+ #
457
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
458
+ # The standard Fleet Engine request header.
459
+ # @param name [::String]
460
+ # Required. Must be in the format
461
+ # `providers/{provider}/vehicles/{vehicle}`.
462
+ # The \\{provider} must be the Project ID (for example, `sample-cloud-project`)
463
+ # of the Google Cloud Project of which the service account making
464
+ # this call is a member.
465
+ # @param vehicle [::Google::Maps::FleetEngine::V1::Vehicle, ::Hash]
466
+ # Required. The `Vehicle` entity values to apply. When updating a `Vehicle`,
467
+ # the following fields may not be updated as they are managed by the
468
+ # server.
469
+ #
470
+ # * `available_capacity`
471
+ # * `current_route_segment_version`
472
+ # * `current_trips`
473
+ # * `name`
474
+ # * `waypoints_version`
475
+ #
476
+ # If the `attributes` field is updated, **all** the vehicle's attributes are
477
+ # replaced with the attributes provided in the request. If you want to update
478
+ # only some attributes, see the `UpdateVehicleAttributes` method.
479
+ #
480
+ # Likewise, the `waypoints` field can be updated, but must contain all the
481
+ # waypoints currently on the vehicle, and no other waypoints.
482
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
483
+ # Required. A field mask indicating which fields of the `Vehicle` to update.
484
+ # At least one field name must be provided.
485
+ # @yield [result, operation] Access the result along with the TransportOperation object
486
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::Vehicle]
487
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
488
+ #
489
+ # @return [::Google::Maps::FleetEngine::V1::Vehicle]
490
+ #
491
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
492
+ #
493
+ # @example Basic example
494
+ # require "google/maps/fleet_engine/v1"
495
+ #
496
+ # # Create a client object. The client can be reused for multiple calls.
497
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
498
+ #
499
+ # # Create a request. To set request fields, pass in keyword arguments.
500
+ # request = Google::Maps::FleetEngine::V1::UpdateVehicleRequest.new
501
+ #
502
+ # # Call the update_vehicle method.
503
+ # result = client.update_vehicle request
504
+ #
505
+ # # The returned object is of type Google::Maps::FleetEngine::V1::Vehicle.
506
+ # p result
507
+ #
508
+ def update_vehicle request, options = nil
509
+ raise ::ArgumentError, "request must be provided" if request.nil?
510
+
511
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::UpdateVehicleRequest
512
+
513
+ # Converts hash and nil to an options object
514
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
515
+
516
+ # Customize the options with defaults
517
+ call_metadata = @config.rpcs.update_vehicle.metadata.to_h
518
+
519
+ # Set x-goog-api-client and x-goog-user-project headers
520
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
521
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
522
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
523
+ transports_version_send: [:rest]
524
+
525
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
526
+
527
+ options.apply_defaults timeout: @config.rpcs.update_vehicle.timeout,
528
+ metadata: call_metadata,
529
+ retry_policy: @config.rpcs.update_vehicle.retry_policy
530
+
531
+ options.apply_defaults timeout: @config.timeout,
532
+ metadata: @config.metadata,
533
+ retry_policy: @config.retry_policy
534
+
535
+ @vehicle_service_stub.update_vehicle request, options do |result, operation|
536
+ yield result, operation if block_given?
537
+ return result
538
+ end
539
+ rescue ::Gapic::Rest::Error => e
540
+ raise ::Google::Cloud::Error.from_error(e)
541
+ end
542
+
543
+ ##
544
+ # Deprecated: Use the `UpdateVehicle` method instead.
545
+ # UpdateVehicleLocation updates the location of the vehicle.
546
+ #
547
+ # @overload update_vehicle_location(request, options = nil)
548
+ # Pass arguments to `update_vehicle_location` via a request object, either of type
549
+ # {::Google::Maps::FleetEngine::V1::UpdateVehicleLocationRequest} or an equivalent Hash.
550
+ #
551
+ # @param request [::Google::Maps::FleetEngine::V1::UpdateVehicleLocationRequest, ::Hash]
552
+ # A request object representing the call parameters. Required. To specify no
553
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
554
+ # @param options [::Gapic::CallOptions, ::Hash]
555
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
556
+ #
557
+ # @overload update_vehicle_location(header: nil, name: nil, current_location: nil, current_state: nil)
558
+ # Pass arguments to `update_vehicle_location` via keyword arguments. Note that at
559
+ # least one keyword argument is required. To specify no parameters, or to keep all
560
+ # the default parameter values, pass an empty Hash as a request object (see above).
561
+ #
562
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
563
+ # The standard Fleet Engine request header.
564
+ # @param name [::String]
565
+ # Required. Must be in the format
566
+ # `providers/{provider}/vehicles/{vehicle}`.
567
+ # The \\{provider} must be the Project ID (for example, `sample-cloud-project`)
568
+ # of the Google Cloud Project of which the service account making
569
+ # this call is a member.
570
+ # @param current_location [::Google::Maps::FleetEngine::V1::VehicleLocation, ::Hash]
571
+ # Required. The vehicle's most recent location. The `location` and
572
+ # `update_time` subfields are required.
573
+ # @param current_state [::Google::Maps::FleetEngine::V1::VehicleState]
574
+ # Set the vehicle's state to either `ONLINE` or `OFFLINE`.
575
+ # If set to `UNKNOWN_VEHICLE_STATE`, the vehicle's state will not be altered.
576
+ # @yield [result, operation] Access the result along with the TransportOperation object
577
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::VehicleLocation]
578
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
579
+ #
580
+ # @return [::Google::Maps::FleetEngine::V1::VehicleLocation]
581
+ #
582
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
583
+ #
584
+ # @example Basic example
585
+ # require "google/maps/fleet_engine/v1"
586
+ #
587
+ # # Create a client object. The client can be reused for multiple calls.
588
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
589
+ #
590
+ # # Create a request. To set request fields, pass in keyword arguments.
591
+ # request = Google::Maps::FleetEngine::V1::UpdateVehicleLocationRequest.new
592
+ #
593
+ # # Call the update_vehicle_location method.
594
+ # result = client.update_vehicle_location request
595
+ #
596
+ # # The returned object is of type Google::Maps::FleetEngine::V1::VehicleLocation.
597
+ # p result
598
+ #
599
+ def update_vehicle_location request, options = nil
600
+ raise ::ArgumentError, "request must be provided" if request.nil?
601
+
602
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::UpdateVehicleLocationRequest
603
+
604
+ # Converts hash and nil to an options object
605
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
606
+
607
+ # Customize the options with defaults
608
+ call_metadata = @config.rpcs.update_vehicle_location.metadata.to_h
609
+
610
+ # Set x-goog-api-client and x-goog-user-project headers
611
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
612
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
613
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
614
+ transports_version_send: [:rest]
615
+
616
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
617
+
618
+ options.apply_defaults timeout: @config.rpcs.update_vehicle_location.timeout,
619
+ metadata: call_metadata,
620
+ retry_policy: @config.rpcs.update_vehicle_location.retry_policy
621
+
622
+ options.apply_defaults timeout: @config.timeout,
623
+ metadata: @config.metadata,
624
+ retry_policy: @config.retry_policy
625
+
626
+ @vehicle_service_stub.update_vehicle_location request, options do |result, operation|
627
+ yield result, operation if block_given?
628
+ return result
629
+ end
630
+ rescue ::Gapic::Rest::Error => e
631
+ raise ::Google::Cloud::Error.from_error(e)
632
+ end
633
+
634
+ ##
635
+ # Partially updates a vehicle's attributes.
636
+ # Only the attributes mentioned in the request will be updated, other
637
+ # attributes will NOT be altered. Note: this is different in `UpdateVehicle`,
638
+ # where the whole `attributes` field will be replaced by the one in
639
+ # `UpdateVehicleRequest`, attributes not in the request would be removed.
640
+ #
641
+ # @overload update_vehicle_attributes(request, options = nil)
642
+ # Pass arguments to `update_vehicle_attributes` via a request object, either of type
643
+ # {::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesRequest} or an equivalent Hash.
644
+ #
645
+ # @param request [::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesRequest, ::Hash]
646
+ # A request object representing the call parameters. Required. To specify no
647
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
648
+ # @param options [::Gapic::CallOptions, ::Hash]
649
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
650
+ #
651
+ # @overload update_vehicle_attributes(header: nil, name: nil, attributes: nil)
652
+ # Pass arguments to `update_vehicle_attributes` via keyword arguments. Note that at
653
+ # least one keyword argument is required. To specify no parameters, or to keep all
654
+ # the default parameter values, pass an empty Hash as a request object (see above).
655
+ #
656
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
657
+ # The standard Fleet Engine request header.
658
+ # @param name [::String]
659
+ # Required. Must be in the format `providers/{provider}/vehicles/{vehicle}`.
660
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
661
+ # of the Google Cloud Project of which the service account making
662
+ # this call is a member.
663
+ # @param attributes [::Array<::Google::Maps::FleetEngine::V1::VehicleAttribute, ::Hash>]
664
+ # Required. The vehicle attributes to update. Unmentioned attributes are not
665
+ # altered or removed.
666
+ # @yield [result, operation] Access the result along with the TransportOperation object
667
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesResponse]
668
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
669
+ #
670
+ # @return [::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesResponse]
671
+ #
672
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
673
+ #
674
+ # @example Basic example
675
+ # require "google/maps/fleet_engine/v1"
676
+ #
677
+ # # Create a client object. The client can be reused for multiple calls.
678
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
679
+ #
680
+ # # Create a request. To set request fields, pass in keyword arguments.
681
+ # request = Google::Maps::FleetEngine::V1::UpdateVehicleAttributesRequest.new
682
+ #
683
+ # # Call the update_vehicle_attributes method.
684
+ # result = client.update_vehicle_attributes request
685
+ #
686
+ # # The returned object is of type Google::Maps::FleetEngine::V1::UpdateVehicleAttributesResponse.
687
+ # p result
688
+ #
689
+ def update_vehicle_attributes request, options = nil
690
+ raise ::ArgumentError, "request must be provided" if request.nil?
691
+
692
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::UpdateVehicleAttributesRequest
693
+
694
+ # Converts hash and nil to an options object
695
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
696
+
697
+ # Customize the options with defaults
698
+ call_metadata = @config.rpcs.update_vehicle_attributes.metadata.to_h
699
+
700
+ # Set x-goog-api-client and x-goog-user-project headers
701
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
702
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
703
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
704
+ transports_version_send: [:rest]
705
+
706
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
707
+
708
+ options.apply_defaults timeout: @config.rpcs.update_vehicle_attributes.timeout,
709
+ metadata: call_metadata,
710
+ retry_policy: @config.rpcs.update_vehicle_attributes.retry_policy
711
+
712
+ options.apply_defaults timeout: @config.timeout,
713
+ metadata: @config.metadata,
714
+ retry_policy: @config.retry_policy
715
+
716
+ @vehicle_service_stub.update_vehicle_attributes request, options do |result, operation|
717
+ yield result, operation if block_given?
718
+ return result
719
+ end
720
+ rescue ::Gapic::Rest::Error => e
721
+ raise ::Google::Cloud::Error.from_error(e)
722
+ end
723
+
724
+ ##
725
+ # Returns a paginated list of vehicles associated with
726
+ # a provider that match the request options.
727
+ #
728
+ # @overload list_vehicles(request, options = nil)
729
+ # Pass arguments to `list_vehicles` via a request object, either of type
730
+ # {::Google::Maps::FleetEngine::V1::ListVehiclesRequest} or an equivalent Hash.
731
+ #
732
+ # @param request [::Google::Maps::FleetEngine::V1::ListVehiclesRequest, ::Hash]
733
+ # A request object representing the call parameters. Required. To specify no
734
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
735
+ # @param options [::Gapic::CallOptions, ::Hash]
736
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
737
+ #
738
+ # @overload list_vehicles(header: nil, parent: nil, page_size: nil, page_token: nil, minimum_capacity: nil, trip_types: nil, maximum_staleness: nil, vehicle_type_categories: nil, required_attributes: nil, required_one_of_attributes: nil, required_one_of_attribute_sets: nil, vehicle_state: nil, on_trip_only: nil, filter: nil, viewport: nil)
739
+ # Pass arguments to `list_vehicles` via keyword arguments. Note that at
740
+ # least one keyword argument is required. To specify no parameters, or to keep all
741
+ # the default parameter values, pass an empty Hash as a request object (see above).
742
+ #
743
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
744
+ # The standard Fleet Engine request header.
745
+ # @param parent [::String]
746
+ # Required. Must be in the format `providers/{provider}`.
747
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
748
+ # of the Google Cloud Project of which the service account making
749
+ # this call is a member.
750
+ # @param page_size [::Integer]
751
+ # The maximum number of vehicles to return.
752
+ # Default value: 100.
753
+ # @param page_token [::String]
754
+ # The value of the `next_page_token` provided by a previous call to
755
+ # `ListVehicles` so that you can paginate through groups of vehicles. The
756
+ # value is undefined if the filter criteria of the request is not the same as
757
+ # the filter criteria for the previous call to `ListVehicles`.
758
+ # @param minimum_capacity [::Google::Protobuf::Int32Value, ::Hash]
759
+ # Specifies the required minimum capacity of the vehicle. All vehicles
760
+ # returned will have a `maximum_capacity` greater than or equal to this
761
+ # value. If set, must be greater or equal to 0.
762
+ # @param trip_types [::Array<::Google::Maps::FleetEngine::V1::TripType>]
763
+ # Restricts the response to vehicles that support at least one of the
764
+ # specified trip types.
765
+ # @param maximum_staleness [::Google::Protobuf::Duration, ::Hash]
766
+ # Restricts the response to vehicles that have sent location updates to Fleet
767
+ # Engine within the specified duration. Stationary vehicles still
768
+ # transmitting their locations are not considered stale. If present, must be
769
+ # a valid positive duration.
770
+ # @param vehicle_type_categories [::Array<::Google::Maps::FleetEngine::V1::Vehicle::VehicleType::Category>]
771
+ # Required. Restricts the response to vehicles with one of the specified type
772
+ # categories. `UNKNOWN` is not allowed.
773
+ # @param required_attributes [::Array<::String>]
774
+ # Callers can form complex logical operations using any combination of the
775
+ # `required_attributes`, `required_one_of_attributes`, and
776
+ # `required_one_of_attribute_sets` fields.
777
+ #
778
+ # `required_attributes` is a list; `required_one_of_attributes` uses a
779
+ # message which allows a list of lists. In combination, the two fields allow
780
+ # the composition of this expression:
781
+ #
782
+ # ```
783
+ # (required_attributes[0] AND required_attributes[1] AND ...)
784
+ # AND
785
+ # (required_one_of_attributes[0][0] OR required_one_of_attributes[0][1] OR
786
+ # ...)
787
+ # AND
788
+ # (required_one_of_attributes[1][0] OR required_one_of_attributes[1][1] OR
789
+ # ...)
790
+ # ```
791
+ #
792
+ # Restricts the response to vehicles with the specified attributes. This
793
+ # field is a conjunction/AND operation. A max of 50 required_attributes is
794
+ # allowed. This matches the maximum number of attributes allowed on a
795
+ # vehicle. Each repeated string should be of the format "key:value".
796
+ # @param required_one_of_attributes [::Array<::String>]
797
+ # Restricts the response to vehicles with at least one of the specified
798
+ # attributes in each `VehicleAttributeList`. Within each list, a vehicle must
799
+ # match at least one of the attributes. This field is an inclusive
800
+ # disjunction/OR operation in each `VehicleAttributeList` and a
801
+ # conjunction/AND operation across the collection of `VehicleAttributeList`.
802
+ # Each repeated string should be of the format
803
+ # "key1:value1|key2:value2|key3:value3".
804
+ # @param required_one_of_attribute_sets [::Array<::String>]
805
+ # `required_one_of_attribute_sets` provides additional functionality.
806
+ #
807
+ # Similar to `required_one_of_attributes`, `required_one_of_attribute_sets`
808
+ # uses a message which allows a list of lists, allowing expressions such as
809
+ # this one:
810
+ #
811
+ # ```
812
+ # (required_attributes[0] AND required_attributes[1] AND ...)
813
+ # AND
814
+ # (
815
+ # (required_one_of_attribute_sets[0][0] AND
816
+ # required_one_of_attribute_sets[0][1] AND
817
+ # ...)
818
+ # OR
819
+ # (required_one_of_attribute_sets[1][0] AND
820
+ # required_one_of_attribute_sets[1][1] AND
821
+ # ...)
822
+ # )
823
+ # ```
824
+ #
825
+ # Restricts the response to vehicles that match all the attributes in a
826
+ # `VehicleAttributeList`. Within each list, a vehicle must match all of the
827
+ # attributes. This field is a conjunction/AND operation in each
828
+ # `VehicleAttributeList` and inclusive disjunction/OR operation across the
829
+ # collection of `VehicleAttributeList`. Each repeated string should be of the
830
+ # format "key1:value1|key2:value2|key3:value3".
831
+ # @param vehicle_state [::Google::Maps::FleetEngine::V1::VehicleState]
832
+ # Restricts the response to vehicles that have this vehicle state.
833
+ # @param on_trip_only [::Boolean]
834
+ # Only return the vehicles with current trip(s).
835
+ # @param filter [::String]
836
+ # Optional. A filter query to apply when listing vehicles. See
837
+ # http://aip.dev/160 for examples of the filter syntax.
838
+ #
839
+ # This field is designed to replace the `required_attributes`,
840
+ # `required_one_of_attributes`, and `required_one_of_attributes_sets` fields.
841
+ # If a non-empty value is specified here, the following fields must be empty:
842
+ # `required_attributes`, `required_one_of_attributes`, and
843
+ # `required_one_of_attributes_sets`.
844
+ #
845
+ # This filter functions as an AND clause with other constraints,
846
+ # such as `vehicle_state` or `on_trip_only`.
847
+ #
848
+ # Note that the only queries supported are on vehicle attributes (for
849
+ # example, `attributes.<key> = <value>` or `attributes.<key1> = <value1> AND
850
+ # attributes.<key2> = <value2>`). The maximum number of restrictions allowed
851
+ # in a filter query is 50.
852
+ #
853
+ # Also, all attributes are stored as strings, so the only supported
854
+ # comparisons against attributes are string comparisons. In order to compare
855
+ # against number or boolean values, the values must be explicitly quoted to
856
+ # be treated as strings (for example, `attributes.<key> = "10"` or
857
+ # `attributes.<key> = "true"`).
858
+ # @param viewport [::Google::Geo::Type::Viewport, ::Hash]
859
+ # Optional. A filter that limits the vehicles returned to those whose last
860
+ # known location was in the rectangular area defined by the viewport.
861
+ # @yield [result, operation] Access the result along with the TransportOperation object
862
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::V1::Vehicle>]
863
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
864
+ #
865
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Maps::FleetEngine::V1::Vehicle>]
866
+ #
867
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
868
+ #
869
+ # @example Basic example
870
+ # require "google/maps/fleet_engine/v1"
871
+ #
872
+ # # Create a client object. The client can be reused for multiple calls.
873
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
874
+ #
875
+ # # Create a request. To set request fields, pass in keyword arguments.
876
+ # request = Google::Maps::FleetEngine::V1::ListVehiclesRequest.new
877
+ #
878
+ # # Call the list_vehicles method.
879
+ # result = client.list_vehicles request
880
+ #
881
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
882
+ # # over elements, and API calls will be issued to fetch pages as needed.
883
+ # result.each do |item|
884
+ # # Each element is of type ::Google::Maps::FleetEngine::V1::Vehicle.
885
+ # p item
886
+ # end
887
+ #
888
+ def list_vehicles request, options = nil
889
+ raise ::ArgumentError, "request must be provided" if request.nil?
890
+
891
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::ListVehiclesRequest
892
+
893
+ # Converts hash and nil to an options object
894
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
895
+
896
+ # Customize the options with defaults
897
+ call_metadata = @config.rpcs.list_vehicles.metadata.to_h
898
+
899
+ # Set x-goog-api-client and x-goog-user-project headers
900
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
901
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
902
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
903
+ transports_version_send: [:rest]
904
+
905
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
906
+
907
+ options.apply_defaults timeout: @config.rpcs.list_vehicles.timeout,
908
+ metadata: call_metadata,
909
+ retry_policy: @config.rpcs.list_vehicles.retry_policy
910
+
911
+ options.apply_defaults timeout: @config.timeout,
912
+ metadata: @config.metadata,
913
+ retry_policy: @config.retry_policy
914
+
915
+ @vehicle_service_stub.list_vehicles request, options do |result, operation|
916
+ result = ::Gapic::Rest::PagedEnumerable.new @vehicle_service_stub, :list_vehicles, "vehicles", request, result, options
917
+ yield result, operation if block_given?
918
+ return result
919
+ end
920
+ rescue ::Gapic::Rest::Error => e
921
+ raise ::Google::Cloud::Error.from_error(e)
922
+ end
923
+
924
+ ##
925
+ # Returns a list of vehicles that match the request options.
926
+ #
927
+ # @overload search_vehicles(request, options = nil)
928
+ # Pass arguments to `search_vehicles` via a request object, either of type
929
+ # {::Google::Maps::FleetEngine::V1::SearchVehiclesRequest} or an equivalent Hash.
930
+ #
931
+ # @param request [::Google::Maps::FleetEngine::V1::SearchVehiclesRequest, ::Hash]
932
+ # A request object representing the call parameters. Required. To specify no
933
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
934
+ # @param options [::Gapic::CallOptions, ::Hash]
935
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
936
+ #
937
+ # @overload search_vehicles(header: nil, parent: nil, pickup_point: nil, dropoff_point: nil, pickup_radius_meters: nil, count: nil, minimum_capacity: nil, trip_types: nil, maximum_staleness: nil, vehicle_types: nil, required_attributes: nil, required_one_of_attributes: nil, required_one_of_attribute_sets: nil, order_by: nil, include_back_to_back: nil, trip_id: nil, current_trips_present: nil, filter: nil)
938
+ # Pass arguments to `search_vehicles` via keyword arguments. Note that at
939
+ # least one keyword argument is required. To specify no parameters, or to keep all
940
+ # the default parameter values, pass an empty Hash as a request object (see above).
941
+ #
942
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
943
+ # The standard Fleet Engine request header.
944
+ # @param parent [::String]
945
+ # Required. Must be in the format `providers/{provider}`.
946
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
947
+ # of the Google Cloud Project of which the service account making
948
+ # this call is a member.
949
+ # @param pickup_point [::Google::Maps::FleetEngine::V1::TerminalLocation, ::Hash]
950
+ # Required. The pickup point to search near.
951
+ # @param dropoff_point [::Google::Maps::FleetEngine::V1::TerminalLocation, ::Hash]
952
+ # The customer's intended dropoff location. The field is required if
953
+ # `trip_types` contains `TripType.SHARED`.
954
+ # @param pickup_radius_meters [::Integer]
955
+ # Required. Defines the vehicle search radius around the pickup point. Only
956
+ # vehicles within the search radius will be returned. Value must be between
957
+ # 400 and 10000 meters (inclusive).
958
+ # @param count [::Integer]
959
+ # Required. Specifies the maximum number of vehicles to return. The value
960
+ # must be between 1 and 50 (inclusive).
961
+ # @param minimum_capacity [::Integer]
962
+ # Required. Specifies the number of passengers being considered for a trip.
963
+ # The value must be greater than or equal to one. The driver is not
964
+ # considered in the capacity value.
965
+ # @param trip_types [::Array<::Google::Maps::FleetEngine::V1::TripType>]
966
+ # Required. Represents the type of proposed trip. Must include exactly one
967
+ # type. `UNKNOWN_TRIP_TYPE` is not allowed. Restricts the search to only
968
+ # those vehicles that can support that trip type.
969
+ # @param maximum_staleness [::Google::Protobuf::Duration, ::Hash]
970
+ # Restricts the search to only those vehicles that have sent location updates
971
+ # to Fleet Engine within the specified duration. Stationary vehicles still
972
+ # transmitting their locations are not considered stale. If this field is not
973
+ # set, the server uses five minutes as the default value.
974
+ # @param vehicle_types [::Array<::Google::Maps::FleetEngine::V1::Vehicle::VehicleType, ::Hash>]
975
+ # Required. Restricts the search to vehicles with one of the specified types.
976
+ # At least one vehicle type must be specified. VehicleTypes with a category
977
+ # of `UNKNOWN` are not allowed.
978
+ # @param required_attributes [::Array<::Google::Maps::FleetEngine::V1::VehicleAttribute, ::Hash>]
979
+ # Callers can form complex logical operations using any combination of the
980
+ # `required_attributes`, `required_one_of_attributes`, and
981
+ # `required_one_of_attribute_sets` fields.
982
+ #
983
+ # `required_attributes` is a list; `required_one_of_attributes` uses a
984
+ # message which allows a list of lists. In combination, the two fields allow
985
+ # the composition of this expression:
986
+ #
987
+ # ```
988
+ # (required_attributes[0] AND required_attributes[1] AND ...)
989
+ # AND
990
+ # (required_one_of_attributes[0][0] OR required_one_of_attributes[0][1] OR
991
+ # ...)
992
+ # AND
993
+ # (required_one_of_attributes[1][0] OR required_one_of_attributes[1][1] OR
994
+ # ...)
995
+ # ```
996
+ #
997
+ # Restricts the search to only those vehicles with the specified attributes.
998
+ # This field is a conjunction/AND operation. A max of 50 required_attributes
999
+ # is allowed. This matches the maximum number of attributes allowed on a
1000
+ # vehicle.
1001
+ # @param required_one_of_attributes [::Array<::Google::Maps::FleetEngine::V1::VehicleAttributeList, ::Hash>]
1002
+ # Restricts the search to only those vehicles with at least one of
1003
+ # the specified attributes in each `VehicleAttributeList`. Within each
1004
+ # list, a vehicle must match at least one of the attributes. This field is an
1005
+ # inclusive disjunction/OR operation in each `VehicleAttributeList` and a
1006
+ # conjunction/AND operation across the collection of `VehicleAttributeList`.
1007
+ # @param required_one_of_attribute_sets [::Array<::Google::Maps::FleetEngine::V1::VehicleAttributeList, ::Hash>]
1008
+ # `required_one_of_attribute_sets` provides additional functionality.
1009
+ #
1010
+ # Similar to `required_one_of_attributes`, `required_one_of_attribute_sets`
1011
+ # uses a message which allows a list of lists, allowing expressions such as
1012
+ # this one:
1013
+ #
1014
+ # ```
1015
+ # (required_attributes[0] AND required_attributes[1] AND ...)
1016
+ # AND
1017
+ # (
1018
+ # (required_one_of_attribute_sets[0][0] AND
1019
+ # required_one_of_attribute_sets[0][1] AND
1020
+ # ...)
1021
+ # OR
1022
+ # (required_one_of_attribute_sets[1][0] AND
1023
+ # required_one_of_attribute_sets[1][1] AND
1024
+ # ...)
1025
+ # )
1026
+ # ```
1027
+ #
1028
+ # Restricts the search to only those vehicles with all the attributes in a
1029
+ # `VehicleAttributeList`. Within each list, a
1030
+ # vehicle must match all of the attributes. This field is a conjunction/AND
1031
+ # operation in each `VehicleAttributeList` and inclusive disjunction/OR
1032
+ # operation across the collection of `VehicleAttributeList`.
1033
+ # @param order_by [::Google::Maps::FleetEngine::V1::SearchVehiclesRequest::VehicleMatchOrder]
1034
+ # Required. Specifies the desired ordering criterion for results.
1035
+ # @param include_back_to_back [::Boolean]
1036
+ # This indicates if vehicles with a single active trip are eligible for this
1037
+ # search. This field is only used when `current_trips_present` is
1038
+ # unspecified. When `current_trips_present` is unspecified and this field
1039
+ # is `false`, vehicles with assigned trips are excluded from the search
1040
+ # results. When `current_trips_present` is unspecified and this field is
1041
+ # `true`, search results can include vehicles with one active trip that has a
1042
+ # status of `ENROUTE_TO_DROPOFF`. When `current_trips_present` is specified,
1043
+ # this field cannot be set to true.
1044
+ #
1045
+ # The default value is `false`.
1046
+ # @param trip_id [::String]
1047
+ # Indicates the trip associated with this `SearchVehicleRequest`.
1048
+ # @param current_trips_present [::Google::Maps::FleetEngine::V1::SearchVehiclesRequest::CurrentTripsPresent]
1049
+ # This indicates if vehicles with active trips are eligible for this search.
1050
+ # This must be set to something other than
1051
+ # `CURRENT_TRIPS_PRESENT_UNSPECIFIED` if `trip_type` includes `SHARED`.
1052
+ # @param filter [::String]
1053
+ # Optional. A filter query to apply when searching vehicles. See
1054
+ # http://aip.dev/160 for examples of the filter syntax.
1055
+ #
1056
+ # This field is designed to replace the `required_attributes`,
1057
+ # `required_one_of_attributes`, and `required_one_of_attributes_sets` fields.
1058
+ # If a non-empty value is specified here, the following fields must be empty:
1059
+ # `required_attributes`, `required_one_of_attributes`, and
1060
+ # `required_one_of_attributes_sets`.
1061
+ #
1062
+ # This filter functions as an AND clause with other constraints,
1063
+ # such as `minimum_capacity` or `vehicle_types`.
1064
+ #
1065
+ # Note that the only queries supported are on vehicle attributes (for
1066
+ # example, `attributes.<key> = <value>` or `attributes.<key1> = <value1> AND
1067
+ # attributes.<key2> = <value2>`). The maximum number of restrictions allowed
1068
+ # in a filter query is 50.
1069
+ #
1070
+ # Also, all attributes are stored as strings, so the only supported
1071
+ # comparisons against attributes are string comparisons. In order to compare
1072
+ # against number or boolean values, the values must be explicitly quoted to
1073
+ # be treated as strings (for example, `attributes.<key> = "10"` or
1074
+ # `attributes.<key> = "true"`).
1075
+ # @yield [result, operation] Access the result along with the TransportOperation object
1076
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::SearchVehiclesResponse]
1077
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1078
+ #
1079
+ # @return [::Google::Maps::FleetEngine::V1::SearchVehiclesResponse]
1080
+ #
1081
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1082
+ #
1083
+ # @example Basic example
1084
+ # require "google/maps/fleet_engine/v1"
1085
+ #
1086
+ # # Create a client object. The client can be reused for multiple calls.
1087
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
1088
+ #
1089
+ # # Create a request. To set request fields, pass in keyword arguments.
1090
+ # request = Google::Maps::FleetEngine::V1::SearchVehiclesRequest.new
1091
+ #
1092
+ # # Call the search_vehicles method.
1093
+ # result = client.search_vehicles request
1094
+ #
1095
+ # # The returned object is of type Google::Maps::FleetEngine::V1::SearchVehiclesResponse.
1096
+ # p result
1097
+ #
1098
+ def search_vehicles request, options = nil
1099
+ raise ::ArgumentError, "request must be provided" if request.nil?
1100
+
1101
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::SearchVehiclesRequest
1102
+
1103
+ # Converts hash and nil to an options object
1104
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1105
+
1106
+ # Customize the options with defaults
1107
+ call_metadata = @config.rpcs.search_vehicles.metadata.to_h
1108
+
1109
+ # Set x-goog-api-client and x-goog-user-project headers
1110
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1111
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1112
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
1113
+ transports_version_send: [:rest]
1114
+
1115
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1116
+
1117
+ options.apply_defaults timeout: @config.rpcs.search_vehicles.timeout,
1118
+ metadata: call_metadata,
1119
+ retry_policy: @config.rpcs.search_vehicles.retry_policy
1120
+
1121
+ options.apply_defaults timeout: @config.timeout,
1122
+ metadata: @config.metadata,
1123
+ retry_policy: @config.retry_policy
1124
+
1125
+ @vehicle_service_stub.search_vehicles request, options do |result, operation|
1126
+ yield result, operation if block_given?
1127
+ return result
1128
+ end
1129
+ rescue ::Gapic::Rest::Error => e
1130
+ raise ::Google::Cloud::Error.from_error(e)
1131
+ end
1132
+
1133
+ ##
1134
+ # Deprecated: Use `SearchVehicles` instead.
1135
+ #
1136
+ # @overload search_fuzzed_vehicles(request, options = nil)
1137
+ # Pass arguments to `search_fuzzed_vehicles` via a request object, either of type
1138
+ # {::Google::Maps::FleetEngine::V1::SearchVehiclesRequest} or an equivalent Hash.
1139
+ #
1140
+ # @param request [::Google::Maps::FleetEngine::V1::SearchVehiclesRequest, ::Hash]
1141
+ # A request object representing the call parameters. Required. To specify no
1142
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1143
+ # @param options [::Gapic::CallOptions, ::Hash]
1144
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1145
+ #
1146
+ # @overload search_fuzzed_vehicles(header: nil, parent: nil, pickup_point: nil, dropoff_point: nil, pickup_radius_meters: nil, count: nil, minimum_capacity: nil, trip_types: nil, maximum_staleness: nil, vehicle_types: nil, required_attributes: nil, required_one_of_attributes: nil, required_one_of_attribute_sets: nil, order_by: nil, include_back_to_back: nil, trip_id: nil, current_trips_present: nil, filter: nil)
1147
+ # Pass arguments to `search_fuzzed_vehicles` via keyword arguments. Note that at
1148
+ # least one keyword argument is required. To specify no parameters, or to keep all
1149
+ # the default parameter values, pass an empty Hash as a request object (see above).
1150
+ #
1151
+ # @param header [::Google::Maps::FleetEngine::V1::RequestHeader, ::Hash]
1152
+ # The standard Fleet Engine request header.
1153
+ # @param parent [::String]
1154
+ # Required. Must be in the format `providers/{provider}`.
1155
+ # The provider must be the Project ID (for example, `sample-cloud-project`)
1156
+ # of the Google Cloud Project of which the service account making
1157
+ # this call is a member.
1158
+ # @param pickup_point [::Google::Maps::FleetEngine::V1::TerminalLocation, ::Hash]
1159
+ # Required. The pickup point to search near.
1160
+ # @param dropoff_point [::Google::Maps::FleetEngine::V1::TerminalLocation, ::Hash]
1161
+ # The customer's intended dropoff location. The field is required if
1162
+ # `trip_types` contains `TripType.SHARED`.
1163
+ # @param pickup_radius_meters [::Integer]
1164
+ # Required. Defines the vehicle search radius around the pickup point. Only
1165
+ # vehicles within the search radius will be returned. Value must be between
1166
+ # 400 and 10000 meters (inclusive).
1167
+ # @param count [::Integer]
1168
+ # Required. Specifies the maximum number of vehicles to return. The value
1169
+ # must be between 1 and 50 (inclusive).
1170
+ # @param minimum_capacity [::Integer]
1171
+ # Required. Specifies the number of passengers being considered for a trip.
1172
+ # The value must be greater than or equal to one. The driver is not
1173
+ # considered in the capacity value.
1174
+ # @param trip_types [::Array<::Google::Maps::FleetEngine::V1::TripType>]
1175
+ # Required. Represents the type of proposed trip. Must include exactly one
1176
+ # type. `UNKNOWN_TRIP_TYPE` is not allowed. Restricts the search to only
1177
+ # those vehicles that can support that trip type.
1178
+ # @param maximum_staleness [::Google::Protobuf::Duration, ::Hash]
1179
+ # Restricts the search to only those vehicles that have sent location updates
1180
+ # to Fleet Engine within the specified duration. Stationary vehicles still
1181
+ # transmitting their locations are not considered stale. If this field is not
1182
+ # set, the server uses five minutes as the default value.
1183
+ # @param vehicle_types [::Array<::Google::Maps::FleetEngine::V1::Vehicle::VehicleType, ::Hash>]
1184
+ # Required. Restricts the search to vehicles with one of the specified types.
1185
+ # At least one vehicle type must be specified. VehicleTypes with a category
1186
+ # of `UNKNOWN` are not allowed.
1187
+ # @param required_attributes [::Array<::Google::Maps::FleetEngine::V1::VehicleAttribute, ::Hash>]
1188
+ # Callers can form complex logical operations using any combination of the
1189
+ # `required_attributes`, `required_one_of_attributes`, and
1190
+ # `required_one_of_attribute_sets` fields.
1191
+ #
1192
+ # `required_attributes` is a list; `required_one_of_attributes` uses a
1193
+ # message which allows a list of lists. In combination, the two fields allow
1194
+ # the composition of this expression:
1195
+ #
1196
+ # ```
1197
+ # (required_attributes[0] AND required_attributes[1] AND ...)
1198
+ # AND
1199
+ # (required_one_of_attributes[0][0] OR required_one_of_attributes[0][1] OR
1200
+ # ...)
1201
+ # AND
1202
+ # (required_one_of_attributes[1][0] OR required_one_of_attributes[1][1] OR
1203
+ # ...)
1204
+ # ```
1205
+ #
1206
+ # Restricts the search to only those vehicles with the specified attributes.
1207
+ # This field is a conjunction/AND operation. A max of 50 required_attributes
1208
+ # is allowed. This matches the maximum number of attributes allowed on a
1209
+ # vehicle.
1210
+ # @param required_one_of_attributes [::Array<::Google::Maps::FleetEngine::V1::VehicleAttributeList, ::Hash>]
1211
+ # Restricts the search to only those vehicles with at least one of
1212
+ # the specified attributes in each `VehicleAttributeList`. Within each
1213
+ # list, a vehicle must match at least one of the attributes. This field is an
1214
+ # inclusive disjunction/OR operation in each `VehicleAttributeList` and a
1215
+ # conjunction/AND operation across the collection of `VehicleAttributeList`.
1216
+ # @param required_one_of_attribute_sets [::Array<::Google::Maps::FleetEngine::V1::VehicleAttributeList, ::Hash>]
1217
+ # `required_one_of_attribute_sets` provides additional functionality.
1218
+ #
1219
+ # Similar to `required_one_of_attributes`, `required_one_of_attribute_sets`
1220
+ # uses a message which allows a list of lists, allowing expressions such as
1221
+ # this one:
1222
+ #
1223
+ # ```
1224
+ # (required_attributes[0] AND required_attributes[1] AND ...)
1225
+ # AND
1226
+ # (
1227
+ # (required_one_of_attribute_sets[0][0] AND
1228
+ # required_one_of_attribute_sets[0][1] AND
1229
+ # ...)
1230
+ # OR
1231
+ # (required_one_of_attribute_sets[1][0] AND
1232
+ # required_one_of_attribute_sets[1][1] AND
1233
+ # ...)
1234
+ # )
1235
+ # ```
1236
+ #
1237
+ # Restricts the search to only those vehicles with all the attributes in a
1238
+ # `VehicleAttributeList`. Within each list, a
1239
+ # vehicle must match all of the attributes. This field is a conjunction/AND
1240
+ # operation in each `VehicleAttributeList` and inclusive disjunction/OR
1241
+ # operation across the collection of `VehicleAttributeList`.
1242
+ # @param order_by [::Google::Maps::FleetEngine::V1::SearchVehiclesRequest::VehicleMatchOrder]
1243
+ # Required. Specifies the desired ordering criterion for results.
1244
+ # @param include_back_to_back [::Boolean]
1245
+ # This indicates if vehicles with a single active trip are eligible for this
1246
+ # search. This field is only used when `current_trips_present` is
1247
+ # unspecified. When `current_trips_present` is unspecified and this field
1248
+ # is `false`, vehicles with assigned trips are excluded from the search
1249
+ # results. When `current_trips_present` is unspecified and this field is
1250
+ # `true`, search results can include vehicles with one active trip that has a
1251
+ # status of `ENROUTE_TO_DROPOFF`. When `current_trips_present` is specified,
1252
+ # this field cannot be set to true.
1253
+ #
1254
+ # The default value is `false`.
1255
+ # @param trip_id [::String]
1256
+ # Indicates the trip associated with this `SearchVehicleRequest`.
1257
+ # @param current_trips_present [::Google::Maps::FleetEngine::V1::SearchVehiclesRequest::CurrentTripsPresent]
1258
+ # This indicates if vehicles with active trips are eligible for this search.
1259
+ # This must be set to something other than
1260
+ # `CURRENT_TRIPS_PRESENT_UNSPECIFIED` if `trip_type` includes `SHARED`.
1261
+ # @param filter [::String]
1262
+ # Optional. A filter query to apply when searching vehicles. See
1263
+ # http://aip.dev/160 for examples of the filter syntax.
1264
+ #
1265
+ # This field is designed to replace the `required_attributes`,
1266
+ # `required_one_of_attributes`, and `required_one_of_attributes_sets` fields.
1267
+ # If a non-empty value is specified here, the following fields must be empty:
1268
+ # `required_attributes`, `required_one_of_attributes`, and
1269
+ # `required_one_of_attributes_sets`.
1270
+ #
1271
+ # This filter functions as an AND clause with other constraints,
1272
+ # such as `minimum_capacity` or `vehicle_types`.
1273
+ #
1274
+ # Note that the only queries supported are on vehicle attributes (for
1275
+ # example, `attributes.<key> = <value>` or `attributes.<key1> = <value1> AND
1276
+ # attributes.<key2> = <value2>`). The maximum number of restrictions allowed
1277
+ # in a filter query is 50.
1278
+ #
1279
+ # Also, all attributes are stored as strings, so the only supported
1280
+ # comparisons against attributes are string comparisons. In order to compare
1281
+ # against number or boolean values, the values must be explicitly quoted to
1282
+ # be treated as strings (for example, `attributes.<key> = "10"` or
1283
+ # `attributes.<key> = "true"`).
1284
+ # @yield [result, operation] Access the result along with the TransportOperation object
1285
+ # @yieldparam result [::Google::Maps::FleetEngine::V1::SearchVehiclesResponse]
1286
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1287
+ #
1288
+ # @return [::Google::Maps::FleetEngine::V1::SearchVehiclesResponse]
1289
+ #
1290
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1291
+ #
1292
+ # @example Basic example
1293
+ # require "google/maps/fleet_engine/v1"
1294
+ #
1295
+ # # Create a client object. The client can be reused for multiple calls.
1296
+ # client = Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new
1297
+ #
1298
+ # # Create a request. To set request fields, pass in keyword arguments.
1299
+ # request = Google::Maps::FleetEngine::V1::SearchVehiclesRequest.new
1300
+ #
1301
+ # # Call the search_fuzzed_vehicles method.
1302
+ # result = client.search_fuzzed_vehicles request
1303
+ #
1304
+ # # The returned object is of type Google::Maps::FleetEngine::V1::SearchVehiclesResponse.
1305
+ # p result
1306
+ #
1307
+ def search_fuzzed_vehicles request, options = nil
1308
+ raise ::ArgumentError, "request must be provided" if request.nil?
1309
+
1310
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Maps::FleetEngine::V1::SearchVehiclesRequest
1311
+
1312
+ # Converts hash and nil to an options object
1313
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1314
+
1315
+ # Customize the options with defaults
1316
+ call_metadata = @config.rpcs.search_fuzzed_vehicles.metadata.to_h
1317
+
1318
+ # Set x-goog-api-client and x-goog-user-project headers
1319
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1320
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1321
+ gapic_version: ::Google::Maps::FleetEngine::V1::VERSION,
1322
+ transports_version_send: [:rest]
1323
+
1324
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1325
+
1326
+ options.apply_defaults timeout: @config.rpcs.search_fuzzed_vehicles.timeout,
1327
+ metadata: call_metadata,
1328
+ retry_policy: @config.rpcs.search_fuzzed_vehicles.retry_policy
1329
+
1330
+ options.apply_defaults timeout: @config.timeout,
1331
+ metadata: @config.metadata,
1332
+ retry_policy: @config.retry_policy
1333
+
1334
+ @vehicle_service_stub.search_fuzzed_vehicles request, options do |result, operation|
1335
+ yield result, operation if block_given?
1336
+ return result
1337
+ end
1338
+ rescue ::Gapic::Rest::Error => e
1339
+ raise ::Google::Cloud::Error.from_error(e)
1340
+ end
1341
+
1342
+ ##
1343
+ # Configuration class for the VehicleService REST API.
1344
+ #
1345
+ # This class represents the configuration for VehicleService REST,
1346
+ # providing control over timeouts, retry behavior, logging, transport
1347
+ # parameters, and other low-level controls. Certain parameters can also be
1348
+ # applied individually to specific RPCs. See
1349
+ # {::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client::Configuration::Rpcs}
1350
+ # for a list of RPCs that can be configured independently.
1351
+ #
1352
+ # Configuration can be applied globally to all clients, or to a single client
1353
+ # on construction.
1354
+ #
1355
+ # @example
1356
+ #
1357
+ # # Modify the global config, setting the timeout for
1358
+ # # create_vehicle to 20 seconds,
1359
+ # # and all remaining timeouts to 10 seconds.
1360
+ # ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.configure do |config|
1361
+ # config.timeout = 10.0
1362
+ # config.rpcs.create_vehicle.timeout = 20.0
1363
+ # end
1364
+ #
1365
+ # # Apply the above configuration only to a new client.
1366
+ # client = ::Google::Maps::FleetEngine::V1::VehicleService::Rest::Client.new do |config|
1367
+ # config.timeout = 10.0
1368
+ # config.rpcs.create_vehicle.timeout = 20.0
1369
+ # end
1370
+ #
1371
+ # @!attribute [rw] endpoint
1372
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1373
+ # nil, indicating to use the default endpoint in the current universe domain.
1374
+ # @return [::String,nil]
1375
+ # @!attribute [rw] credentials
1376
+ # Credentials to send with calls. You may provide any of the following types:
1377
+ # * (`String`) The path to a service account key file in JSON format
1378
+ # * (`Hash`) A service account key as a Hash
1379
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1380
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1381
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1382
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1383
+ # * (`nil`) indicating no credentials
1384
+ # @return [::Object]
1385
+ # @!attribute [rw] scope
1386
+ # The OAuth scopes
1387
+ # @return [::Array<::String>]
1388
+ # @!attribute [rw] lib_name
1389
+ # The library name as recorded in instrumentation and logging
1390
+ # @return [::String]
1391
+ # @!attribute [rw] lib_version
1392
+ # The library version as recorded in instrumentation and logging
1393
+ # @return [::String]
1394
+ # @!attribute [rw] timeout
1395
+ # The call timeout in seconds.
1396
+ # @return [::Numeric]
1397
+ # @!attribute [rw] metadata
1398
+ # Additional headers to be sent with the call.
1399
+ # @return [::Hash{::Symbol=>::String}]
1400
+ # @!attribute [rw] retry_policy
1401
+ # The retry policy. The value is a hash with the following keys:
1402
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1403
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1404
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1405
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1406
+ # trigger a retry.
1407
+ # @return [::Hash]
1408
+ # @!attribute [rw] quota_project
1409
+ # A separate project against which to charge quota.
1410
+ # @return [::String]
1411
+ # @!attribute [rw] universe_domain
1412
+ # The universe domain within which to make requests. This determines the
1413
+ # default endpoint URL. The default value of nil uses the environment
1414
+ # universe (usually the default "googleapis.com" universe).
1415
+ # @return [::String,nil]
1416
+ #
1417
+ class Configuration
1418
+ extend ::Gapic::Config
1419
+
1420
+ # @private
1421
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1422
+ DEFAULT_ENDPOINT = "fleetengine.googleapis.com"
1423
+
1424
+ config_attr :endpoint, nil, ::String, nil
1425
+ config_attr :credentials, nil do |value|
1426
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1427
+ allowed.any? { |klass| klass === value }
1428
+ end
1429
+ config_attr :scope, nil, ::String, ::Array, nil
1430
+ config_attr :lib_name, nil, ::String, nil
1431
+ config_attr :lib_version, nil, ::String, nil
1432
+ config_attr :timeout, nil, ::Numeric, nil
1433
+ config_attr :metadata, nil, ::Hash, nil
1434
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1435
+ config_attr :quota_project, nil, ::String, nil
1436
+ config_attr :universe_domain, nil, ::String, nil
1437
+
1438
+ # @private
1439
+ def initialize parent_config = nil
1440
+ @parent_config = parent_config unless parent_config.nil?
1441
+
1442
+ yield self if block_given?
1443
+ end
1444
+
1445
+ ##
1446
+ # Configurations for individual RPCs
1447
+ # @return [Rpcs]
1448
+ #
1449
+ def rpcs
1450
+ @rpcs ||= begin
1451
+ parent_rpcs = nil
1452
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1453
+ Rpcs.new parent_rpcs
1454
+ end
1455
+ end
1456
+
1457
+ ##
1458
+ # Configuration RPC class for the VehicleService API.
1459
+ #
1460
+ # Includes fields providing the configuration for each RPC in this service.
1461
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1462
+ # the following configuration fields:
1463
+ #
1464
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1465
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1466
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1467
+ # include the following keys:
1468
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1469
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1470
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1471
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1472
+ # trigger a retry.
1473
+ #
1474
+ class Rpcs
1475
+ ##
1476
+ # RPC-specific configuration for `create_vehicle`
1477
+ # @return [::Gapic::Config::Method]
1478
+ #
1479
+ attr_reader :create_vehicle
1480
+ ##
1481
+ # RPC-specific configuration for `get_vehicle`
1482
+ # @return [::Gapic::Config::Method]
1483
+ #
1484
+ attr_reader :get_vehicle
1485
+ ##
1486
+ # RPC-specific configuration for `update_vehicle`
1487
+ # @return [::Gapic::Config::Method]
1488
+ #
1489
+ attr_reader :update_vehicle
1490
+ ##
1491
+ # RPC-specific configuration for `update_vehicle_location`
1492
+ # @return [::Gapic::Config::Method]
1493
+ #
1494
+ attr_reader :update_vehicle_location
1495
+ ##
1496
+ # RPC-specific configuration for `update_vehicle_attributes`
1497
+ # @return [::Gapic::Config::Method]
1498
+ #
1499
+ attr_reader :update_vehicle_attributes
1500
+ ##
1501
+ # RPC-specific configuration for `list_vehicles`
1502
+ # @return [::Gapic::Config::Method]
1503
+ #
1504
+ attr_reader :list_vehicles
1505
+ ##
1506
+ # RPC-specific configuration for `search_vehicles`
1507
+ # @return [::Gapic::Config::Method]
1508
+ #
1509
+ attr_reader :search_vehicles
1510
+ ##
1511
+ # RPC-specific configuration for `search_fuzzed_vehicles`
1512
+ # @return [::Gapic::Config::Method]
1513
+ #
1514
+ attr_reader :search_fuzzed_vehicles
1515
+
1516
+ # @private
1517
+ def initialize parent_rpcs = nil
1518
+ create_vehicle_config = parent_rpcs.create_vehicle if parent_rpcs.respond_to? :create_vehicle
1519
+ @create_vehicle = ::Gapic::Config::Method.new create_vehicle_config
1520
+ get_vehicle_config = parent_rpcs.get_vehicle if parent_rpcs.respond_to? :get_vehicle
1521
+ @get_vehicle = ::Gapic::Config::Method.new get_vehicle_config
1522
+ update_vehicle_config = parent_rpcs.update_vehicle if parent_rpcs.respond_to? :update_vehicle
1523
+ @update_vehicle = ::Gapic::Config::Method.new update_vehicle_config
1524
+ update_vehicle_location_config = parent_rpcs.update_vehicle_location if parent_rpcs.respond_to? :update_vehicle_location
1525
+ @update_vehicle_location = ::Gapic::Config::Method.new update_vehicle_location_config
1526
+ update_vehicle_attributes_config = parent_rpcs.update_vehicle_attributes if parent_rpcs.respond_to? :update_vehicle_attributes
1527
+ @update_vehicle_attributes = ::Gapic::Config::Method.new update_vehicle_attributes_config
1528
+ list_vehicles_config = parent_rpcs.list_vehicles if parent_rpcs.respond_to? :list_vehicles
1529
+ @list_vehicles = ::Gapic::Config::Method.new list_vehicles_config
1530
+ search_vehicles_config = parent_rpcs.search_vehicles if parent_rpcs.respond_to? :search_vehicles
1531
+ @search_vehicles = ::Gapic::Config::Method.new search_vehicles_config
1532
+ search_fuzzed_vehicles_config = parent_rpcs.search_fuzzed_vehicles if parent_rpcs.respond_to? :search_fuzzed_vehicles
1533
+ @search_fuzzed_vehicles = ::Gapic::Config::Method.new search_fuzzed_vehicles_config
1534
+
1535
+ yield self if block_given?
1536
+ end
1537
+ end
1538
+ end
1539
+ end
1540
+ end
1541
+ end
1542
+ end
1543
+ end
1544
+ end
1545
+ end