@daocloud-proto/mcamel-redis 0.0.1-5
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/cluster.pb.ts +62 -0
- package/common.pb.ts +24 -0
- package/fetch.pb.ts +232 -0
- package/package.json +12 -0
- package/redis.pb.ts +363 -0
- package/version.pb.ts +27 -0
package/cluster.pb.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
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 CommonCommon from "./common.pb"
|
|
8
|
+
import * as fm from "./fetch.pb"
|
|
9
|
+
|
|
10
|
+
export enum GetWorkspaceListReqSortDir {
|
|
11
|
+
ASC = "ASC",
|
|
12
|
+
DESC = "DESC",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type GetWorkspaceListReq = {
|
|
16
|
+
page?: number
|
|
17
|
+
pageSize?: number
|
|
18
|
+
sortDir?: GetWorkspaceListReqSortDir
|
|
19
|
+
sortBy?: string
|
|
20
|
+
searchKey?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type GetWorkspaceListRespItem = {
|
|
24
|
+
workspaceId?: number
|
|
25
|
+
alias?: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type GetWorkspaceListResp = {
|
|
29
|
+
items?: GetWorkspaceListRespItem[]
|
|
30
|
+
pagination?: CommonCommon.Pagination
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type GetClusterListReq = {
|
|
34
|
+
workspaceId?: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type GetClusterListResp = {
|
|
38
|
+
items?: string[]
|
|
39
|
+
pagination?: CommonCommon.Pagination
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type GetClusterNamespaceListReq = {
|
|
43
|
+
workspaceId?: number
|
|
44
|
+
cluster?: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type GetClusterNamespaceListResp = {
|
|
48
|
+
items?: string[]
|
|
49
|
+
pagination?: CommonCommon.Pagination
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class Cluster {
|
|
53
|
+
static GetClusterList(req: GetClusterListReq, initReq?: fm.InitReq): Promise<GetClusterListResp> {
|
|
54
|
+
return fm.fetchReq<GetClusterListReq, GetClusterListResp>(`/apis/mcamel.io/redis/v1alpha1/${req["workspaceId"]}/clusters?${fm.renderURLSearchParams(req, ["workspaceId"])}`, {...initReq, method: "GET"})
|
|
55
|
+
}
|
|
56
|
+
static GetClusterNamespaceList(req: GetClusterNamespaceListReq, initReq?: fm.InitReq): Promise<GetClusterNamespaceListResp> {
|
|
57
|
+
return fm.fetchReq<GetClusterNamespaceListReq, GetClusterNamespaceListResp>(`/apis/mcamel.io/redis/v1alpha1/${req["workspaceId"]}/${req["cluster"]}/namespaces?${fm.renderURLSearchParams(req, ["workspaceId", "cluster"])}`, {...initReq, method: "GET"})
|
|
58
|
+
}
|
|
59
|
+
static GetWorkspaceList(req: GetWorkspaceListReq, initReq?: fm.InitReq): Promise<GetWorkspaceListResp> {
|
|
60
|
+
return fm.fetchReq<GetWorkspaceListReq, GetWorkspaceListResp>(`/apis/mcamel.io/redis/v1alpha1/workspaces?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
61
|
+
}
|
|
62
|
+
}
|
package/common.pb.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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 PageInfoReqSortDir {
|
|
8
|
+
ASC = "ASC",
|
|
9
|
+
DESC = "DESC",
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type Pagination = {
|
|
13
|
+
total?: number
|
|
14
|
+
page?: number
|
|
15
|
+
pageSize?: number
|
|
16
|
+
pages?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type PageInfoReq = {
|
|
20
|
+
page?: number
|
|
21
|
+
pageSize?: number
|
|
22
|
+
sortDir?: PageInfoReqSortDir
|
|
23
|
+
sortBy?: string
|
|
24
|
+
}
|
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
|
+
}
|
package/package.json
ADDED
package/redis.pb.ts
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
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 CommonCommon from "./common.pb"
|
|
8
|
+
import * as fm from "./fetch.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 InstanceType {
|
|
20
|
+
RedisStandalone = "RedisStandalone",
|
|
21
|
+
RedisFailover = "RedisFailover",
|
|
22
|
+
RedisCluster = "RedisCluster",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export enum Status {
|
|
26
|
+
Failed = "Failed",
|
|
27
|
+
Running = "Running",
|
|
28
|
+
Creating = "Creating",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum RedisPodType {
|
|
32
|
+
StandaloneRedis = "StandaloneRedis",
|
|
33
|
+
SentinelRedis = "SentinelRedis",
|
|
34
|
+
Sentinel = "Sentinel",
|
|
35
|
+
LeaderRedis = "LeaderRedis",
|
|
36
|
+
FollowerRedis = "FollowerRedis",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export enum GetRedisListReqSortDir {
|
|
40
|
+
ASC = "ASC",
|
|
41
|
+
DESC = "DESC",
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export enum GetRedisConfReqSortDir {
|
|
45
|
+
ASC = "ASC",
|
|
46
|
+
DESC = "DESC",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export enum CreateRedisReqServiceType {
|
|
50
|
+
ClusterIP = "ClusterIP",
|
|
51
|
+
NodePort = "NodePort",
|
|
52
|
+
LoadBalancer = "LoadBalancer",
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export enum GetRedisParamRespSelectSelectType {
|
|
56
|
+
Single = "Single",
|
|
57
|
+
Multiple = "Multiple",
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export enum GetRedisNodeListRespPodStatus {
|
|
61
|
+
PHASE_UNSPECIFIED = "PHASE_UNSPECIFIED",
|
|
62
|
+
Unknown = "Unknown",
|
|
63
|
+
Pending = "Pending",
|
|
64
|
+
Running = "Running",
|
|
65
|
+
Succeeded = "Succeeded",
|
|
66
|
+
Failed = "Failed",
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export enum GetRedisConfRespItemsParamType {
|
|
70
|
+
authPass = "authPass",
|
|
71
|
+
conf = "conf",
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type GetRedisListReq = {
|
|
75
|
+
page?: number
|
|
76
|
+
pageSize?: number
|
|
77
|
+
sortDir?: GetRedisListReqSortDir
|
|
78
|
+
sortBy?: string
|
|
79
|
+
searchKey?: string
|
|
80
|
+
workspaceId?: number
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type GetRedisConfReq = {
|
|
84
|
+
page?: number
|
|
85
|
+
pageSize?: number
|
|
86
|
+
sortDir?: GetRedisConfReqSortDir
|
|
87
|
+
sortBy?: string
|
|
88
|
+
searchKey?: string
|
|
89
|
+
cluster?: string
|
|
90
|
+
namespace?: string
|
|
91
|
+
name?: string
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type GetRedisParamReq = {
|
|
95
|
+
cluster?: string
|
|
96
|
+
instanceType?: InstanceType
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type CreateRedisReqPorts = {
|
|
100
|
+
name?: string
|
|
101
|
+
protocol?: string
|
|
102
|
+
port?: number
|
|
103
|
+
targetPort?: number
|
|
104
|
+
nodePort?: number
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type CreateRedisReq = {
|
|
108
|
+
cluster?: string
|
|
109
|
+
namespace?: string
|
|
110
|
+
name?: string
|
|
111
|
+
describe?: string
|
|
112
|
+
replicas?: number
|
|
113
|
+
storageClassName?: string
|
|
114
|
+
storageCapacity?: string
|
|
115
|
+
instanceType?: InstanceType
|
|
116
|
+
authPass?: string
|
|
117
|
+
serviceType?: CreateRedisReqServiceType
|
|
118
|
+
serviceAnnotations?: {[key: string]: string}
|
|
119
|
+
ports?: CreateRedisReqPorts[]
|
|
120
|
+
cpuRequest?: string
|
|
121
|
+
cpuLimit?: string
|
|
122
|
+
memoryRequest?: string
|
|
123
|
+
memoryLimit?: string
|
|
124
|
+
conf?: string
|
|
125
|
+
version?: string
|
|
126
|
+
followerReplicas?: number
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type UpdateRedisConfReq = {
|
|
130
|
+
cluster?: string
|
|
131
|
+
namespace?: string
|
|
132
|
+
name?: string
|
|
133
|
+
authPass?: string
|
|
134
|
+
conf?: string
|
|
135
|
+
instanceType?: InstanceType
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export type UpdateRedisParamsReq = {
|
|
139
|
+
cluster?: string
|
|
140
|
+
namespace?: string
|
|
141
|
+
name?: string
|
|
142
|
+
replicas?: number
|
|
143
|
+
storageCapacity?: string
|
|
144
|
+
serviceType?: CreateRedisReqServiceType
|
|
145
|
+
serviceAnnotations?: {[key: string]: string}
|
|
146
|
+
describe?: string
|
|
147
|
+
ports?: CreateRedisReqPorts[]
|
|
148
|
+
cpuRequest?: string
|
|
149
|
+
cpuLimit?: string
|
|
150
|
+
memoryRequest?: string
|
|
151
|
+
memoryLimit?: string
|
|
152
|
+
instanceType?: InstanceType
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type UpdateRedisParamsResp = {
|
|
156
|
+
message?: string
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type UpdateRedisConfResp = {
|
|
160
|
+
message?: string
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export type GetRedisParamRespSelectDataStringValue = {
|
|
164
|
+
value?: string
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type GetRedisParamRespSelectDataResourceValue = {
|
|
168
|
+
cpuRequest?: string
|
|
169
|
+
cpuLimit?: string
|
|
170
|
+
memoryRequest?: string
|
|
171
|
+
memoryLimit?: string
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export type GetRedisParamRespSelectDataIntValue = {
|
|
175
|
+
value?: number
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export type GetRedisParamRespSelectDataInstanceTypeValue = {
|
|
179
|
+
value?: InstanceType
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
type BaseGetRedisParamRespSelectData = {
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export type GetRedisParamRespSelectData = BaseGetRedisParamRespSelectData
|
|
187
|
+
& OneOf<{ sValue: GetRedisParamRespSelectDataStringValue; rValue: GetRedisParamRespSelectDataResourceValue; iValue: GetRedisParamRespSelectDataIntValue; tValue: GetRedisParamRespSelectDataInstanceTypeValue }>
|
|
188
|
+
|
|
189
|
+
export type GetRedisParamRespSelect = {
|
|
190
|
+
selectType?: GetRedisParamRespSelectSelectType
|
|
191
|
+
data?: GetRedisParamRespSelectData[]
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export type GetRedisParamResp = {
|
|
195
|
+
version?: GetRedisParamRespSelect
|
|
196
|
+
replicas?: GetRedisParamRespSelect
|
|
197
|
+
resource?: GetRedisParamRespSelect
|
|
198
|
+
storage?: GetRedisParamRespSelect
|
|
199
|
+
conf?: GetRedisParamRespSelect
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export type CreateRedisResp = {
|
|
203
|
+
message?: string
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export type GetRedisOperatorVersionListReq = {
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export type GetRedisOperatorVersionListRespGetRedisOperatorVersionListData = {
|
|
210
|
+
cluster?: string
|
|
211
|
+
namespace?: string
|
|
212
|
+
version?: string
|
|
213
|
+
instanceType?: InstanceType[]
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export type GetRedisOperatorVersionListResp = {
|
|
217
|
+
items?: GetRedisOperatorVersionListRespGetRedisOperatorVersionListData[]
|
|
218
|
+
pagination?: CommonCommon.Pagination
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export type DeleteRedisReq = {
|
|
222
|
+
cluster?: string
|
|
223
|
+
namespace?: string
|
|
224
|
+
name?: string
|
|
225
|
+
instanceType?: InstanceType
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export type DeleteRedissReq = {
|
|
229
|
+
data?: DeleteRedisReq[]
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type DeleteRedisResp = {
|
|
233
|
+
message?: string
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export type DeleteRedissResp = {
|
|
237
|
+
message?: string
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export type GetRedisNodeListReq = {
|
|
241
|
+
cluster?: string
|
|
242
|
+
namespace?: string
|
|
243
|
+
name?: string
|
|
244
|
+
instanceType?: InstanceType
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export type GetRedisNodeListRespData = {
|
|
248
|
+
podName?: string
|
|
249
|
+
status?: GetRedisNodeListRespPodStatus
|
|
250
|
+
ip?: string
|
|
251
|
+
restart?: number
|
|
252
|
+
cpuUsage?: number
|
|
253
|
+
cpuLimit?: number
|
|
254
|
+
memoryUsage?: number
|
|
255
|
+
memoryLimit?: number
|
|
256
|
+
createTimestamp?: string
|
|
257
|
+
redisType?: RedisPodType
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export type GetRedisNodeListResp = {
|
|
261
|
+
items?: GetRedisNodeListRespData[]
|
|
262
|
+
pagination?: CommonCommon.Pagination
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export type GetRedisGrafanaAddrReq = {
|
|
266
|
+
cluster?: string
|
|
267
|
+
namespace?: string
|
|
268
|
+
name?: string
|
|
269
|
+
instanceType?: InstanceType
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export type GetRedisGrafanaAddrResp = {
|
|
273
|
+
data?: string
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export type GetRedisReq = {
|
|
277
|
+
cluster?: string
|
|
278
|
+
namespace?: string
|
|
279
|
+
name?: string
|
|
280
|
+
instanceType?: InstanceType
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export type GetRedisResp = {
|
|
284
|
+
data?: RedisItem
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export type GetRedisConfRespItems = {
|
|
288
|
+
paramType?: GetRedisConfRespItemsParamType
|
|
289
|
+
paramName?: string
|
|
290
|
+
value?: string
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export type GetRedisConfResp = {
|
|
294
|
+
items?: GetRedisConfRespItems[]
|
|
295
|
+
pagination?: CommonCommon.Pagination
|
|
296
|
+
conf?: UpdateRedisConfReq
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export type GetRedisListResp = {
|
|
300
|
+
items?: RedisItem[]
|
|
301
|
+
pagination?: CommonCommon.Pagination
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export type RedisItemStatus = {
|
|
305
|
+
status?: Status
|
|
306
|
+
podsAreReadyNum?: number
|
|
307
|
+
redisAddr?: string
|
|
308
|
+
clusterIPs?: string[]
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export type RedisItemMetadata = {
|
|
312
|
+
annotations?: {[key: string]: string}
|
|
313
|
+
creationTimestamp?: string
|
|
314
|
+
name?: string
|
|
315
|
+
namespace?: string
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export type RedisItem = {
|
|
319
|
+
apiVersion?: string
|
|
320
|
+
kind?: string
|
|
321
|
+
metadata?: RedisItemMetadata
|
|
322
|
+
spec?: CreateRedisReq
|
|
323
|
+
status?: RedisItemStatus
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export class Redis {
|
|
327
|
+
static GetRedisList(req: GetRedisListReq, initReq?: fm.InitReq): Promise<GetRedisListResp> {
|
|
328
|
+
return fm.fetchReq<GetRedisListReq, GetRedisListResp>(`/apis/mcamel.io/redis/v1alpha1/${req["workspaceId"]}/rediss?${fm.renderURLSearchParams(req, ["workspaceId"])}`, {...initReq, method: "GET"})
|
|
329
|
+
}
|
|
330
|
+
static GetRedisOperatorVersionList(req: GetRedisOperatorVersionListReq, initReq?: fm.InitReq): Promise<GetRedisOperatorVersionListResp> {
|
|
331
|
+
return fm.fetchReq<GetRedisOperatorVersionListReq, GetRedisOperatorVersionListResp>(`/apis/mcamel.io/redis/v1alpha1/redis-operator/versions?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
332
|
+
}
|
|
333
|
+
static GetRedis(req: GetRedisReq, initReq?: fm.InitReq): Promise<GetRedisResp> {
|
|
334
|
+
return fm.fetchReq<GetRedisReq, GetRedisResp>(`/apis/mcamel.io/redis/v1alpha1/redis/${req["instanceType"]}/${req["cluster"]}/${req["namespace"]}/${req["name"]}?${fm.renderURLSearchParams(req, ["instanceType", "cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
|
|
335
|
+
}
|
|
336
|
+
static GetRedisParam(req: GetRedisParamReq, initReq?: fm.InitReq): Promise<GetRedisParamResp> {
|
|
337
|
+
return fm.fetchReq<GetRedisParamReq, GetRedisParamResp>(`/apis/mcamel.io/redis/v1alpha1/redis-params/${req["cluster"]}?${fm.renderURLSearchParams(req, ["cluster"])}`, {...initReq, method: "GET"})
|
|
338
|
+
}
|
|
339
|
+
static GetRedisNodeList(req: GetRedisNodeListReq, initReq?: fm.InitReq): Promise<GetRedisNodeListResp> {
|
|
340
|
+
return fm.fetchReq<GetRedisNodeListReq, GetRedisNodeListResp>(`/apis/mcamel.io/redis/v1alpha1/redis/${req["instanceType"]}/${req["cluster"]}/${req["namespace"]}/${req["name"]}/nodes?${fm.renderURLSearchParams(req, ["instanceType", "cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
|
|
341
|
+
}
|
|
342
|
+
static GetRedisGrafanaAddr(req: GetRedisGrafanaAddrReq, initReq?: fm.InitReq): Promise<GetRedisGrafanaAddrResp> {
|
|
343
|
+
return fm.fetchReq<GetRedisGrafanaAddrReq, GetRedisGrafanaAddrResp>(`/apis/mcamel.io/redis/v1alpha1/redis/${req["instanceType"]}/${req["cluster"]}/${req["namespace"]}/${req["name"]}/grafana?${fm.renderURLSearchParams(req, ["instanceType", "cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
|
|
344
|
+
}
|
|
345
|
+
static CreateRedis(req: CreateRedisReq, initReq?: fm.InitReq): Promise<CreateRedisResp> {
|
|
346
|
+
return fm.fetchReq<CreateRedisReq, CreateRedisResp>(`/apis/mcamel.io/redis/v1alpha1/redis`, {...initReq, method: "POST", body: JSON.stringify(req)})
|
|
347
|
+
}
|
|
348
|
+
static GetRedisConfs(req: GetRedisConfReq, initReq?: fm.InitReq): Promise<GetRedisConfResp> {
|
|
349
|
+
return fm.fetchReq<GetRedisConfReq, GetRedisConfResp>(`/apis/mcamel.io/redis/v1alpha1/redis/${req["cluster"]}/${req["namespace"]}/${req["name"]}/confs?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
|
|
350
|
+
}
|
|
351
|
+
static UpdateRedisConf(req: UpdateRedisConfReq, initReq?: fm.InitReq): Promise<UpdateRedisConfResp> {
|
|
352
|
+
return fm.fetchReq<UpdateRedisConfReq, UpdateRedisConfResp>(`/apis/mcamel.io/redis/v1alpha1/redis/${req["instanceType"]}/${req["cluster"]}/${req["namespace"]}/${req["name"]}/conf`, {...initReq, method: "PUT", body: JSON.stringify(req)})
|
|
353
|
+
}
|
|
354
|
+
static UpdateRedisParams(req: UpdateRedisParamsReq, initReq?: fm.InitReq): Promise<UpdateRedisParamsResp> {
|
|
355
|
+
return fm.fetchReq<UpdateRedisParamsReq, UpdateRedisParamsResp>(`/apis/mcamel.io/redis/v1alpha1/redis/${req["instanceType"]}/${req["cluster"]}/${req["namespace"]}/${req["name"]}/params`, {...initReq, method: "PUT", body: JSON.stringify(req)})
|
|
356
|
+
}
|
|
357
|
+
static DeleteRedis(req: DeleteRedisReq, initReq?: fm.InitReq): Promise<DeleteRedisResp> {
|
|
358
|
+
return fm.fetchReq<DeleteRedisReq, DeleteRedisResp>(`/apis/mcamel.io/redis/v1alpha1/redis/${req["instanceType"]}/${req["cluster"]}/${req["namespace"]}/${req["name"]}`, {...initReq, method: "DELETE"})
|
|
359
|
+
}
|
|
360
|
+
static DeleteRediss(req: DeleteRedissReq, initReq?: fm.InitReq): Promise<DeleteRedissResp> {
|
|
361
|
+
return fm.fetchReq<DeleteRedissReq, DeleteRedissResp>(`/apis/mcamel.io/redis/v1alpha1/rediss`, {...initReq, method: "POST", body: JSON.stringify(req)})
|
|
362
|
+
}
|
|
363
|
+
}
|
package/version.pb.ts
ADDED
|
@@ -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
|
+
import * as fm from "./fetch.pb"
|
|
8
|
+
export type CommonReply = {
|
|
9
|
+
code?: number
|
|
10
|
+
msg?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type GetVersionReply = {
|
|
14
|
+
commonReply?: CommonReply
|
|
15
|
+
gitCommit?: string
|
|
16
|
+
gitVersion?: string
|
|
17
|
+
buildTime?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type Empty = {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class Version {
|
|
24
|
+
static Get(req: Empty, initReq?: fm.InitReq): Promise<GetVersionReply> {
|
|
25
|
+
return fm.fetchReq<Empty, GetVersionReply>(`/apis/mcamel.io/redis/v1alpha1/redis/version?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
26
|
+
}
|
|
27
|
+
}
|