-
-
Notifications
You must be signed in to change notification settings - Fork 301
/
Copy pathHelm.ts
47 lines (44 loc) · 1.43 KB
/
Helm.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
import { BaseResource } from '@gitbeaker/requester-utils';
import { RequestHelper, endpoint } from '../infrastructure';
import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure';
export class Helm<C extends boolean = false> extends BaseResource<C> {
downloadChartIndex<E extends boolean = false>(
projectId: string | number,
channel: string,
options?: Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<Blob, void, E, void>> {
return RequestHelper.get<Blob>()(
this,
endpoint`projects/${projectId}/packages/helm/${channel}/index.yaml`,
options,
);
}
downloadChart<E extends boolean = false>(
projectId: string | number,
channel: string,
filename: string,
options?: Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<Blob, void, E, void>> {
return RequestHelper.get<Blob>()(
this,
endpoint`projects/${projectId}/packages/helm/${channel}/charts/${filename}.tgz`,
options,
);
}
import<E extends boolean = false>(
projectId: string | number,
channel: string,
chart: { content: Blob; filename: string },
options?: Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<void, C, E, void>> {
return RequestHelper.post<void>()(
this,
endpoint`projects/${projectId}/packages/helm/api/${channel}/charts`,
{
isForm: true,
...options,
chart: [chart.content, chart.filename],
},
);
}
}