Ci sono altri AWS SDK esempi disponibili nel repository AWS Doc SDK Examples
Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Utilizzare DescribeMigrationTask
con un AWS SDK
Il seguente esempio di codice mostra come utilizzareDescribeMigrationTask
.
- Java
-
- SDKper Java 2.x
-
Nota
C'è altro su. GitHub Trova l'esempio completo e scopri di più sulla configurazione e l'esecuzione nel Repository di esempi di codice AWS
. import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.migrationhub.MigrationHubClient; import software.amazon.awssdk.services.migrationhub.model.DescribeMigrationTaskRequest; import software.amazon.awssdk.services.migrationhub.model.DescribeMigrationTaskResponse; import software.amazon.awssdk.services.migrationhub.model.MigrationHubException; /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class DescribeMigrationTask { public static void main(String[] args) { final String usage = """ Usage: DescribeMigrationTask <migrationTask> <progressStream>\s Where: migrationTask - the name of a migration task.\s progressStream - the name of a progress stream.\s """; if (args.length < 2) { System.out.println(usage); System.exit(1); } String migrationTask = args[0]; String progressStream = args[1]; Region region = Region.US_WEST_2; MigrationHubClient migrationClient = MigrationHubClient.builder() .region(region) .build(); describeMigTask(migrationClient, migrationTask, progressStream); migrationClient.close(); } public static void describeMigTask(MigrationHubClient migrationClient, String migrationTask, String progressStream) { try { DescribeMigrationTaskRequest migrationTaskRequestRequest = DescribeMigrationTaskRequest.builder() .progressUpdateStream(progressStream) .migrationTaskName(migrationTask) .build(); DescribeMigrationTaskResponse migrationTaskResponse = migrationClient .describeMigrationTask(migrationTaskRequestRequest); System.out.println("The name is " + migrationTaskResponse.migrationTask().migrationTaskName()); } catch (MigrationHubException e) { System.out.println(e.getMessage()); System.exit(1); } } }
-
Per API i dettagli, vedi DescribeMigrationTask AWS SDK for Java 2.xAPIReference.
-
DescribeApplicationState
ImportMigrationTask