@@ -0,0 +1,3029 @@
+// snippet-sourcedescription:%5BListCreatedArtifacts.java demonstrates how to List the created artifacts attached to a given migration task.%5D%0A// snippet-service:%5BAmazon Migration Hub%5D%0A// snippet-keyword:%5BJava%5D%0A// snippet-keyword:%5BAmazon Migration Hub%5D%0A// snippet-keyword:%5BCode Sample%5D%0A// snippet-sourcetype:%5Bfull-example%5D%0A// snippet-sourcedate:%5B6-23-2020%5D%0A// snippet-sourceauthor:%5Bscmacdon - AWS%5D%0A%0A/**%0A * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A *%0A * This file is licensed under the Apache License, Version 2.0 (the %22License%22).%0A * You may not use this file except in compliance with the License. A copy of%0A * the License is located at%0A *%0A * http://aws.amazon.com/apache2.0/%0A *%0A * This file is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR%0A * CONDITIONS OF ANY KIND, either express or implied. See the License for the%0A * specific language governing permissions and limitations under the License.%0A */%0A%0Apackage com.example.migrationhub;%0A%0A// snippet-start:%5Bmigration.java2.list_artifacts.import%5D%0Aimport software.amazon.awssdk.regions.Region;%0Aimport software.amazon.awssdk.services.migrationhub.MigrationHubClient;%0Aimport software.amazon.awssdk.services.migrationhub.model.CreatedArtifact;%0Aimport software.amazon.awssdk.services.migrationhub.model.ListCreatedArtifactsRequest;%0Aimport software.amazon.awssdk.services.migrationhub.model.ListCreatedArtifactsResponse;%0Aimport software.amazon.awssdk.services.migrationhub.model.MigrationHubException;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0A// snippet-end:%5Bmigration.java2.list_artifacts.import%5D%0A%0Apublic class ListCreatedArtifacts %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        Region region = Region.US_WEST_2;%0A        MigrationHubClient migrationClient = MigrationHubClient.builder()%0A                .region(region)%0A                .build();%0A%0A        listArtifacts(migrationClient);%0A    %7D%0A%0A    // snippet-start:%5Bmigration.java2.list_artifacts.main%5D%0A    public static void listArtifacts(MigrationHubClient migrationClient) %7B%0A%0A        try %7B%0A%0A            ListCreatedArtifactsRequest listCreatedArtifactsRequest = ListCreatedArtifactsRequest.builder()%0A                    .maxResults(10)%0A                    .migrationTaskName(%22SampleApp5%22)%0A                    .progressUpdateStream(%22ProgressSteamB%22)%0A                    .build();%0A%0A            ListCreatedArtifactsResponse response = migrationClient.listCreatedArtifacts(listCreatedArtifactsRequest);%0A            List%3CCreatedArtifact%3E apps = response.createdArtifactList();%0A%0A            Iterator%3CCreatedArtifact%3E appIterator = apps.iterator();%0A%0A            while(appIterator.hasNext()) %7B%0A                CreatedArtifact artifact = appIterator.next();%0A                System.out.println(%22APp Id is %22 +artifact.description());%0A                System.out.println(%22The name is %22 +artifact.name());%0A            %7D%0A%0A    %7D catch(MigrationHubException e) %7B%0A        System.out.println(e.getMessage());%0A        System.exit(1);%0A    %7D%0A   // snippet-start:%5Bmigration.java2.list_artifacts.main%5D%0A  %7D%0A %7D%0A

Create ListCreatedArtifacts.java