amazon glacier Archive Remover - Java AWS

Java examples for AWS:Glacier

Description

amazon glacier Archive Remover

Demo Code


import java.io.IOException;

import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.services.glacier.AmazonGlacierClient;
import com.amazonaws.services.glacier.model.DeleteArchiveRequest;


public class ArchiveRemover {

    public static String vaultName = "GLACIER_TEST";
    public static String archiveId = "Archive ID";

    public static void main(String[] args) throws IOException {
        ClientConfiguration clientConfiguration = new ClientConfiguration();
        clientConfiguration.setProxyHost("xx.xx.xx.xx");
        clientConfiguration.setProxyPort(0);

        AWSCredentials credentials = new PropertiesCredentials(
                VaultCreator.class
                        .getResourceAsStream("AwsCredentials.properties"));
        AmazonGlacierClient client = new AmazonGlacierClient(credentials,
                clientConfiguration);//from  w  w  w . ja va  2  s  .  c om
        client.setEndpoint("https://glacier.ap-northeast-1.amazonaws.com/");
        try {
            client.deleteArchive(new DeleteArchiveRequest().withVaultName(
                    vaultName).withArchiveId(archiveId));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Related Tutorials