2017-01-31 23:26:29 +00:00
|
|
|
angular.module('portainer.rest')
|
2017-03-12 16:24:15 +00:00
|
|
|
.factory('Container', ['$resource', 'Settings', 'EndpointProvider', function ContainerFactory($resource, Settings, EndpointProvider) {
|
2017-01-31 23:26:29 +00:00
|
|
|
'use strict';
|
2017-03-12 16:24:15 +00:00
|
|
|
return $resource(Settings.url + '/:endpointId/containers/:id/:action', {
|
|
|
|
name: '@name',
|
|
|
|
endpointId: EndpointProvider.endpointID
|
|
|
|
},
|
|
|
|
{
|
2017-01-31 23:26:29 +00:00
|
|
|
query: {method: 'GET', params: {all: 0, action: 'json', filters: '@filters' }, isArray: true},
|
|
|
|
get: {method: 'GET', params: {action: 'json'}},
|
|
|
|
stop: {method: 'POST', params: {id: '@id', t: 5, action: 'stop'}},
|
|
|
|
restart: {method: 'POST', params: {id: '@id', t: 5, action: 'restart'}},
|
|
|
|
kill: {method: 'POST', params: {id: '@id', action: 'kill'}},
|
|
|
|
pause: {method: 'POST', params: {id: '@id', action: 'pause'}},
|
|
|
|
unpause: {method: 'POST', params: {id: '@id', action: 'unpause'}},
|
|
|
|
stats: {method: 'GET', params: {id: '@id', stream: false, action: 'stats'}, timeout: 5000},
|
|
|
|
start: {
|
|
|
|
method: 'POST', params: {id: '@id', action: 'start'},
|
|
|
|
transformResponse: genericHandler
|
|
|
|
},
|
|
|
|
create: {
|
|
|
|
method: 'POST', params: {action: 'create'},
|
|
|
|
transformResponse: genericHandler
|
|
|
|
},
|
|
|
|
remove: {
|
2017-05-01 10:18:06 +00:00
|
|
|
method: 'DELETE', params: {id: '@id', v: '@v', force: '@force'},
|
2017-01-31 23:26:29 +00:00
|
|
|
transformResponse: genericHandler
|
|
|
|
},
|
|
|
|
rename: {
|
|
|
|
method: 'POST', params: {id: '@id', action: 'rename', name: '@name'},
|
|
|
|
transformResponse: genericHandler
|
|
|
|
},
|
|
|
|
exec: {
|
|
|
|
method: 'POST', params: {id: '@id', action: 'exec'},
|
|
|
|
transformResponse: genericHandler
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}]);
|