Search in sources :

Example 1 with DeleteArchiveRequest

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

the class Glacier method delete.

public void delete(String vaultName, String archiveId) {
    String msg = "Deleting " + archiveId + " from Glacier vault " + vaultName;
    System.out.println(msg);
    try {
        client.deleteArchive(new DeleteArchiveRequest().withVaultName(vaultName).withArchiveId(archiveId));
        System.out.println("Deleted archive: " + archiveId);
    } catch (Exception e) {
        throw new RuntimeException("Error " + msg, e);
    }
}
Also used : DeleteArchiveRequest(com.amazonaws.services.glacier.model.DeleteArchiveRequest) UnrecognizedOptionException(org.apache.commons.cli.UnrecognizedOptionException) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException)

Example 2 with DeleteArchiveRequest

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

the class DeleteArchiveFrame method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getSource() == jbtDelete) {
        if ((jtfDeleteField.getText().trim().equals(""))) {
            JOptionPane.showMessageDialog(null, "Enter the Archive ID of the file to be deleted.", "Error", JOptionPane.ERROR_MESSAGE);
        } else {
            try {
                String archiveId = jtfDeleteField.getText().trim();
                // Banish the extra chars printed in early logs.
                String sendThis = archiveId.replaceAll("[^\\p{Print}]", "");
                String vaultName = deleteVault;
                // Delete the archive.
                deleteClient.deleteArchive(new DeleteArchiveRequest().withVaultName(vaultName).withArchiveId(sendThis));
                JOptionPane.showMessageDialog(null, "Deleted archive successfully.", "Success", JOptionPane.INFORMATION_MESSAGE);
            } catch (AmazonServiceException k) {
                JOptionPane.showMessageDialog(null, "The server returned an error. Wait 24 hours after submitting an archive to attempt a delete. Also check that correct location of archive has been set on the previous page.", "Error", JOptionPane.ERROR_MESSAGE);
                System.out.println("" + k);
            } catch (AmazonClientException i) {
                JOptionPane.showMessageDialog(null, "Client Error. Check that all fields are correct. Archive not deleted.", "Error", JOptionPane.ERROR_MESSAGE);
            } catch (Exception j) {
                JOptionPane.showMessageDialog(null, "Archive not deleted. Unspecified Error.", "Error", JOptionPane.ERROR_MESSAGE);
            }
            jtfDeleteField.setText("");
            jtfDeleteField.requestFocus();
        }
    } else if (e.getSource() == jbtBack) {
        this.setVisible(false);
        dispose();
    } else {
        JOptionPane.showMessageDialog(this, "Please choose a valid action.");
    }
}
Also used : DeleteArchiveRequest(com.amazonaws.services.glacier.model.DeleteArchiveRequest) AmazonClientException(com.amazonaws.AmazonClientException) AmazonServiceException(com.amazonaws.AmazonServiceException) AmazonServiceException(com.amazonaws.AmazonServiceException) AmazonClientException(com.amazonaws.AmazonClientException)

Aggregations

DeleteArchiveRequest (com.amazonaws.services.glacier.model.DeleteArchiveRequest)2 AmazonClientException (com.amazonaws.AmazonClientException)1 AmazonServiceException (com.amazonaws.AmazonServiceException)1 IOException (java.io.IOException)1 UnrecognizedOptionException (org.apache.commons.cli.UnrecognizedOptionException)1 JsonParseException (org.codehaus.jackson.JsonParseException)1