Search in sources :

Example 1 with ListItemsRequest

use of software.amazon.awssdk.services.mediastoredata.model.ListItemsRequest 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);
    }
}
Also used : Item(software.amazon.awssdk.services.mediastoredata.model.Item) MediaStoreDataException(software.amazon.awssdk.services.mediastoredata.model.MediaStoreDataException) ListItemsRequest(software.amazon.awssdk.services.mediastoredata.model.ListItemsRequest) ListItemsResponse(software.amazon.awssdk.services.mediastoredata.model.ListItemsResponse)

Aggregations

Item (software.amazon.awssdk.services.mediastoredata.model.Item)1 ListItemsRequest (software.amazon.awssdk.services.mediastoredata.model.ListItemsRequest)1 ListItemsResponse (software.amazon.awssdk.services.mediastoredata.model.ListItemsResponse)1 MediaStoreDataException (software.amazon.awssdk.services.mediastoredata.model.MediaStoreDataException)1