/
url.ts
57 lines (51 loc) · 2.06 KB
/
url.ts
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { APIBase } from "./Kube";
import { definedNamespaces } from "./Namespace";
import { IServiceBroker } from "./ServiceCatalog";
import { IChartVersion } from "./types";
export const app = {
charts: {
version: (cv: IChartVersion) =>
`/charts/${cv.relationships.chart.data.repo.name}/${cv.relationships.chart.data.name}/versions/${cv.attributes.version}`,
},
};
export const backend = {
apprepositories: {
base: "api/v1/apprepositories",
create: () => `${backend.apprepositories.base}`,
},
namespaces: {
base: "api/v1/namespaces",
list: () => `${backend.namespaces.base}`,
},
};
export const api = {
apprepostories: {
base: `${APIBase}/apis/kubeapps.com/v1alpha1`,
create: (namespace = definedNamespaces.default) =>
`${api.apprepostories.base}/namespaces/${namespace}/apprepositories`,
},
charts: {
base: "api/assetsvc/v1",
get: (id: string) => `${api.charts.base}/charts/${id}`,
getReadme: (id: string, version: string) =>
`${api.charts.base}/assets/${id}/versions/${encodeURIComponent(version)}/README.md`,
getValues: (id: string, version: string) =>
`${api.charts.base}/assets/${id}/versions/${encodeURIComponent(version)}/values.yaml`,
getSchema: (id: string, version: string) =>
`${api.charts.base}/assets/${id}/versions/${encodeURIComponent(version)}/values.schema.json`,
getVersion: (id: string, version: string) =>
`${api.charts.base}/charts/${id}/versions/${encodeURIComponent(version)}`,
list: (repo?: string) => `${api.charts.base}/charts${repo ? `/${repo}` : ""}`,
listVersions: (id: string) => `${api.charts.get(id)}/versions`,
},
serviceinstances: {
base: `${APIBase}/apis/servicecatalog.k8s.io/v1beta1`,
create: (namespace = definedNamespaces.default) =>
`${api.serviceinstances.base}/namespaces/${namespace}/serviceinstances`,
},
clusterservicebrokers: {
base: `${APIBase}/apis/servicecatalog.k8s.io/v1beta1`,
sync: (broker: IServiceBroker) =>
`${api.clusterservicebrokers.base}/clusterservicebrokers/${broker.metadata.name}`,
},
};