@stolostron/multicluster-sdk 0.5.3 → 0.6.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.
Files changed (70) hide show
  1. package/README.md +277 -34
  2. package/lib/api/fleetK8sCreate.d.ts +19 -0
  3. package/lib/api/fleetK8sCreate.d.ts.map +1 -0
  4. package/lib/api/fleetK8sCreate.js +43 -0
  5. package/lib/api/fleetK8sCreate.js.map +1 -0
  6. package/lib/api/fleetK8sDelete.d.ts +26 -0
  7. package/lib/api/fleetK8sDelete.d.ts.map +1 -0
  8. package/lib/api/fleetK8sDelete.js +53 -0
  9. package/lib/api/fleetK8sDelete.js.map +1 -0
  10. package/lib/api/fleetK8sGet.d.ts +20 -0
  11. package/lib/api/fleetK8sGet.d.ts.map +1 -0
  12. package/lib/api/fleetK8sGet.js +43 -0
  13. package/lib/api/fleetK8sGet.js.map +1 -0
  14. package/lib/api/fleetK8sList.d.ts +28 -0
  15. package/lib/api/fleetK8sList.d.ts.map +1 -0
  16. package/lib/api/fleetK8sList.js +60 -0
  17. package/lib/api/fleetK8sList.js.map +1 -0
  18. package/lib/api/fleetK8sPatch.d.ts +23 -0
  19. package/lib/api/fleetK8sPatch.d.ts.map +1 -0
  20. package/lib/api/fleetK8sPatch.js +50 -0
  21. package/lib/api/fleetK8sPatch.js.map +1 -0
  22. package/lib/api/fleetK8sUpdate.d.ts +23 -0
  23. package/lib/api/fleetK8sUpdate.d.ts.map +1 -0
  24. package/lib/api/fleetK8sUpdate.js +47 -0
  25. package/lib/api/fleetK8sUpdate.js.map +1 -0
  26. package/lib/api/getFleetK8sAPIPath.d.ts +8 -0
  27. package/lib/api/getFleetK8sAPIPath.d.ts.map +1 -0
  28. package/lib/api/getFleetK8sAPIPath.js +32 -0
  29. package/lib/api/getFleetK8sAPIPath.js.map +1 -0
  30. package/lib/api/index.d.ts +10 -4
  31. package/lib/api/index.d.ts.map +1 -1
  32. package/lib/api/index.js +10 -4
  33. package/lib/api/index.js.map +1 -1
  34. package/lib/api/useFleetK8sAPIPath.d.ts +6 -1
  35. package/lib/api/useFleetK8sAPIPath.d.ts.map +1 -1
  36. package/lib/api/useFleetK8sAPIPath.js +10 -34
  37. package/lib/api/useFleetK8sAPIPath.js.map +1 -1
  38. package/lib/api/useFleetK8sWatchResource.js +2 -5
  39. package/lib/api/useFleetK8sWatchResource.js.map +1 -1
  40. package/lib/api/useFleetPrometheusPoll.js +1 -1
  41. package/lib/api/useFleetPrometheusPoll.js.map +1 -1
  42. package/lib/components/FleetResourceEventStream.d.ts.map +1 -1
  43. package/lib/components/FleetResourceEventStream.js +2 -1
  44. package/lib/components/FleetResourceEventStream.js.map +1 -1
  45. package/lib/internal/apiRequests.d.ts +39 -0
  46. package/lib/internal/apiRequests.d.ts.map +1 -0
  47. package/lib/internal/apiRequests.js +141 -0
  48. package/lib/internal/apiRequests.js.map +1 -0
  49. package/lib/internal/cachedHubConfiguration.js +1 -1
  50. package/lib/internal/cachedHubConfiguration.js.map +1 -1
  51. package/lib/internal/checkAccess.js +2 -2
  52. package/lib/internal/checkAccess.js.map +1 -1
  53. package/lib/internal/constants.d.ts +0 -1
  54. package/lib/internal/constants.d.ts.map +1 -1
  55. package/lib/internal/constants.js +1 -2
  56. package/lib/internal/constants.js.map +1 -1
  57. package/lib/internal/isHubRequest.d.ts +2 -0
  58. package/lib/internal/isHubRequest.d.ts.map +1 -0
  59. package/lib/internal/isHubRequest.js +21 -0
  60. package/lib/internal/isHubRequest.js.map +1 -0
  61. package/lib/internal/search/search-client.js +1 -1
  62. package/lib/internal/search/search-client.js.map +1 -1
  63. package/lib/tsconfig.build.tsbuildinfo +1 -1
  64. package/lib/types/fleet.d.ts +47 -1
  65. package/lib/types/fleet.d.ts.map +1 -1
  66. package/package.json +2 -2
  67. package/lib/api/apiRequests.d.ts +0 -70
  68. package/lib/api/apiRequests.d.ts.map +0 -1
  69. package/lib/api/apiRequests.js +0 -193
  70. package/lib/api/apiRequests.js.map +0 -1
