@daocloud-proto/kangaroo 0.1.1-10

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 ADDED
@@ -0,0 +1,232 @@
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 interface InitReq extends RequestInit {
8
+ pathPrefix?: string
9
+ }
10
+
11
+ export function fetchReq<I, O>(path: string, init?: InitReq): Promise<O> {
12
+ const {pathPrefix, ...req} = init || {}
13
+
14
+ const url = pathPrefix ? `${pathPrefix}${path}` : path
15
+
16
+ return fetch(url, req).then(r => r.json().then((body: O) => {
17
+ if (!r.ok) { throw body; }
18
+ return body;
19
+ })) as Promise<O>
20
+ }
21
+
22
+ // NotifyStreamEntityArrival is a callback that will be called on streaming entity arrival
23
+ export type NotifyStreamEntityArrival<T> = (resp: T) => void
24
+
25
+ /**
26
+ * fetchStreamingRequest is able to handle grpc-gateway server side streaming call
27
+ * it takes NotifyStreamEntityArrival that lets users respond to entity arrival during the call
28
+ * all entities will be returned as an array after the call finishes.
29
+ **/
30
+ export async function fetchStreamingRequest<S, R>(path: string, callback?: NotifyStreamEntityArrival<R>, init?: InitReq) {
31
+ const {pathPrefix, ...req} = init || {}
32
+ const url = pathPrefix ?`${pathPrefix}${path}` : path
33
+ const result = await fetch(url, req)
34
+ // needs to use the .ok to check the status of HTTP status code
35
+ // http other than 200 will not throw an error, instead the .ok will become false.
36
+ // see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#
37
+ if (!result.ok) {
38
+ const resp = await result.json()
39
+ const errMsg = resp.error && resp.error.message ? resp.error.message : ""
40
+ throw new Error(errMsg)
41
+ }
42
+
43
+ if (!result.body) {
44
+ throw new Error("response doesnt have a body")
45
+ }
46
+
47
+ await result.body
48
+ .pipeThrough(new TextDecoderStream())
49
+ .pipeThrough<R>(getNewLineDelimitedJSONDecodingStream<R>())
50
+ .pipeTo(getNotifyEntityArrivalSink((e: R) => {
51
+ if (callback) {
52
+ callback(e)
53
+ }
54
+ }))
55
+
56
+ // wait for the streaming to finish and return the success respond
57
+ return
58
+ }
59
+
60
+ /**
61
+ * JSONStringStreamController represents the transform controller that's able to transform the incoming
62
+ * new line delimited json content stream into entities and able to push the entity to the down stream
63
+ */
64
+ interface JSONStringStreamController<T> extends TransformStreamDefaultController {
65
+ buf?: string
66
+ pos?: number
67
+ enqueue: (s: T) => void
68
+ }
69
+
70
+ /**
71
+ * getNewLineDelimitedJSONDecodingStream returns a TransformStream that's able to handle new line delimited json stream content into parsed entities
72
+ */
73
+ function getNewLineDelimitedJSONDecodingStream<T>(): TransformStream<string, T> {
74
+ return new TransformStream({
75
+ start(controller: JSONStringStreamController<T>) {
76
+ controller.buf = ''
77
+ controller.pos = 0
78
+ },
79
+
80
+ transform(chunk: string, controller: JSONStringStreamController<T>) {
81
+ if (controller.buf === undefined) {
82
+ controller.buf = ''
83
+ }
84
+ if (controller.pos === undefined) {
85
+ controller.pos = 0
86
+ }
87
+ controller.buf += chunk
88
+ while (controller.pos < controller.buf.length) {
89
+ if (controller.buf[controller.pos] === '\n') {
90
+ const line = controller.buf.substring(0, controller.pos)
91
+ const response = JSON.parse(line)
92
+ controller.enqueue(response.result)
93
+ controller.buf = controller.buf.substring(controller.pos + 1)
94
+ controller.pos = 0
95
+ } else {
96
+ ++controller.pos
97
+ }
98
+ }
99
+ }
100
+ })
101
+
102
+ }
103
+
104
+ /**
105
+ * getNotifyEntityArrivalSink takes the NotifyStreamEntityArrival callback and return
106
+ * a sink that will call the callback on entity arrival
107
+ * @param notifyCallback
108
+ */
109
+ function getNotifyEntityArrivalSink<T>(notifyCallback: NotifyStreamEntityArrival<T>) {
110
+ return new WritableStream<T>({
111
+ write(entity: T) {
112
+ notifyCallback(entity)
113
+ }
114
+ })
115
+ }
116
+
117
+ type Primitive = string | boolean | number;
118
+ type RequestPayload = Record<string, unknown>;
119
+ type FlattenedRequestPayload = Record<string, Primitive | Array<Primitive>>;
120
+
121
+ /**
122
+ * Checks if given value is a plain object
123
+ * Logic copied and adapted from below source:
124
+ * https://github.com/char0n/ramda-adjunct/blob/master/src/isPlainObj.js
125
+ * @param {unknown} value
126
+ * @return {boolean}
127
+ */
128
+ function isPlainObject(value: unknown): boolean {
129
+ const isObject =
130
+ Object.prototype.toString.call(value).slice(8, -1) === "Object";
131
+ const isObjLike = value !== null && isObject;
132
+
133
+ if (!isObjLike || !isObject) {
134
+ return false;
135
+ }
136
+
137
+ const proto = Object.getPrototypeOf(value);
138
+
139
+ const hasObjectConstructor =
140
+ typeof proto === "object" &&
141
+ proto.constructor === Object.prototype.constructor;
142
+
143
+ return hasObjectConstructor;
144
+ }
145
+
146
+ /**
147
+ * Checks if given value is of a primitive type
148
+ * @param {unknown} value
149
+ * @return {boolean}
150
+ */
151
+ function isPrimitive(value: unknown): boolean {
152
+ return ["string", "number", "boolean"].some(t => typeof value === t);
153
+ }
154
+
155
+ /**
156
+ * Checks if given primitive is zero-value
157
+ * @param {Primitive} value
158
+ * @return {boolean}
159
+ */
160
+ function isZeroValuePrimitive(value: Primitive): boolean {
161
+ return value === false || value === 0 || value === "";
162
+ }
163
+
164
+ /**
165
+ * Flattens a deeply nested request payload and returns an object
166
+ * with only primitive values and non-empty array of primitive values
167
+ * as per https://github.com/googleapis/googleapis/blob/master/google/api/http.proto
168
+ * @param {RequestPayload} requestPayload
169
+ * @param {String} path
170
+ * @return {FlattenedRequestPayload>}
171
+ */
172
+ function flattenRequestPayload<T extends RequestPayload>(
173
+ requestPayload: T,
174
+ path: string = ""
175
+ ): FlattenedRequestPayload {
176
+ return Object.keys(requestPayload).reduce(
177
+ (acc: T, key: string): T => {
178
+ const value = requestPayload[key];
179
+ const newPath = path ? [path, key].join(".") : key;
180
+
181
+ const isNonEmptyPrimitiveArray =
182
+ Array.isArray(value) &&
183
+ value.every(v => isPrimitive(v)) &&
184
+ value.length > 0;
185
+
186
+ const isNonZeroValuePrimitive =
187
+ isPrimitive(value) && !isZeroValuePrimitive(value as Primitive);
188
+
189
+ let objectToMerge = {};
190
+
191
+ if (isPlainObject(value)) {
192
+ objectToMerge = flattenRequestPayload(value as RequestPayload, newPath);
193
+ } else if (isNonZeroValuePrimitive || isNonEmptyPrimitiveArray) {
194
+ objectToMerge = { [newPath]: value };
195
+ }
196
+
197
+ return { ...acc, ...objectToMerge };
198
+ },
199
+ {} as T
200
+ ) as FlattenedRequestPayload;
201
+ }
202
+
203
+ /**
204
+ * Renders a deeply nested request payload into a string of URL search
205
+ * parameters by first flattening the request payload and then removing keys
206
+ * which are already present in the URL path.
207
+ * @param {RequestPayload} requestPayload
208
+ * @param {string[]} urlPathParams
209
+ * @return {string}
210
+ */
211
+ export function renderURLSearchParams<T extends RequestPayload>(
212
+ requestPayload: T,
213
+ urlPathParams: string[] = []
214
+ ): string {
215
+ const flattenedRequestPayload = flattenRequestPayload(requestPayload);
216
+
217
+ const urlSearchParams = Object.keys(flattenedRequestPayload).reduce(
218
+ (acc: string[][], key: string): string[][] => {
219
+ // key should not be present in the url path as a parameter
220
+ const value = flattenedRequestPayload[key];
221
+ if (urlPathParams.find(f => f === key)) {
222
+ return acc;
223
+ }
224
+ return Array.isArray(value)
225
+ ? [...acc, ...value.map(m => [key, m.toString()])]
226
+ : (acc = [...acc, [key, value.toString()]]);
227
+ },
228
+ [] as string[][]
229
+ );
230
+
231
+ return new URLSearchParams(urlSearchParams).toString();
232
+ }
@@ -0,0 +1 @@
1
+ export default {}
@@ -0,0 +1,7 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ /*
4
+ * This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
5
+ */
6
+ export type Empty = {
7
+ }
@@ -0,0 +1,44 @@
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 KangarooIoApiTypesPage from "../../types/page.pb"
8
+
9
+ export enum ListClusterRequestSortBy {
10
+ SORT_BY_UNSPECIFIED = "SORT_BY_UNSPECIFIED",
11
+ field_name = "field_name",
12
+ creation_time = "creation_time",
13
+ }
14
+
15
+ export enum ListNamespaceRequestSortBy {
16
+ SORT_BY_UNSPECIFIED = "SORT_BY_UNSPECIFIED",
17
+ field_name = "field_name",
18
+ creation_time = "creation_time",
19
+ }
20
+
21
+ export type ListClusterRequest = {
22
+ page?: number
23
+ pageSize?: number
24
+ sortBy?: ListClusterRequestSortBy
25
+ orderBy?: KangarooIoApiTypesPage.OrderBy
26
+ }
27
+
28
+ export type ListClusterResponse = {
29
+ items?: string[]
30
+ pagination?: KangarooIoApiTypesPage.Page
31
+ }
32
+
33
+ export type ListNamespaceRequest = {
34
+ cluster?: string
35
+ page?: number
36
+ pageSize?: number
37
+ sortBy?: ListNamespaceRequestSortBy
38
+ orderBy?: KangarooIoApiTypesPage.OrderBy
39
+ }
40
+
41
+ export type ListNamespaceResponse = {
42
+ items?: string[]
43
+ pagination?: KangarooIoApiTypesPage.Page
44
+ }
@@ -0,0 +1,227 @@
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 KangarooIoApiTypesObjectmeta from "../../types/objectmeta.pb"
8
+ import * as KangarooIoApiTypesPage from "../../types/page.pb"
9
+
10
+ export enum DatabaseSpecDatabaseType {
11
+ DATABASE_UNSPECIFIED = "DATABASE_UNSPECIFIED",
12
+ BUILT_IN_MODE = "BUILT_IN_MODE",
13
+ MCAMEL_MODE = "MCAMEL_MODE",
14
+ EXTERNAL_MODE = "EXTERNAL_MODE",
15
+ }
16
+
17
+ export enum CacheSpecCacheType {
18
+ CACHE_UNSPECIFIED = "CACHE_UNSPECIFIED",
19
+ BUILT_IN_MODE = "BUILT_IN_MODE",
20
+ MCAMEL_MODE = "MCAMEL_MODE",
21
+ EXTERNAL_MODE = "EXTERNAL_MODE",
22
+ }
23
+
24
+ export enum OCIStorageSpecStorageType {
25
+ STORAGE_UNSPECIFIED = "STORAGE_UNSPECIFIED",
26
+ S3 = "S3",
27
+ STORAGE_CLASS = "STORAGE_CLASS",
28
+ }
29
+
30
+ export enum ExposeSpecExposeType {
31
+ EXPOSE_UNSPECIFIED = "EXPOSE_UNSPECIFIED",
32
+ INGRESS = "INGRESS",
33
+ LOAD_BALANCE = "LOAD_BALANCE",
34
+ NODE_PORT = "NODE_PORT",
35
+ }
36
+
37
+ export enum HarborClusterStatusClusterStatus {
38
+ CLUSTER_STATUS_UNSPECIFIED = "CLUSTER_STATUS_UNSPECIFIED",
39
+ PROVISIONING = "PROVISIONING",
40
+ HEALTHY = "HEALTHY",
41
+ UNHEALTHY = "UNHEALTHY",
42
+ }
43
+
44
+ export type GetHarborParamsRequest = {
45
+ cluster?: string
46
+ }
47
+
48
+ export type GetHarborParamsResponse = {
49
+ version?: string[]
50
+ storage?: ResourceNameList[]
51
+ ingress?: ResourceNameList[]
52
+ }
53
+
54
+ export type ResourceNameList = {
55
+ name?: string
56
+ default?: boolean
57
+ }
58
+
59
+ export type VerifyHarborOperatorRequest = {
60
+ cluster?: string
61
+ namespace?: string
62
+ }
63
+
64
+ export type VerifyHarborOperatorResponse = {
65
+ status?: boolean
66
+ message?: string
67
+ }
68
+
69
+ export type HarborCluster = {
70
+ metadata?: KangarooIoApiTypesObjectmeta.ObjectMeta
71
+ spec?: HarborClusterSpec
72
+ status?: HarborClusterStatus
73
+ }
74
+
75
+ export type HarborClusterSpec = {
76
+ version?: string
77
+ replicas?: number
78
+ resources?: Resources
79
+ database?: DatabaseSpec
80
+ cache?: CacheSpec
81
+ storage?: OCIStorageSpec
82
+ expose?: ExposeSpec
83
+ userSyncToHarbor?: boolean
84
+ adminPassword?: string
85
+ }
86
+
87
+ export type Resources = {
88
+ requests?: {[key: string]: string}
89
+ limits?: {[key: string]: string}
90
+ }
91
+
92
+ export type DatabaseSpec = {
93
+ type?: DatabaseSpecDatabaseType
94
+ inSpec?: DBBuiltInModeSpec
95
+ mcamelSpec?: DBMcamelModeSpec
96
+ externalSpec?: DBExternalModeSpec
97
+ }
98
+
99
+ export type DBBuiltInModeSpec = {
100
+ }
101
+
102
+ export type DBMcamelModeSpec = {
103
+ }
104
+
105
+ export type DBExternalModeSpec = {
106
+ hostAndPort?: string
107
+ username?: string
108
+ password?: string
109
+ }
110
+
111
+ export type CacheSpec = {
112
+ type?: CacheSpecCacheType
113
+ inSpec?: CacheBuiltInModeSpec
114
+ mcamelSpec?: CacheMcamelModeSpec
115
+ externalSpec?: CacheExternalModeSpec
116
+ }
117
+
118
+ export type CacheBuiltInModeSpec = {
119
+ }
120
+
121
+ export type CacheMcamelModeSpec = {
122
+ }
123
+
124
+ export type CacheExternalModeSpec = {
125
+ hostAndPort?: string
126
+ username?: string
127
+ password?: string
128
+ }
129
+
130
+ export type OCIStorageSpec = {
131
+ type?: OCIStorageSpecStorageType
132
+ s3Spec?: S3Spec
133
+ scSpec?: StorageClassSpec
134
+ }
135
+
136
+ export type StorageClassSpec = {
137
+ name?: string
138
+ resource?: Resources
139
+ }
140
+
141
+ export type S3Spec = {
142
+ accessKey?: string
143
+ secretKey?: string
144
+ region?: string
145
+ regionEndpoint?: string
146
+ bucket?: string
147
+ skipVerify?: boolean
148
+ v4Auth?: boolean
149
+ }
150
+
151
+ export type ExposeSpec = {
152
+ type?: ExposeSpecExposeType
153
+ ingressSpec?: ExposeIngressSpec
154
+ loadBalanceSpec?: ExposeLoadBalanceSpec
155
+ nodePortSpec?: ExposeNodePortSpec
156
+ }
157
+
158
+ export type ExposeIngressSpec = {
159
+ host?: string
160
+ ingressClassName?: string
161
+ }
162
+
163
+ export type ExposeLoadBalanceSpec = {
164
+ }
165
+
166
+ export type ExposeNodePortSpec = {
167
+ }
168
+
169
+ export type HarborClusterStatus = {
170
+ status?: HarborClusterStatusClusterStatus
171
+ }
172
+
173
+ export type CreateHarborClusterRequest = {
174
+ cluster?: string
175
+ namespace?: string
176
+ name?: string
177
+ metadata?: KangarooIoApiTypesObjectmeta.ObjectMeta
178
+ spec?: HarborClusterSpec
179
+ }
180
+
181
+ export type UpdateHarborClusterRequest = {
182
+ cluster?: string
183
+ namespace?: string
184
+ name?: string
185
+ spec?: HarborClusterSpec
186
+ }
187
+
188
+ export type GetHarborClusterRequest = {
189
+ cluster?: string
190
+ namespace?: string
191
+ name?: string
192
+ }
193
+
194
+ export type DeleteHarborCluster = {
195
+ cluster?: string
196
+ namespace?: string
197
+ name?: string
198
+ }
199
+
200
+ export type ListHarborClusterRequest = {
201
+ page?: number
202
+ pageSize?: number
203
+ sortBy?: KangarooIoApiTypesPage.SortBy
204
+ orderBy?: KangarooIoApiTypesPage.OrderBy
205
+ }
206
+
207
+ export type ListHarborClusterResponse = {
208
+ items?: HarborCluster[]
209
+ pagination?: KangarooIoApiTypesPage.Page
210
+ }
211
+
212
+ export type GetStorageStatisticRequest = {
213
+ cluster?: string
214
+ namespace?: string
215
+ name?: string
216
+ start?: string
217
+ end?: string
218
+ }
219
+
220
+ export type GetStorageStatisticResponse = {
221
+ data?: StorageStatisticItem[]
222
+ }
223
+
224
+ export type StorageStatisticItem = {
225
+ timestamp?: string
226
+ value?: string
227
+ }
@@ -0,0 +1,85 @@
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 KangarooIoApiTypesPage from "../../types/page.pb"
8
+
9
+ export enum ListProjectRequestSortBy {
10
+ SORT_BY_UNSPECIFIED = "SORT_BY_UNSPECIFIED",
11
+ field_name = "field_name",
12
+ creation_time = "creation_time",
13
+ }
14
+
15
+ export type Project = {
16
+ chartCount?: string
17
+ creationTime?: string
18
+ currentUserRoleID?: string
19
+ currentUserRoleIds?: number[]
20
+ cVEAllowList?: CVEAllowList
21
+ deleted?: boolean
22
+ metadata?: ProjectMetadata
23
+ name?: string
24
+ ownerID?: number
25
+ ownerName?: string
26
+ projectID?: number
27
+ registryID?: string
28
+ repoCount?: string
29
+ togglable?: boolean
30
+ updateTime?: string
31
+ }
32
+
33
+ export type CVEAllowList = {
34
+ creationTime?: string
35
+ expiresAt?: string
36
+ id?: string
37
+ items?: CVEAllowListItem[]
38
+ projectID?: string
39
+ updateTime?: string
40
+ }
41
+
42
+ export type CVEAllowListItem = {
43
+ cVEID?: string
44
+ }
45
+
46
+ export type ProjectMetadata = {
47
+ autoScan?: string
48
+ enableContentTrust?: string
49
+ enableContentTrustCosign?: string
50
+ preventVul?: string
51
+ public?: string
52
+ retentionID?: string
53
+ reuseSysCVEAllowList?: string
54
+ severity?: string
55
+ }
56
+
57
+ export type ListProjectRequest = {
58
+ cluster?: string
59
+ namespace?: string
60
+ harbor?: string
61
+ page?: number
62
+ pageSize?: number
63
+ sortBy?: ListProjectRequestSortBy
64
+ orderBy?: KangarooIoApiTypesPage.OrderBy
65
+ }
66
+
67
+ export type ListProjectResponse = {
68
+ items?: Project[]
69
+ pagination?: KangarooIoApiTypesPage.Page
70
+ }
71
+
72
+ export type DeleteProjectRequest = {
73
+ cluster?: string
74
+ namespace?: string
75
+ harbor?: string
76
+ name?: string
77
+ }
78
+
79
+ export type CreateProjectRequest = {
80
+ cluster?: string
81
+ namespace?: string
82
+ harbor?: string
83
+ name?: string
84
+ public?: boolean
85
+ }
@@ -0,0 +1,48 @@
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 KangarooIoApiTypesPage from "../../types/page.pb"
8
+
9
+ export enum ListRepositoriesRequestSortBy {
10
+ SORT_BY_UNSPECIFIED = "SORT_BY_UNSPECIFIED",
11
+ name = "name",
12
+ creation_time = "creation_time",
13
+ }
14
+
15
+ export type Repository = {
16
+ artifactCount?: string
17
+ creationTime?: string
18
+ description?: string
19
+ id?: string
20
+ name?: string
21
+ projectId?: string
22
+ pullCount?: string
23
+ updateTime?: string
24
+ }
25
+
26
+ export type ListRepositoriesRequest = {
27
+ cluster?: string
28
+ namespace?: string
29
+ harbor?: string
30
+ project?: string
31
+ page?: number
32
+ pageSize?: number
33
+ sortBy?: ListRepositoriesRequestSortBy
34
+ orderBy?: KangarooIoApiTypesPage.OrderBy
35
+ }
36
+
37
+ export type ListRepositoriesResponse = {
38
+ items?: Repository[]
39
+ pagination?: KangarooIoApiTypesPage.Page
40
+ }
41
+
42
+ export type DeleteRepositoryRequest = {
43
+ cluster?: string
44
+ namespace?: string
45
+ harbor?: string
46
+ project?: string
47
+ name?: string
48
+ }
@@ -0,0 +1,63 @@
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 GoogleProtobufEmpty from "../../../../google/protobuf/empty.pb"
9
+ import * as KangarooIoApiHarborV1alpha1Cluster from "./cluster.pb"
10
+ import * as KangarooIoApiHarborV1alpha1Harbor from "./harbor.pb"
11
+ import * as KangarooIoApiHarborV1alpha1Project from "./project.pb"
12
+ import * as KangarooIoApiHarborV1alpha1Repository from "./repository.pb"
13
+ export class Harbor {
14
+ static GetHarborParams(req: KangarooIoApiHarborV1alpha1Harbor.GetHarborParamsRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Harbor.GetHarborParamsResponse> {
15
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Harbor.GetHarborParamsRequest, KangarooIoApiHarborV1alpha1Harbor.GetHarborParamsResponse>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/harbors/default-params?${fm.renderURLSearchParams(req, ["cluster"])}`, {...initReq, method: "GET"})
16
+ }
17
+ static VerifyHarborOperator(req: KangarooIoApiHarborV1alpha1Harbor.VerifyHarborOperatorRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Harbor.VerifyHarborOperatorResponse> {
18
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Harbor.VerifyHarborOperatorRequest, KangarooIoApiHarborV1alpha1Harbor.VerifyHarborOperatorResponse>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/check?${fm.renderURLSearchParams(req, ["cluster", "namespace"])}`, {...initReq, method: "GET"})
19
+ }
20
+ static GetHarborCluster(req: KangarooIoApiHarborV1alpha1Harbor.GetHarborClusterRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Harbor.HarborCluster> {
21
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Harbor.GetHarborClusterRequest, KangarooIoApiHarborV1alpha1Harbor.HarborCluster>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["name"]}?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
22
+ }
23
+ static ListHarborClusters(req: KangarooIoApiHarborV1alpha1Harbor.ListHarborClusterRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Harbor.ListHarborClusterResponse> {
24
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Harbor.ListHarborClusterRequest, KangarooIoApiHarborV1alpha1Harbor.ListHarborClusterResponse>(`/apis/kangaroo.io/v1alpha1/harbors?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
25
+ }
26
+ static CreateHarborCluster(req: KangarooIoApiHarborV1alpha1Harbor.CreateHarborClusterRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Harbor.HarborCluster> {
27
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Harbor.CreateHarborClusterRequest, KangarooIoApiHarborV1alpha1Harbor.HarborCluster>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["name"]}`, {...initReq, method: "POST", body: JSON.stringify(req)})
28
+ }
29
+ static UpdateHarborCluster(req: KangarooIoApiHarborV1alpha1Harbor.UpdateHarborClusterRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Harbor.HarborCluster> {
30
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Harbor.UpdateHarborClusterRequest, KangarooIoApiHarborV1alpha1Harbor.HarborCluster>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["name"]}`, {...initReq, method: "PUT", body: JSON.stringify(req)})
31
+ }
32
+ static DeleteHarborCluster(req: KangarooIoApiHarborV1alpha1Harbor.DeleteHarborCluster, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
33
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Harbor.DeleteHarborCluster, GoogleProtobufEmpty.Empty>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["name"]}`, {...initReq, method: "DELETE"})
34
+ }
35
+ static ListCluster(req: KangarooIoApiHarborV1alpha1Cluster.ListClusterRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Cluster.ListClusterResponse> {
36
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Cluster.ListClusterRequest, KangarooIoApiHarborV1alpha1Cluster.ListClusterResponse>(`/apis/kangaroo.io/v1alpha1/cluster?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
37
+ }
38
+ static ListNamespace(req: KangarooIoApiHarborV1alpha1Cluster.ListNamespaceRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Cluster.ListNamespaceResponse> {
39
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Cluster.ListNamespaceRequest, KangarooIoApiHarborV1alpha1Cluster.ListNamespaceResponse>(`/apis/kangaroo.io/v1alpha1/cluster/${req["cluster"]}/namespace?${fm.renderURLSearchParams(req, ["cluster"])}`, {...initReq, method: "GET"})
40
+ }
41
+ static GetStorageStatistic(req: KangarooIoApiHarborV1alpha1Harbor.GetStorageStatisticRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Harbor.GetStorageStatisticResponse> {
42
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Harbor.GetStorageStatisticRequest, KangarooIoApiHarborV1alpha1Harbor.GetStorageStatisticResponse>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["name"]}/storage_statistic?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
43
+ }
44
+ }
45
+ export class HarborProject {
46
+ static ListProject(req: KangarooIoApiHarborV1alpha1Project.ListProjectRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Project.ListProjectResponse> {
47
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Project.ListProjectRequest, KangarooIoApiHarborV1alpha1Project.ListProjectResponse>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["harbor"]}/projects?${fm.renderURLSearchParams(req, ["cluster", "namespace", "harbor"])}`, {...initReq, method: "GET"})
48
+ }
49
+ static DeleteProject(req: KangarooIoApiHarborV1alpha1Project.DeleteProjectRequest, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
50
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Project.DeleteProjectRequest, GoogleProtobufEmpty.Empty>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["harbor"]}/projects/${req["name"]}`, {...initReq, method: "DELETE"})
51
+ }
52
+ static CreateProject(req: KangarooIoApiHarborV1alpha1Project.CreateProjectRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Project.Project> {
53
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Project.CreateProjectRequest, KangarooIoApiHarborV1alpha1Project.Project>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["harbor"]}/project`, {...initReq, method: "POST", body: JSON.stringify(req)})
54
+ }
55
+ }
56
+ export class HarborRepository {
57
+ static ListRepositories(req: KangarooIoApiHarborV1alpha1Repository.ListRepositoriesRequest, initReq?: fm.InitReq): Promise<KangarooIoApiHarborV1alpha1Repository.ListRepositoriesResponse> {
58
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Repository.ListRepositoriesRequest, KangarooIoApiHarborV1alpha1Repository.ListRepositoriesResponse>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["harbor"]}/projects/${req["project"]}/repositories?${fm.renderURLSearchParams(req, ["cluster", "namespace", "harbor", "project"])}`, {...initReq, method: "GET"})
59
+ }
60
+ static DeleteRepository(req: KangarooIoApiHarborV1alpha1Repository.DeleteRepositoryRequest, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
61
+ return fm.fetchReq<KangarooIoApiHarborV1alpha1Repository.DeleteRepositoryRequest, GoogleProtobufEmpty.Empty>(`/apis/kangaroo.io/v1alpha1/clusters/${req["cluster"]}/namespaces/${req["namespace"]}/harbors/${req["harbor"]}/projects/${req["project"]}/repositories/${req["name"]}`, {...initReq, method: "DELETE"})
62
+ }
63
+ }
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ /*
4
+ * This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
5
+ */
6
+ export type ObjectMeta = {
7
+ name?: string
8
+ namespace?: string
9
+ cluster?: string
10
+ annotations?: {[key: string]: string}
11
+ }
@@ -0,0 +1,23 @@
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 OrderBy {
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
+ created_at = "created_at",
16
+ }
17
+
18
+ export type Page = {
19
+ page?: number
20
+ size?: number
21
+ total?: number
22
+ pages?: number
23
+ }
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name":"@daocloud-proto/kangaroo",
3
+ "version":"0.1.1-10",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC"
12
+ }
@@ -0,0 +1 @@
1
+ export default {}
@@ -0,0 +1,266 @@
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 GoogleProtobufDuration from "../../google/protobuf/duration.pb"
8
+ import * as GoogleProtobufTimestamp from "../../google/protobuf/timestamp.pb"
9
+
10
+ type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined };
11
+ type OneOf<T> =
12
+ | { [k in keyof T]?: undefined }
13
+ | (
14
+ keyof T extends infer K ?
15
+ (K extends string & keyof T ? { [k in K]: T[K] } & Absent<T, K>
16
+ : never)
17
+ : never);
18
+
19
+ export enum KnownRegex {
20
+ UNKNOWN = "UNKNOWN",
21
+ HTTP_HEADER_NAME = "HTTP_HEADER_NAME",
22
+ HTTP_HEADER_VALUE = "HTTP_HEADER_VALUE",
23
+ }
24
+
25
+
26
+ type BaseFieldRules = {
27
+ message?: MessageRules
28
+ }
29
+
30
+ export type FieldRules = BaseFieldRules
31
+ & OneOf<{ float: FloatRules; double: DoubleRules; int32: Int32Rules; int64: Int64Rules; uint32: UInt32Rules; uint64: UInt64Rules; sint32: SInt32Rules; sint64: SInt64Rules; fixed32: Fixed32Rules; fixed64: Fixed64Rules; sfixed32: SFixed32Rules; sfixed64: SFixed64Rules; bool: BoolRules; string: StringRules; bytes: BytesRules; enum: EnumRules; repeated: RepeatedRules; map: MapRules; any: AnyRules; duration: DurationRules; timestamp: TimestampRules }>
32
+
33
+ export type FloatRules = {
34
+ const?: number
35
+ lt?: number
36
+ lte?: number
37
+ gt?: number
38
+ gte?: number
39
+ in?: number[]
40
+ notIn?: number[]
41
+ ignoreEmpty?: boolean
42
+ }
43
+
44
+ export type DoubleRules = {
45
+ const?: number
46
+ lt?: number
47
+ lte?: number
48
+ gt?: number
49
+ gte?: number
50
+ in?: number[]
51
+ notIn?: number[]
52
+ ignoreEmpty?: boolean
53
+ }
54
+
55
+ export type Int32Rules = {
56
+ const?: number
57
+ lt?: number
58
+ lte?: number
59
+ gt?: number
60
+ gte?: number
61
+ in?: number[]
62
+ notIn?: number[]
63
+ ignoreEmpty?: boolean
64
+ }
65
+
66
+ export type Int64Rules = {
67
+ const?: string
68
+ lt?: string
69
+ lte?: string
70
+ gt?: string
71
+ gte?: string
72
+ in?: string[]
73
+ notIn?: string[]
74
+ ignoreEmpty?: boolean
75
+ }
76
+
77
+ export type UInt32Rules = {
78
+ const?: number
79
+ lt?: number
80
+ lte?: number
81
+ gt?: number
82
+ gte?: number
83
+ in?: number[]
84
+ notIn?: number[]
85
+ ignoreEmpty?: boolean
86
+ }
87
+
88
+ export type UInt64Rules = {
89
+ const?: string
90
+ lt?: string
91
+ lte?: string
92
+ gt?: string
93
+ gte?: string
94
+ in?: string[]
95
+ notIn?: string[]
96
+ ignoreEmpty?: boolean
97
+ }
98
+
99
+ export type SInt32Rules = {
100
+ const?: number
101
+ lt?: number
102
+ lte?: number
103
+ gt?: number
104
+ gte?: number
105
+ in?: number[]
106
+ notIn?: number[]
107
+ ignoreEmpty?: boolean
108
+ }
109
+
110
+ export type SInt64Rules = {
111
+ const?: string
112
+ lt?: string
113
+ lte?: string
114
+ gt?: string
115
+ gte?: string
116
+ in?: string[]
117
+ notIn?: string[]
118
+ ignoreEmpty?: boolean
119
+ }
120
+
121
+ export type Fixed32Rules = {
122
+ const?: number
123
+ lt?: number
124
+ lte?: number
125
+ gt?: number
126
+ gte?: number
127
+ in?: number[]
128
+ notIn?: number[]
129
+ ignoreEmpty?: boolean
130
+ }
131
+
132
+ export type Fixed64Rules = {
133
+ const?: string
134
+ lt?: string
135
+ lte?: string
136
+ gt?: string
137
+ gte?: string
138
+ in?: string[]
139
+ notIn?: string[]
140
+ ignoreEmpty?: boolean
141
+ }
142
+
143
+ export type SFixed32Rules = {
144
+ const?: number
145
+ lt?: number
146
+ lte?: number
147
+ gt?: number
148
+ gte?: number
149
+ in?: number[]
150
+ notIn?: number[]
151
+ ignoreEmpty?: boolean
152
+ }
153
+
154
+ export type SFixed64Rules = {
155
+ const?: string
156
+ lt?: string
157
+ lte?: string
158
+ gt?: string
159
+ gte?: string
160
+ in?: string[]
161
+ notIn?: string[]
162
+ ignoreEmpty?: boolean
163
+ }
164
+
165
+ export type BoolRules = {
166
+ const?: boolean
167
+ }
168
+
169
+
170
+ type BaseStringRules = {
171
+ const?: string
172
+ len?: string
173
+ minLen?: string
174
+ maxLen?: string
175
+ lenBytes?: string
176
+ minBytes?: string
177
+ maxBytes?: string
178
+ pattern?: string
179
+ prefix?: string
180
+ suffix?: string
181
+ contains?: string
182
+ notContains?: string
183
+ in?: string[]
184
+ notIn?: string[]
185
+ strict?: boolean
186
+ ignoreEmpty?: boolean
187
+ }
188
+
189
+ export type StringRules = BaseStringRules
190
+ & OneOf<{ email: boolean; hostname: boolean; ip: boolean; ipv4: boolean; ipv6: boolean; uri: boolean; uriRef: boolean; address: boolean; uuid: boolean; wellKnownRegex: KnownRegex }>
191
+
192
+
193
+ type BaseBytesRules = {
194
+ const?: Uint8Array
195
+ len?: string
196
+ minLen?: string
197
+ maxLen?: string
198
+ pattern?: string
199
+ prefix?: Uint8Array
200
+ suffix?: Uint8Array
201
+ contains?: Uint8Array
202
+ in?: Uint8Array[]
203
+ notIn?: Uint8Array[]
204
+ ignoreEmpty?: boolean
205
+ }
206
+
207
+ export type BytesRules = BaseBytesRules
208
+ & OneOf<{ ip: boolean; ipv4: boolean; ipv6: boolean }>
209
+
210
+ export type EnumRules = {
211
+ const?: number
212
+ definedOnly?: boolean
213
+ in?: number[]
214
+ notIn?: number[]
215
+ }
216
+
217
+ export type MessageRules = {
218
+ skip?: boolean
219
+ required?: boolean
220
+ }
221
+
222
+ export type RepeatedRules = {
223
+ minItems?: string
224
+ maxItems?: string
225
+ unique?: boolean
226
+ items?: FieldRules
227
+ ignoreEmpty?: boolean
228
+ }
229
+
230
+ export type MapRules = {
231
+ minPairs?: string
232
+ maxPairs?: string
233
+ noSparse?: boolean
234
+ keys?: FieldRules
235
+ values?: FieldRules
236
+ ignoreEmpty?: boolean
237
+ }
238
+
239
+ export type AnyRules = {
240
+ required?: boolean
241
+ in?: string[]
242
+ notIn?: string[]
243
+ }
244
+
245
+ export type DurationRules = {
246
+ required?: boolean
247
+ const?: GoogleProtobufDuration.Duration
248
+ lt?: GoogleProtobufDuration.Duration
249
+ lte?: GoogleProtobufDuration.Duration
250
+ gt?: GoogleProtobufDuration.Duration
251
+ gte?: GoogleProtobufDuration.Duration
252
+ in?: GoogleProtobufDuration.Duration[]
253
+ notIn?: GoogleProtobufDuration.Duration[]
254
+ }
255
+
256
+ export type TimestampRules = {
257
+ required?: boolean
258
+ const?: GoogleProtobufTimestamp.Timestamp
259
+ lt?: GoogleProtobufTimestamp.Timestamp
260
+ lte?: GoogleProtobufTimestamp.Timestamp
261
+ gt?: GoogleProtobufTimestamp.Timestamp
262
+ gte?: GoogleProtobufTimestamp.Timestamp
263
+ ltNow?: boolean
264
+ gtNow?: boolean
265
+ within?: GoogleProtobufDuration.Duration
266
+ }