Exemplo n.º 1
0
 public BackupInfo getBackupInfo(String name, boolean isLocal) {
   UriBuilder builder = client.uriBuilder(BACKUP_INFO_URL);
   addQueryParam(builder, "backupname", name);
   if (isLocal) {
     addQueryParam(builder, "isLocal", isLocal);
   }
   return client.getURI(BackupInfo.class, builder.build());
 }
Exemplo n.º 2
0
 public void createBackup(String name, boolean force) {
   int specialTimeout = 30 * 60 * 1000; // 30 minutes
   client.getConfig().withReadTimeout(specialTimeout);
   client.getConfig().withConnectionTimeout(specialTimeout);
   UriBuilder builder = client.uriBuilder(BACKUP_CREATE_URL);
   addQueryParam(builder, "tag", name);
   if (force) {
     addQueryParam(builder, "force", true);
   }
   client.postURI(String.class, builder.build());
 }
Exemplo n.º 3
0
 public void restore(String name, String password, boolean isLocal, boolean isGeoFromScratch) {
   UriBuilder builder = client.uriBuilder(RESTORE_URL);
   addQueryParam(builder, "backupname", name);
   addQueryParam(builder, "password", password);
   if (isGeoFromScratch) {
     addQueryParam(builder, "isgeofromscratch", true);
   }
   if (isLocal) {
     addQueryParam(builder, "isLocal", true);
   }
   client.postURI(String.class, builder.build());
 }
Exemplo n.º 4
0
  public BackupUploadStatus uploadBackupStatus(String name) {
    BackupUploadStatus status = null;
    UriBuilder builder = client.uriBuilder(BACKUP_UPLOAD_URL);
    addQueryParam(builder, "tag", name);

    try {
      status = client.getURI(BackupUploadStatus.class, builder.build());
    } catch (Exception e) {
      status = new BackupUploadStatus();
    }

    return status;
  }
Exemplo n.º 5
0
  public BackupRestoreStatus getRestoreStatus(String name, boolean isLocal) {
    BackupRestoreStatus status = null;
    UriBuilder builder = client.uriBuilder(RESTORE_STATUS_URL);
    addQueryParam(builder, "backupname", name);
    addQueryParam(builder, "isLocal", isLocal);

    try {
      status = client.getURI(BackupRestoreStatus.class, builder.build());
    } catch (Exception e) {
      status = new BackupRestoreStatus();
      status.setStatus(BackupRestoreStatus.Status.DOWNLOAD_FAILED);
      status.setDetails(e.getMessage());
    }

    return status;
  }
 public List<String> getAssetDependencies(String assetType, AssetDependencyRequest request) {
   AssetDependencyResponse response =
       client.post(
           AssetDependencyResponse.class,
           request,
           PathConstants.ASSET_OPTIONS2_DEP_URL,
           cleanAssetType(assetType));
   return response.getAssetDependencies();
 }
 public List<AssetOption> getAssetOptions(String assetType, AssetOptionsRequest request) {
   AssetOptionsResponse response =
       client.post(
           AssetOptionsResponse.class,
           request,
           PathConstants.ASSET_OPTIONS2_OPTIONS_URL,
           cleanAssetType(assetType));
   return response.getOptions();
 }
 /**
  * Performs discovery operation on a vCenter.
  *
  * <p>API Call: POST /api/vcenters/{id}/discover
  *
  * @param id Identifier of the host to discover.
  */
 public void discover(String id) {
   client.postURI(String.class, client.uriBuilder(VCENTER_DISCOVER_URL).build(id));
 }
Exemplo n.º 9
0
 public void pullBackup(String name) {
   UriBuilder builder = client.uriBuilder(BACKUP_PULL_URL);
   addQueryParam(builder, "file", name);
   client.postURI(String.class, builder.build());
 }
Exemplo n.º 10
0
 public void uploadBackup(String name) {
   UriBuilder builder = client.uriBuilder(BACKUP_UPLOAD_URL);
   addQueryParam(builder, "tag", name);
   client.postURI(String.class, builder.build());
 }
Exemplo n.º 11
0
 public void deleteBackup(String name) {
   UriBuilder builder = client.uriBuilder(BACKUP_CREATE_URL);
   addQueryParam(builder, "tag", name);
   client.deleteURI(String.class, builder.build());
 }
Exemplo n.º 12
0
 public ExternalBackups getExternalBackups() {
   return client.get(ExternalBackups.class, BACKUP_EXTERNAL_URL);
 }
Exemplo n.º 13
0
 public BackupSet getBackup(String name) {
   UriBuilder builder = client.uriBuilder(BACKUP_URL + "backup");
   addQueryParam(builder, "tag", name);
   return client.getURI(BackupSet.class, builder.build());
 }
Exemplo n.º 14
0
 public BackupSets getBackups() {
   return client.get(BackupSets.class, BACKUP_URL, "");
 }
Exemplo n.º 15
0
 public void cancelPullBackup() {
   UriBuilder builder = client.uriBuilder(BACKUP_PULL_CANCEL_URL);
   client.postURI(String.class, builder.build());
 }