Welcome to mirror list, hosted at ThFree Co, Russian Federation.

clusters_service.js « services « clusters « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fa12802b3de182cdc8f486065d5c883af4bd6b3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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,
      cert_manager: this.options.installCertManagerEndpoint,
      runner: this.options.installRunnerEndpoint,
      prometheus: this.options.installPrometheusEndpoint,
      jupyter: this.options.installJupyterEndpoint,
      knative: this.options.installKnativeEndpoint,
    };
    this.appUpdateEndpointMap = {
      knative: this.options.updateKnativeEndpoint,
    };
  }

  fetchClusterStatus() {
    return axios.get(this.options.endpoint);
  }

  installApplication(appId, params) {
    return axios.post(this.appInstallEndpointMap[appId], params);
  }

  updateApplication(appId, params) {
    return axios.patch(this.appUpdateEndpointMap[appId], params);
  }

  uninstallApplication(appId, params) {
    return axios.delete(this.appInstallEndpointMap[appId], params);
  }

  fetchClusterEnvironments() {
    return axios.get(this.options.clusterEnvironmentsEndpoint);
  }

  static updateCluster(endpoint, data) {
    return axios.put(endpoint, data);
  }
}