Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa guida ti aiuta a verificare che la configurazione dell'autorizzazione Fleet Engine sia
completa e che tu possa creare un veicolo di prova. Questa guida utilizza
l'utilità a riga di comando gcloud per testare
la firma del token di autorizzazione e la creazione del veicolo.
Per completare la procedura:
Sostituisci i campi riportati di seguito con i dati che hai creato durante la configurazione:
[null,null,["Ultimo aggiornamento 2025-08-16 UTC."],[[["\u003cp\u003eThis guide provides instructions to verify your Fleet Engine authorization and create a trial vehicle using the \u003ccode\u003egcloud\u003c/code\u003e command line utility.\u003c/p\u003e\n"],["\u003cp\u003eYou will need your Cloud project ID, service account email address, and a unique vehicle ID to complete the verification process.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves generating and signing a JWT, then using it to create a test vehicle via a \u003ccode\u003ecurl\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful setup is indicated by the output displaying the name of the created vehicle (e.g., "providers/PROJECT_ID/vehicles/VEHICLE_ID").\u003c/p\u003e\n"],["\u003cp\u003eFleet Engine automatically purges inactive vehicles after 7 days, eliminating the need for manual deletion.\u003c/p\u003e\n"]]],[],null,["This guide helps you verify that your Fleet Engine authorization setup is\ncomplete, and that you can create a trial vehicle. This guide uses\n[the `gcloud` command line utility](https://cloud.google.com/sdk/gcloud) to test\nauthorization token signing and vehicle creation.\n\nTo complete this process, do the following:\n\n1. Replace the fields below with the data you created as part of the setup:\n\n| Field | Replace with |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| \u003cvar class=\"edit\" scope=\"PROJECT_ID\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e | Your Cloud project ID. |\n| \u003cvar class=\"edit\" scope=\"SERVICE_ACCOUNT_EMAIL_ADDRESS\" translate=\"no\"\u003eSERVICE_ACCOUNT_EMAIL_ADDRESS\u003c/var\u003e | The email address of a service account you've created with the Admin role. See [Mobility service account roles](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/service-accounts#mobility_service_account_roles) for details. |\n| \u003cvar class=\"edit\" scope=\"VEHICLE_ID\" translate=\"no\"\u003eVEHICLE_ID\u003c/var\u003e **OR** \u003cvar class=\"edit\" scope=\"DELIVERY_VEHICLE_ID\" translate=\"no\"\u003eDELIVERY_VEHICLE_ID\u003c/var\u003e | A random ID for the vehicle. The ID can contain a maximum of 64 characters. |\n\n1. Use the `gcloud` utility to log into the Google Cloud account and set the\n active project on your workstation:\n\n gcloud auth login\n gcloud config set project \u003cvar label=\"project ID\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n2. Create a JSON Web Token (JWT) claim for the vehicle creation:\n\n On-demand trips \n\n ```\n cat \u003e claim.jwt \u003c\u003c EOM\n {\n \"iss\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"sub\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"aud\": \"https://fleetengine.googleapis.com/\",\n \"iat\": $(date +%s),\n \"exp\": $((`date +%s` + 3600)),\n \"authorization\": {\n \"vehicleid\": \"VEHICLE_ID\"\n }\n }\n EOM\n \n ```\n\n Scheduled tasks \n\n ```\n cat \u003e claim.jwt \u003c\u003c EOM\n {\n \"iss\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"sub\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"aud\": \"https://fleetengine.googleapis.com/\",\n \"iat\": $(date +%s),\n \"exp\": $((`date +%s` + 3600)),\n \"authorization\": {\n \"deliveryvehicleid\": \"DELIVERY_VEHICLE_ID\"\n }\n }\n EOM\n \n ```\n3. Use `gcloud` to sign this JWT with the appropriate IAM permissions. :\n\n gcloud iam service-accounts sign-jwt claim.jwt output.jwt \\\n --iam-account=\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_EMAIL_ADDRESS\u003c/var\u003e\n\n The signed JWT is stored in `output.jwt`.\n\n For details, see [Provide required permissions](https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#permissions-access) and\n [the `gcloud` command line guide](https://cloud.google.com/sdk/gcloud/reference/beta/iam/service-accounts/sign-jwt) in the Google Cloud\n documentation.\n4. Use `curl` to create a test vehicle on Fleet Engine:\n\n On-demand trips \n\n ```\n curl -X POST \"https://fleetengine.googleapis.com/v1/providers/PROJECT_ID/vehicles?vehicleId=VEHICLE_ID\" \\\n -H \"Content-type: application/json\" \\\n -H \"Authorization: Bearer $(cat output.jwt)\" \\\n --data-binary @- \u003c\u003c EOM\n {\n \"name\": \"providers/PROJECT_ID/vehicles/VEHICLE_ID\"\n }\n EOM\n {\n \"vehicleState\": \"OFFLINE\",\n \"supportedTripTypes\": [\"EXCLUSIVE\"],\n \"maximumCapacity\": 4,\n \"vehicleType\": {\"category\": \"AUTO\"},\n \"attributes\": [{\"key\": \"on_trip\", \"value\": \"false\"}]\n }\n \n ```\n\n This command should print the name of the vehicle as output. If you\n see the following text, your setup is successful. \n\n ```\n {\n \"name\": \"providers/PROJECT_ID/vehicles/VEHICLE_ID\"\n }\n \n ```\n\n Scheduled tasks \n\n ```\n curl -X POST \"https://fleetengine.googleapis.com/v1/providers/PROJECT_ID/deliveryVehicles?deliveryVehicleId=DELIVERY_VEHICLE_ID\" \\\n -H \"Content-type: application/json\" \\\n -H \"Authorization: Bearer $(cat output.jwt)\" \\\n --data-binary @- \u003c\u003c EOM\n {\n \"name\": \"providers/PROJECT_ID/deliveryVehicles/DELIVERY_VEHICLE_ID\"\n }\n EOM\n \n ```\n\n This command should print the name of the delivery vehicle as output. If you\n see the following text, your setup is successful. \n\n ```\n {\n \"name\": \"providers/PROJECT_ID/deliveryVehicles/DELIVERY_VEHICLE_ID\"\n }\n \n ```\n | **Note:** Fleet Engine automatically purges all entities (including vehicles) after 7 days of inactivity, such as updates.\n\nWhat's next\n\n- [Troubleshoot common issues](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/troubleshoot)\n- [Create and use vehicles](/maps/documentation/mobility/fleet-engine/essentials/vehicles)"]]