Sono disponibili altri esempi per SDK AWS nel repository GitHub della documentazione degli esempi per SDK AWS
Utilizzo di createVehicle con un SDK AWS
Gli esempi di codice seguenti mostrano come utilizzare createVehicle.
- Java
-
- SDK per Java 2.x
-
Nota
Ulteriori informazioni su GitHub. Trova l’esempio completo e scopri di più sulla configurazione e l’esecuzione nel Repository di esempi di codice AWS
. /** * Creates a new vehicle in the system. * * @param vecName the name of the vehicle to be created * @param manifestArn the Amazon Resource Name (ARN) of the model manifest for the vehicle * @param decArn the Amazon Resource Name (ARN) of the decoder manifest for the vehicle * @return a {@link CompletableFuture} that completes when the vehicle has been created, or throws a */ public CompletableFuture<Void> createVehicleAsync(String vecName, String manifestArn, String decArn) { CreateVehicleRequest request = CreateVehicleRequest.builder() .vehicleName(vecName) .modelManifestArn(manifestArn) .decoderManifestArn(decArn) .build(); CompletableFuture<Void> result = new CompletableFuture<>(); getAsyncClient().createVehicle(request) .whenComplete((response, exception) -> { if (exception != null) { Throwable cause = exception instanceof CompletionException ? exception.getCause() : exception; if (cause instanceof ResourceNotFoundException) { result.completeExceptionally(cause); } else { result.completeExceptionally(new RuntimeException("Failed to create vehicle: " + cause.getMessage(), cause)); } } else { logger.info("Vehicle '{}' created successfully.", vecName); result.complete(null); // mark future as complete } }); return result; }-
Per informazioni dettagliate sull’API, consulta createVehicle nella documentazione di riferimento dell’API AWS SDK for Java 2.x.
-
- Kotlin
-
- SDK per Kotlin
-
Nota
Ulteriori informazioni su GitHub. Trova l’esempio completo e scopri di più sulla configurazione e l’esecuzione nel Repository di esempi di codice AWS
. suspend fun createVehicle(vecName: String, manifestArn: String?, decArn: String) { val request = CreateVehicleRequest { vehicleName = vecName modelManifestArn = manifestArn decoderManifestArn = decArn } IotFleetWiseClient.fromEnvironment { region = "us-east-1" }.use { fleetwiseClient -> fleetwiseClient.createVehicle(request) println("Vehicle $vecName was created successfully.") } }-
Per informazioni dettagliate sull’API, consulta createVehicle
nella documentazione di riferimento dell’API AWS SDK per Kotlin.
-
createSignalCatalog
deleteDecoderManifest