Files
backroad/app/portainer/rest/stack.js
2023-06-22 11:08:24 -03:00

26 lines
1.4 KiB
JavaScript

import angular from 'angular';
angular.module('portainer.app').factory('Stack', StackFactory);
/* @ngInject */
function StackFactory($resource, API_ENDPOINT_STACKS) {
return $resource(
API_ENDPOINT_STACKS + '/:id/:action/:subaction',
{},
{
get: { method: 'GET', params: { id: '@id' } },
query: { method: 'GET', isArray: true },
create: { method: 'POST', ignoreLoadingBar: true, params: { id: 'create', subaction: '@method', action: '@type' } },
update: { method: 'PUT', params: { id: '@id' }, ignoreLoadingBar: true },
associate: { method: 'PUT', params: { id: '@id', swarmId: '@swarmId', endpointId: '@endpointId', orphanedRunning: '@orphanedRunning', action: 'associate' } },
remove: { method: 'DELETE', params: { id: '@id', external: '@external', endpointId: '@endpointId' } },
getStackFile: { method: 'GET', params: { id: '@id', action: 'file' } },
migrate: { method: 'POST', params: { id: '@id', action: 'migrate', endpointId: '@endpointId' }, ignoreLoadingBar: true },
start: { method: 'POST', params: { id: '@id', action: 'start', endpointId: '@endpointId' } },
stop: { method: 'POST', params: { id: '@id', action: 'stop', endpointId: '@endpointId' } },
updateGit: { method: 'PUT', params: { id: '@id', action: 'git', subaction: 'redeploy' } },
updateGitStackSettings: { method: 'POST', params: { id: '@id', action: 'git' }, ignoreLoadingBar: true },
}
);
}