package/README.md CHANGED
@@ -42,6 +42,8 @@ Setup depends on your usage scenarios.
42
42
  - [fleetK8sCreate](#gear-fleetk8screate)
43
43
  - [fleetK8sDelete](#gear-fleetk8sdelete)
44
44
  - [fleetK8sGet](#gear-fleetk8sget)
45
+ - [fleetK8sList](#gear-fleetk8slist)
46
+ - [fleetK8sListItems](#gear-fleetk8slistitems)
45
47
  - [fleetK8sPatch](#gear-fleetk8spatch)
46
48
  - [fleetK8sUpdate](#gear-fleetk8supdate)
47
49
  - [FleetResourceEventStream](#gear-fleetresourceeventstream)
@@ -55,46 +57,227 @@ Setup depends on your usage scenarios.
55
57
  - [useFleetSearchPoll](#gear-usefleetsearchpoll)
56
58
  - [useHubClusterName](#gear-usehubclustername)
57
59
  - [useIsFleetAvailable](#gear-useisfleetavailable)
60
+ - [useIsFleetObservabilityInstalled](#gear-useisfleetobservabilityinstalled)
58
61
 
59
62
  ### :gear: fleetK8sCreate
60
63
 
64
+ A fleet version of [`k8sCreate`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8screate) from
65
+ the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that creates a resource on the specified cluster.
66
+
67
+ The cluster name can be specified in options or the payload, with the value from options taking precedence.
68
+ If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
69
+
61
70
  | Function | Type |
62
71
  | ---------- | ---------- |
63
- | `fleetK8sCreate` | `<R extends K8sResourceCommon>(options: OptionsCreate<R>) => Promise<R>` |
72
+ | `fleetK8sCreate` | `<R extends FleetK8sResourceCommon>(options: FleetK8sCreateUpdateOptions<R>) => Promise<R>` |
73
+
74
+ Parameters:
75
+
76
+ * `options`: Which are passed as key-value pairs in the map
77
+ * `options.cluster`: - the cluster on which to create the resource
78
+ * `options.model`: - Kubernetes model
79
+ * `options.data`: - payload for the resource to be created
80
+ * `options.path`: - Appends as subpath if provided
81
+ * `options.queryParams`: - The query parameters to be included in the URL.
82
+
83
+
84
+ Returns:
85
+
86
+ A promise that resolves to the response of the resource created.
87
+ In case of failure, the promise gets rejected with HTTP error response.
64
88
 
65
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/apiRequests.ts#L187)
89
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/fleetK8sCreate.ts#L24)
66
90
 
67
91
  ### :gear: fleetK8sDelete
68
92
 
93
+ A fleet version of [`k8sDelete`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8sdelete) from
94
+ the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that deletes resources from the specified cluster, based on the provided model and resource.
95
+
96
+ The cluster name can be specified in options or the resource, with the value from options taking precedence.
97
+ If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
98
+
99
+ The garbage collection works based on 'Foreground' | 'Background', can be configured with `propagationPolicy` property in provided model or passed in json.
100
+
69
101
  | Function | Type |
70
102
  | ---------- | ---------- |
71
- | `fleetK8sDelete` | `<R extends K8sResourceCommon>(options: OptionsDelete<R>) => Promise<R>` |
103
+ | `fleetK8sDelete` | `<R extends FleetK8sResourceCommon>(options: FleetK8sDeleteOptions<R>) => Promise<R>` |
104
+
105
+ Parameters:
106
+
107
+ * `options`: which are passed as key-value pair in the map.
108
+ * `options.cluster`: - the cluster from which to delete the resource
109
+ * `options.model`: - Kubernetes model
110
+ * `options.resource`: - The resource to be deleted.
111
+ * `options.path`: - Appends as subpath if provided.
112
+ * `options.queryParams`: - The query parameters to be included in the URL.
113
+ * `options.requestInit`: - The fetch init object to use. This can have request headers, method, redirect, etc. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html
114
+ * `options.json`: - Can control garbage collection of resources explicitly if provided else will default to model's `propagationPolicy`.
115
+
116
+
117
+ Returns:
72
118
 
73
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/apiRequests.ts#L214)
119
+ A promise that resolves to the response of kind Status.
120
+ In case of failure promise gets rejected with HTTP error response.
121
+
122
+ Examples:
123
+
124
+ ```
125
+ { kind: 'DeleteOptions', apiVersion: 'v1', propagationPolicy }
126
+ ```
127
+
128
+
129
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/fleetK8sDelete.ts#L31)
74
130
 
75
131
  ### :gear: fleetK8sGet
76
132
 
133
+ A fleet version of [`k8sGet`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8sget) from
134
+ the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that fetches a resource from the specified cluster, based on the provided options.
135
+
136
+ If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
137
+
138
+ If the name is provided it returns resource, else it returns all the resources matching the model.
139
+
77
140
  | Function | Type |
78
141
  | ---------- | ---------- |
79
- | `fleetK8sGet` | `<R extends K8sResourceCommon>(options: OptionsGet) => Promise<R>` |
142
+ | `fleetK8sGet` | `<R extends FleetK8sResourceCommon>(options: FleetK8sGetOptions) => Promise<R>` |
143
+
144
+ Parameters:
145
+
146
+ * `options`: Which are passed as key-value pairs in the map
147
+ * `options.cluster`: - the cluster from which to fetch the resource
148
+ * `options.model`: - Kubernetes model
149
+ * `options.name`: - The name of the resource, if not provided then it looks for all the resources matching the model.
150
+ * `options.ns`: - The namespace to look into, should not be specified for cluster-scoped resources.
151
+ * `options.path`: - Appends as subpath if provided
152
+ * `options.queryParams`: - The query parameters to be included in the URL.
153
+ * `options.requestInit`: - The fetch init object to use. This can have request headers, method, redirect, etc. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html
154
+
155
+
156
+ Returns:
157
+
158
+ A promise that resolves to the response as JSON object with a resource if the name is provided, else it returns all the resources matching the model. In case of failure, the promise gets rejected with HTTP error response.
159
+
160
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/fleetK8sGet.ts#L25)
80
161
 
81
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/apiRequests.ts#L128)
162
+ ### :gear: fleetK8sList
163
+
164
+ A fleet version of [`k8sList`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slist) from
165
+ the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that lists the resources as an array in the specified cluster, based on the provided options.
166
+
167
+ If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
168
+
169
+ | Function | Type |
170
+ | ---------- | ---------- |
171
+ | `fleetK8sList` | `<R extends FleetK8sResourceCommon>(options: FleetK8sListOptions) => Promise<R[]>` |
172
+
173
+ Parameters:
174
+
175
+ * `options`: Which are passed as key-value pairs in the map.
176
+ * `options.cluster`: - the cluster from which to list the resources
177
+ * `options.model`: - Kubernetes model
178
+ * `options.queryParams`: - The query parameters to be included in the URL. It can also pass label selectors by using the `labelSelector` key.
179
+ * `options.requestInit`: - The fetch init object to use. This can have request headers, method, redirect, and so forth. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html
180
+
181
+
182
+ Returns:
183
+
184
+ A promise that resolves to the response
185
+
186
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/fleetK8sList.ts#L20)
187
+
188
+ ### :gear: fleetK8sListItems
189
+
190
+ A fleet version of [`k8sListItems`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slistitems) from
191
+ the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that lists the resources as an array in the specified cluster, based on the provided options.
192
+
193
+ If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
194
+
195
+ | Function | Type |
196
+ | ---------- | ---------- |
197
+ | `fleetK8sListItems` | `<R extends FleetK8sResourceCommon>(options: FleetK8sListOptions) => Promise<R[]>` |
198
+
199
+ Parameters:
200
+
201
+ * `options`: Which are passed as key-value pairs in the map.
202
+ * `options.cluster`: - the cluster from which to list the resources
203
+ * `options.model`: - Kubernetes model
204
+ * `options.queryParams`: - The query parameters to be included in the URL. It can also pass label selectors by using the `labelSelector` key.
205
+ * `options.requestInit`: - The fetch init object to use. This can have request headers, method, redirect, and so forth. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html
206
+
207
+
208
+ Returns:
209
+
210
+ A promise that resolves to the response
211
+
212
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/fleetK8sList.ts#L54)
82
213
 
83
214
  ### :gear: fleetK8sPatch
84
215
 
216
+ A fleet version of [`k8sPatch`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slist) from
217
+ the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that patches any resource on the specified cluster, based on the provided options.
218
+
219
+ The cluster name can be specified in options or the resource, with the value from options taking precedence.
220
+ If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
221
+
222
+ When a client needs to perform the partial update, the client can use `fleetK8sPatch`.
223
+ Alternatively, the client can use `fleetK8sUpdate` to replace an existing resource entirely.
224
+ See more https://datatracker.ietf.org/doc/html/rfc6902
225
+
85
226
  | Function | Type |
86
227
  | ---------- | ---------- |
87
- | `fleetK8sPatch` | `<R extends K8sResourceCommon>(options: OptionsPatch<R>) => Promise<R>` |
228
+ | `fleetK8sPatch` | `<R extends FleetK8sResourceCommon>(options: FleetK8sPatchOptions<R>) => Promise<R>` |
229
+
230
+ Parameters:
231
+
232
+ * `options`: Which are passed as key-value pairs in the map.
233
+ * `options.cluster`: - the cluster on which to patch the resource
234
+ * `options.model`: - Kubernetes model
235
+ * `options.resource`: - The resource to be patched.
236
+ * `options.data`: - Only the data to be patched on existing resource with the operation, path, and value.
237
+ * `options.path`: - Appends as subpath if provided.
238
+ * `options.queryParams`: - The query parameters to be included in the URL.
239
+
240
+
241
+ Returns:
242
+
243
+ A promise that resolves to the response of the resource patched.
244
+ In case of failure promise gets rejected with HTTP error response.
88
245
 
89
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/apiRequests.ts#L160)
246
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/fleetK8sPatch.ts#L29)
90
247
 
91
248
  ### :gear: fleetK8sUpdate
92
249
 
250
+ A fleet version of [`k8sPatch`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slist) from
251
+ the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that updates the entire resource on the specified cluster, based on the provided options.
252
+
253
+ The cluster name can be specified in options or the payload, with the value from options taking precedence.
254
+ If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
255
+
256
+ When a client needs to replace an existing resource entirely, the client can use `fleetK8sUpdate`.
257
+ Alternatively, the client can use `fleetK8sPatch` to perform the partial update.
258
+
93
259
  | Function | Type |
94
260
  | ---------- | ---------- |
95
- | `fleetK8sUpdate` | `<R extends K8sResourceCommon>(options: OptionsUpdate<R>) => Promise<R>` |
261
+ | `fleetK8sUpdate` | `<R extends FleetK8sResourceCommon>(options: FleetK8sCreateUpdateOptions<R>) => Promise<R>` |
262
+
263
+ Parameters:
264
+
265
+ * `options`: which are passed as key-value pair in the map
266
+ * `options.cluster`: - the cluster on which to update the resource
267
+ * `options.model`: - Kubernetes model
268
+ * `options.data`: - payload for the Kubernetes resource to be updated
269
+ * `options.ns`: - namespace to look into, it should not be specified for cluster-scoped resources.
270
+ * `options.name`: - resource name to be updated.
271
+ * `options.path`: - appends as subpath if provided.
272
+ * `options.queryParams`: - The query parameters to be included in the URL.
273
+
96
274
 
97
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/apiRequests.ts#L140)
275
+ Returns:
276
+
277
+ A promise that resolves to the response of the resource updated.
278
+ In case of failure promise gets rejected with HTTP error response.
279
+
280
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/fleetK8sUpdate.ts#L30)
98
281
 
99
282
  ### :gear: FleetResourceEventStream
100
283
 
@@ -149,7 +332,7 @@ Examples:
149
332
  />
150
333
 
151
334
 
152
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/components/FleetResourceEventStream.tsx#L93)
335
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/components/FleetResourceEventStream.tsx#L94)
153
336
 
154
337
  ### :gear: FleetResourceLink
155
338
 
@@ -161,11 +344,22 @@ Examples:
161
344
 
162
345
  ### :gear: getFleetK8sAPIPath
163
346
 
347
+ Function that provides the k8s API path for the fleet.
348
+
164
349
  | Function | Type |
165
350
  | ---------- | ---------- |
166
351
  | `getFleetK8sAPIPath` | `(cluster?: string or undefined) => Promise<string>` |
167
352
 
168
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetK8sAPIPath.ts#L21)
353
+ Parameters:
354
+
355
+ * `cluster`: - The cluster name.
356
+
357
+
358
+ Returns:
359
+
360
+ The k8s API path for the fleet.
361
+
362
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/getFleetK8sAPIPath.ts#L14)
169
363
 
170
364
  ### :gear: useFleetAccessReview
171
365
 
@@ -203,11 +397,22 @@ Array with `isAllowed` and `loading` values.
203
397
 
204
398
  ### :gear: useFleetK8sAPIPath
205
399
 
400
+ Hook that provides the k8s API path for the fleet.
401
+
206
402
  | Function | Type |
207
403
  | ---------- | ---------- |
208
404
  | `useFleetK8sAPIPath` | `UseFleetK8sAPIPath` |
209
405
 
210
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetK8sAPIPath.ts#L9)
406
+ Parameters:
407
+
408
+ * `cluster`: - The cluster name.
409
+
410
+
411
+ Returns:
412
+
413
+ Array with `k8sAPIPath`, `loaded` and `error` values.
414
+
415
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetK8sAPIPath.ts#L13)
211
416
 
212
417
  ### :gear: useFleetK8sWatchResource
213
418
 
@@ -254,7 +459,7 @@ const [deployment, loaded, error] = useFleetK8sWatchResource({
254
459
  ```
255
460
 
256
461
 
257
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetK8sWatchResource.ts#L48)
462
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetK8sWatchResource.ts#L50)
258
463
 
259
464
  ### :gear: useFleetPrometheusPoll
260
465
 
@@ -262,7 +467,7 @@ const [deployment, loaded, error] = useFleetK8sWatchResource({
262
467
  | ---------- | ---------- |
263
468
  | `useFleetPrometheusPoll` | `UsePrometheusPoll` |
264
469
 
265
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetPrometheusPoll/index.ts#L13)
470
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useFleetPrometheusPoll.ts#L13)
266
471
 
267
472
  ### :gear: useFleetSearchPoll
268
473
 
@@ -398,6 +603,11 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
398
603
  - [AdvancedSearchFilter](#gear-advancedsearchfilter)
399
604
  - [Fleet](#gear-fleet)
400
605
  - [FleetAccessReviewResourceAttributes](#gear-fleetaccessreviewresourceattributes)
606
+ - [FleetK8sCreateUpdateOptions](#gear-fleetk8screateupdateoptions)
607
+ - [FleetK8sDeleteOptions](#gear-fleetk8sdeleteoptions)
608
+ - [FleetK8sGetOptions](#gear-fleetk8sgetoptions)
609
+ - [FleetK8sListOptions](#gear-fleetk8slistoptions)
610
+ - [FleetK8sPatchOptions](#gear-fleetk8spatchoptions)
401
611
  - [FleetK8sResourceCommon](#gear-fleetk8sresourcecommon)
402
612
  - [FleetResourceLinkProps](#gear-fleetresourcelinkprops)
403
613
  - [FleetWatchK8sResource](#gear-fleetwatchk8sresource)
@@ -408,6 +618,7 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
408
618
  - [UseFleetSearchPoll](#gear-usefleetsearchpoll)
409
619
  - [UseHubClusterName](#gear-usehubclustername)
410
620
  - [UseIsFleetAvailable](#gear-useisfleetavailable)
621
+ - [UseIsFleetObservabilityInstalled](#gear-useisfleetobservabilityinstalled)
411
622
 
412
623
  ### :gear: AdvancedSearchFilter
413
624
 
@@ -417,29 +628,61 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
417
628
 
418
629
  [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/search.ts#L8)
419
630
 
420
- ### :gear: AdvancedSearchFilter
631
+ ### :gear: Fleet
421
632
 
422
633
  | Type | Type |
423
634
  | ---------- | ---------- |
424
- | `AdvancedSearchFilter` | `{ property: string; values: string[] }[]` |
635
+ | `Fleet` | `T and { cluster?: string }` |
425
636
 
426
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/search.ts#L8)
637
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L14)
427
638
 
428
- ### :gear: Fleet
639
+ ### :gear: FleetAccessReviewResourceAttributes
429
640
 
430
641
  | Type | Type |
431
642
  | ---------- | ---------- |
432
- | `Fleet` | `T and { cluster?: string }` |
643
+ | `FleetAccessReviewResourceAttributes` | `Fleet<AccessReviewResourceAttributes>` |
433
644
 
434
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L11)
645
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L18)
435
646
 
436
- ### :gear: FleetAccessReviewResourceAttributes
647
+ ### :gear: FleetK8sCreateUpdateOptions
437
648
 
438
649
  | Type | Type |
439
650
  | ---------- | ---------- |
440
- | `FleetAccessReviewResourceAttributes` | `Fleet<AccessReviewResourceAttributes>` |
651
+ | `FleetK8sCreateUpdateOptions` | `{ model: K8sModel name?: string ns?: string path?: string cluster?: string queryParams?: QueryParams data: R }` |
652
+
653
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L49)
654
+
655
+ ### :gear: FleetK8sDeleteOptions
656
+
657
+ | Type | Type |
658
+ | ---------- | ---------- |
659
+ | `FleetK8sDeleteOptions` | `{ model: K8sModel name?: string ns?: string path?: string cluster?: string queryParams?: QueryParams resource: R requestInit?: RequestInit json?: Record<string, any> }` |
660
+
661
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L80)
662
+
663
+ ### :gear: FleetK8sGetOptions
441
664
 
442
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L15)
665
+ | Type | Type |
666
+ | ---------- | ---------- |
667
+ | `FleetK8sGetOptions` | `{ model: K8sModel name?: string ns?: string path?: string cluster?: string queryParams?: QueryParams requestInit?: RequestInit }` |
668
+
669
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L59)
670
+
671
+ ### :gear: FleetK8sListOptions
672
+
673
+ | Type | Type |
674
+ | ---------- | ---------- |
675
+ | `FleetK8sListOptions` | `{ model: K8sModel queryParams: { [key: string]: any } requestInit?: RequestInit }` |
676
+
677
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L92)
678
+
679
+ ### :gear: FleetK8sPatchOptions
680
+
681
+ | Type | Type |
682
+ | ---------- | ---------- |
683
+ | `FleetK8sPatchOptions` | `{ model: K8sModel name?: string ns?: string path?: string cluster?: string queryParams?: QueryParams resource: R data: Patch[] }` |
684
+
685
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L69)
443
686
 
444
687
  ### :gear: FleetK8sResourceCommon
445
688
 
@@ -447,7 +690,7 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
447
690
  | ---------- | ---------- |
448
691
  | `FleetK8sResourceCommon` | `Fleet<K8sResourceCommon>` |
449
692
 
450
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L14)
693
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L17)
451
694
 
452
695
  ### :gear: FleetResourceLinkProps
453
696
 
@@ -455,7 +698,7 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
455
698
  | ---------- | ---------- |
456
699
  | `FleetResourceLinkProps` | `Fleet<ResourceLinkProps>` |
457
700
 
458
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L21)
701
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L24)
459
702
 
460
703
  ### :gear: FleetWatchK8sResource
461
704
 
@@ -463,7 +706,7 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
463
706
  | ---------- | ---------- |
464
707
  | `FleetWatchK8sResource` | `Fleet<WatchK8sResource>` |
465
708
 
466
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L13)
709
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L16)
467
710
 
468
711
  ### :gear: SearchResult
469
712
 
@@ -479,7 +722,7 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
479
722
  | ---------- | ---------- |
480
723
  | `UseFleetClusterNames` | `() => [string[], boolean, any]` |
481
724
 
482
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L25)
725
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L28)
483
726
 
484
727
  ### :gear: UseFleetK8sAPIPath
485
728
 
@@ -487,7 +730,7 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
487
730
  | ---------- | ---------- |
488
731
  | `UseFleetK8sAPIPath` | `( cluster?: string ) => [k8sAPIPath: string or undefined, loaded: boolean, error: Error or undefined]` |
489
732
 
490
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L18)
733
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L21)
491
734
 
492
735
  ### :gear: UseFleetK8sWatchResource
493
736
 
@@ -495,7 +738,7 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
495
738
  | ---------- | ---------- |
496
739
  | `UseFleetK8sWatchResource` | `<R extends FleetK8sResourceCommon or FleetK8sResourceCommon[]>( initResource: FleetWatchK8sResource or null ) => WatchK8sResult<R> or [undefined, boolean, any]` |
497
740
 
498
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L22)
741
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L25)
499
742
 
500
743
  ### :gear: UseFleetSearchPoll
501
744
 
@@ -503,7 +746,7 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
503
746
  | ---------- | ---------- |
504
747
  | `UseFleetSearchPoll` | `<T extends K8sResourceCommon or K8sResourceCommon[]>( watchOptions: WatchK8sResource, advancedSearchFilters?: AdvancedSearchFilter, pollInterval?: number or false ) => [SearchResult<T> or undefined, boolean, Error or undefined, () => void]` |
505
748
 
506
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L30)
749
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L33)
507
750
 
508
751
  ### :gear: UseHubClusterName
509
752
 
@@ -511,7 +754,7 @@ Array with `isObservabilityInstalled`, `loaded` and `error` values.
511
754
  | ---------- | ---------- |
512
755
  | `UseHubClusterName` | `() => [hubClusterName: string or undefined, loaded: boolean, error: any]` |
513
756
 
514
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L17)
757
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L20)
515
758
 
516
759
  ### :gear: UseIsFleetAvailable
517
760
 
@@ -521,7 +764,7 @@ Signature of the `useIsFleetAvailable` hook
521
764
  | ---------- | ---------- |
522
765
  | `UseIsFleetAvailable` | `() => boolean` |
523
766
 
524
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L28)
767
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L31)
525
768
 
526
769
  ### :gear: UseIsFleetObservabilityInstalled
527
770
 
@@ -535,7 +778,7 @@ Returns:
535
778
 
536
779
  A tuple containing a boolean indicating if the observability controller is installed, a boolean indicating if loaded, and an error if any.
537
780
 
538
- [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L40)
781
+ [:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L43)
539
782
 
540
783
 
541
784
  <!-- TSDOC_END -->
@@ -0,0 +1,19 @@
1
+ import { FleetK8sCreateUpdateOptions, FleetK8sResourceCommon } from '../types';
2
+ /**
3
+ * A fleet version of [`k8sCreate`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8screate) from
4
+ * the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that creates a resource on the specified cluster.
5
+ *
6
+ * The cluster name can be specified in options or the payload, with the value from options taking precedence.
7
+ * If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
8
+ *
9
+ * @param options Which are passed as key-value pairs in the map
10
+ * @param options.cluster - the cluster on which to create the resource
11
+ * @param options.model - Kubernetes model
12
+ * @param options.data - payload for the resource to be created
13
+ * @param options.path - Appends as subpath if provided
14
+ * @param options.queryParams - The query parameters to be included in the URL.
15
+ * @returns A promise that resolves to the response of the resource created.
16
+ * In case of failure, the promise gets rejected with HTTP error response.
17
+ */
18
+ export declare function fleetK8sCreate<R extends FleetK8sResourceCommon>(options: FleetK8sCreateUpdateOptions<R>): Promise<R>;
19
+ //# sourceMappingURL=fleetK8sCreate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sCreate.d.ts","sourceRoot":"","sources":["../../src/api/fleetK8sCreate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAO9E;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,sBAAsB,EACnE,OAAO,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACtC,OAAO,CAAC,CAAC,CAAC,CAQZ"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.fleetK8sCreate = fleetK8sCreate;
13
+ /* Copyright Contributors to the Open Cluster Management project */
14
+ const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
15
+ const apiRequests_1 = require("../internal/apiRequests");
16
+ const isHubRequest_1 = require("../internal/isHubRequest");
17
+ /**
18
+ * A fleet version of [`k8sCreate`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8screate) from
19
+ * the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that creates a resource on the specified cluster.
20
+ *
21
+ * The cluster name can be specified in options or the payload, with the value from options taking precedence.
22
+ * If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
23
+ *
24
+ * @param options Which are passed as key-value pairs in the map
25
+ * @param options.cluster - the cluster on which to create the resource
26
+ * @param options.model - Kubernetes model
27
+ * @param options.data - payload for the resource to be created
28
+ * @param options.path - Appends as subpath if provided
29
+ * @param options.queryParams - The query parameters to be included in the URL.
30
+ * @returns A promise that resolves to the response of the resource created.
31
+ * In case of failure, the promise gets rejected with HTTP error response.
32
+ */
33
+ function fleetK8sCreate(options) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
36
+ const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
37
+ const result = (yield (0, isHubRequest_1.isHubRequest)(cluster))
38
+ ? (0, dynamic_plugin_sdk_1.k8sCreate)(optionsWithoutCluster)
39
+ : dynamic_plugin_sdk_1.consoleFetchJSON.post(yield (0, apiRequests_1.getResourceURLFromOptions)(options, true), optionsWithoutCluster.data);
40
+ return Object.assign(Object.assign({}, (yield result)), { cluster });
41
+ });
42
+ }
43
+ //# sourceMappingURL=fleetK8sCreate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sCreate.js","sourceRoot":"","sources":["../../src/api/fleetK8sCreate.ts"],"names":[],"mappings":";;;;;;;;;;;AAuBA,wCAUC;AAhCD,mEAAmE;AACnE,8EAAmF;AACnF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,SAAsB,cAAc,CAClC,OAAuC;;QAEvC,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YAC1C,CAAC,CAAC,IAAA,8BAAS,EAAC,qBAAqB,CAAC;YAClC,CAAC,CAAE,qCAAgB,CAAC,IAAI,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,qBAAqB,CAAC,IAAI,CAAgB,CAAA;QACrH,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
@@ -0,0 +1,26 @@
1
+ import { FleetK8sDeleteOptions, FleetK8sResourceCommon } from '../types';
2
+ /**
3
+ * A fleet version of [`k8sDelete`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8sdelete) from
4
+ * the [dynamic plugin SDK](https://www.npmjs.com/package/@openshift-console/dynamic-plugin-sdk) that deletes resources from the specified cluster, based on the provided model and resource.
5
+ *
6
+ * The cluster name can be specified in options or the resource, with the value from options taking precedence.
7
+ * If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
8
+ *
9
+ * The garbage collection works based on 'Foreground' | 'Background', can be configured with `propagationPolicy` property in provided model or passed in json.
10
+ * @param options which are passed as key-value pair in the map.
11
+ * @param options.cluster - the cluster from which to delete the resource
12
+ * @param options.model - Kubernetes model
13
+ * @param options.resource - The resource to be deleted.
14
+ * @param options.path - Appends as subpath if provided.
15
+ * @param options.queryParams - The query parameters to be included in the URL.
16
+ * @param options.requestInit - The fetch init object to use. This can have request headers, method, redirect, etc. See more https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html
17
+ * @param options.json - Can control garbage collection of resources explicitly if provided else will default to model's `propagationPolicy`.
18
+ * @example
19
+ * ```
20
+ * { kind: 'DeleteOptions', apiVersion: 'v1', propagationPolicy }
21
+ * ```
22
+ * @returns A promise that resolves to the response of kind Status.
23
+ * In case of failure promise gets rejected with HTTP error response.
24
+ * */
25
+ export declare function fleetK8sDelete<R extends FleetK8sResourceCommon>(options: FleetK8sDeleteOptions<R>): Promise<R>;
26
+ //# sourceMappingURL=fleetK8sDelete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sDelete.d.ts","sourceRoot":"","sources":["../../src/api/fleetK8sDelete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAOxE;;;;;;;;;;;;;;;;;;;;;;MAsBM;AACN,wBAAsB,cAAc,CAAC,CAAC,SAAS,sBAAsB,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAWpH"}