debian-mirror-gitlab/app/assets/javascripts/clusters/services/clusters_service.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
import axios from '../../lib/utils/axios_utils';
export default class ClusterService {
constructor(options = {}) {
this.options = options;
this.appInstallEndpointMap = {
helm: this.options.installHelmEndpoint,
ingress: this.options.installIngressEndpoint,
2019-02-15 15:39:39 +05:30
cert_manager: this.options.installCertManagerEndpoint,
2018-03-17 18:26:18 +05:30
runner: this.options.installRunnerEndpoint,
prometheus: this.options.installPrometheusEndpoint,
2018-11-08 19:23:39 +05:30
jupyter: this.options.installJupyterEndpoint,
2018-12-13 13:39:08 +05:30
knative: this.options.installKnativeEndpoint,
2018-03-17 18:26:18 +05:30
};
2019-07-07 11:18:12 +05:30
this.appUpdateEndpointMap = {
knative: this.options.updateKnativeEndpoint,
};
2018-03-17 18:26:18 +05:30
}
2019-12-04 20:38:33 +05:30
fetchClusterStatus() {
2018-03-17 18:26:18 +05:30
return axios.get(this.options.endpoint);
}
2018-11-08 19:23:39 +05:30
installApplication(appId, params) {
return axios.post(this.appInstallEndpointMap[appId], params);
2018-03-17 18:26:18 +05:30
}
2019-07-07 11:18:12 +05:30
updateApplication(appId, params) {
return axios.patch(this.appUpdateEndpointMap[appId], params);
}
2019-07-31 22:56:46 +05:30
uninstallApplication(appId, params) {
return axios.delete(this.appInstallEndpointMap[appId], params);
}
2019-12-04 20:38:33 +05:30
fetchClusterEnvironments() {
return axios.get(this.options.clusterEnvironmentsEndpoint);
}
2018-03-17 18:26:18 +05:30
static updateCluster(endpoint, data) {
return axios.put(endpoint, data);
}
}