@daocloud-proto/skoala 0.4.1-150 → 0.4.1-156
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.
|
@@ -34,6 +34,14 @@ export enum RedirectResponseCode {
|
|
|
34
34
|
PERMANENT_REDIRECT = "PERMANENT_REDIRECT",
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export enum LoadBalancePolicyStrategy {
|
|
38
|
+
Random = "Random",
|
|
39
|
+
RoundRobin = "RoundRobin",
|
|
40
|
+
WeightedLeastRequest = "WeightedLeastRequest",
|
|
41
|
+
Cookie = "Cookie",
|
|
42
|
+
RequestHash = "RequestHash",
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
export type CreateAPIReq = {
|
|
38
46
|
workspaceId?: string
|
|
39
47
|
gatewayName?: string
|
|
@@ -42,6 +50,49 @@ export type CreateAPIReq = {
|
|
|
42
50
|
apiConfig?: APIConfig
|
|
43
51
|
}
|
|
44
52
|
|
|
53
|
+
export type AdvancedAPIReq = {
|
|
54
|
+
workspaceId?: string
|
|
55
|
+
gatewayName?: string
|
|
56
|
+
clusterName?: string
|
|
57
|
+
namespaceName?: string
|
|
58
|
+
apiName?: string
|
|
59
|
+
advancedApiConfig?: AdvancedAPIConfig
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type AdvancedAPIRes = {
|
|
63
|
+
apiName?: string
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type TimeoutPolicy = {
|
|
67
|
+
response?: string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type PathRewritePolicy = {
|
|
71
|
+
oldPath?: string
|
|
72
|
+
replacement?: string
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type AdvancedAPIConfig = {
|
|
76
|
+
loadBalancePolicy?: LoadBalancePolicy
|
|
77
|
+
timeoutPolicy?: TimeoutPolicy
|
|
78
|
+
pathRewritePolicy?: PathRewritePolicy
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type LoadBalancePolicy = {
|
|
82
|
+
requestHashPolicies?: RequestHashPolicies[]
|
|
83
|
+
strategy?: LoadBalancePolicyStrategy
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type RequestHashPolicies = {
|
|
87
|
+
hashSourceIp?: boolean
|
|
88
|
+
terminal?: boolean
|
|
89
|
+
headerHashPolicy?: HeaderHashPolicy
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type HeaderHashPolicy = {
|
|
93
|
+
headerName?: string
|
|
94
|
+
}
|
|
95
|
+
|
|
45
96
|
export type UpdateAPIReq = {
|
|
46
97
|
apiName?: string
|
|
47
98
|
workspaceId?: string
|
|
@@ -52,12 +103,15 @@ export type UpdateAPIReq = {
|
|
|
52
103
|
}
|
|
53
104
|
|
|
54
105
|
export type CreateAPIRes = {
|
|
106
|
+
apiName?: string
|
|
55
107
|
}
|
|
56
108
|
|
|
57
109
|
export type UpdateAPIRes = {
|
|
110
|
+
apiName?: string
|
|
58
111
|
}
|
|
59
112
|
|
|
60
113
|
export type DeleteAPIRes = {
|
|
114
|
+
apiName?: string
|
|
61
115
|
}
|
|
62
116
|
|
|
63
117
|
export type GetAPIReq = {
|
|
@@ -82,6 +136,7 @@ export type GetAPIRes = {
|
|
|
82
136
|
fqdn?: string
|
|
83
137
|
matchRule?: MatchRule
|
|
84
138
|
targetService?: TargetService
|
|
139
|
+
advancedPolicy?: AdvancedAPIConfig
|
|
85
140
|
}
|
|
86
141
|
|
|
87
142
|
export type TargetService = {
|
|
@@ -212,6 +212,9 @@ export class Gateway {
|
|
|
212
212
|
static UpdateAPI(req: SkoalaApiHostedV1alpha1Api.UpdateAPIReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Api.UpdateAPIRes> {
|
|
213
213
|
return fm.fetchReq<SkoalaApiHostedV1alpha1Api.UpdateAPIReq, SkoalaApiHostedV1alpha1Api.UpdateAPIRes>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/clusters/${req["clusterName"]}/namespaces/${req["namespaceName"]}/gateways/${req["gatewayName"]}/apis/${req["apiName"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
214
214
|
}
|
|
215
|
+
static UpdateAPIPolicy(req: SkoalaApiHostedV1alpha1Api.AdvancedAPIReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Api.AdvancedAPIRes> {
|
|
216
|
+
return fm.fetchReq<SkoalaApiHostedV1alpha1Api.AdvancedAPIReq, SkoalaApiHostedV1alpha1Api.AdvancedAPIRes>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/clusters/${req["clusterName"]}/namespaces/${req["namespaceName"]}/gateways/${req["gatewayName"]}/apis/${req["apiName"]}/policies`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
217
|
+
}
|
|
215
218
|
static ListGatewayLog(req: SkoalaApiHostedV1alpha1Apilog.SearchLogReq, initReq?: fm.InitReq): Promise<SkoalaApiHostedV1alpha1Apilog.SearchLogRes> {
|
|
216
219
|
return fm.fetchReq<SkoalaApiHostedV1alpha1Apilog.SearchLogReq, SkoalaApiHostedV1alpha1Apilog.SearchLogRes>(`/apis/sesame.skoala.io/v1alpha1/workspaces/${req["workspaceId"]}/clusters/${req["clusterName"]}/namespaces/${req["namespaceName"]}/gateways/${req["gatewayName"]}/requestlogs?${fm.renderURLSearchParams(req, ["workspaceId", "clusterName", "namespaceName", "gatewayName"])}`, {...initReq, method: "GET"})
|
|
217
220
|
}
|