@daocloud-proto/mcamel-postgresql 0.0.1

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.
@@ -0,0 +1,78 @@
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 GoogleProtobufEmpty from "../../../google/protobuf/empty.pb"
8
+ import * as CommonCommon from "./common.pb"
9
+ import * as fm from "./fetch.pb"
10
+
11
+ export enum CreateCloudShellRequestType {
12
+ TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED",
13
+ bash = "bash",
14
+ exec = "exec",
15
+ logs = "logs",
16
+ upload = "upload",
17
+ download = "download",
18
+ }
19
+
20
+ export type ObjectMeta = {
21
+ name?: string
22
+ namespace?: string
23
+ uid?: string
24
+ resourceVersion?: string
25
+ creationTimestamp?: string
26
+ deletionTimestamp?: string
27
+ labels?: {[key: string]: string}
28
+ annotations?: {[key: string]: string}
29
+ ownerReferences?: CommonCommon.OwnerReference[]
30
+ cluster?: string
31
+ workspaceAlias?: string
32
+ }
33
+
34
+ export type CloudShell = {
35
+ metadata?: ObjectMeta
36
+ spec?: CloudShellSpec
37
+ status?: CloudShellStatus
38
+ }
39
+
40
+ export type CloudShellSpec = {
41
+ configMapName?: string
42
+ once?: boolean
43
+ commandAction?: string
44
+ ttl?: number
45
+ cleanup?: boolean
46
+ }
47
+
48
+ export type CloudShellStatus = {
49
+ phase?: string
50
+ accessUrl?: string
51
+ }
52
+
53
+ export type CreateCloudShellRequest = {
54
+ type?: CreateCloudShellRequestType
55
+ cluster?: string
56
+ namespace?: string
57
+ podName?: string
58
+ filePath?: string
59
+ container?: string
60
+ logCount?: number
61
+ data?: CloudShell
62
+ }
63
+
64
+ export type GetorDeleteCloudShellRequest = {
65
+ name?: string
66
+ }
67
+
68
+ export class CloudShellService {
69
+ static CreateCloudShell(req: CreateCloudShellRequest, initReq?: fm.InitReq): Promise<CloudShell> {
70
+ return fm.fetchReq<CreateCloudShellRequest, CloudShell>(`/apis/mcamel.io/postgresql/v1alpha1/cloudshells`, {...initReq, method: "POST", body: JSON.stringify(req)})
71
+ }
72
+ static GetCloudShell(req: GetorDeleteCloudShellRequest, initReq?: fm.InitReq): Promise<CloudShell> {
73
+ return fm.fetchReq<GetorDeleteCloudShellRequest, CloudShell>(`/apis/mcamel.io/postgresql/v1alpha1/cloudshells/${req["name"]}?${fm.renderURLSearchParams(req, ["name"])}`, {...initReq, method: "GET"})
74
+ }
75
+ static DeleteCloudShell(req: GetorDeleteCloudShellRequest, initReq?: fm.InitReq): Promise<GoogleProtobufEmpty.Empty> {
76
+ return fm.fetchReq<GetorDeleteCloudShellRequest, GoogleProtobufEmpty.Empty>(`/apis/mcamel.io/postgresql/v1alpha1/cloudshells/${req["name"]}`, {...initReq, method: "DELETE"})
77
+ }
78
+ }
package/cluster.pb.ts ADDED
@@ -0,0 +1,239 @@
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 EventType {
11
+ EVENT_TYPE_UNSPECIFIED = "EVENT_TYPE_UNSPECIFIED",
12
+ Normal = "Normal",
13
+ Warning = "Warning",
14
+ }
15
+
16
+ export enum GetAllEventListReqSortDir {
17
+ ASC = "ASC",
18
+ DESC = "DESC",
19
+ }
20
+
21
+ export enum GetEventListReqKind {
22
+ KIND_UNSPECIFIED = "KIND_UNSPECIFIED",
23
+ Pod = "Pod",
24
+ }
25
+
26
+ export enum GetWorkspaceListReqSortDir {
27
+ ASC = "ASC",
28
+ DESC = "DESC",
29
+ }
30
+
31
+ export enum GetInsightAgentStatusRespInsightAgentStatus {
32
+ NotInstall = "NotInstall",
33
+ Install = "Install",
34
+ }
35
+
36
+ export type GetAllEventListReq = {
37
+ page?: number
38
+ pageSize?: number
39
+ sortDir?: GetAllEventListReqSortDir
40
+ sortBy?: string
41
+ searchKey?: string
42
+ cluster?: string
43
+ namespace?: string
44
+ name?: string
45
+ eventType?: EventType
46
+ }
47
+
48
+ export type GetAllEventListRespItemsSource = {
49
+ component?: string
50
+ }
51
+
52
+ export type GetAllEventListRespItemsMetadata = {
53
+ uid?: string
54
+ name?: string
55
+ namespace?: string
56
+ annotations?: {[key: string]: string}
57
+ resourceVersion?: string
58
+ creationTimestamp?: string
59
+ }
60
+
61
+ export type GetAllEventListRespItemsInvolvedObject = {
62
+ uid?: string
63
+ kind?: string
64
+ name?: string
65
+ namespace?: string
66
+ apiVersion?: string
67
+ resourceVersion?: string
68
+ }
69
+
70
+ export type GetAllEventListRespItems = {
71
+ kind?: string
72
+ type?: string
73
+ count?: number
74
+ reason?: string
75
+ source?: GetAllEventListRespItemsSource
76
+ message?: string
77
+ metadata?: GetAllEventListRespItemsMetadata
78
+ apiVersion?: string
79
+ lastTimestamp?: string
80
+ firstTimestamp?: string
81
+ involvedObject?: GetAllEventListRespItemsInvolvedObject
82
+ reportingInstance?: string
83
+ reportingComponent?: string
84
+ }
85
+
86
+ export type GetAllEventListResp = {
87
+ items?: GetAllEventListRespItems[]
88
+ pagination?: CommonCommon.Pagination
89
+ }
90
+
91
+ export type GetClusterNodeLabelListReq = {
92
+ cluster?: string
93
+ }
94
+
95
+ export type GetClusterNodeLabelListRespLabel = {
96
+ key?: string
97
+ value?: string[]
98
+ }
99
+
100
+ export type GetClusterNodeLabelListResp = {
101
+ items?: GetClusterNodeLabelListRespLabel[]
102
+ pagination?: CommonCommon.Pagination
103
+ }
104
+
105
+ export type GetClusterNodePortListReq = {
106
+ cluster?: string
107
+ }
108
+
109
+ export type GetClusterNodePortListResp = {
110
+ items?: string[]
111
+ pagination?: CommonCommon.Pagination
112
+ }
113
+
114
+ export type EventSource = {
115
+ component?: string
116
+ host?: string
117
+ }
118
+
119
+ export type GetMetallbIPAddressPoolsListReq = {
120
+ cluster?: string
121
+ }
122
+
123
+ export type GetMetallbIPAddressPoolsListRespItem = {
124
+ name?: string
125
+ addresses?: string[]
126
+ autoAssign?: boolean
127
+ avoidBuggyIPs?: boolean
128
+ }
129
+
130
+ export type GetMetallbIPAddressPoolsListResp = {
131
+ items?: GetMetallbIPAddressPoolsListRespItem[]
132
+ isSupportLb?: boolean
133
+ externalTrafficPolicy?: CommonCommon.ExternalTrafficPolicy[]
134
+ lbTyp?: CommonCommon.LBTyp[]
135
+ }
136
+
137
+ export type GetEventListReq = {
138
+ cluster?: string
139
+ namespace?: string
140
+ kind?: GetEventListReqKind
141
+ kindName?: string
142
+ page?: number
143
+ pageSize?: number
144
+ type?: EventType[]
145
+ }
146
+
147
+ export type ObjectReference = {
148
+ kind?: string
149
+ name?: string
150
+ }
151
+
152
+ export type GetEventListRespItem = {
153
+ involvedObject?: ObjectReference
154
+ reason?: string
155
+ message?: string
156
+ source?: EventSource
157
+ lastTimestamp?: string
158
+ type?: EventType
159
+ }
160
+
161
+ export type GetEventListResp = {
162
+ items?: GetEventListRespItem[]
163
+ pagination?: CommonCommon.Pagination
164
+ }
165
+
166
+ export type GetWorkspaceListReq = {
167
+ page?: number
168
+ pageSize?: number
169
+ sortDir?: GetWorkspaceListReqSortDir
170
+ sortBy?: string
171
+ searchKey?: string
172
+ }
173
+
174
+ export type GetWorkspaceListRespItem = {
175
+ workspaceId?: number
176
+ alias?: string
177
+ }
178
+
179
+ export type GetWorkspaceListResp = {
180
+ items?: GetWorkspaceListRespItem[]
181
+ pagination?: CommonCommon.Pagination
182
+ }
183
+
184
+ export type GetClusterListReq = {
185
+ workspaceId?: number
186
+ }
187
+
188
+ export type GetClusterListResp = {
189
+ items?: string[]
190
+ pagination?: CommonCommon.Pagination
191
+ }
192
+
193
+ export type GetClusterNamespaceListReq = {
194
+ workspaceId?: number
195
+ cluster?: string
196
+ }
197
+
198
+ export type GetClusterNamespaceListResp = {
199
+ items?: string[]
200
+ pagination?: CommonCommon.Pagination
201
+ }
202
+
203
+ export type GetInsightAgentStatusReq = {
204
+ cluster?: string
205
+ }
206
+
207
+ export type GetInsightAgentStatusResp = {
208
+ status?: GetInsightAgentStatusRespInsightAgentStatus
209
+ }
210
+
211
+ export class Cluster {
212
+ static GetClusterList(req: GetClusterListReq, initReq?: fm.InitReq): Promise<GetClusterListResp> {
213
+ return fm.fetchReq<GetClusterListReq, GetClusterListResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["workspaceId"]}/clusters?${fm.renderURLSearchParams(req, ["workspaceId"])}`, {...initReq, method: "GET"})
214
+ }
215
+ static GetClusterNamespaceList(req: GetClusterNamespaceListReq, initReq?: fm.InitReq): Promise<GetClusterNamespaceListResp> {
216
+ return fm.fetchReq<GetClusterNamespaceListReq, GetClusterNamespaceListResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["workspaceId"]}/${req["cluster"]}/namespaces?${fm.renderURLSearchParams(req, ["workspaceId", "cluster"])}`, {...initReq, method: "GET"})
217
+ }
218
+ static GetClusterNodePortList(req: GetClusterNodePortListReq, initReq?: fm.InitReq): Promise<GetClusterNodePortListResp> {
219
+ return fm.fetchReq<GetClusterNodePortListReq, GetClusterNodePortListResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["cluster"]}/nodeports?${fm.renderURLSearchParams(req, ["cluster"])}`, {...initReq, method: "GET"})
220
+ }
221
+ static GetClusterNodeLabelList(req: GetClusterNodeLabelListReq, initReq?: fm.InitReq): Promise<GetClusterNodeLabelListResp> {
222
+ return fm.fetchReq<GetClusterNodeLabelListReq, GetClusterNodeLabelListResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["cluster"]}/nodelabels?${fm.renderURLSearchParams(req, ["cluster"])}`, {...initReq, method: "GET"})
223
+ }
224
+ static GetWorkspaceList(req: GetWorkspaceListReq, initReq?: fm.InitReq): Promise<GetWorkspaceListResp> {
225
+ return fm.fetchReq<GetWorkspaceListReq, GetWorkspaceListResp>(`/apis/mcamel.io/postgresql/v1alpha1/workspaces?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
226
+ }
227
+ static GetInsightAgentStatus(req: GetInsightAgentStatusReq, initReq?: fm.InitReq): Promise<GetInsightAgentStatusResp> {
228
+ return fm.fetchReq<GetInsightAgentStatusReq, GetInsightAgentStatusResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["cluster"]}/insight/status?${fm.renderURLSearchParams(req, ["cluster"])}`, {...initReq, method: "GET"})
229
+ }
230
+ static GetEventList(req: GetEventListReq, initReq?: fm.InitReq): Promise<GetEventListResp> {
231
+ return fm.fetchReq<GetEventListReq, GetEventListResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["cluster"]}/${req["namespace"]}/events?${fm.renderURLSearchParams(req, ["cluster", "namespace"])}`, {...initReq, method: "GET"})
232
+ }
233
+ static GetAllEventList(req: GetAllEventListReq, initReq?: fm.InitReq): Promise<GetAllEventListResp> {
234
+ return fm.fetchReq<GetAllEventListReq, GetAllEventListResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["cluster"]}/${req["namespace"]}/${req["name"]}/all-events?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
235
+ }
236
+ static GetMetallbIPAddressPoolsList(req: GetMetallbIPAddressPoolsListReq, initReq?: fm.InitReq): Promise<GetMetallbIPAddressPoolsListResp> {
237
+ return fm.fetchReq<GetMetallbIPAddressPoolsListReq, GetMetallbIPAddressPoolsListResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["cluster"]}/lbaddress/pools?${fm.renderURLSearchParams(req, ["cluster"])}`, {...initReq, method: "GET"})
238
+ }
239
+ }
package/common.pb.ts ADDED
@@ -0,0 +1,165 @@
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 ExternalTrafficPolicy {
8
+ Cluster = "Cluster",
9
+ Local = "Local",
10
+ }
11
+
12
+ export enum LBTyp {
13
+ MetalLB = "MetalLB",
14
+ Others = "Others",
15
+ }
16
+
17
+ export enum ServiceType {
18
+ ClusterIP = "ClusterIP",
19
+ NodePort = "NodePort",
20
+ LoadBalancer = "LoadBalancer",
21
+ }
22
+
23
+ export enum PageInfoReqSortDir {
24
+ ASC = "ASC",
25
+ DESC = "DESC",
26
+ }
27
+
28
+ export enum PodCommonPodPhase {
29
+ PHASE_UNSPECIFIED = "PHASE_UNSPECIFIED",
30
+ Unknown = "Unknown",
31
+ Pending = "Pending",
32
+ Running = "Running",
33
+ Succeeded = "Succeeded",
34
+ Failed = "Failed",
35
+ }
36
+
37
+ export enum PodCommonConditionStatus {
38
+ PodConditionStatusUnknown = "PodConditionStatusUnknown",
39
+ PodConditionStatusTrue = "PodConditionStatusTrue",
40
+ PodConditionStatusFalse = "PodConditionStatusFalse",
41
+ }
42
+
43
+ export type Affinity = {
44
+ nodeAffinity?: NodeAffinity
45
+ podAffinity?: PodAffinity
46
+ podAntiAffinity?: PodAntiAffinity
47
+ }
48
+
49
+ export type PodAntiAffinity = {
50
+ requiredDuringSchedulingIgnoredDuringExecution?: PodAffinityTerm[]
51
+ preferredDuringSchedulingIgnoredDuringExecution?: WeightedPodAffinityTerm[]
52
+ }
53
+
54
+ export type NodeAffinity = {
55
+ requiredDuringSchedulingIgnoredDuringExecution?: NodeSelector
56
+ preferredDuringSchedulingIgnoredDuringExecution?: PreferredSchedulingTerm[]
57
+ }
58
+
59
+ export type NodeSelector = {
60
+ nodeSelectorTerms?: NodeSelectorTerm[]
61
+ }
62
+
63
+ export type NodeSelectorTerm = {
64
+ matchExpressions?: NodeSelectorRequirement[]
65
+ matchFields?: NodeSelectorRequirement[]
66
+ }
67
+
68
+ export type NodeSelectorRequirement = {
69
+ key?: string
70
+ values?: string[]
71
+ operator?: string
72
+ }
73
+
74
+ export type PreferredSchedulingTerm = {
75
+ weight?: number
76
+ preference?: NodeSelectorTerm
77
+ }
78
+
79
+ export type PodAffinity = {
80
+ requiredDuringSchedulingIgnoredDuringExecution?: PodAffinityTerm[]
81
+ preferredDuringSchedulingIgnoredDuringExecution?: WeightedPodAffinityTerm[]
82
+ }
83
+
84
+ export type WeightedPodAffinityTerm = {
85
+ weight?: number
86
+ podAffinityTerm?: PodAffinityTerm
87
+ }
88
+
89
+ export type PodAffinityTerm = {
90
+ labelSelector?: LabelSelector
91
+ namespaces?: string[]
92
+ topologyKey?: string
93
+ namespaceSelector?: LabelSelector
94
+ }
95
+
96
+ export type LabelSelector = {
97
+ matchLabels?: {[key: string]: string}
98
+ matchExpressions?: LabelSelectorRequirement[]
99
+ }
100
+
101
+ export type LabelSelectorRequirement = {
102
+ key?: string
103
+ values?: string[]
104
+ operator?: string
105
+ }
106
+
107
+ export type Toleration = {
108
+ key?: string
109
+ operator?: string
110
+ value?: string
111
+ effect?: string
112
+ tolerationSeconds?: string
113
+ }
114
+
115
+ export type Pagination = {
116
+ total?: number
117
+ page?: number
118
+ pageSize?: number
119
+ pages?: number
120
+ }
121
+
122
+ export type PageInfoReq = {
123
+ page?: number
124
+ pageSize?: number
125
+ sortDir?: PageInfoReqSortDir
126
+ sortBy?: string
127
+ }
128
+
129
+ export type PodCommonCondition = {
130
+ lastTransitionTime?: string
131
+ lastUpdateTime?: string
132
+ message?: string
133
+ reason?: string
134
+ status?: PodCommonConditionStatus
135
+ type?: string
136
+ }
137
+
138
+ export type PodCommon = {
139
+ name?: string
140
+ phase?: PodCommonPodPhase
141
+ ip?: string
142
+ restartCount?: number
143
+ createTimestamp?: string
144
+ cpuUsage?: number
145
+ cpuLimit?: number
146
+ memoryUsage?: number
147
+ memoryLimit?: number
148
+ conditions?: PodCommonCondition[]
149
+ containersName?: string[]
150
+ ownerReference?: OwnerReference[]
151
+ initContainersName?: string[]
152
+ }
153
+
154
+ export type OwnerReference = {
155
+ uid?: string
156
+ controller?: boolean
157
+ name?: string
158
+ kind?: string
159
+ }
160
+
161
+ export type CommonItemStatus = {
162
+ serviceAddresses?: string[]
163
+ webManagerAddress?: string
164
+ webLogAddress?: string
165
+ }
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/insight.pb.ts ADDED
@@ -0,0 +1,46 @@
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 Severity {
8
+ SEVERITY_UNSPECIFIED = "SEVERITY_UNSPECIFIED",
9
+ CRITICAL = "CRITICAL",
10
+ WARNING = "WARNING",
11
+ INFO = "INFO",
12
+ }
13
+
14
+ export enum TargetType {
15
+ TARGET_TYPE_UNSPECIFIED = "TARGET_TYPE_UNSPECIFIED",
16
+ GLOBAL = "GLOBAL",
17
+ CLUSTER = "CLUSTER",
18
+ NAMESPACE = "NAMESPACE",
19
+ NODE = "NODE",
20
+ DEPLOYMENT = "DEPLOYMENT",
21
+ STATEFULSET = "STATEFULSET",
22
+ DAEMONSET = "DAEMONSET",
23
+ CRONJOB = "CRONJOB",
24
+ POD = "POD",
25
+ }
26
+
27
+ export enum AlertStatus {
28
+ ALERT_STATUS_UNSPECIFIED = "ALERT_STATUS_UNSPECIFIED",
29
+ ALERT_STATUS_FIRING = "ALERT_STATUS_FIRING",
30
+ ALERT_STATUS_RESOLVED = "ALERT_STATUS_RESOLVED",
31
+ }
32
+
33
+ export type AlertSummary = {
34
+ alertId?: string
35
+ ruleName?: string
36
+ severity?: Severity
37
+ clusterName?: string
38
+ namespace?: string
39
+ targetType?: TargetType
40
+ targetName?: string
41
+ status?: AlertStatus
42
+ description?: string
43
+ startAt?: string
44
+ updateAt?: string
45
+ notifyResponse?: string
46
+ }
package/metric.pb.ts ADDED
@@ -0,0 +1,25 @@
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
+ import * as InsightIoApiInsightV1alpha1Insight from "./insight.pb"
10
+ export type GetAlertsListReq = {
11
+ cluster?: string
12
+ namespace?: string
13
+ name?: string
14
+ }
15
+
16
+ export type GetAlertsListResp = {
17
+ items?: InsightIoApiInsightV1alpha1Insight.AlertSummary[]
18
+ pagination?: CommonCommon.Pagination
19
+ }
20
+
21
+ export class Metric {
22
+ static GetAlertsList(req: GetAlertsListReq, initReq?: fm.InitReq): Promise<GetAlertsListResp> {
23
+ return fm.fetchReq<GetAlertsListReq, GetAlertsListResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["cluster"]}/${req["namespace"]}/${req["name"]}/alerts?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
24
+ }
25
+ }
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name":"@daocloud-proto/mcamel-postgresql",
3
+ "version":"0.0.1",
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,376 @@
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 Status {
20
+ Failed = "Failed",
21
+ Running = "Running",
22
+ Creating = "Creating",
23
+ }
24
+
25
+ export enum GetPostgresqlListReqSortDir {
26
+ ASC = "ASC",
27
+ DESC = "DESC",
28
+ }
29
+
30
+ export enum GetPostgresqlConfReqSortDir {
31
+ ASC = "ASC",
32
+ DESC = "DESC",
33
+ }
34
+
35
+ export enum CreatePostgresqlReqServiceType {
36
+ ClusterIP = "ClusterIP",
37
+ NodePort = "NodePort",
38
+ LoadBalancer = "LoadBalancer",
39
+ }
40
+
41
+ export enum GetPostgresqlParamRespSelectSelectType {
42
+ Single = "Single",
43
+ Multiple = "Multiple",
44
+ }
45
+
46
+ export enum GetPostgresqlPodListReqSortDir {
47
+ ASC = "ASC",
48
+ DESC = "DESC",
49
+ }
50
+
51
+ export enum GetPostgresqlPodListRespPodStatus {
52
+ PHASE_UNSPECIFIED = "PHASE_UNSPECIFIED",
53
+ Unknown = "Unknown",
54
+ Pending = "Pending",
55
+ Running = "Running",
56
+ Succeeded = "Succeeded",
57
+ Failed = "Failed",
58
+ }
59
+
60
+ export enum GetPostgresqlPodListRespPodType {
61
+ Master = "Master",
62
+ Replica = "Replica",
63
+ PgAdmin = "PgAdmin",
64
+ }
65
+
66
+ export enum GetPostgresqlConfRespItemsParamType {
67
+ conf = "conf",
68
+ }
69
+
70
+ export type GetPostgresqlUsersReq = {
71
+ cluster?: string
72
+ namespace?: string
73
+ name?: string
74
+ }
75
+
76
+ export type GetPostgresqlUsersRespUserItem = {
77
+ username?: string
78
+ password?: string
79
+ }
80
+
81
+ export type GetPostgresqlUsersResp = {
82
+ users?: GetPostgresqlUsersRespUserItem[]
83
+ }
84
+
85
+ export type GetPostgresqlListReq = {
86
+ page?: number
87
+ pageSize?: number
88
+ sortDir?: GetPostgresqlListReqSortDir
89
+ sortBy?: string
90
+ searchKey?: string
91
+ workspaceId?: number
92
+ }
93
+
94
+ export type GetPostgresqlConfReq = {
95
+ page?: number
96
+ pageSize?: number
97
+ sortDir?: GetPostgresqlConfReqSortDir
98
+ sortBy?: string
99
+ searchKey?: string
100
+ cluster?: string
101
+ namespace?: string
102
+ name?: string
103
+ }
104
+
105
+ export type GetPostgresqlParamReq = {
106
+ cluster?: string
107
+ }
108
+
109
+ export type CreatePostgresqlReqPorts = {
110
+ name?: string
111
+ protocol?: string
112
+ port?: number
113
+ targetPort?: number
114
+ nodePort?: number
115
+ }
116
+
117
+ export type CreatePostgresqlReq = {
118
+ workspaceId?: number
119
+ cluster?: string
120
+ namespace?: string
121
+ name?: string
122
+ describe?: string
123
+ version?: string
124
+ numberOfInstances?: number
125
+ synchronousMode?: boolean
126
+ synchronousModeStrict?: boolean
127
+ synchronousNodeCount?: number
128
+ superuserPassword?: string
129
+ storageClassName?: string
130
+ storageCapacity?: string
131
+ serviceType?: CreatePostgresqlReqServiceType
132
+ serviceAnnotations?: {[key: string]: string}
133
+ ports?: CreatePostgresqlReqPorts[]
134
+ cpuRequest?: string
135
+ cpuLimit?: string
136
+ memoryRequest?: string
137
+ memoryLimit?: string
138
+ conf?: string
139
+ isOpenPgAdmin?: boolean
140
+ pgAdminServiceType?: CommonCommon.ServiceType
141
+ pgAdminNodePort?: number
142
+ pgAdminCpuRequest?: string
143
+ pgAdminCpuLimit?: string
144
+ pgAdminMemoryRequest?: string
145
+ pgAdminMemoryLimit?: string
146
+ pgAdminServerModeEnable?: boolean
147
+ pgAdminDefaultEmail?: string
148
+ pgAdminDefaultPassword?: string
149
+ affinity?: CommonCommon.Affinity
150
+ }
151
+
152
+ export type UpdatePostgresqlConfReq = {
153
+ cluster?: string
154
+ namespace?: string
155
+ name?: string
156
+ conf?: string
157
+ }
158
+
159
+ export type UpdatePostgresqlParamsResp = {
160
+ message?: string
161
+ }
162
+
163
+ export type UpdatePostgresqlConfResp = {
164
+ message?: string
165
+ }
166
+
167
+ export type GetPostgresqlParamRespSelectDataStringValue = {
168
+ value?: string
169
+ }
170
+
171
+ export type GetPostgresqlParamRespSelectDataResourceValue = {
172
+ cpuRequest?: string
173
+ cpuLimit?: string
174
+ memoryRequest?: string
175
+ memoryLimit?: string
176
+ }
177
+
178
+ export type GetPostgresqlParamRespSelectDataIntValue = {
179
+ value?: number
180
+ }
181
+
182
+ export type GetPostgresqlParamRespSelectDataStorageClassValue = {
183
+ name?: string
184
+ allowVolumeExpansion?: boolean
185
+ }
186
+
187
+
188
+ type BaseGetPostgresqlParamRespSelectData = {
189
+ }
190
+
191
+ export type GetPostgresqlParamRespSelectData = BaseGetPostgresqlParamRespSelectData
192
+ & OneOf<{ sValue: GetPostgresqlParamRespSelectDataStringValue; rValue: GetPostgresqlParamRespSelectDataResourceValue; iValue: GetPostgresqlParamRespSelectDataIntValue; scValue: GetPostgresqlParamRespSelectDataStorageClassValue }>
193
+
194
+ export type GetPostgresqlParamRespSelect = {
195
+ selectType?: GetPostgresqlParamRespSelectSelectType
196
+ data?: GetPostgresqlParamRespSelectData[]
197
+ }
198
+
199
+ export type GetPostgresqlParamResp = {
200
+ version?: GetPostgresqlParamRespSelect
201
+ conf?: GetPostgresqlParamRespSelect
202
+ replicas?: GetPostgresqlParamRespSelect
203
+ resource?: GetPostgresqlParamRespSelect
204
+ storage?: GetPostgresqlParamRespSelect
205
+ }
206
+
207
+ export type GetPostgresqlBackupProviderListResp = {
208
+ provider?: GetPostgresqlParamRespSelect
209
+ }
210
+
211
+ export type CreatePostgresqlResp = {
212
+ message?: string
213
+ }
214
+
215
+ export type GetPostgresqlOperatorVersionListReq = {
216
+ }
217
+
218
+ export type GetPostgresqlOperatorVersionListRespGetPostgresqlOperatorVersionListData = {
219
+ cluster?: string
220
+ namespace?: string
221
+ version?: string
222
+ }
223
+
224
+ export type GetPostgresqlOperatorVersionListResp = {
225
+ items?: GetPostgresqlOperatorVersionListRespGetPostgresqlOperatorVersionListData[]
226
+ pagination?: CommonCommon.Pagination
227
+ }
228
+
229
+ export type DeletePostgresqlReq = {
230
+ cluster?: string
231
+ namespace?: string
232
+ name?: string
233
+ }
234
+
235
+ export type DeletePostgresqlsReq = {
236
+ data?: DeletePostgresqlReq[]
237
+ }
238
+
239
+ export type DeletePostgresqlResp = {
240
+ message?: string
241
+ }
242
+
243
+ export type DeletePostgresqlsResp = {
244
+ message?: string
245
+ }
246
+
247
+ export type GetPostgresqlPodListReq = {
248
+ cluster?: string
249
+ namespace?: string
250
+ name?: string
251
+ page?: number
252
+ pageSize?: number
253
+ sortDir?: GetPostgresqlPodListReqSortDir
254
+ sortBy?: string
255
+ searchKey?: string
256
+ }
257
+
258
+ export type GetPostgresqlPodListRespData = {
259
+ podName?: string
260
+ status?: GetPostgresqlPodListRespPodStatus
261
+ ip?: string
262
+ restart?: number
263
+ cpuUsage?: number
264
+ cpuLimit?: number
265
+ memoryUsage?: number
266
+ memoryLimit?: number
267
+ createTimestamp?: string
268
+ podType?: GetPostgresqlPodListRespPodType
269
+ common?: CommonCommon.PodCommon
270
+ }
271
+
272
+ export type GetPostgresqlPodListResp = {
273
+ items?: GetPostgresqlPodListRespData[]
274
+ pagination?: CommonCommon.Pagination
275
+ }
276
+
277
+ export type GetPostgresqlGrafanaAddrReq = {
278
+ cluster?: string
279
+ namespace?: string
280
+ name?: string
281
+ }
282
+
283
+ export type GetPostgresqlGrafanaAddrResp = {
284
+ data?: string
285
+ }
286
+
287
+ export type GetPostgresqlReq = {
288
+ cluster?: string
289
+ namespace?: string
290
+ name?: string
291
+ }
292
+
293
+ export type GetPostgresqlResp = {
294
+ data?: PostgresqlItem
295
+ }
296
+
297
+ export type GetPostgresqlConfRespItems = {
298
+ paramType?: GetPostgresqlConfRespItemsParamType
299
+ paramName?: string
300
+ value?: string
301
+ }
302
+
303
+ export type GetPostgresqlConfResp = {
304
+ items?: GetPostgresqlConfRespItems[]
305
+ pagination?: CommonCommon.Pagination
306
+ conf?: UpdatePostgresqlConfReq
307
+ }
308
+
309
+ export type GetPostgresqlListResp = {
310
+ items?: PostgresqlItem[]
311
+ pagination?: CommonCommon.Pagination
312
+ }
313
+
314
+ export type PostgresqlItemStatus = {
315
+ status?: Status
316
+ podsAreReadyNum?: number
317
+ clusterIPs?: string[]
318
+ common?: CommonCommon.CommonItemStatus
319
+ }
320
+
321
+ export type PostgresqlItemMetadata = {
322
+ annotations?: {[key: string]: string}
323
+ creationTimestamp?: string
324
+ name?: string
325
+ namespace?: string
326
+ }
327
+
328
+ export type PostgresqlItem = {
329
+ apiVersion?: string
330
+ kind?: string
331
+ metadata?: PostgresqlItemMetadata
332
+ spec?: CreatePostgresqlReq
333
+ status?: PostgresqlItemStatus
334
+ }
335
+
336
+ export class Postgresql {
337
+ static GetPostgresqlList(req: GetPostgresqlListReq, initReq?: fm.InitReq): Promise<GetPostgresqlListResp> {
338
+ return fm.fetchReq<GetPostgresqlListReq, GetPostgresqlListResp>(`/apis/mcamel.io/postgresql/v1alpha1/${req["workspaceId"]}/postgresqls?${fm.renderURLSearchParams(req, ["workspaceId"])}`, {...initReq, method: "GET"})
339
+ }
340
+ static GetPostgresqlOperatorVersionList(req: GetPostgresqlOperatorVersionListReq, initReq?: fm.InitReq): Promise<GetPostgresqlOperatorVersionListResp> {
341
+ return fm.fetchReq<GetPostgresqlOperatorVersionListReq, GetPostgresqlOperatorVersionListResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql-operator/versions?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
342
+ }
343
+ static GetPostgresql(req: GetPostgresqlReq, initReq?: fm.InitReq): Promise<GetPostgresqlResp> {
344
+ return fm.fetchReq<GetPostgresqlReq, GetPostgresqlResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql/${req["cluster"]}/${req["namespace"]}/${req["name"]}?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
345
+ }
346
+ static GetPostgresqlParam(req: GetPostgresqlParamReq, initReq?: fm.InitReq): Promise<GetPostgresqlParamResp> {
347
+ return fm.fetchReq<GetPostgresqlParamReq, GetPostgresqlParamResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql-params/${req["cluster"]}?${fm.renderURLSearchParams(req, ["cluster"])}`, {...initReq, method: "GET"})
348
+ }
349
+ static GetPostgresqlPodList(req: GetPostgresqlPodListReq, initReq?: fm.InitReq): Promise<GetPostgresqlPodListResp> {
350
+ return fm.fetchReq<GetPostgresqlPodListReq, GetPostgresqlPodListResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql/${req["cluster"]}/${req["namespace"]}/${req["name"]}/pods?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
351
+ }
352
+ static GetPostgresqlGrafanaAddr(req: GetPostgresqlGrafanaAddrReq, initReq?: fm.InitReq): Promise<GetPostgresqlGrafanaAddrResp> {
353
+ return fm.fetchReq<GetPostgresqlGrafanaAddrReq, GetPostgresqlGrafanaAddrResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql/${req["cluster"]}/${req["namespace"]}/${req["name"]}/grafana?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
354
+ }
355
+ static CreatePostgresql(req: CreatePostgresqlReq, initReq?: fm.InitReq): Promise<CreatePostgresqlResp> {
356
+ return fm.fetchReq<CreatePostgresqlReq, CreatePostgresqlResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql`, {...initReq, method: "POST", body: JSON.stringify(req)})
357
+ }
358
+ static GetPostgresqlConfs(req: GetPostgresqlConfReq, initReq?: fm.InitReq): Promise<GetPostgresqlConfResp> {
359
+ return fm.fetchReq<GetPostgresqlConfReq, GetPostgresqlConfResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql/${req["cluster"]}/${req["namespace"]}/${req["name"]}/confs?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
360
+ }
361
+ static UpdatePostgresqlConf(req: UpdatePostgresqlConfReq, initReq?: fm.InitReq): Promise<UpdatePostgresqlConfResp> {
362
+ return fm.fetchReq<UpdatePostgresqlConfReq, UpdatePostgresqlConfResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql/${req["cluster"]}/${req["namespace"]}/${req["name"]}/conf`, {...initReq, method: "PUT", body: JSON.stringify(req)})
363
+ }
364
+ static UpdatePostgresqlParams(req: CreatePostgresqlReq, initReq?: fm.InitReq): Promise<UpdatePostgresqlParamsResp> {
365
+ return fm.fetchReq<CreatePostgresqlReq, UpdatePostgresqlParamsResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql/${req["cluster"]}/${req["namespace"]}/${req["name"]}/params`, {...initReq, method: "PUT", body: JSON.stringify(req)})
366
+ }
367
+ static DeletePostgresql(req: DeletePostgresqlReq, initReq?: fm.InitReq): Promise<DeletePostgresqlResp> {
368
+ return fm.fetchReq<DeletePostgresqlReq, DeletePostgresqlResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql/${req["cluster"]}/${req["namespace"]}/${req["name"]}`, {...initReq, method: "DELETE"})
369
+ }
370
+ static DeletePostgresqls(req: DeletePostgresqlsReq, initReq?: fm.InitReq): Promise<DeletePostgresqlsResp> {
371
+ return fm.fetchReq<DeletePostgresqlsReq, DeletePostgresqlsResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresqls`, {...initReq, method: "POST", body: JSON.stringify(req)})
372
+ }
373
+ static GetPostgresqlUsers(req: GetPostgresqlUsersReq, initReq?: fm.InitReq): Promise<GetPostgresqlUsersResp> {
374
+ return fm.fetchReq<GetPostgresqlUsersReq, GetPostgresqlUsersResp>(`/apis/mcamel.io/postgresql/v1alpha1/postgresql/${req["cluster"]}/${req["namespace"]}/${req["name"]}/users?${fm.renderURLSearchParams(req, ["cluster", "namespace", "name"])}`, {...initReq, method: "GET"})
375
+ }
376
+ }
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/postgresql/v1alpha1/postgresql/version?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
26
+ }
27
+ }