Java 类com.amazonaws.services.glacier.model.DescribeVaultOutput 实例源码

项目:meta-glacier    文件:AllVaults.java   
/**
 * Returns a list of <b>DescribeVaultOutput</b> for the AWS account.
 * This always make a call to AWS.
 *
 * @return list of <code>DescribeVaultOutput>
 * @throws Exception
 */
public List<DescribeVaultOutput> list() throws Exception{
    String marker = null;
    ListVaultsResult listVaultsResult = null;

    do {
        LGR.fine("getting vaults up to 100");
        ListVaultsRequest listVaultsRequest
                = new ListVaultsRequest()
                    .withLimit("100").withMarker(marker);       
        listVaultsResult
                = GlacierFrame.getClient().listVaults(listVaultsRequest);
        LGR.fine("got list");
        List<DescribeVaultOutput> vaultList
                = listVaultsResult.getVaultList();
        marker = listVaultsResult.getMarker();
        if (allVaults == null) {
            allVaults = vaultList;
            continue;
        }
        allVaults.addAll(vaultList);
    } while (marker !=null);
    return allVaults;
}
项目:aws-doc-sdk-examples    文件:ListVaults.java   
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.");
    }
}
项目:aws-utilization-monitor    文件:AwsScan.java   
/**
 * Collect data for Glacier.
 *
 * @param stats
 *            current statistics object.
 * @param account
 *            currently used credentials object.
 * @param region
 *            currently used aws region.
 */
public static void scanGlacier(AwsStats stats, AwsAccount account, Regions region) {
    LOG.debug("Scan for Glacier in region " + region.getName() + " in account " + account.getAccountId());

    try {
        AmazonGlacier glacier = new AmazonGlacierClient(account.getCredentials());
        glacier.setRegion(Region.getRegion(region));

        // DescribeVaultRequest dvr = new DescribeVaultRequest();
        ListVaultsRequest lvr = new ListVaultsRequest();
        int totalItems = 0;
        for (DescribeVaultOutput dvo : glacier.listVaults(lvr).getVaultList()) {
            AwsResource res = new AwsResource(dvo.getVaultName(), account.getAccountId(), AwsResourceType.Glacier, region);
            res.addInfo("NumberOfArchives", dvo.getNumberOfArchives());
            res.addInfo("VaultARN", dvo.getVaultARN());
            res.addInfo(AwsTag.SizeInBytes, dvo.getSizeInBytes());
            stats.add(res);
            totalItems++;
        }

        LOG.info(totalItems + " Glacier in region " + region.getName() + " in account " + account.getAccountId());
    } catch (AmazonServiceException ase) {
        if (ase.getErrorCode().contains("AccessDenied")) {
            LOG.info("Access denied for Glacier in region " + region.getName() + " in account " + account.getAccountId());
        } else {
            LOG.error("Exception of Glacier: " + ase.getMessage());
        }
    }
}
项目:olfs    文件:NoaaResourceIngester.java   
public String describeVault(DescribeVaultOutput dvo){
    StringBuilder sb = new StringBuilder();
    sb.append("================================================================================\n");
    sb.append("Found Vault: ").append(dvo.getVaultName()).append("\n");
    sb.append("    getCreationDateString(): ").append(dvo.getCreationDate()).append("\n");
    sb.append("    getLastInventoryDate(): ").append(dvo.getLastInventoryDate()).append("\n");
    sb.append("    getNumberOfArchives(): ").append(dvo.getNumberOfArchives()).append("\n");
    sb.append("    getSizeInBytes(): ").append(dvo.getSizeInBytes()).append("\n");
    sb.append("    getVaultARN(): ").append(dvo.getVaultARN()).append("\n");
    sb.append("    toString(): ").append(dvo.toString()).append("\n");
    sb.append("    toString(): ").append(dvo.getVaultName()).append("\n");
    return sb.toString();
}
项目:meta-glacier    文件:AllVaults.java   
/**
 * Returns a set of vault names.
 * This method makes use of data cached by <b>list()</b> and call that
 * method first internally.
 * 
 * @return a list of vault names
 * @throws Exception 
 */
public Set<String> listNames() throws Exception{
    list();
    String [] vaultNameArray = new String[allVaults.size()];
    short i = 0;

    for (final DescribeVaultOutput dvo: allVaults) {
        vaultNameArray[i++] = dvo.getVaultName();
    }
    return new HashSet<>(Arrays.asList(vaultNameArray));
}
项目:meta-glacier    文件:VaultListPanel.java   
VaultListPanel withList(final List<DescribeVaultOutput> _list){
    list = _list;
    return this;
}
项目:olfs    文件:NoaaResourceIngester.java   
public void inspectVaults(AWSCredentials creds, String endPointUrl){


        AmazonGlacierClient client = new AmazonGlacierClient(creds);
        client.setEndpoint(endPointUrl);

        ListVaultsResult listVaultsResult =  client.listVaults(new ListVaultsRequest());
        for(DescribeVaultOutput dvo : listVaultsResult.getVaultList() ){
            System.out.println(describeVault(dvo));

        }



    }