Skip to content

Commit 8039d4c

Browse files
committed
Add API surface for Argo CD's CRDs
1 parent 9eaf23f commit 8039d4c

File tree

4 files changed

+2056
-0
lines changed

4 files changed

+2056
-0
lines changed

generation/generate-all.sh

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
./generation/sources/builtin.sh v1.22.4
44

5+
./generation/sources/argo-cd.sh v2.1.7
56
./generation/sources/cert-manager.sh v1.6.1
67
./generation/sources/external-dns.sh v0.10.1

generation/sources/argo-cd.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh -eux
2+
3+
gitapi="https://api.github.com"
4+
upstream="argoproj/argo-cd"
5+
crdpath="manifests/crds"
6+
projectname="argo-cd"
7+
specdir="generation/api-specs/$projectname-$1"
8+
9+
if [ ! -d "$specdir" ]
10+
then {
11+
echo 'mkdir '"$specdir"
12+
echo 'cd '"$specdir"
13+
wget -O - "$gitapi/repos/$upstream/contents/$crdpath?ref=$1" \
14+
| jq -r '.[] | select(.name | endswith("-crd.yaml")) | "wget \(.download_url)"'
15+
} | sh -eux
16+
fi
17+
18+
mkdir -p "lib/$projectname"
19+
rm -r "lib/$projectname"/* \
20+
|| true
21+
22+
deno run \
23+
--allow-read="generation/api-specs" \
24+
--allow-write="lib/$projectname" \
25+
generation/run-on-crds.ts \
26+
"$specdir" \
27+
"$projectname"
28+
29+
deno cache "lib/$projectname"/*/mod.ts
30+
git status "lib/$projectname"
+264
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
export * from "./structs.ts";
2+
3+
// Autogenerated API file for ArgoprojIoV1alpha1
4+
import * as c from "../../common.ts";
5+
import * as operations from "../../operations.ts";
6+
import * as MetaV1 from "../../builtin/meta@v1/structs.ts";
7+
import * as ArgoprojIoV1alpha1 from "./structs.ts";
8+
9+
export class ArgoprojIoV1alpha1Api {
10+
#client: c.RestClient;
11+
#root = "/apis/argoproj.io/v1alpha1/";
12+
constructor(client: c.RestClient) {
13+
this.#client = client;
14+
}
15+
16+
namespace(name: string) {
17+
return new ArgoprojIoV1alpha1NamespacedApi(this.#client, name);
18+
}
19+
myNamespace() {
20+
if (!this.#client.defaultNamespace) throw new Error("No current namespace is set");
21+
return new ArgoprojIoV1alpha1NamespacedApi(this.#client, this.#client.defaultNamespace);
22+
}
23+
24+
async getApplicationListForAllNamespaces(opts: operations.GetListOpts = {}) {
25+
const resp = await this.#client.performRequest({
26+
method: "GET",
27+
path: `${this.#root}applications`,
28+
expectJson: true,
29+
querystring: operations.formatGetListOpts(opts),
30+
abortSignal: opts.abortSignal,
31+
});
32+
return ArgoprojIoV1alpha1.toApplicationList(resp);
33+
}
34+
35+
async watchApplicationListForAllNamespaces(opts: operations.WatchListOpts = {}) {
36+
const resp = await this.#client.performRequest({
37+
method: "GET",
38+
path: `${this.#root}applications`,
39+
expectJson: true,
40+
expectStream: true,
41+
querystring: operations.formatWatchListOpts(opts),
42+
abortSignal: opts.abortSignal,
43+
});
44+
return resp.pipeThrough(new c.WatchEventTransformer(ArgoprojIoV1alpha1.toApplication, MetaV1.toStatus));
45+
}
46+
47+
async getAppProjectListForAllNamespaces(opts: operations.GetListOpts = {}) {
48+
const resp = await this.#client.performRequest({
49+
method: "GET",
50+
path: `${this.#root}appprojects`,
51+
expectJson: true,
52+
querystring: operations.formatGetListOpts(opts),
53+
abortSignal: opts.abortSignal,
54+
});
55+
return ArgoprojIoV1alpha1.toAppProjectList(resp);
56+
}
57+
58+
async watchAppProjectListForAllNamespaces(opts: operations.WatchListOpts = {}) {
59+
const resp = await this.#client.performRequest({
60+
method: "GET",
61+
path: `${this.#root}appprojects`,
62+
expectJson: true,
63+
expectStream: true,
64+
querystring: operations.formatWatchListOpts(opts),
65+
abortSignal: opts.abortSignal,
66+
});
67+
return resp.pipeThrough(new c.WatchEventTransformer(ArgoprojIoV1alpha1.toAppProject, MetaV1.toStatus));
68+
}
69+
70+
}
71+
72+
export class ArgoprojIoV1alpha1NamespacedApi {
73+
#client: c.RestClient
74+
#root: string
75+
constructor(client: c.RestClient, namespace: string) {
76+
this.#client = client;
77+
this.#root = `/apis/argoproj.io/v1alpha1/namespaces/${namespace}/`;
78+
}
79+
80+
async getApplicationList(opts: operations.GetListOpts = {}) {
81+
const resp = await this.#client.performRequest({
82+
method: "GET",
83+
path: `${this.#root}applications`,
84+
expectJson: true,
85+
querystring: operations.formatGetListOpts(opts),
86+
abortSignal: opts.abortSignal,
87+
});
88+
return ArgoprojIoV1alpha1.toApplicationList(resp);
89+
}
90+
91+
async watchApplicationList(opts: operations.WatchListOpts = {}) {
92+
const resp = await this.#client.performRequest({
93+
method: "GET",
94+
path: `${this.#root}applications`,
95+
expectJson: true,
96+
expectStream: true,
97+
querystring: operations.formatWatchListOpts(opts),
98+
abortSignal: opts.abortSignal,
99+
});
100+
return resp.pipeThrough(new c.WatchEventTransformer(ArgoprojIoV1alpha1.toApplication, MetaV1.toStatus));
101+
}
102+
103+
async createApplication(body: ArgoprojIoV1alpha1.Application, opts: operations.PutOpts = {}) {
104+
const resp = await this.#client.performRequest({
105+
method: "POST",
106+
path: `${this.#root}applications`,
107+
expectJson: true,
108+
querystring: operations.formatPutOpts(opts),
109+
bodyJson: ArgoprojIoV1alpha1.fromApplication(body),
110+
abortSignal: opts.abortSignal,
111+
});
112+
return ArgoprojIoV1alpha1.toApplication(resp);
113+
}
114+
115+
async deleteApplicationList(opts: operations.DeleteListOpts = {}) {
116+
const resp = await this.#client.performRequest({
117+
method: "DELETE",
118+
path: `${this.#root}applications`,
119+
expectJson: true,
120+
querystring: operations.formatDeleteListOpts(opts),
121+
abortSignal: opts.abortSignal,
122+
});
123+
return ArgoprojIoV1alpha1.toApplicationList(resp);
124+
}
125+
126+
async getApplication(name: string, opts: operations.NoOpts = {}) {
127+
const resp = await this.#client.performRequest({
128+
method: "GET",
129+
path: `${this.#root}applications/${name}`,
130+
expectJson: true,
131+
abortSignal: opts.abortSignal,
132+
});
133+
return ArgoprojIoV1alpha1.toApplication(resp);
134+
}
135+
136+
async deleteApplication(name: string, opts: operations.DeleteOpts = {}) {
137+
const resp = await this.#client.performRequest({
138+
method: "DELETE",
139+
path: `${this.#root}applications/${name}`,
140+
expectJson: true,
141+
querystring: operations.formatDeleteOpts(opts),
142+
abortSignal: opts.abortSignal,
143+
});
144+
return MetaV1.toStatus(resp);
145+
}
146+
147+
async replaceApplication(name: string, body: ArgoprojIoV1alpha1.Application, opts: operations.PutOpts = {}) {
148+
const resp = await this.#client.performRequest({
149+
method: "PUT",
150+
path: `${this.#root}applications/${name}`,
151+
expectJson: true,
152+
querystring: operations.formatPutOpts(opts),
153+
bodyJson: ArgoprojIoV1alpha1.fromApplication(body),
154+
abortSignal: opts.abortSignal,
155+
});
156+
return ArgoprojIoV1alpha1.toApplication(resp);
157+
}
158+
159+
async patchApplication(name: string, type: c.PatchType, body: ArgoprojIoV1alpha1.Application | c.JsonPatch, opts: operations.PatchOpts = {}) {
160+
const resp = await this.#client.performRequest({
161+
method: "PATCH",
162+
path: `${this.#root}applications/${name}`,
163+
expectJson: true,
164+
querystring: operations.formatPatchOpts(opts),
165+
contentType: c.getPatchContentType(type),
166+
bodyJson: Array.isArray(body) ? body : ArgoprojIoV1alpha1.fromApplication(body),
167+
abortSignal: opts.abortSignal,
168+
});
169+
return ArgoprojIoV1alpha1.toApplication(resp);
170+
}
171+
172+
async getAppProjectList(opts: operations.GetListOpts = {}) {
173+
const resp = await this.#client.performRequest({
174+
method: "GET",
175+
path: `${this.#root}appprojects`,
176+
expectJson: true,
177+
querystring: operations.formatGetListOpts(opts),
178+
abortSignal: opts.abortSignal,
179+
});
180+
return ArgoprojIoV1alpha1.toAppProjectList(resp);
181+
}
182+
183+
async watchAppProjectList(opts: operations.WatchListOpts = {}) {
184+
const resp = await this.#client.performRequest({
185+
method: "GET",
186+
path: `${this.#root}appprojects`,
187+
expectJson: true,
188+
expectStream: true,
189+
querystring: operations.formatWatchListOpts(opts),
190+
abortSignal: opts.abortSignal,
191+
});
192+
return resp.pipeThrough(new c.WatchEventTransformer(ArgoprojIoV1alpha1.toAppProject, MetaV1.toStatus));
193+
}
194+
195+
async createAppProject(body: ArgoprojIoV1alpha1.AppProject, opts: operations.PutOpts = {}) {
196+
const resp = await this.#client.performRequest({
197+
method: "POST",
198+
path: `${this.#root}appprojects`,
199+
expectJson: true,
200+
querystring: operations.formatPutOpts(opts),
201+
bodyJson: ArgoprojIoV1alpha1.fromAppProject(body),
202+
abortSignal: opts.abortSignal,
203+
});
204+
return ArgoprojIoV1alpha1.toAppProject(resp);
205+
}
206+
207+
async deleteAppProjectList(opts: operations.DeleteListOpts = {}) {
208+
const resp = await this.#client.performRequest({
209+
method: "DELETE",
210+
path: `${this.#root}appprojects`,
211+
expectJson: true,
212+
querystring: operations.formatDeleteListOpts(opts),
213+
abortSignal: opts.abortSignal,
214+
});
215+
return ArgoprojIoV1alpha1.toAppProjectList(resp);
216+
}
217+
218+
async getAppProject(name: string, opts: operations.NoOpts = {}) {
219+
const resp = await this.#client.performRequest({
220+
method: "GET",
221+
path: `${this.#root}appprojects/${name}`,
222+
expectJson: true,
223+
abortSignal: opts.abortSignal,
224+
});
225+
return ArgoprojIoV1alpha1.toAppProject(resp);
226+
}
227+
228+
async deleteAppProject(name: string, opts: operations.DeleteOpts = {}) {
229+
const resp = await this.#client.performRequest({
230+
method: "DELETE",
231+
path: `${this.#root}appprojects/${name}`,
232+
expectJson: true,
233+
querystring: operations.formatDeleteOpts(opts),
234+
abortSignal: opts.abortSignal,
235+
});
236+
return MetaV1.toStatus(resp);
237+
}
238+
239+
async replaceAppProject(name: string, body: ArgoprojIoV1alpha1.AppProject, opts: operations.PutOpts = {}) {
240+
const resp = await this.#client.performRequest({
241+
method: "PUT",
242+
path: `${this.#root}appprojects/${name}`,
243+
expectJson: true,
244+
querystring: operations.formatPutOpts(opts),
245+
bodyJson: ArgoprojIoV1alpha1.fromAppProject(body),
246+
abortSignal: opts.abortSignal,
247+
});
248+
return ArgoprojIoV1alpha1.toAppProject(resp);
249+
}
250+
251+
async patchAppProject(name: string, type: c.PatchType, body: ArgoprojIoV1alpha1.AppProject | c.JsonPatch, opts: operations.PatchOpts = {}) {
252+
const resp = await this.#client.performRequest({
253+
method: "PATCH",
254+
path: `${this.#root}appprojects/${name}`,
255+
expectJson: true,
256+
querystring: operations.formatPatchOpts(opts),
257+
contentType: c.getPatchContentType(type),
258+
bodyJson: Array.isArray(body) ? body : ArgoprojIoV1alpha1.fromAppProject(body),
259+
abortSignal: opts.abortSignal,
260+
});
261+
return ArgoprojIoV1alpha1.toAppProject(resp);
262+
}
263+
264+
}

0 commit comments

Comments
 (0)