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