@stolostron/multicluster-sdk 0.5.2 → 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.
- package/README.md +306 -27
- package/lib/api/fleetK8sCreate.d.ts +19 -0
- package/lib/api/fleetK8sCreate.d.ts.map +1 -0
- package/lib/api/fleetK8sCreate.js +43 -0
- package/lib/api/fleetK8sCreate.js.map +1 -0
- package/lib/api/fleetK8sDelete.d.ts +26 -0
- package/lib/api/fleetK8sDelete.d.ts.map +1 -0
- package/lib/api/fleetK8sDelete.js +53 -0
- package/lib/api/fleetK8sDelete.js.map +1 -0
- package/lib/api/fleetK8sGet.d.ts +20 -0
- package/lib/api/fleetK8sGet.d.ts.map +1 -0
- package/lib/api/fleetK8sGet.js +43 -0
- package/lib/api/fleetK8sGet.js.map +1 -0
- package/lib/api/fleetK8sList.d.ts +28 -0
- package/lib/api/fleetK8sList.d.ts.map +1 -0
- package/lib/api/fleetK8sList.js +60 -0
- package/lib/api/fleetK8sList.js.map +1 -0
- package/lib/api/fleetK8sPatch.d.ts +23 -0
- package/lib/api/fleetK8sPatch.d.ts.map +1 -0
- package/lib/api/fleetK8sPatch.js +50 -0
- package/lib/api/fleetK8sPatch.js.map +1 -0
- package/lib/api/fleetK8sUpdate.d.ts +23 -0
- package/lib/api/fleetK8sUpdate.d.ts.map +1 -0
- package/lib/api/fleetK8sUpdate.js +47 -0
- package/lib/api/fleetK8sUpdate.js.map +1 -0
- package/lib/api/getFleetK8sAPIPath.d.ts +8 -0
- package/lib/api/getFleetK8sAPIPath.d.ts.map +1 -0
- package/lib/api/getFleetK8sAPIPath.js +32 -0
- package/lib/api/getFleetK8sAPIPath.js.map +1 -0
- package/lib/api/index.d.ts +11 -4
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +11 -4
- package/lib/api/index.js.map +1 -1
- package/lib/api/useFleetK8sAPIPath.d.ts +6 -1
- package/lib/api/useFleetK8sAPIPath.d.ts.map +1 -1
- package/lib/api/useFleetK8sAPIPath.js +10 -34
- package/lib/api/useFleetK8sAPIPath.js.map +1 -1
- package/lib/api/useFleetK8sWatchResource.js +2 -5
- package/lib/api/useFleetK8sWatchResource.js.map +1 -1
- package/lib/api/{useFleetPrometheusPoll/index.d.ts → useFleetPrometheusPoll.d.ts} +1 -1
- package/lib/api/useFleetPrometheusPoll.d.ts.map +1 -0
- package/lib/api/{useFleetPrometheusPoll/index.js → useFleetPrometheusPoll.js} +6 -6
- package/lib/api/useFleetPrometheusPoll.js.map +1 -0
- package/lib/api/useHubClusterName.d.ts.map +1 -1
- package/lib/api/useHubClusterName.js +2 -42
- package/lib/api/useHubClusterName.js.map +1 -1
- package/lib/api/useIsFleetObservabilityInstalled.d.ts +8 -0
- package/lib/api/useIsFleetObservabilityInstalled.d.ts.map +1 -0
- package/lib/api/useIsFleetObservabilityInstalled.js +12 -0
- package/lib/api/useIsFleetObservabilityInstalled.js.map +1 -0
- package/lib/components/FleetResourceEventStream.d.ts.map +1 -1
- package/lib/components/FleetResourceEventStream.js +2 -1
- package/lib/components/FleetResourceEventStream.js.map +1 -1
- package/lib/internal/apiRequests.d.ts +39 -0
- package/lib/internal/apiRequests.d.ts.map +1 -0
- package/lib/internal/apiRequests.js +141 -0
- package/lib/internal/apiRequests.js.map +1 -0
- package/lib/internal/cachedHubConfiguration.d.ts +9 -0
- package/lib/internal/cachedHubConfiguration.d.ts.map +1 -0
- package/lib/internal/{cachedHubClusterName.js → cachedHubConfiguration.js} +16 -18
- package/lib/internal/cachedHubConfiguration.js.map +1 -0
- package/lib/internal/checkAccess.js +2 -2
- package/lib/internal/checkAccess.js.map +1 -1
- package/lib/internal/constants.d.ts +8 -1
- package/lib/internal/constants.d.ts.map +1 -1
- package/lib/internal/constants.js +10 -3
- package/lib/internal/constants.js.map +1 -1
- package/lib/internal/isHubRequest.d.ts +2 -0
- package/lib/internal/isHubRequest.d.ts.map +1 -0
- package/lib/internal/isHubRequest.js +21 -0
- package/lib/internal/isHubRequest.js.map +1 -0
- package/lib/internal/search/search-client.js +1 -1
- package/lib/internal/search/search-client.js.map +1 -1
- package/lib/internal/useHubConfigurationItem.d.ts +3 -0
- package/lib/internal/useHubConfigurationItem.d.ts.map +1 -0
- package/lib/internal/useHubConfigurationItem.js +49 -0
- package/lib/internal/useHubConfigurationItem.js.map +1 -0
- package/lib/internal/usePoll.d.ts.map +1 -0
- package/lib/internal/usePoll.js.map +1 -0
- package/lib/internal/useSafeFetch.d.ts.map +1 -0
- package/lib/internal/useSafeFetch.js.map +1 -0
- package/lib/internal/useURLPoll.d.ts.map +1 -0
- package/lib/internal/useURLPoll.js.map +1 -0
- package/lib/internal/utils.d.ts.map +1 -0
- package/lib/internal/utils.js.map +1 -0
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/types/fleet.d.ts +57 -1
- package/lib/types/fleet.d.ts.map +1 -1
- package/package.json +2 -2
- package/lib/api/apiRequests.d.ts +0 -70
- package/lib/api/apiRequests.d.ts.map +0 -1
- package/lib/api/apiRequests.js +0 -193
- package/lib/api/apiRequests.js.map +0 -1
- package/lib/api/useFleetPrometheusPoll/constants.d.ts +0 -8
- package/lib/api/useFleetPrometheusPoll/constants.d.ts.map +0 -1
- package/lib/api/useFleetPrometheusPoll/constants.js +0 -12
- package/lib/api/useFleetPrometheusPoll/constants.js.map +0 -1
- package/lib/api/useFleetPrometheusPoll/index.d.ts.map +0 -1
- package/lib/api/useFleetPrometheusPoll/index.js.map +0 -1
- package/lib/api/useFleetPrometheusPoll/usePoll.d.ts.map +0 -1
- package/lib/api/useFleetPrometheusPoll/usePoll.js.map +0 -1
- package/lib/api/useFleetPrometheusPoll/useSafeFetch.d.ts.map +0 -1
- package/lib/api/useFleetPrometheusPoll/useSafeFetch.js.map +0 -1
- package/lib/api/useFleetPrometheusPoll/useURLPoll.d.ts.map +0 -1
- package/lib/api/useFleetPrometheusPoll/useURLPoll.js.map +0 -1
- package/lib/api/useFleetPrometheusPoll/utils.d.ts.map +0 -1
- package/lib/api/useFleetPrometheusPoll/utils.js.map +0 -1
- package/lib/internal/cachedHubClusterName.d.ts +0 -3
- package/lib/internal/cachedHubClusterName.d.ts.map +0 -1
- package/lib/internal/cachedHubClusterName.js.map +0 -1
- /package/lib/{api/useFleetPrometheusPoll → internal}/usePoll.d.ts +0 -0
- /package/lib/{api/useFleetPrometheusPoll → internal}/usePoll.js +0 -0
- /package/lib/{api/useFleetPrometheusPoll → internal}/useSafeFetch.d.ts +0 -0
- /package/lib/{api/useFleetPrometheusPoll → internal}/useSafeFetch.js +0 -0
- /package/lib/{api/useFleetPrometheusPoll → internal}/useURLPoll.d.ts +0 -0
- /package/lib/{api/useFleetPrometheusPoll → internal}/useURLPoll.js +0 -0
- /package/lib/{api/useFleetPrometheusPoll → internal}/utils.d.ts +0 -0
- /package/lib/{api/useFleetPrometheusPoll → internal}/utils.js +0 -0
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
|
|
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.
|
|
64
82
|
|
|
65
|
-
|
|
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.
|
|
88
|
+
|
|
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
|
|
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`.
|
|
72
115
|
|
|
73
|
-
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
|
|
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
|
|
142
|
+
| `fleetK8sGet` | `<R extends FleetK8sResourceCommon>(options: FleetK8sGetOptions) => Promise<R>` |
|
|
143
|
+
|
|
144
|
+
Parameters:
|
|
80
145
|
|
|
81
|
-
|
|
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)
|
|
161
|
+
|
|
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
|
|
228
|
+
| `fleetK8sPatch` | `<R extends FleetK8sResourceCommon>(options: FleetK8sPatchOptions<R>) => Promise<R>` |
|
|
229
|
+
|
|
230
|
+
Parameters:
|
|
88
231
|
|
|
89
|
-
|
|
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.
|
|
245
|
+
|
|
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
|
|
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
|
+
|
|
274
|
+
|
|
275
|
+
Returns:
|
|
96
276
|
|
|
97
|
-
|
|
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#
|
|
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
|
-
|
|
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
|
-
|
|
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#
|
|
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
|
|
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
|
|
|
@@ -344,7 +549,7 @@ Returns:
|
|
|
344
549
|
|
|
345
550
|
Array with `hubclustername`, `loaded` and `error` values.
|
|
346
551
|
|
|
347
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useHubClusterName.ts#
|
|
552
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useHubClusterName.ts#L10)
|
|
348
553
|
|
|
349
554
|
### :gear: useIsFleetAvailable
|
|
350
555
|
|
|
@@ -364,6 +569,20 @@ Returns:
|
|
|
364
569
|
|
|
365
570
|
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useIsFleetAvailable.ts#L15)
|
|
366
571
|
|
|
572
|
+
### :gear: useIsFleetObservabilityInstalled
|
|
573
|
+
|
|
574
|
+
Hook that provides is observability installed.
|
|
575
|
+
|
|
576
|
+
| Function | Type |
|
|
577
|
+
| ---------- | ---------- |
|
|
578
|
+
| `useIsFleetObservabilityInstalled` | `UseIsFleetObservabilityInstalled` |
|
|
579
|
+
|
|
580
|
+
Returns:
|
|
581
|
+
|
|
582
|
+
Array with `isObservabilityInstalled`, `loaded` and `error` values.
|
|
583
|
+
|
|
584
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/api/useIsFleetObservabilityInstalled.ts#L10)
|
|
585
|
+
|
|
367
586
|
|
|
368
587
|
## :wrench: Constants
|
|
369
588
|
|
|
@@ -384,6 +603,11 @@ Returns:
|
|
|
384
603
|
- [AdvancedSearchFilter](#gear-advancedsearchfilter)
|
|
385
604
|
- [Fleet](#gear-fleet)
|
|
386
605
|
- [FleetAccessReviewResourceAttributes](#gear-fleetaccessreviewresourceattributes)
|
|
606
|
+
- [FleetK8sCreateUpdateOptions](#gear-fleetk8screateupdateoptions)
|
|
607
|
+
- [FleetK8sDeleteOptions](#gear-fleetk8sdeleteoptions)
|
|
608
|
+
- [FleetK8sGetOptions](#gear-fleetk8sgetoptions)
|
|
609
|
+
- [FleetK8sListOptions](#gear-fleetk8slistoptions)
|
|
610
|
+
- [FleetK8sPatchOptions](#gear-fleetk8spatchoptions)
|
|
387
611
|
- [FleetK8sResourceCommon](#gear-fleetk8sresourcecommon)
|
|
388
612
|
- [FleetResourceLinkProps](#gear-fleetresourcelinkprops)
|
|
389
613
|
- [FleetWatchK8sResource](#gear-fleetwatchk8sresource)
|
|
@@ -394,6 +618,7 @@ Returns:
|
|
|
394
618
|
- [UseFleetSearchPoll](#gear-usefleetsearchpoll)
|
|
395
619
|
- [UseHubClusterName](#gear-usehubclustername)
|
|
396
620
|
- [UseIsFleetAvailable](#gear-useisfleetavailable)
|
|
621
|
+
- [UseIsFleetObservabilityInstalled](#gear-useisfleetobservabilityinstalled)
|
|
397
622
|
|
|
398
623
|
### :gear: AdvancedSearchFilter
|
|
399
624
|
|
|
@@ -409,7 +634,7 @@ Returns:
|
|
|
409
634
|
| ---------- | ---------- |
|
|
410
635
|
| `Fleet` | `T and { cluster?: string }` |
|
|
411
636
|
|
|
412
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
637
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L14)
|
|
413
638
|
|
|
414
639
|
### :gear: FleetAccessReviewResourceAttributes
|
|
415
640
|
|
|
@@ -417,7 +642,47 @@ Returns:
|
|
|
417
642
|
| ---------- | ---------- |
|
|
418
643
|
| `FleetAccessReviewResourceAttributes` | `Fleet<AccessReviewResourceAttributes>` |
|
|
419
644
|
|
|
420
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
645
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L18)
|
|
646
|
+
|
|
647
|
+
### :gear: FleetK8sCreateUpdateOptions
|
|
648
|
+
|
|
649
|
+
| Type | Type |
|
|
650
|
+
| ---------- | ---------- |
|
|
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
|
|
664
|
+
|
|
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)
|
|
421
686
|
|
|
422
687
|
### :gear: FleetK8sResourceCommon
|
|
423
688
|
|
|
@@ -425,7 +690,7 @@ Returns:
|
|
|
425
690
|
| ---------- | ---------- |
|
|
426
691
|
| `FleetK8sResourceCommon` | `Fleet<K8sResourceCommon>` |
|
|
427
692
|
|
|
428
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
693
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L17)
|
|
429
694
|
|
|
430
695
|
### :gear: FleetResourceLinkProps
|
|
431
696
|
|
|
@@ -433,7 +698,7 @@ Returns:
|
|
|
433
698
|
| ---------- | ---------- |
|
|
434
699
|
| `FleetResourceLinkProps` | `Fleet<ResourceLinkProps>` |
|
|
435
700
|
|
|
436
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
701
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L24)
|
|
437
702
|
|
|
438
703
|
### :gear: FleetWatchK8sResource
|
|
439
704
|
|
|
@@ -441,7 +706,7 @@ Returns:
|
|
|
441
706
|
| ---------- | ---------- |
|
|
442
707
|
| `FleetWatchK8sResource` | `Fleet<WatchK8sResource>` |
|
|
443
708
|
|
|
444
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
709
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L16)
|
|
445
710
|
|
|
446
711
|
### :gear: SearchResult
|
|
447
712
|
|
|
@@ -457,7 +722,7 @@ Returns:
|
|
|
457
722
|
| ---------- | ---------- |
|
|
458
723
|
| `UseFleetClusterNames` | `() => [string[], boolean, any]` |
|
|
459
724
|
|
|
460
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
725
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L28)
|
|
461
726
|
|
|
462
727
|
### :gear: UseFleetK8sAPIPath
|
|
463
728
|
|
|
@@ -465,7 +730,7 @@ Returns:
|
|
|
465
730
|
| ---------- | ---------- |
|
|
466
731
|
| `UseFleetK8sAPIPath` | `( cluster?: string ) => [k8sAPIPath: string or undefined, loaded: boolean, error: Error or undefined]` |
|
|
467
732
|
|
|
468
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
733
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L21)
|
|
469
734
|
|
|
470
735
|
### :gear: UseFleetK8sWatchResource
|
|
471
736
|
|
|
@@ -473,7 +738,7 @@ Returns:
|
|
|
473
738
|
| ---------- | ---------- |
|
|
474
739
|
| `UseFleetK8sWatchResource` | `<R extends FleetK8sResourceCommon or FleetK8sResourceCommon[]>( initResource: FleetWatchK8sResource or null ) => WatchK8sResult<R> or [undefined, boolean, any]` |
|
|
475
740
|
|
|
476
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
741
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L25)
|
|
477
742
|
|
|
478
743
|
### :gear: UseFleetSearchPoll
|
|
479
744
|
|
|
@@ -481,7 +746,7 @@ Returns:
|
|
|
481
746
|
| ---------- | ---------- |
|
|
482
747
|
| `UseFleetSearchPoll` | `<T extends K8sResourceCommon or K8sResourceCommon[]>( watchOptions: WatchK8sResource, advancedSearchFilters?: AdvancedSearchFilter, pollInterval?: number or false ) => [SearchResult<T> or undefined, boolean, Error or undefined, () => void]` |
|
|
483
748
|
|
|
484
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
749
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L33)
|
|
485
750
|
|
|
486
751
|
### :gear: UseHubClusterName
|
|
487
752
|
|
|
@@ -489,7 +754,7 @@ Returns:
|
|
|
489
754
|
| ---------- | ---------- |
|
|
490
755
|
| `UseHubClusterName` | `() => [hubClusterName: string or undefined, loaded: boolean, error: any]` |
|
|
491
756
|
|
|
492
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
757
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L20)
|
|
493
758
|
|
|
494
759
|
### :gear: UseIsFleetAvailable
|
|
495
760
|
|
|
@@ -499,7 +764,21 @@ Signature of the `useIsFleetAvailable` hook
|
|
|
499
764
|
| ---------- | ---------- |
|
|
500
765
|
| `UseIsFleetAvailable` | `() => boolean` |
|
|
501
766
|
|
|
502
|
-
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#
|
|
767
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L31)
|
|
768
|
+
|
|
769
|
+
### :gear: UseIsFleetObservabilityInstalled
|
|
770
|
+
|
|
771
|
+
Signature of the `UseIsFleet ObservabilityInstalled` hook.
|
|
772
|
+
|
|
773
|
+
| Type | Type |
|
|
774
|
+
| ---------- | ---------- |
|
|
775
|
+
| `UseIsFleetObservabilityInstalled` | `() => [ isObservabilityInstalled: boolean or undefined, loaded: boolean, error: any, ]` |
|
|
776
|
+
|
|
777
|
+
Returns:
|
|
778
|
+
|
|
779
|
+
A tuple containing a boolean indicating if the observability controller is installed, a boolean indicating if loaded, and an error if any.
|
|
780
|
+
|
|
781
|
+
[:link: Source](https://github.com/stolostron/console/blob/main/frontend/packages/multicluster-sdk/tree/../src/types/fleet.ts#L43)
|
|
503
782
|
|
|
504
783
|
|
|
505
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"}
|