Package org.jclouds.glacier

Examples of org.jclouds.glacier.GlacierClient


      }
   }

   private static void providerExample(BlobStoreContext context) throws IOException {
      // Get the provider API
      GlacierClient client = context.unwrapApi(GlacierClient.class);

      // Create a vault
      final String vaultName =  "jclouds_providerExample_" + UUID.randomUUID().toString();
      client.createVault(vaultName);

      // Upload an archive
      Payload payload = new ByteSourcePayload(buildData(16));
      payload.getContentMetadata().setContentType(PLAIN_TEXT_UTF_8.toString());
      payload.getContentMetadata().setContentLength(16L);
      String archiveId = client.uploadArchive(vaultName, payload);

      // Create an archive retrieval job request
      JobRequest archiveRetrievalJobRequest = ArchiveRetrievalJobRequest.builder()
            .archiveId(archiveId)
            .description("retrieval job")
            .build();

      // Initiate job
      String jobId = client.initiateJob(vaultName, archiveRetrievalJobRequest);
      try {
         // Poll until the job is done
         new BasePollingStrategy(client).waitForSuccess(vaultName, jobId);

         // Get the job output
         Payload result = client.getJobOutput(vaultName, jobId);

         // Print the result
         System.out.println("The retrieved payload is: " + Strings2.toStringAndClose(result.openStream()));
      } catch (InterruptedException e) {
         Throwables.propagate(e);
View Full Code Here

TOP

Related Classes of org.jclouds.glacier.GlacierClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.