@daocloud-proto/kairship 0.0.0-37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fetch.pb.ts +341 -0
- package/google/api/annotations.pb.ts +1 -0
- package/google/api/empty.pb.ts +7 -0
- package/kairship.io/api/apiextensions/v1/types.pb.ts +8 -0
- package/kairship.io/api/cluster/v1alpha1/cluster.pb.ts +92 -0
- package/kairship.io/api/guestbook/v1alpha1/guestbook.pb.ts +14 -0
- package/kairship.io/api/policy/v1alpha1/overridepolicy.pb.ts +53 -0
- package/kairship.io/api/policy/v1alpha1/pp.pb.ts +103 -0
- package/kairship.io/api/policy/v1alpha1/types.pb.ts +19 -0
- package/kairship.io/api/types/core.pb.ts +18 -0
- package/kairship.io/api/types/objectmeta.pb.ts +67 -0
- package/kairship.io/api/types/page.pb.ts +27 -0
- package/kairship.io/api/types/types.pb.ts +12 -0
- package/kairship.io/api/v1alpha1/kairship.pb.ts +32 -0
- package/package.json +12 -0
package/fetch.pb.ts
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* base64 encoder and decoder
|
|
9
|
+
* Copied and adapted from https://github.com/protobufjs/protobuf.js/blob/master/lib/base64/index.js
|
|
10
|
+
*/
|
|
11
|
+
// Base64 encoding table
|
|
12
|
+
const b64 = new Array(64);
|
|
13
|
+
|
|
14
|
+
// Base64 decoding table
|
|
15
|
+
const s64 = new Array(123);
|
|
16
|
+
|
|
17
|
+
// 65..90, 97..122, 48..57, 43, 47
|
|
18
|
+
for (let i = 0; i < 64;)
|
|
19
|
+
s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
|
|
20
|
+
|
|
21
|
+
export function b64Encode(buffer: Uint8Array, start: number, end: number): string {
|
|
22
|
+
let parts: string[] = null;
|
|
23
|
+
const chunk = [];
|
|
24
|
+
let i = 0, // output index
|
|
25
|
+
j = 0, // goto index
|
|
26
|
+
t; // temporary
|
|
27
|
+
while (start < end) {
|
|
28
|
+
const b = buffer[start++];
|
|
29
|
+
switch (j) {
|
|
30
|
+
case 0:
|
|
31
|
+
chunk[i++] = b64[b >> 2];
|
|
32
|
+
t = (b & 3) << 4;
|
|
33
|
+
j = 1;
|
|
34
|
+
break;
|
|
35
|
+
case 1:
|
|
36
|
+
chunk[i++] = b64[t | b >> 4];
|
|
37
|
+
t = (b & 15) << 2;
|
|
38
|
+
j = 2;
|
|
39
|
+
break;
|
|
40
|
+
case 2:
|
|
41
|
+
chunk[i++] = b64[t | b >> 6];
|
|
42
|
+
chunk[i++] = b64[b & 63];
|
|
43
|
+
j = 0;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
if (i > 8191) {
|
|
47
|
+
(parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
|
48
|
+
i = 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (j) {
|
|
52
|
+
chunk[i++] = b64[t];
|
|
53
|
+
chunk[i++] = 61;
|
|
54
|
+
if (j === 1)
|
|
55
|
+
chunk[i++] = 61;
|
|
56
|
+
}
|
|
57
|
+
if (parts) {
|
|
58
|
+
if (i)
|
|
59
|
+
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
|
60
|
+
return parts.join("");
|
|
61
|
+
}
|
|
62
|
+
return String.fromCharCode.apply(String, chunk.slice(0, i));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const invalidEncoding = "invalid encoding";
|
|
66
|
+
|
|
67
|
+
export function b64Decode(s: string): Uint8Array {
|
|
68
|
+
const buffer = [];
|
|
69
|
+
let offset = 0;
|
|
70
|
+
let j = 0, // goto index
|
|
71
|
+
t; // temporary
|
|
72
|
+
for (let i = 0; i < s.length;) {
|
|
73
|
+
let c = s.charCodeAt(i++);
|
|
74
|
+
if (c === 61 && j > 1)
|
|
75
|
+
break;
|
|
76
|
+
if ((c = s64[c]) === undefined)
|
|
77
|
+
throw Error(invalidEncoding);
|
|
78
|
+
switch (j) {
|
|
79
|
+
case 0:
|
|
80
|
+
t = c;
|
|
81
|
+
j = 1;
|
|
82
|
+
break;
|
|
83
|
+
case 1:
|
|
84
|
+
buffer[offset++] = t << 2 | (c & 48) >> 4;
|
|
85
|
+
t = c;
|
|
86
|
+
j = 2;
|
|
87
|
+
break;
|
|
88
|
+
case 2:
|
|
89
|
+
buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
|
|
90
|
+
t = c;
|
|
91
|
+
j = 3;
|
|
92
|
+
break;
|
|
93
|
+
case 3:
|
|
94
|
+
buffer[offset++] = (t & 3) << 6 | c;
|
|
95
|
+
j = 0;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (j === 1)
|
|
100
|
+
throw Error(invalidEncoding);
|
|
101
|
+
return new Uint8Array(buffer);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function b64Test(s: string): boolean {
|
|
105
|
+
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface InitReq extends RequestInit {
|
|
109
|
+
pathPrefix?: string
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function replacer(key: any, value: any): any {
|
|
113
|
+
if(value && value.constructor === Uint8Array) {
|
|
114
|
+
return b64Encode(value, 0, value.length);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function fetchReq<I, O>(path: string, init?: InitReq): Promise<O> {
|
|
121
|
+
const {pathPrefix, ...req} = init || {}
|
|
122
|
+
|
|
123
|
+
const url = pathPrefix ? `${pathPrefix}${path}` : path
|
|
124
|
+
|
|
125
|
+
return fetch(url, req).then(r => r.json().then((body: O) => {
|
|
126
|
+
if (!r.ok) { throw body; }
|
|
127
|
+
return body;
|
|
128
|
+
})) as Promise<O>
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// NotifyStreamEntityArrival is a callback that will be called on streaming entity arrival
|
|
132
|
+
export type NotifyStreamEntityArrival<T> = (resp: T) => void
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* fetchStreamingRequest is able to handle grpc-gateway server side streaming call
|
|
136
|
+
* it takes NotifyStreamEntityArrival that lets users respond to entity arrival during the call
|
|
137
|
+
* all entities will be returned as an array after the call finishes.
|
|
138
|
+
**/
|
|
139
|
+
export async function fetchStreamingRequest<S, R>(path: string, callback?: NotifyStreamEntityArrival<R>, init?: InitReq) {
|
|
140
|
+
const {pathPrefix, ...req} = init || {}
|
|
141
|
+
const url = pathPrefix ?`${pathPrefix}${path}` : path
|
|
142
|
+
const result = await fetch(url, req)
|
|
143
|
+
// needs to use the .ok to check the status of HTTP status code
|
|
144
|
+
// http other than 200 will not throw an error, instead the .ok will become false.
|
|
145
|
+
// see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#
|
|
146
|
+
if (!result.ok) {
|
|
147
|
+
const resp = await result.json()
|
|
148
|
+
const errMsg = resp.error && resp.error.message ? resp.error.message : ""
|
|
149
|
+
throw new Error(errMsg)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (!result.body) {
|
|
153
|
+
throw new Error("response doesnt have a body")
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
await result.body
|
|
157
|
+
.pipeThrough(new TextDecoderStream())
|
|
158
|
+
.pipeThrough<R>(getNewLineDelimitedJSONDecodingStream<R>())
|
|
159
|
+
.pipeTo(getNotifyEntityArrivalSink((e: R) => {
|
|
160
|
+
if (callback) {
|
|
161
|
+
callback(e)
|
|
162
|
+
}
|
|
163
|
+
}))
|
|
164
|
+
|
|
165
|
+
// wait for the streaming to finish and return the success respond
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* JSONStringStreamController represents the transform controller that's able to transform the incoming
|
|
171
|
+
* new line delimited json content stream into entities and able to push the entity to the down stream
|
|
172
|
+
*/
|
|
173
|
+
interface JSONStringStreamController<T> extends TransformStreamDefaultController {
|
|
174
|
+
buf?: string
|
|
175
|
+
pos?: number
|
|
176
|
+
enqueue: (s: T) => void
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* getNewLineDelimitedJSONDecodingStream returns a TransformStream that's able to handle new line delimited json stream content into parsed entities
|
|
181
|
+
*/
|
|
182
|
+
function getNewLineDelimitedJSONDecodingStream<T>(): TransformStream<string, T> {
|
|
183
|
+
return new TransformStream({
|
|
184
|
+
start(controller: JSONStringStreamController<T>) {
|
|
185
|
+
controller.buf = ''
|
|
186
|
+
controller.pos = 0
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
transform(chunk: string, controller: JSONStringStreamController<T>) {
|
|
190
|
+
if (controller.buf === undefined) {
|
|
191
|
+
controller.buf = ''
|
|
192
|
+
}
|
|
193
|
+
if (controller.pos === undefined) {
|
|
194
|
+
controller.pos = 0
|
|
195
|
+
}
|
|
196
|
+
controller.buf += chunk
|
|
197
|
+
while (controller.pos < controller.buf.length) {
|
|
198
|
+
if (controller.buf[controller.pos] === '\n') {
|
|
199
|
+
const line = controller.buf.substring(0, controller.pos)
|
|
200
|
+
const response = JSON.parse(line)
|
|
201
|
+
controller.enqueue(response.result)
|
|
202
|
+
controller.buf = controller.buf.substring(controller.pos + 1)
|
|
203
|
+
controller.pos = 0
|
|
204
|
+
} else {
|
|
205
|
+
++controller.pos
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* getNotifyEntityArrivalSink takes the NotifyStreamEntityArrival callback and return
|
|
215
|
+
* a sink that will call the callback on entity arrival
|
|
216
|
+
* @param notifyCallback
|
|
217
|
+
*/
|
|
218
|
+
function getNotifyEntityArrivalSink<T>(notifyCallback: NotifyStreamEntityArrival<T>) {
|
|
219
|
+
return new WritableStream<T>({
|
|
220
|
+
write(entity: T) {
|
|
221
|
+
notifyCallback(entity)
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
type Primitive = string | boolean | number;
|
|
227
|
+
type RequestPayload = Record<string, unknown>;
|
|
228
|
+
type FlattenedRequestPayload = Record<string, Primitive | Array<Primitive>>;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Checks if given value is a plain object
|
|
232
|
+
* Logic copied and adapted from below source:
|
|
233
|
+
* https://github.com/char0n/ramda-adjunct/blob/master/src/isPlainObj.js
|
|
234
|
+
* @param {unknown} value
|
|
235
|
+
* @return {boolean}
|
|
236
|
+
*/
|
|
237
|
+
function isPlainObject(value: unknown): boolean {
|
|
238
|
+
const isObject =
|
|
239
|
+
Object.prototype.toString.call(value).slice(8, -1) === "Object";
|
|
240
|
+
const isObjLike = value !== null && isObject;
|
|
241
|
+
|
|
242
|
+
if (!isObjLike || !isObject) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const proto = Object.getPrototypeOf(value);
|
|
247
|
+
|
|
248
|
+
const hasObjectConstructor =
|
|
249
|
+
typeof proto === "object" &&
|
|
250
|
+
proto.constructor === Object.prototype.constructor;
|
|
251
|
+
|
|
252
|
+
return hasObjectConstructor;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Checks if given value is of a primitive type
|
|
257
|
+
* @param {unknown} value
|
|
258
|
+
* @return {boolean}
|
|
259
|
+
*/
|
|
260
|
+
function isPrimitive(value: unknown): boolean {
|
|
261
|
+
return ["string", "number", "boolean"].some(t => typeof value === t);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Checks if given primitive is zero-value
|
|
266
|
+
* @param {Primitive} value
|
|
267
|
+
* @return {boolean}
|
|
268
|
+
*/
|
|
269
|
+
function isZeroValuePrimitive(value: Primitive): boolean {
|
|
270
|
+
return value === false || value === 0 || value === "";
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Flattens a deeply nested request payload and returns an object
|
|
275
|
+
* with only primitive values and non-empty array of primitive values
|
|
276
|
+
* as per https://github.com/googleapis/googleapis/blob/master/google/api/http.proto
|
|
277
|
+
* @param {RequestPayload} requestPayload
|
|
278
|
+
* @param {String} path
|
|
279
|
+
* @return {FlattenedRequestPayload>}
|
|
280
|
+
*/
|
|
281
|
+
function flattenRequestPayload<T extends RequestPayload>(
|
|
282
|
+
requestPayload: T,
|
|
283
|
+
path: string = ""
|
|
284
|
+
): FlattenedRequestPayload {
|
|
285
|
+
return Object.keys(requestPayload).reduce(
|
|
286
|
+
(acc: T, key: string): T => {
|
|
287
|
+
const value = requestPayload[key];
|
|
288
|
+
const newPath = path ? [path, key].join(".") : key;
|
|
289
|
+
|
|
290
|
+
const isNonEmptyPrimitiveArray =
|
|
291
|
+
Array.isArray(value) &&
|
|
292
|
+
value.every(v => isPrimitive(v)) &&
|
|
293
|
+
value.length > 0;
|
|
294
|
+
|
|
295
|
+
const isNonZeroValuePrimitive =
|
|
296
|
+
isPrimitive(value) && !isZeroValuePrimitive(value as Primitive);
|
|
297
|
+
|
|
298
|
+
let objectToMerge = {};
|
|
299
|
+
|
|
300
|
+
if (isPlainObject(value)) {
|
|
301
|
+
objectToMerge = flattenRequestPayload(value as RequestPayload, newPath);
|
|
302
|
+
} else if (isNonZeroValuePrimitive || isNonEmptyPrimitiveArray) {
|
|
303
|
+
objectToMerge = { [newPath]: value };
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return { ...acc, ...objectToMerge };
|
|
307
|
+
},
|
|
308
|
+
{} as T
|
|
309
|
+
) as FlattenedRequestPayload;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Renders a deeply nested request payload into a string of URL search
|
|
314
|
+
* parameters by first flattening the request payload and then removing keys
|
|
315
|
+
* which are already present in the URL path.
|
|
316
|
+
* @param {RequestPayload} requestPayload
|
|
317
|
+
* @param {string[]} urlPathParams
|
|
318
|
+
* @return {string}
|
|
319
|
+
*/
|
|
320
|
+
export function renderURLSearchParams<T extends RequestPayload>(
|
|
321
|
+
requestPayload: T,
|
|
322
|
+
urlPathParams: string[] = []
|
|
323
|
+
): string {
|
|
324
|
+
const flattenedRequestPayload = flattenRequestPayload(requestPayload);
|
|
325
|
+
|
|
326
|
+
const urlSearchParams = Object.keys(flattenedRequestPayload).reduce(
|
|
327
|
+
(acc: string[][], key: string): string[][] => {
|
|
328
|
+
// key should not be present in the url path as a parameter
|
|
329
|
+
const value = flattenedRequestPayload[key];
|
|
330
|
+
if (urlPathParams.find(f => f === key)) {
|
|
331
|
+
return acc;
|
|
332
|
+
}
|
|
333
|
+
return Array.isArray(value)
|
|
334
|
+
? [...acc, ...value.map(m => [key, m.toString()])]
|
|
335
|
+
: (acc = [...acc, [key, value.toString()]]);
|
|
336
|
+
},
|
|
337
|
+
[] as string[][]
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
return new URLSearchParams(urlSearchParams).toString();
|
|
341
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as KairshipIoApiTypesObjectmeta from "../../types/objectmeta.pb"
|
|
8
|
+
import * as KairshipIoApiTypesPage from "../../types/page.pb"
|
|
9
|
+
|
|
10
|
+
export enum ClusterPhase {
|
|
11
|
+
CLUSTER_PHASE_UNSPECIFIED = "CLUSTER_PHASE_UNSPECIFIED",
|
|
12
|
+
UNKNOWN = "UNKNOWN",
|
|
13
|
+
CREATING = "CREATING",
|
|
14
|
+
RUNNING = "RUNNING",
|
|
15
|
+
UPDATING = "UPDATING",
|
|
16
|
+
DELETING = "DELETING",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export enum ClusterProvider {
|
|
20
|
+
GENERIC = "GENERIC",
|
|
21
|
+
DAOCLOUD_KUBESPRAY = "DAOCLOUD_KUBESPRAY",
|
|
22
|
+
DAOCLOUD_CLUSTER_API = "DAOCLOUD_CLUSTER_API",
|
|
23
|
+
DAOCLOUD_DCE4 = "DAOCLOUD_DCE4",
|
|
24
|
+
REDHAT_OPENSHIFT4 = "REDHAT_OPENSHIFT4",
|
|
25
|
+
SUSE_RANCHER = "SUSE_RANCHER",
|
|
26
|
+
VMWARE_TANZU = "VMWARE_TANZU",
|
|
27
|
+
AWS_EKS = "AWS_EKS",
|
|
28
|
+
ALIYUN_ACK = "ALIYUN_ACK",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type Cluster = {
|
|
32
|
+
metadata?: KairshipIoApiTypesObjectmeta.ObjectMeta
|
|
33
|
+
spec?: ClusterSpec
|
|
34
|
+
status?: ClusterStatus
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type ClusterStatus = {
|
|
38
|
+
kubernetesVersion?: string
|
|
39
|
+
kubeSystemID?: string
|
|
40
|
+
serviceCIDR?: string
|
|
41
|
+
podCIDR?: string
|
|
42
|
+
phase?: ClusterPhase
|
|
43
|
+
cpuUsage?: number
|
|
44
|
+
memoryUsage?: number
|
|
45
|
+
mode?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type ClusterSpec = {
|
|
49
|
+
provider?: ClusterProvider
|
|
50
|
+
apiEndpoint?: string
|
|
51
|
+
region?: string
|
|
52
|
+
zone?: string
|
|
53
|
+
roles?: string[]
|
|
54
|
+
managedBy?: string
|
|
55
|
+
aliasName?: string
|
|
56
|
+
secretRef?: LocalSecretReference
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type LocalSecretReference = {
|
|
60
|
+
name?: string
|
|
61
|
+
namespace?: string
|
|
62
|
+
resourceVersion?: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type ListClustersRequest = {
|
|
66
|
+
instance?: string
|
|
67
|
+
page?: number
|
|
68
|
+
pageSize?: number
|
|
69
|
+
role?: string[]
|
|
70
|
+
kubernetesVersion?: string
|
|
71
|
+
phases?: string[]
|
|
72
|
+
labels?: {[key: string]: string}
|
|
73
|
+
annotations?: {[key: string]: string}
|
|
74
|
+
managedBy?: string
|
|
75
|
+
sortBy?: KairshipIoApiTypesPage.SortDir
|
|
76
|
+
sortDir?: KairshipIoApiTypesPage.SortDir
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type ListClustersResponse = {
|
|
80
|
+
items?: Cluster[]
|
|
81
|
+
pagination?: KairshipIoApiTypesPage.Pagination
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type JoinClusterRequest = {
|
|
85
|
+
instance?: string
|
|
86
|
+
cluster?: Cluster
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type JoinClusterResponse = {
|
|
90
|
+
items?: Cluster
|
|
91
|
+
pagination?: KairshipIoApiTypesPage.Pagination
|
|
92
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as KairshipIoApiTypesObjectmeta from "../../types/objectmeta.pb"
|
|
8
|
+
export type GuestBook = {
|
|
9
|
+
metadata?: KairshipIoApiTypesObjectmeta.ObjectMeta
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type GetGuestBookRequest = {
|
|
13
|
+
name?: string
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as KairshipIoApiApiextensionsV1Types from "../../apiextensions/v1/types.pb"
|
|
8
|
+
import * as KairshipIoApiTypesObjectmeta from "../../types/objectmeta.pb"
|
|
9
|
+
import * as KairshipIoApiTypesPage from "../../types/page.pb"
|
|
10
|
+
import * as KairshipIoApiPolicyV1alpha1Types from "./types.pb"
|
|
11
|
+
export type OverridePolicy = {
|
|
12
|
+
metadata?: KairshipIoApiTypesObjectmeta.ObjectMeta
|
|
13
|
+
spec?: OverridePolicySpec
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type OverridePolicySpec = {
|
|
17
|
+
resourceSelectors?: KairshipIoApiPolicyV1alpha1Types.ResourceSelector[]
|
|
18
|
+
overrideRules?: RuleWithCluster[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type RuleWithCluster = {
|
|
22
|
+
targetCluster?: KairshipIoApiPolicyV1alpha1Types.ClusterAffinity
|
|
23
|
+
overriders?: Overriders
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type Overriders = {
|
|
27
|
+
plaintext?: PlaintextOverrider[]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type PlaintextOverrider = {
|
|
31
|
+
path?: string
|
|
32
|
+
operator?: string
|
|
33
|
+
value?: KairshipIoApiApiextensionsV1Types.JSON
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type OverridePolicyList = {
|
|
37
|
+
items?: OverridePolicy[]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type ListAllOverridePoliciesRequest = {
|
|
41
|
+
instance?: string
|
|
42
|
+
namespace?: string
|
|
43
|
+
page?: number
|
|
44
|
+
pageSize?: number
|
|
45
|
+
name?: string[]
|
|
46
|
+
sortBy?: KairshipIoApiTypesPage.SortBy
|
|
47
|
+
sortDir?: KairshipIoApiTypesPage.SortDir
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type ListOverridePoliciesResponse = {
|
|
51
|
+
items?: OverridePolicy[]
|
|
52
|
+
pagination?: KairshipIoApiTypesPage.Pagination
|
|
53
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as KairshipIoApiTypesObjectmeta from "../../types/objectmeta.pb"
|
|
8
|
+
import * as KairshipIoApiTypesPage from "../../types/page.pb"
|
|
9
|
+
import * as KairshipIoApiPolicyV1alpha1Types from "./types.pb"
|
|
10
|
+
|
|
11
|
+
export enum SpreadFieldValue {
|
|
12
|
+
SPREAD_FIELD_VALUE_UNSPECIFIED = "SPREAD_FIELD_VALUE_UNSPECIFIED",
|
|
13
|
+
SpreadByFieldCluster = "SpreadByFieldCluster",
|
|
14
|
+
SpreadByFieldRegion = "SpreadByFieldRegion",
|
|
15
|
+
SpreadByFieldZone = "SpreadByFieldZone",
|
|
16
|
+
SpreadByFieldProvider = "SpreadByFieldProvider",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export enum ReplicaSchedulingType {
|
|
20
|
+
REPLICA_SCHEDULING_TYPE_UNSPECIFIED = "REPLICA_SCHEDULING_TYPE_UNSPECIFIED",
|
|
21
|
+
ReplicaSchedulingTypeDuplicated = "ReplicaSchedulingTypeDuplicated",
|
|
22
|
+
ReplicaSchedulingTypeDivided = "ReplicaSchedulingTypeDivided",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export enum ReplicaDivisionPreference {
|
|
26
|
+
REPLICA_DIVISION_PREFERENCE_UNSPECIFIED = "REPLICA_DIVISION_PREFERENCE_UNSPECIFIED",
|
|
27
|
+
ReplicaDivisionPreferenceAggregated = "ReplicaDivisionPreferenceAggregated",
|
|
28
|
+
ReplicaDivisionPreferenceWeighted = "ReplicaDivisionPreferenceWeighted",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum DynamicWeightFactor {
|
|
32
|
+
DYNAMIC_WEIGHT_FACTOR_UNSPECIFIED = "DYNAMIC_WEIGHT_FACTOR_UNSPECIFIED",
|
|
33
|
+
DynamicWeightByAvailableReplicas = "DynamicWeightByAvailableReplicas",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type PropagationPolicy = {
|
|
37
|
+
metadata?: KairshipIoApiTypesObjectmeta.ObjectMeta
|
|
38
|
+
spec?: PropagationPolicySpec
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type PropagationPolicySpec = {
|
|
42
|
+
resourceSelectors?: KairshipIoApiPolicyV1alpha1Types.ResourceSelector[]
|
|
43
|
+
placement?: Placement
|
|
44
|
+
propagateDeps?: boolean
|
|
45
|
+
dependentOverrides?: string[]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type Placement = {
|
|
49
|
+
clusterAffinity?: KairshipIoApiPolicyV1alpha1Types.ClusterAffinity
|
|
50
|
+
clusterTolerations?: Toleration[]
|
|
51
|
+
spreadConstraints?: SpreadConstraint[]
|
|
52
|
+
replicaScheduling?: ReplicaSchedulingStrategy
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type Toleration = {
|
|
56
|
+
key?: string
|
|
57
|
+
operator?: string
|
|
58
|
+
value?: string
|
|
59
|
+
effect?: string
|
|
60
|
+
tolerationSeconds?: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type SpreadConstraint = {
|
|
64
|
+
spreadByField?: SpreadFieldValue
|
|
65
|
+
spreadByLabel?: string
|
|
66
|
+
maxGroups?: string
|
|
67
|
+
minGroups?: string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type ReplicaSchedulingStrategy = {
|
|
71
|
+
replicaSchedulingType?: ReplicaSchedulingType
|
|
72
|
+
replicaDivisionPreference?: ReplicaDivisionPreference
|
|
73
|
+
weightPreference?: ClusterPreferences
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type ClusterPreferences = {
|
|
77
|
+
staticWeightList?: StaticClusterWeight[]
|
|
78
|
+
dynamicWeight?: DynamicWeightFactor
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type StaticClusterWeight = {
|
|
82
|
+
targetCluster?: KairshipIoApiPolicyV1alpha1Types.ClusterAffinity
|
|
83
|
+
weight?: string
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type PropagationPolicyList = {
|
|
87
|
+
items?: PropagationPolicy[]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type ListAllPropagationPoliciesRequest = {
|
|
91
|
+
instance?: string
|
|
92
|
+
namespace?: string
|
|
93
|
+
page?: number
|
|
94
|
+
pageSize?: number
|
|
95
|
+
name?: string[]
|
|
96
|
+
sortBy?: KairshipIoApiTypesPage.SortBy
|
|
97
|
+
sortDir?: KairshipIoApiTypesPage.SortDir
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type ListPropagationPoliciesResponse = {
|
|
101
|
+
items?: PropagationPolicy[]
|
|
102
|
+
pagination?: KairshipIoApiTypesPage.Pagination
|
|
103
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as KairshipIoApiTypesObjectmeta from "../../types/objectmeta.pb"
|
|
8
|
+
export type ResourceSelector = {
|
|
9
|
+
apiVersion?: string
|
|
10
|
+
kind?: string
|
|
11
|
+
namespace?: string
|
|
12
|
+
name?: string
|
|
13
|
+
labelSelector?: KairshipIoApiTypesObjectmeta.LabelSelector
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type ClusterAffinity = {
|
|
17
|
+
labelSelector?: KairshipIoApiTypesObjectmeta.LabelSelector
|
|
18
|
+
clusterNames?: string[]
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export enum TaintEffect {
|
|
8
|
+
TAINT_EFFECT_UNSPECIFIED = "TAINT_EFFECT_UNSPECIFIED",
|
|
9
|
+
NoSchedule = "NoSchedule",
|
|
10
|
+
PreferNoSchedule = "PreferNoSchedule",
|
|
11
|
+
NoExecute = "NoExecute",
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type Taint = {
|
|
15
|
+
key?: string
|
|
16
|
+
value?: string
|
|
17
|
+
effect?: TaintEffect
|
|
18
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export enum WorkloadState {
|
|
8
|
+
WORKLOAD_STATE_UNSPECIFIED = "WORKLOAD_STATE_UNSPECIFIED",
|
|
9
|
+
WORKLOAD_STATE_RUNNING = "WORKLOAD_STATE_RUNNING",
|
|
10
|
+
WORKLOAD_STATE_DELETING = "WORKLOAD_STATE_DELETING",
|
|
11
|
+
WORKLOAD_STATE_NOT_READY = "WORKLOAD_STATE_NOT_READY",
|
|
12
|
+
WORKLOAD_STATE_STOPPED = "WORKLOAD_STATE_STOPPED",
|
|
13
|
+
WORKLOAD_STATE_WAITING = "WORKLOAD_STATE_WAITING",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type OwnerReference = {
|
|
17
|
+
uid?: string
|
|
18
|
+
controller?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ObjectMeta = {
|
|
22
|
+
name?: string
|
|
23
|
+
namespace?: string
|
|
24
|
+
uid?: string
|
|
25
|
+
resourceVersion?: string
|
|
26
|
+
creationTimestamp?: string
|
|
27
|
+
deletionTimestamp?: string
|
|
28
|
+
labels?: {[key: string]: string}
|
|
29
|
+
annotations?: {[key: string]: string}
|
|
30
|
+
ownerReferences?: OwnerReference[]
|
|
31
|
+
cluster?: string
|
|
32
|
+
workspaceAlias?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type Selector = {
|
|
36
|
+
matchLabels?: {[key: string]: string}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type LabelSelector = {
|
|
40
|
+
matchLabels?: {[key: string]: string}
|
|
41
|
+
matchExpressions?: LabelSelectorRequirement[]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type LabelSelectorRequirement = {
|
|
45
|
+
key?: string
|
|
46
|
+
operator?: string
|
|
47
|
+
values?: string[]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type RollingUpdate = {
|
|
51
|
+
maxSurge?: string
|
|
52
|
+
maxUnavailable?: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type UpdateStrategy = {
|
|
56
|
+
rollingUpdate?: RollingUpdate
|
|
57
|
+
type?: string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type Condition = {
|
|
61
|
+
lastTransitionTime?: string
|
|
62
|
+
lastUpdateTime?: string
|
|
63
|
+
message?: string
|
|
64
|
+
reason?: string
|
|
65
|
+
status?: string
|
|
66
|
+
type?: string
|
|
67
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export enum SortDir {
|
|
8
|
+
desc = "desc",
|
|
9
|
+
asc = "asc",
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export enum SortBy {
|
|
13
|
+
SORT_BY_UNSPECIFIED = "SORT_BY_UNSPECIFIED",
|
|
14
|
+
field_name = "field_name",
|
|
15
|
+
state = "state",
|
|
16
|
+
workspace = "workspace",
|
|
17
|
+
cluster = "cluster",
|
|
18
|
+
namespace = "namespace",
|
|
19
|
+
created_at = "created_at",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type Pagination = {
|
|
23
|
+
total?: number
|
|
24
|
+
page?: number
|
|
25
|
+
pageSize?: number
|
|
26
|
+
pages?: number
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export enum ConditionStatus {
|
|
8
|
+
CONDITION_STATUS_UNSPECIFIED = "CONDITION_STATUS_UNSPECIFIED",
|
|
9
|
+
True = "True",
|
|
10
|
+
False = "False",
|
|
11
|
+
Unknown = "Unknown",
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as fm from "../../../fetch.pb"
|
|
8
|
+
import * as KairshipIoApiClusterV1alpha1Cluster from "../cluster/v1alpha1/cluster.pb"
|
|
9
|
+
import * as KairshipIoApiGuestbookV1alpha1Guestbook from "../guestbook/v1alpha1/guestbook.pb"
|
|
10
|
+
import * as KairshipIoApiPolicyV1alpha1Overridepolicy from "../policy/v1alpha1/overridepolicy.pb"
|
|
11
|
+
import * as KairshipIoApiPolicyV1alpha1Pp from "../policy/v1alpha1/pp.pb"
|
|
12
|
+
export class example {
|
|
13
|
+
static GetGuestBook(req: KairshipIoApiGuestbookV1alpha1Guestbook.GetGuestBookRequest, initReq?: fm.InitReq): Promise<KairshipIoApiGuestbookV1alpha1Guestbook.GuestBook> {
|
|
14
|
+
return fm.fetchReq<KairshipIoApiGuestbookV1alpha1Guestbook.GetGuestBookRequest, KairshipIoApiGuestbookV1alpha1Guestbook.GuestBook>(`/apis/kairship.io/v1alpha1/guestbooks/${req["name"]}?${fm.renderURLSearchParams(req, ["name"])}`, {...initReq, method: "GET"})
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class Policy {
|
|
18
|
+
static ListPropagationPolicies(req: KairshipIoApiPolicyV1alpha1Pp.ListAllPropagationPoliciesRequest, initReq?: fm.InitReq): Promise<KairshipIoApiPolicyV1alpha1Pp.ListPropagationPoliciesResponse> {
|
|
19
|
+
return fm.fetchReq<KairshipIoApiPolicyV1alpha1Pp.ListAllPropagationPoliciesRequest, KairshipIoApiPolicyV1alpha1Pp.ListPropagationPoliciesResponse>(`/apis/kairship.io/v1alpha1/instances/${req["instance"]}/namespaces/${req["namespace"]}/propagationpolicies?${fm.renderURLSearchParams(req, ["instance", "namespace"])}`, {...initReq, method: "GET"})
|
|
20
|
+
}
|
|
21
|
+
static ListOverridePolicies(req: KairshipIoApiPolicyV1alpha1Overridepolicy.ListAllOverridePoliciesRequest, initReq?: fm.InitReq): Promise<KairshipIoApiPolicyV1alpha1Overridepolicy.ListOverridePoliciesResponse> {
|
|
22
|
+
return fm.fetchReq<KairshipIoApiPolicyV1alpha1Overridepolicy.ListAllOverridePoliciesRequest, KairshipIoApiPolicyV1alpha1Overridepolicy.ListOverridePoliciesResponse>(`/apis/kairship.io/v1alpha1/instances/${req["instance"]}/namespaces/${req["namespace"]}/overridepolicies?${fm.renderURLSearchParams(req, ["instance", "namespace"])}`, {...initReq, method: "GET"})
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class Cluster {
|
|
26
|
+
static ListClusters(req: KairshipIoApiClusterV1alpha1Cluster.ListClustersRequest, initReq?: fm.InitReq): Promise<KairshipIoApiClusterV1alpha1Cluster.ListClustersResponse> {
|
|
27
|
+
return fm.fetchReq<KairshipIoApiClusterV1alpha1Cluster.ListClustersRequest, KairshipIoApiClusterV1alpha1Cluster.ListClustersResponse>(`/apis/kairship.io/v1alpha1/kpanda-clusters?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
28
|
+
}
|
|
29
|
+
static JoinCluster(req: KairshipIoApiClusterV1alpha1Cluster.JoinClusterRequest, initReq?: fm.InitReq): Promise<KairshipIoApiClusterV1alpha1Cluster.JoinClusterResponse> {
|
|
30
|
+
return fm.fetchReq<KairshipIoApiClusterV1alpha1Cluster.JoinClusterRequest, KairshipIoApiClusterV1alpha1Cluster.JoinClusterResponse>(`/apis/kairship.io/v1alpha1/instances/${req["instance"]}/kpanda-clusters`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
31
|
+
}
|
|
32
|
+
}
|
package/package.json
ADDED