use of software.amazon.awssdk.services.mediastoredata.model.ListItemsResponse in project aws-doc-sdk-examples by awsdocs.
the class ListItems method listAllItems.
// snippet-start:[mediastore.java2.list_items.main]
public static void listAllItems(MediaStoreDataClient mediaStoreData, String completePath) {
try {
ListItemsRequest itemsRequest = ListItemsRequest.builder().path(completePath).build();
ListItemsResponse itemsResponse = mediaStoreData.listItems(itemsRequest);
Boolean hasItems = itemsResponse.hasItems();
if (hasItems) {
List<Item> items = itemsResponse.items();
for (Item item : items) {
System.out.println("Item name is: " + item.name());
System.out.println("Content type is: " + item.contentType());
}
} else {
System.out.println("There are no items");
}
} catch (MediaStoreDataException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
Aggregations