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

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