Gunakan ListCreatedArtifacts dengan AWS SDK - AWS SDKContoh Kode

Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen.

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan ListCreatedArtifacts dengan AWS SDK

Contoh kode berikut menunjukkan cara menggunakanListCreatedArtifacts.

Java
SDKuntuk Java 2.x
catatan

Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS.

import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.migrationhub.MigrationHubClient; import software.amazon.awssdk.services.migrationhub.model.CreatedArtifact; import software.amazon.awssdk.services.migrationhub.model.ListCreatedArtifactsRequest; import software.amazon.awssdk.services.migrationhub.model.ListCreatedArtifactsResponse; import software.amazon.awssdk.services.migrationhub.model.MigrationHubException; import java.util.List; /** * To run this Java V2 code example, ensure that you have setup your development * environment, including your credentials. * * For information, see this documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class ListCreatedArtifacts { public static void main(String[] args) { Region region = Region.US_WEST_2; MigrationHubClient migrationClient = MigrationHubClient.builder() .region(region) .build(); listArtifacts(migrationClient); migrationClient.close(); } public static void listArtifacts(MigrationHubClient migrationClient) { try { ListCreatedArtifactsRequest listCreatedArtifactsRequest = ListCreatedArtifactsRequest.builder() .maxResults(10) .migrationTaskName("SampleApp5") .progressUpdateStream("ProgressSteamB") .build(); ListCreatedArtifactsResponse response = migrationClient.listCreatedArtifacts(listCreatedArtifactsRequest); List<CreatedArtifact> apps = response.createdArtifactList(); for (CreatedArtifact artifact : apps) { System.out.println("APp Id is " + artifact.description()); System.out.println("The name is " + artifact.name()); } } catch (MigrationHubException e) { System.out.println(e.getMessage()); System.exit(1); } } }