ApiSvc.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. /**
  3. *  * Licensed Materials - Property of IBM  * IBM Cognos Products: Cognos
  4. * Analytics  * Copyright IBM Corp. 2015, 2016  * US Government Users Restricted
  5. * Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
  6. * Contract with IBM Corp.  
  7. */
  8. define(['jquery', 'underscore', "q", 'bi/admin/common/services/ApiBase'], function ($, _, Q, ApiBase) {
  9. 'use strict'; //NOSONAR: meant to be strict
  10. var _singletonInstance = null;
  11. var ApiService = ApiBase.extend({
  12. getBackupList: function getBackupList() {
  13. return this._ajax('backups', this._getRestOptions());
  14. },
  15. generateExportImportDefinition: function generateExportImportDefinition(type, data) {
  16. return this._ajax(type, this._getRestOptions('POST', data));
  17. },
  18. executeExportImportDefinition: function executeExportImportDefinition(type, id) {
  19. return this._ajax(type + '/' + id + '/run', this._getRestOptions('PUT'));
  20. },
  21. queryStatus: function queryStatus(type, id) {
  22. return this._ajax(type + '/' + id + '/status', this._getRestOptions());
  23. },
  24. getUploadedStatistics: function getUploadedStatistics() {
  25. return this._ajax('disk_usage', this._getRestOptions());
  26. },
  27. getProductionSetting: function getProductionSetting() {
  28. return this._ajax('license', this._getRestOptions());
  29. },
  30. updateProductionSetting: function updateProductionSetting(data) {
  31. return this._ajax('license', this._getRestOptions('PUT', data));
  32. }
  33. });
  34. var _static = {
  35. getInstance: function getInstance() {
  36. if (!_singletonInstance) {
  37. _singletonInstance = new ApiService();
  38. }
  39. return _singletonInstance;
  40. }
  41. };
  42. return _static.getInstance();
  43. });