@daocloud-proto/hydra 0.2.0-dev-6 → 0.2.0-dev-8

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.
@@ -16,6 +16,11 @@ export enum TimePeriod {
16
16
  TIME_PERIOD_MONTH = "TIME_PERIOD_MONTH",
17
17
  }
18
18
 
19
+ export type CreateWSAPIKeyRequest = {
20
+ name?: string
21
+ workspace?: number
22
+ }
23
+
19
24
  export type CreateAPIKeyRequest = {
20
25
  name?: string
21
26
  }
@@ -28,6 +33,13 @@ export type APIKey = {
28
33
  creationTimestamp?: GoogleProtobufTimestamp.Timestamp
29
34
  name?: string
30
35
  denyModels?: string[]
36
+ workspace?: number
37
+ createBy?: string
38
+ }
39
+
40
+ export type ListWSAPIKeyRequest = {
41
+ workspace?: number
42
+ page?: HydraCommonCommon.Pagination
31
43
  }
32
44
 
33
45
  export type ListAPIKeyRequest = {
@@ -39,10 +51,24 @@ export type ListAPIKeyResponse = {
39
51
  page?: HydraCommonCommon.Pagination
40
52
  }
41
53
 
54
+ export type DeleteWSAPIKeyRequest = {
55
+ id?: string
56
+ workspace?: number
57
+ }
58
+
42
59
  export type DeleteAPIKeyRequest = {
43
60
  id?: string
44
61
  }
45
62
 
63
+ export type WSAPIKeyUsageStatisticsRequest = {
64
+ startTime?: GoogleProtobufTimestamp.Timestamp
65
+ endTime?: GoogleProtobufTimestamp.Timestamp
66
+ ids?: string[]
67
+ models?: string[]
68
+ period?: TimePeriod
69
+ workspace?: number
70
+ }
71
+
46
72
  export type APIKeyUsageStatisticsRequest = {
47
73
  startTime?: GoogleProtobufTimestamp.Timestamp
48
74
  endTime?: GoogleProtobufTimestamp.Timestamp
@@ -81,4 +107,18 @@ export class APIKeyManagement {
81
107
  static GetAPIKeyUsageStatistics(req: APIKeyUsageStatisticsRequest, initReq?: fm.InitReq): Promise<APIKeyUsageStatisticsResponse> {
82
108
  return fm.fetchReq<APIKeyUsageStatisticsRequest, APIKeyUsageStatisticsResponse>(`/apis/hydra.io/v1alpha1/apikeys-stats?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
83
109
  }
110
+ }
111
+ export class WSAPIKeyManagement {
112
+ static CreateWSAPIKey(req: CreateWSAPIKeyRequest, initReq?: fm.InitReq): Promise<APIKey> {
113
+ return fm.fetchReq<CreateWSAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
114
+ }
115
+ static ListWSAPIKey(req: ListWSAPIKeyRequest, initReq?: fm.InitReq): Promise<ListAPIKeyResponse> {
116
+ return fm.fetchReq<ListWSAPIKeyRequest, ListAPIKeyResponse>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys?${fm.renderURLSearchParams(req, ["workspace"])}`, {...initReq, method: "GET"})
117
+ }
118
+ static DeleteWSAPIKey(req: DeleteWSAPIKeyRequest, initReq?: fm.InitReq): Promise<APIKey> {
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
+ }
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?${fm.renderURLSearchParams(req, ["workspace"])}`, {...initReq, method: "GET"})
123
+ }
84
124
  }
@@ -6,6 +6,13 @@
6
6
 
7
7
  import * as HydraCommonCommon from "../../../common/common.pb"
8
8
  import * as fm from "../../../fetch.pb"
9
+
10
+ export enum ClusterStatus {
11
+ STATUS_UNSPECIFIED = "STATUS_UNSPECIFIED",
12
+ STATUS_READY = "STATUS_READY",
13
+ STATUS_NOT_READY = "STATUS_NOT_READY",
14
+ }
15
+
9
16
  export type ListWorkspaceRequest = {
10
17
  page?: HydraCommonCommon.Pagination
11
18
  cluster?: string
@@ -21,8 +28,47 @@ export type ListWorkspacesResponse = {
21
28
  page?: HydraCommonCommon.Pagination
22
29
  }
23
30
 
31
+ export type ListClusterRequest = {
32
+ workspace?: number
33
+ page?: HydraCommonCommon.Pagination
34
+ }
35
+
36
+ export type Cluster = {
37
+ name?: string
38
+ status?: ClusterStatus
39
+ agentInstalled?: boolean
40
+ baseUrl?: string
41
+ }
42
+
43
+ export type ListClustersResponse = {
44
+ items?: Cluster[]
45
+ page?: HydraCommonCommon.Pagination
46
+ }
47
+
48
+ export type ClusterNamespace = {
49
+ cluster?: string
50
+ namespace?: string
51
+ }
52
+
53
+ export type ListClusterNamespacesRequest = {
54
+ workspace?: number
55
+ cluster?: string
56
+ page?: HydraCommonCommon.Pagination
57
+ }
58
+
59
+ export type ListClusterNamespaceResponse = {
60
+ items?: ClusterNamespace[]
61
+ page?: HydraCommonCommon.Pagination
62
+ }
63
+
24
64
  export class WorkspaceService {
25
65
  static ListWorkspaces(req: ListWorkspaceRequest, initReq?: fm.InitReq): Promise<ListWorkspacesResponse> {
26
66
  return fm.fetchReq<ListWorkspaceRequest, ListWorkspacesResponse>(`/apis/hydra.io/v1alpha1/workspaces?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
27
67
  }
68
+ static ListClusters(req: ListClusterRequest, initReq?: fm.InitReq): Promise<ListClustersResponse> {
69
+ return fm.fetchReq<ListClusterRequest, ListClustersResponse>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/clusters?${fm.renderURLSearchParams(req, ["workspace"])}`, {...initReq, method: "GET"})
70
+ }
71
+ static ListClusterNamespaces(req: ListClusterNamespacesRequest, initReq?: fm.InitReq): Promise<ListClusterNamespaceResponse> {
72
+ return fm.fetchReq<ListClusterNamespacesRequest, ListClusterNamespaceResponse>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/cluster-namespaces?${fm.renderURLSearchParams(req, ["workspace"])}`, {...initReq, method: "GET"})
73
+ }
28
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daocloud-proto/hydra",
3
- "version": "v0.2.0-dev-6",
3
+ "version": "v0.2.0-dev-8",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC"