use of com.amazonaws.services.mediastoredata.model.ListItemsResult in project aws-doc-sdk-examples by awsdocs.
the class ListItems method main.
public static void main(String[] args) {
final String USAGE = "\n" + "To run this example, supply the name of a container and an optional path!\n" + "\n" + "Ex: ListItems <container-name> [path]\n";
if (args.length < 1) {
System.out.println(USAGE);
System.exit(1);
}
final String containerName = args[0];
String path = "";
if (args.length > 1) {
path = args[1];
}
System.out.format("Objects in MediaStore container %s, path '%s':\n", containerName, path);
final String endpoint = getContainerEndpoint(containerName);
if (endpoint == null || endpoint.isEmpty()) {
System.err.println("Could not determine container endpoint!");
System.exit(1);
}
final String region = new DefaultAwsRegionProviderChain().getRegion();
final EndpointConfiguration endpointConfig = new EndpointConfiguration(endpoint, region);
final AWSMediaStoreData mediastoredata = AWSMediaStoreDataClientBuilder.standard().withEndpointConfiguration(endpointConfig).build();
final ListItemsRequest request = new ListItemsRequest().withPath(path);
ListItemsResult result = mediastoredata.listItems(request);
List<Item> items = result.getItems();
for (Item i : items) {
System.out.printf("* (%s)\t%s\n", i.getType(), i.getName());
}
}
Aggregations