Search in sources :

Example 1 with DescribeVaultOutput

use of com.amazonaws.services.glacier.model.DescribeVaultOutput in project glacier-cli by carlossg.

the class Glacier method list.

public void list() {
    String msg = "Listing ...";
    System.out.println(msg);
    try {
        ListVaultsResult vaults = client.listVaults(new ListVaultsRequest());
        for (DescribeVaultOutput vault : vaults.getVaultList()) {
            System.out.println("----");
            System.out.println("Vault : " + vault.getVaultName() + "\n\tCreation date : " + vault.getCreationDate() + "\n\tNumber of archives : " + vault.getNumberOfArchives() + "\n\tVault size : " + vault.getSizeInBytes() + "\n\tLast inventory date : " + vault.getLastInventoryDate());
        }
    } catch (Exception e) {
        throw new RuntimeException("Error " + msg, e);
    }
}
Also used : DescribeVaultOutput(com.amazonaws.services.glacier.model.DescribeVaultOutput) ListVaultsResult(com.amazonaws.services.glacier.model.ListVaultsResult) ListVaultsRequest(com.amazonaws.services.glacier.model.ListVaultsRequest) UnrecognizedOptionException(org.apache.commons.cli.UnrecognizedOptionException) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException)

Example 2 with DescribeVaultOutput

use of com.amazonaws.services.glacier.model.DescribeVaultOutput 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)

Example 3 with DescribeVaultOutput

use of com.amazonaws.services.glacier.model.DescribeVaultOutput in project SAGU by brianmcmichael.

the class SAGU method repopulateVaults.

private void repopulateVaults(String accessString, String secretString) {
    int newLoc = getServerRegion();
    if (!(getAccessKey().equals("") || getSecretKey().equals(""))) {
        AmazonGlacierClient newVaultCheckClient = makeClient(accessString, secretString, newLoc);
        String marker = null;
        vaultSelector.removeAllItems();
        vaultSelector.addItem("Select Existing:");
        do {
            ListVaultsRequest lv = new ListVaultsRequest().withMarker(marker).withLimit("1000");
            ListVaultsResult lvr = newVaultCheckClient.listVaults(lv);
            ArrayList<DescribeVaultOutput> vList = new ArrayList<DescribeVaultOutput>(lvr.getVaultList());
            marker = lvr.getMarker();
            for (DescribeVaultOutput vault : vList) {
                vaultSelector.addItem(vault.getVaultName());
            }
        } while (marker != null);
    }
}
Also used : DescribeVaultOutput(com.amazonaws.services.glacier.model.DescribeVaultOutput) ListVaultsResult(com.amazonaws.services.glacier.model.ListVaultsResult) AmazonGlacierClient(com.amazonaws.services.glacier.AmazonGlacierClient) ListVaultsRequest(com.amazonaws.services.glacier.model.ListVaultsRequest) ArrayList(java.util.ArrayList)

Aggregations

DescribeVaultOutput (com.amazonaws.services.glacier.model.DescribeVaultOutput)3 ListVaultsRequest (com.amazonaws.services.glacier.model.ListVaultsRequest)3 ListVaultsResult (com.amazonaws.services.glacier.model.ListVaultsResult)3 AmazonGlacier (com.amazonaws.services.glacier.AmazonGlacier)1 AmazonGlacierClient (com.amazonaws.services.glacier.AmazonGlacierClient)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 UnrecognizedOptionException (org.apache.commons.cli.UnrecognizedOptionException)1 JsonParseException (org.codehaus.jackson.JsonParseException)1