Skip to content

Commit

Permalink
feat: [google-maps-fleetengine] Added Fleet Engine Delete APIs (#13567)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 732281673

Source-Link:
googleapis/googleapis@2f37e0a

Source-Link:
googleapis/googleapis-gen@016b753
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtZmxlZXRlbmdpbmUvLk93bEJvdC55YW1sIiwiaCI6IjAxNmI3NTM4YmE1YTc5OGYyYWU0MjNkNGNjZDdmODJiMDZjZGY2ZDIifQ==

BEGIN_NESTED_COMMIT
feat: [google-maps-fleetengine] Added Fleet Engine Delete APIs
PiperOrigin-RevId: 731779200

Source-Link:
googleapis/googleapis@fc5c0bd

Source-Link:
googleapis/googleapis-gen@776721a
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtZmxlZXRlbmdpbmUvLk93bEJvdC55YW1sIiwiaCI6Ijc3NjcyMWEwYTdhYjJjYThmMDZhMmU4MGU0ZjE0NmU4MzVlYmJlNGMifQ==
END_NESTED_COMMIT

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Mar 1, 2025
1 parent a2c1c9a commit 1df29f9
Show file tree
Hide file tree
Showing 26 changed files with 1,883 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
)
from google.maps.fleetengine_v1.types.trip_api import (
CreateTripRequest,
DeleteTripRequest,
GetTripRequest,
ReportBillableTripRequest,
SearchTripsRequest,
Expand All @@ -62,6 +63,7 @@
)
from google.maps.fleetengine_v1.types.vehicle_api import (
CreateVehicleRequest,
DeleteVehicleRequest,
GetVehicleRequest,
ListVehiclesRequest,
ListVehiclesResponse,
Expand Down Expand Up @@ -106,6 +108,7 @@
"ConsumableTrafficPolyline",
"SpeedReadingInterval",
"CreateTripRequest",
"DeleteTripRequest",
"GetTripRequest",
"ReportBillableTripRequest",
"SearchTripsRequest",
Expand All @@ -117,6 +120,7 @@
"TripStatus",
"TripView",
"CreateVehicleRequest",
"DeleteVehicleRequest",
"GetVehicleRequest",
"ListVehiclesRequest",
"ListVehiclesResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.2.7" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from .types.traffic import ConsumableTrafficPolyline, SpeedReadingInterval
from .types.trip_api import (
CreateTripRequest,
DeleteTripRequest,
GetTripRequest,
ReportBillableTripRequest,
SearchTripsRequest,
Expand All @@ -51,6 +52,7 @@
)
from .types.vehicle_api import (
CreateVehicleRequest,
DeleteVehicleRequest,
GetVehicleRequest,
ListVehiclesRequest,
ListVehiclesResponse,
Expand Down Expand Up @@ -85,6 +87,8 @@
"ConsumableTrafficPolyline",
"CreateTripRequest",
"CreateVehicleRequest",
"DeleteTripRequest",
"DeleteVehicleRequest",
"DeviceSettings",
"GetTripRequest",
"GetVehicleRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"create_trip"
]
},
"DeleteTrip": {
"methods": [
"delete_trip"
]
},
"GetTrip": {
"methods": [
"get_trip"
Expand Down Expand Up @@ -45,6 +50,11 @@
"create_trip"
]
},
"DeleteTrip": {
"methods": [
"delete_trip"
]
},
"GetTrip": {
"methods": [
"get_trip"
Expand Down Expand Up @@ -79,6 +89,11 @@
"create_vehicle"
]
},
"DeleteVehicle": {
"methods": [
"delete_vehicle"
]
},
"GetVehicle": {
"methods": [
"get_vehicle"
Expand Down Expand Up @@ -114,6 +129,11 @@
"create_vehicle"
]
},
"DeleteVehicle": {
"methods": [
"delete_vehicle"
]
},
"GetVehicle": {
"methods": [
"get_vehicle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.2.7" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,116 @@ async def sample_get_trip():
# Done; return the response.
return response

async def delete_trip(
self,
request: Optional[Union[trip_api.DeleteTripRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a single Trip.
Returns FAILED_PRECONDITION if the Trip is active and assigned
to a vehicle.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.maps import fleetengine_v1
async def sample_delete_trip():
# Create a client
client = fleetengine_v1.TripServiceAsyncClient()
# Initialize request argument(s)
request = fleetengine_v1.DeleteTripRequest(
name="name_value",
)
# Make the request
await client.delete_trip(request=request)
Args:
request (Optional[Union[google.maps.fleetengine_v1.types.DeleteTripRequest, dict]]):
The request object. DeleteTrip request message.
name (:class:`str`):
Required. Must be in the format
``providers/{provider}/trips/{trip}``. The provider must
be the Project ID (for example,
``sample-cloud-project``) of the Google Cloud Project of
which the service account making this call is a member.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# Create or coerce a protobuf request object.
# - Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, trip_api.DeleteTripRequest):
request = trip_api.DeleteTripRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if name is not None:
request.name = name

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.delete_trip
]

header_params = {}

routing_param_regex = re.compile("^(?P<provider_id>providers/[^/]+)$")
regex_match = routing_param_regex.match(request.name)
if regex_match and regex_match.group("provider_id"):
header_params["provider_id"] = regex_match.group("provider_id")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

async def report_billable_trip(
self,
request: Optional[Union[trip_api.ReportBillableTripRequest, dict]] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,113 @@ def sample_get_trip():
# Done; return the response.
return response

def delete_trip(
self,
request: Optional[Union[trip_api.DeleteTripRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a single Trip.
Returns FAILED_PRECONDITION if the Trip is active and assigned
to a vehicle.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.maps import fleetengine_v1
def sample_delete_trip():
# Create a client
client = fleetengine_v1.TripServiceClient()
# Initialize request argument(s)
request = fleetengine_v1.DeleteTripRequest(
name="name_value",
)
# Make the request
client.delete_trip(request=request)
Args:
request (Union[google.maps.fleetengine_v1.types.DeleteTripRequest, dict]):
The request object. DeleteTrip request message.
name (str):
Required. Must be in the format
``providers/{provider}/trips/{trip}``. The provider must
be the Project ID (for example,
``sample-cloud-project``) of the Google Cloud Project of
which the service account making this call is a member.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# Create or coerce a protobuf request object.
# - Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, trip_api.DeleteTripRequest):
request = trip_api.DeleteTripRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if name is not None:
request.name = name

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.delete_trip]

header_params = {}

routing_param_regex = re.compile("^(?P<provider_id>providers/[^/]+)$")
regex_match = routing_param_regex.match(request.name)
if regex_match and regex_match.group("provider_id"):
header_params["provider_id"] = regex_match.group("provider_id")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

def report_billable_trip(
self,
request: Optional[Union[trip_api.ReportBillableTripRequest, dict]] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=15.0,
client_info=client_info,
),
self.delete_trip: gapic_v1.method.wrap_method(
self.delete_trip,
default_timeout=None,
client_info=client_info,
),
self.report_billable_trip: gapic_v1.method.wrap_method(
self.report_billable_trip,
default_timeout=None,
Expand Down Expand Up @@ -215,6 +220,14 @@ def get_trip(
) -> Callable[[trip_api.GetTripRequest], Union[trips.Trip, Awaitable[trips.Trip]]]:
raise NotImplementedError()

@property
def delete_trip(
self,
) -> Callable[
[trip_api.DeleteTripRequest], Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]]
]:
raise NotImplementedError()

@property
def report_billable_trip(
self,
Expand Down
Loading

0 comments on commit 1df29f9

Please sign in to comment.