@daocloud-proto/kcoral 0.6.1 → 0.7.0

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.
@@ -5,6 +5,15 @@
5
5
  */
6
6
 
7
7
  import * as KcoralIoApiTypesPage from "../../types/page.pb"
8
+
9
+ type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined };
10
+ type OneOf<T> =
11
+ | { [k in keyof T]?: undefined }
12
+ | (
13
+ keyof T extends infer K ?
14
+ (K extends string & keyof T ? { [k in K]: T[K] } & Absent<T, K>
15
+ : never)
16
+ : never);
8
17
  export type ListKCoralClustersRequest = {
9
18
  page?: number
10
19
  pageSize?: number
@@ -15,12 +24,34 @@ export type ListKCoralClustersRequest = {
15
24
  fuzzyName?: string
16
25
  }
17
26
 
18
- export type ClusterDescription = {
27
+
28
+ type BaseClusterDescription = {
19
29
  clusterName?: string
20
30
  veleroInstalled?: boolean
21
31
  running?: boolean
22
32
  }
23
33
 
34
+ export type ClusterDescription = BaseClusterDescription
35
+ & OneOf<{ error: string }>
36
+
24
37
  export type ListKCoralClustersResponse = {
25
38
  items?: ClusterDescription[]
39
+ }
40
+
41
+ export type ListAllUserRoleSummaryRequest = {
42
+ cluster?: string
43
+ namespace?: string
44
+ }
45
+
46
+ export type ListAllUserRoleSummaryResponse = {
47
+ items?: {[key: string]: RoleSummary}
48
+ }
49
+
50
+ export type RoleSummary = {
51
+ clusterRoles?: string[]
52
+ roles?: {[key: string]: RoleNames}
53
+ }
54
+
55
+ export type RoleNames = {
56
+ names?: string[]
26
57
  }
@@ -26,6 +26,9 @@ export class Kubernetes {
26
26
  static EnableVolumeSnapshotClass(req: KcoralIoApiStorageV1alpha1Volumesnapshotclass.EnableVolumeSnapshotClassRequest, initReq?: fm.InitReq): Promise<KcoralIoApiStorageV1alpha1Volumesnapshotclass.VolumeSnapshotClass> {
27
27
  return fm.fetchReq<KcoralIoApiStorageV1alpha1Volumesnapshotclass.EnableVolumeSnapshotClassRequest, KcoralIoApiStorageV1alpha1Volumesnapshotclass.VolumeSnapshotClass>(`/apis/kcoral.io/v1alpha1/clusters/${req["cluster"]}/enablevolumesnapshotclass/${req["name"]}:enable`, {...initReq, method: "POST", body: JSON.stringify(req)})
28
28
  }
29
+ static ListAllUserRoleSummary(req: KcoralIoApiKcoralclusterV1alpha1Kcoralcluster.ListAllUserRoleSummaryRequest, initReq?: fm.InitReq): Promise<KcoralIoApiKcoralclusterV1alpha1Kcoralcluster.ListAllUserRoleSummaryResponse> {
30
+ return fm.fetchReq<KcoralIoApiKcoralclusterV1alpha1Kcoralcluster.ListAllUserRoleSummaryRequest, KcoralIoApiKcoralclusterV1alpha1Kcoralcluster.ListAllUserRoleSummaryResponse>(`/apis/kcoral.io/v1alpha1/rolesummary?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
31
+ }
29
32
  }
30
33
  export class BackupStorageLocation {
31
34
  static ListBackupStorageLocations(req: KcoralIoApiVeleroV1alpha1Backupstoragelocation.ListBackupStorageLocationsRequest, initReq?: fm.InitReq): Promise<KcoralIoApiVeleroV1alpha1Backupstoragelocation.ListBackupStorageLocationsResponse> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"@daocloud-proto/kcoral",
3
- "version":"0.6.1",
3
+ "version":"0.7.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {