2020-04-10 21:54:53 +00:00
|
|
|
angular.module('portainer.integrations.storidge').factory('Storidge', [
|
|
|
|
'$resource',
|
|
|
|
'API_ENDPOINT_ENDPOINTS',
|
|
|
|
'EndpointProvider',
|
|
|
|
function StoridgeFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
|
|
|
'use strict';
|
|
|
|
return $resource(
|
|
|
|
API_ENDPOINT_ENDPOINTS + '/:endpointId/storidge/:resource/:id/:action',
|
|
|
|
{
|
|
|
|
endpointId: EndpointProvider.endpointID,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
rebootCluster: { method: 'POST', params: { resource: 'clusters', action: 'reboot' } },
|
|
|
|
shutdownCluster: { method: 'POST', params: { resource: 'clusters', action: 'shutdown' } },
|
|
|
|
queryEvents: { method: 'GET', params: { resource: 'clusters', action: 'events' }, timeout: 4500, ignoreLoadingBar: true, isArray: true },
|
|
|
|
getVersion: { method: 'GET', params: { resource: 'clusters', action: 'version' } },
|
|
|
|
getInfo: { method: 'GET', params: { resource: 'clusters', action: 'info' }, timeout: 4500, ignoreLoadingBar: true },
|
2019-05-24 21:53:10 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
queryNodes: { method: 'GET', params: { resource: 'nodes' } },
|
|
|
|
getNode: { method: 'GET', params: { resource: 'nodes', id: '@id' } },
|
|
|
|
addNode: { method: 'POST', params: { resource: 'nodes' } },
|
|
|
|
removeNode: { method: 'DELETE', params: { resource: 'nodes', id: '@id' } },
|
|
|
|
cordonNode: { method: 'POST', params: { resource: 'nodes', action: 'cordon', id: '@id' } },
|
|
|
|
uncordonNode: { method: 'POST', params: { resource: 'nodes', action: 'uncordon', id: '@id' } },
|
2019-05-24 21:53:10 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
queryProfiles: { method: 'GET', params: { resource: 'profiles' } },
|
|
|
|
getProfile: { method: 'GET', params: { resource: 'profiles' } },
|
|
|
|
createProfile: { method: 'POST', params: { resource: 'profiles' } },
|
|
|
|
updateProfile: { method: 'PUT', params: { resource: 'profiles', id: '@name' } },
|
|
|
|
deleteProfile: { method: 'DELETE', params: { resource: 'profiles' } },
|
2019-05-24 21:53:10 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
queryDrives: { method: 'GET', params: { resource: 'drives' } },
|
|
|
|
getDrive: { method: 'GET', params: { resource: 'drives', id: '@id' } },
|
|
|
|
addDrive: { method: 'POST', params: { resource: 'drives' } },
|
|
|
|
removeDrive: { method: 'DELETE', params: { resource: 'drives', id: '@id' } },
|
|
|
|
rescanDrives: { method: 'POST', params: { resource: 'drives', action: 'rescan' } },
|
2019-05-24 21:53:10 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
queryVolumes: { method: 'GET', params: { resource: 'volumes' } },
|
|
|
|
createVolume: { method: 'POST', params: { resource: 'volumes' } },
|
|
|
|
getVolume: { method: 'GET', params: { resource: 'volumes', id: '@id' } },
|
|
|
|
updateVolume: { method: 'POST', params: { resource: 'volumes', id: '@name' } },
|
|
|
|
removeVolume: { method: 'DELETE', params: { resource: 'volumes', id: '@id' } },
|
2019-05-24 21:53:10 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
querySnapshots: { method: 'GET', params: { resource: 'volumes', id: '@id', action: 'snapshots' } },
|
|
|
|
createSnapshot: { method: 'POST', params: { resource: 'volumes', id: '@id', action: 'snapshot' } },
|
|
|
|
getSnapshot: { method: 'GET', params: { resource: 'snapshots', id: '@id' } },
|
|
|
|
removeSnapshot: { method: 'DELETE', params: { resource: 'snapshots', id: '@id' } },
|
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
]);
|