- AWS Code Sample demonstrates how to list Amazon Personalize solutions.


To run this Java (SDK V2) code example, ensure that you have set up your development environment, including your credentials. For more information, see AWS SDK for Java 2.x Developer Guide.

/* Copyright, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package com.example.personalize; import; import; import; import; import; import; 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: * * */ public class ListSolutions { public static void main(String[] args) { final String USAGE = "\n" + "Usage:\n" + " ListSolutions <datasetGroupArn>\n\n" + "Where:\n" + " datasetGroupArn - The ARN of the data set group.\n\n"; if (args.length < 1) { System.out.println(USAGE); System.exit(1); } String datasetGroupArn = args[0]; Region region = Region.US_EAST_1; PersonalizeClient personalizeClient = PersonalizeClient.builder() .region(region) .build(); listAllSolutions(personalizeClient, datasetGroupArn); personalizeClient.close(); } public static void listAllSolutions(PersonalizeClient personalizeClient, String datasetGroupArn) { try { ListSolutionsRequest solutionsRequest = ListSolutionsRequest.builder() .maxResults(10) .datasetGroupArn(datasetGroupArn) .build() ; ListSolutionsResponse response = personalizeClient.listSolutions(solutionsRequest); List<SolutionSummary> solutions =; for (SolutionSummary solution: solutions) { System.out.println("The solution ARN is: "+solution.solutionArn()); System.out.println("The solution name is: "; } } catch (PersonalizeException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } }

Sample Details

Service: Amazon Personalize

Last tested: 11/05/2020

Author: scmacdon - AWS

Type: full-example