/** Utility method for refreshing OSG URI in the S3Client object used by this class. */
 private void refreshOsgURI() {
   try {
     ServiceConfiguration osgConfig = getOsgConfig();
     String osgURI = ServiceUris.remote(osgConfig).toASCIIString();
     s3Client.setS3Endpoint(osgURI);
     LOG.info("Setting objectstorage URI to: " + osgURI);
   } catch (Exception e) {
     LOG.warn("Could not refresh objectstorage URI");
   }
 }
 public SnapshotObjectOps(CredentialsType credentials) {
   s3Client =
       new S3Client(
           new BasicSessionCredentials(
               credentials.getAccessKeyId(),
               credentials.getSecretAccessKey(),
               credentials.getSessionToken()),
           false);
   s3Client.setUsePathStyle(true);
   s3Client.setS3Endpoint(StorageProperties.WALRUS_URL);
 }
Exemplo n.º 3
0
 public SnapshotObjectOps() {
   try {
     Account system = Accounts.lookupAccountByName(Account.SYSTEM_ACCOUNT);
     for (User user : system.getUsers()) {
       if (StorageProperties.BLOCKSTORAGE_ACCOUNT.equals(user.getName())) {
         List<AccessKey> keys = user.getKeys();
         if (!keys.isEmpty()) {
           AccessKey key = keys.get(0);
           s3Client =
               new S3Client(
                   new BasicAWSCredentials(key.getAccessKey(), key.getSecretKey()), false);
           s3Client.setUsePathStyle(true);
           s3Client.setS3Endpoint(StorageProperties.WALRUS_URL);
         } else {
           LOG.error(
               "Something went really wrong. Block storage account does not have an associated access key.");
         }
       }
     }
   } catch (Exception ex) {
     LOG.error(ex, ex);
   }
 }
 // TODO EUCA-8700 - Temporary workaround for snapshot uploads to work. THIS CANNOT BE RELEASED
 public SnapshotObjectOps(String accessKey, String secretKey) {
   s3Client = new S3Client(new BasicAWSCredentials(accessKey, secretKey), false);
   s3Client.setUsePathStyle(true);
   s3Client.setS3Endpoint(StorageProperties.WALRUS_URL);
 }