Search in sources :

Example 1 with AmazonGlacier

use of com.amazonaws.services.glacier.AmazonGlacier in project aws-doc-sdk-examples by awsdocs.

the class ListVaults method main.

public static void main(String[] args) {
    final AmazonGlacier glacier = AmazonGlacierClientBuilder.defaultClient();
    ListVaultsRequest request = new ListVaultsRequest();
    boolean list_complete = false;
    int total_vaults = 0;
    System.out.println("Your Amazon Glacier vaults:");
    while (!list_complete) {
        ListVaultsResult result = glacier.listVaults(request);
        List<DescribeVaultOutput> vault_list = result.getVaultList();
        for (DescribeVaultOutput v : vault_list) {
            total_vaults += 1;
            System.out.println("* " + v.getVaultName());
        }
        // check for further results.
        String marker = result.getMarker();
        if (marker != null) {
            request.setMarker(marker);
        } else {
            list_complete = true;
        }
    }
    if (total_vaults == 0) {
        System.out.println("  no vaults found.");
    }
}
Also used : DescribeVaultOutput(com.amazonaws.services.glacier.model.DescribeVaultOutput) AmazonGlacier(com.amazonaws.services.glacier.AmazonGlacier) ListVaultsResult(com.amazonaws.services.glacier.model.ListVaultsResult) ListVaultsRequest(com.amazonaws.services.glacier.model.ListVaultsRequest)

Aggregations

AmazonGlacier (com.amazonaws.services.glacier.AmazonGlacier)1 DescribeVaultOutput (com.amazonaws.services.glacier.model.DescribeVaultOutput)1 ListVaultsRequest (com.amazonaws.services.glacier.model.ListVaultsRequest)1 ListVaultsResult (com.amazonaws.services.glacier.model.ListVaultsResult)1