@daocloud-proto/hydra 0.5.0-dev-23 → 0.5.0-dev-26
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,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
|
+
import * as HydraCommonCommon from "../../../common/common.pb"
|
|
8
|
+
import * as fm from "../../../fetch.pb"
|
|
9
|
+
import * as HydraManagement_apiWorkspaceV1alpha1Workspace from "../../../management-api/workspace/v1alpha1/workspace.pb"
|
|
10
|
+
export type ListClusterRequest = {
|
|
11
|
+
page?: HydraCommonCommon.Pagination
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type ListClusterResponse = {
|
|
15
|
+
items?: HydraManagement_apiWorkspaceV1alpha1Workspace.Cluster[]
|
|
16
|
+
page?: HydraCommonCommon.Pagination
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class CoreService {
|
|
20
|
+
static AdminListCluster(req: ListClusterRequest, initReq?: fm.InitReq): Promise<ListClusterResponse> {
|
|
21
|
+
return fm.fetchReq<ListClusterRequest, ListClusterResponse>(`/apis/admin.hydra.io/v1alpha1/clusters?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
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 HydraCommonCommon from "../../../common/common.pb"
|
|
8
|
+
import * as fm from "../../../fetch.pb"
|
|
9
|
+
import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
10
|
+
import * as HydraAdmin_apiModelV1alpha1Model from "../../model/v1alpha1/model.pb"
|
|
11
|
+
|
|
12
|
+
export enum LoadBalanceStrategy {
|
|
13
|
+
LOAD_BALANCE_STRATEGY_UNSPECIFIED = "LOAD_BALANCE_STRATEGY_UNSPECIFIED",
|
|
14
|
+
LOAD_BALANCE_STRATEGY_ROUND_ROBIN = "LOAD_BALANCE_STRATEGY_ROUND_ROBIN",
|
|
15
|
+
LOAD_BALANCE_STRATEGY_RANDOM = "LOAD_BALANCE_STRATEGY_RANDOM",
|
|
16
|
+
LOAD_BALANCE_STRATEGY_WEIGHTED = "LOAD_BALANCE_STRATEGY_WEIGHTED",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export enum RateLimitBaseOn {
|
|
20
|
+
RATE_LIMIT_BASE_ON_UNSPECIFIED = "RATE_LIMIT_BASE_ON_UNSPECIFIED",
|
|
21
|
+
RATE_LIMIT_BASE_ON_API_KEY = "RATE_LIMIT_BASE_ON_API_KEY",
|
|
22
|
+
RATE_LIMIT_BASE_ON_WS = "RATE_LIMIT_BASE_ON_WS",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export enum MAASModelGatewayStatus {
|
|
26
|
+
GATEWAY_STATUS_UNSPECIFIED = "GATEWAY_STATUS_UNSPECIFIED",
|
|
27
|
+
GATEWAY_STATUS_HEALTHY = "GATEWAY_STATUS_HEALTHY",
|
|
28
|
+
GATEWAY_STATUS_FAILED = "GATEWAY_STATUS_FAILED",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum UpstreamModelStatus {
|
|
32
|
+
STATUS_UNSPECIFIED = "STATUS_UNSPECIFIED",
|
|
33
|
+
STATUS_HEALTHY = "STATUS_HEALTHY",
|
|
34
|
+
STATUS_FAILED = "STATUS_FAILED",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type CreateMAASModelRequest = {
|
|
38
|
+
modelId?: string
|
|
39
|
+
upstreamModels?: UpstreamModel[]
|
|
40
|
+
cluster?: string
|
|
41
|
+
ratelimitConfig?: RatelimitConfig
|
|
42
|
+
loadBalanceConfig?: LoadBalanceConfig
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type MAASModel = {
|
|
46
|
+
model?: HydraAdmin_apiModelV1alpha1Model.Model
|
|
47
|
+
upstreamModels?: UpstreamModel[]
|
|
48
|
+
cluster?: string
|
|
49
|
+
ratelimitConfig?: RatelimitConfig
|
|
50
|
+
loadBalanceConfig?: LoadBalanceConfig
|
|
51
|
+
creationTimestamp?: GoogleProtobufTimestamp.Timestamp
|
|
52
|
+
gatewayStatus?: MAASModelGatewayStatus
|
|
53
|
+
enabled?: boolean
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type LoadBalanceConfig = {
|
|
57
|
+
strategy?: LoadBalanceStrategy
|
|
58
|
+
weightedConfig?: WeightedLoadBalanceConfig
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type WeightedLoadBalanceConfig = {
|
|
62
|
+
endpoints?: WeightedEndpoint[]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type WeightedEndpoint = {
|
|
66
|
+
modelId?: string
|
|
67
|
+
weight?: number
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type RatelimitConfig = {
|
|
71
|
+
enabled?: boolean
|
|
72
|
+
rules?: RateLimitRule[]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type RateLimitRule = {
|
|
76
|
+
baseOn?: RateLimitBaseOn
|
|
77
|
+
limit?: number
|
|
78
|
+
duration?: number
|
|
79
|
+
workspace?: number
|
|
80
|
+
apiKey?: string
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type UpstreamModel = {
|
|
84
|
+
modelId?: string
|
|
85
|
+
apiKey?: string
|
|
86
|
+
endpoint?: string
|
|
87
|
+
status?: UpstreamModelStatus
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type ListMAASModelRequest = {
|
|
91
|
+
page?: HydraCommonCommon.Pagination
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type ListMAASModelResponse = {
|
|
95
|
+
items?: MAASModel[]
|
|
96
|
+
page?: HydraCommonCommon.Pagination
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type UpdateMAASModelRequest = {
|
|
100
|
+
modelId?: string
|
|
101
|
+
ratelimitConfig?: RatelimitConfig
|
|
102
|
+
loadBalanceConfig?: LoadBalanceConfig
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type UpdateMAASModelStatusRequest = {
|
|
106
|
+
modelId?: string
|
|
107
|
+
enable?: boolean
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type GetMAASModelRequest = {
|
|
111
|
+
modelId?: string
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export class MAASService {
|
|
115
|
+
static GetMAASModel(req: GetMAASModelRequest, initReq?: fm.InitReq): Promise<MAASModel> {
|
|
116
|
+
return fm.fetchReq<GetMAASModelRequest, MAASModel>(`/apis/admin.hydra.io/v1alpha1/maas-models/${req["modelId"]}?${fm.renderURLSearchParams(req, ["modelId"])}`, {...initReq, method: "GET"})
|
|
117
|
+
}
|
|
118
|
+
static CreateMAASModel(req: CreateMAASModelRequest, initReq?: fm.InitReq): Promise<MAASModel> {
|
|
119
|
+
return fm.fetchReq<CreateMAASModelRequest, MAASModel>(`/apis/admin.hydra.io/v1alpha1/maas-models`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
120
|
+
}
|
|
121
|
+
static ListMAASModels(req: ListMAASModelRequest, initReq?: fm.InitReq): Promise<ListMAASModelResponse> {
|
|
122
|
+
return fm.fetchReq<ListMAASModelRequest, ListMAASModelResponse>(`/apis/admin.hydra.io/v1alpha1/maas-models?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
123
|
+
}
|
|
124
|
+
static UpdateMAASModel(req: UpdateMAASModelRequest, initReq?: fm.InitReq): Promise<MAASModel> {
|
|
125
|
+
return fm.fetchReq<UpdateMAASModelRequest, MAASModel>(`/apis/admin.hydra.io/v1alpha1/maas-models/${req["modelId"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
126
|
+
}
|
|
127
|
+
static UpdateMAASModelStatus(req: UpdateMAASModelStatusRequest, initReq?: fm.InitReq): Promise<MAASModel> {
|
|
128
|
+
return fm.fetchReq<UpdateMAASModelStatusRequest, MAASModel>(`/apis/admin.hydra.io/v1alpha1/maas-models/${req["modelId"]}/status`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -105,7 +105,7 @@ export class APIKeyManagement {
|
|
|
105
105
|
return fm.fetchReq<DeleteAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/apikeys/${req["id"]}`, {...initReq, method: "DELETE", body: JSON.stringify(req, fm.replacer)})
|
|
106
106
|
}
|
|
107
107
|
static GetAPIKeyUsageStatistics(req: APIKeyUsageStatisticsRequest, initReq?: fm.InitReq): Promise<APIKeyUsageStatisticsResponse> {
|
|
108
|
-
return fm.fetchReq<APIKeyUsageStatisticsRequest, APIKeyUsageStatisticsResponse>(`/apis/hydra.io/v1alpha1/apikeys-stats
|
|
108
|
+
return fm.fetchReq<APIKeyUsageStatisticsRequest, APIKeyUsageStatisticsResponse>(`/apis/hydra.io/v1alpha1/apikeys-stats`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
export class WSAPIKeyManagement {
|
|
@@ -119,6 +119,6 @@ export class WSAPIKeyManagement {
|
|
|
119
119
|
return fm.fetchReq<DeleteWSAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys/${req["id"]}`, {...initReq, method: "DELETE", body: JSON.stringify(req, fm.replacer)})
|
|
120
120
|
}
|
|
121
121
|
static GetAPIKeyUsageStatistics(req: WSAPIKeyUsageStatisticsRequest, initReq?: fm.InitReq): Promise<APIKeyUsageStatisticsResponse> {
|
|
122
|
-
return fm.fetchReq<WSAPIKeyUsageStatisticsRequest, APIKeyUsageStatisticsResponse>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys-stats
|
|
122
|
+
return fm.fetchReq<WSAPIKeyUsageStatisticsRequest, APIKeyUsageStatisticsResponse>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys-stats`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
123
123
|
}
|
|
124
124
|
}
|