Java 类com.amazonaws.services.glacier.AmazonGlacierClient 实例源码

项目:simple-glacier-client    文件:BaseAmazonGlacierClientAware.java   
protected BaseAmazonGlacierClientAware(String region, String account, String vault) {

    this.region  = region;
    this.account = account;
    this.vault   = vault;

    //@TODO Need to move away from deprecated fashion of acquiring a client
    //@TODO Also, consider supporting other ways of passing credentials (other than relying of local .aws profile)

    // load the credentials from the .aws profile
    this.credentialsProvider = new ProfileCredentialsProvider();

    this.awsClient = new AmazonGlacierClient(this.credentialsProvider);

    // Set Glacier end-point
    this.awsClient.setEndpoint("https://glacier." + this.region + ".amazonaws.com/");
}
项目:olfs    文件:Vault.java   
public String describeVault(String vaultName, AWSCredentials credentials){

        DescribeVaultResult dvo;

        AmazonGlacierClient client = new AmazonGlacierClient(credentials);
        client.setEndpoint(getEndpoint());

        DescribeVaultRequest dvr = new DescribeVaultRequest(vaultName);

        dvo = client.describeVault(dvr);

        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");
        return sb.toString();
    }
项目:omakase    文件:GlacierClientProducer.java   
@Produces
@Omakase
public GlacierClient getGlacierClient() {
    RuntimeCredentialsProvider provider = new RuntimeCredentialsProvider();
    AmazonGlacier amazonGlacier = new AmazonGlacierClient(provider);
    return new GlacierClient(httpClient, provider, amazonGlacier);
}
项目:omakase    文件:GlacierClientProducer.java   
@Produces
@Omakase
public GlacierClient getGlacierClient() {
    RuntimeCredentialsProvider provider = new RuntimeCredentialsProvider();
    AmazonGlacier amazonGlacier = new AmazonGlacierClient(provider);
    return new GlacierClient(httpClient, provider, amazonGlacier);
}
项目: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    文件:Vault.java   
public void deleteArchive(String archiveId){
    _log.warn("deleteArchive() - Removing {}", archiveId);
    AmazonGlacierClient client = new AmazonGlacierClient(getCredentials());
    DeleteArchiveRequest dar = new DeleteArchiveRequest(getVaultName(),archiveId);
    client.deleteArchive(dar);

}
项目:meta-glacier    文件:GlacierFrame.java   
/**
 * Returns the AWS client in the specified region.
 *
 * @param region string such as 'us-west-1', 'eu-west-1'
 * @return AWS client object
 */
public static AmazonGlacierClient getClient(final String region){
        final AmazonGlacierClient client = new AmazonGlacierClient(Main.frame);
    int current_api_call_count = P.getInt(NUMBER_OF_AWS_API_CALLS, 0);
    final String endpointURL = "https://glacier.%s.amazonaws.com";

    client.setEndpoint(String.format(endpointURL, region));
    if (current_api_call_count == 0) {
        P.putLong(LAST_AWS_API_CALL_RESET, System.currentTimeMillis());
    }
    P.putInt(NUMBER_OF_AWS_API_CALLS, 1 + current_api_call_count);
    return client;    
}
项目:omakase    文件:GlacierClient.java   
/**
 * Creates a new Glacier Client configured with it's own pooled Http Client.
 */
public GlacierClient() {
    this.httpClient = HttpClientFactory.pooledConnectionHttpClient(100, 30000, 600000);
    this.runtimeCredentialsProvider = new RuntimeCredentialsProvider();
    this.amazonGlacier = new AmazonGlacierClient(runtimeCredentialsProvider);
}
项目:olfs    文件:Vault.java   
public String put(String resourceId, File uploadFile) throws FileNotFoundException {
    AmazonGlacierClient client = new AmazonGlacierClient(getCredentials());
    client.setEndpoint(getEndpoint());

    ArchiveTransferManager atm = new ArchiveTransferManager(client, getCredentials());

    _log.info("Transferring cache file content to Glacier. vault: " + getVaultName() + "  description: " + resourceId);
    UploadResult uploadResult = atm.upload(getVaultName(), resourceId, uploadFile);

    String archiveId = uploadResult.getArchiveId();

    _log.info("Upload Successful. archiveId: {} resourceId: {}",archiveId,resourceId);

    return archiveId;

}
项目: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));

        }



    }
项目:olfs    文件:Vault.java   
public void deleteVault() throws IOException{

        purgeVault();
        AmazonGlacierClient client = new AmazonGlacierClient(getCredentials());
        client.setEndpoint(getEndpoint());

        DeleteVaultRequest request = new DeleteVaultRequest()
            .withVaultName(getVaultName());

        client.deleteVault(request);
        System.out.println("Deleted vault: " + getVaultName());



    }
项目:aws-sdk-java-resources    文件:GlacierImpl.java   
/**
 * Construct a service implementation that talks to the specified AWS
 * region. The low-level client will be created via the default no-arg
 * constructor, which means it will have all the default client
 * configurations and it will use the default provider chain to retrieve AWS
 * credentials. If you need more flexible control over the low-level client,
 * use {@link #GlacierImpl(AmazonGlacier)} instead.
 *
 * @param region The AWS region where the service API calls will be sent to.
 */
public GlacierImpl(Regions region) {
    this(new AmazonGlacierClient());
    this.client().setRegion(Region.getRegion(region));
}
项目:meta-glacier    文件:GlacierFrame.java   
/**
 * Returns AWS client in the current region.
 *
 * @return AWS client object
 */
public static AmazonGlacierClient getClient(){
    return getClient(getAWSRegion());
}