@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
@@ -0,0 +1,53 @@
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.fleetK8sDelete = fleetK8sDelete;
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 [`k8sDelete`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8sdelete) from
19
+ * 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.
20
+ *
21
+ * The cluster name can be specified in options or the resource, 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
+ * The garbage collection works based on 'Foreground' | 'Background', can be configured with `propagationPolicy` property in provided model or passed in json.
25
+ * @param options which are passed as key-value pair in the map.
26
+ * @param options.cluster - the cluster from which to delete the resource
27
+ * @param options.model - Kubernetes model
28
+ * @param options.resource - The resource to be deleted.
29
+ * @param options.path - Appends as subpath if provided.
30
+ * @param options.queryParams - The query parameters to be included in the URL.
31
+ * @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
32
+ * @param options.json - Can control garbage collection of resources explicitly if provided else will default to model's `propagationPolicy`.
33
+ * @example
34
+ * ```
35
+ * { kind: 'DeleteOptions', apiVersion: 'v1', propagationPolicy }
36
+ * ```
37
+ * @returns A promise that resolves to the response of kind Status.
38
+ * In case of failure promise gets rejected with HTTP error response.
39
+ * */
40
+ function fleetK8sDelete(options) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ var _a;
43
+ const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
44
+ const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
45
+ const { propagationPolicy } = options.model;
46
+ const jsonData = (_a = options.json) !== null && _a !== void 0 ? _a : (propagationPolicy && { kind: 'DeleteOptions', apiVersion: 'v1', propagationPolicy });
47
+ const result = (yield (0, isHubRequest_1.isHubRequest)(cluster))
48
+ ? (0, dynamic_plugin_sdk_1.k8sDelete)(optionsWithoutCluster)
49
+ : dynamic_plugin_sdk_1.consoleFetchJSON.delete(yield (0, apiRequests_1.getResourceURLFromOptions)(options), jsonData, options.requestInit);
50
+ return Object.assign(Object.assign({}, (yield result)), { cluster });
51
+ });
52
+ }
53
+ //# sourceMappingURL=fleetK8sDelete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sDelete.js","sourceRoot":"","sources":["../../src/api/fleetK8sDelete.ts"],"names":[],"mappings":";;;;;;;;;;;AA8BA,wCAWC;AAxCD,mEAAmE;AACnE,8EAAmF;AACnF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;MAsBM;AACN,SAAsB,cAAc,CAAmC,OAAiC;;;QACtG,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC3C,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,IAAI,mCAAI,CAAC,iBAAiB,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAA;QAEtH,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YAC1C,CAAC,CAAC,IAAA,8BAAS,EAAC,qBAAqB,CAAC;YAClC,CAAC,CAAE,qCAAgB,CAAC,MAAM,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAgB,CAAA;QACpH,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
@@ -0,0 +1,20 @@
1
+ import { FleetK8sGetOptions, FleetK8sResourceCommon } from '../types';
2
+ /**
3
+ * A fleet version of [`k8sGet`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8sget) from
4
+ * 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.
5
+ *
6
+ * If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
7
+ *
8
+ * If the name is provided it returns resource, else it returns all the resources matching the model.
9
+ * @param options Which are passed as key-value pairs in the map
10
+ * @param options.cluster - the cluster from which to fetch the resource
11
+ * @param options.model - Kubernetes model
12
+ * @param options.name - The name of the resource, if not provided then it looks for all the resources matching the model.
13
+ * @param options.ns - The namespace to look into, should not be specified for cluster-scoped resources.
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
+ * @returns 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.
18
+ */
19
+ export declare function fleetK8sGet<R extends FleetK8sResourceCommon>(options: FleetK8sGetOptions): Promise<R>;
20
+ //# sourceMappingURL=fleetK8sGet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sGet.d.ts","sourceRoot":"","sources":["../../src/api/fleetK8sGet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAMrE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,WAAW,CAAC,CAAC,SAAS,sBAAsB,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAQ3G"}
@@ -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.fleetK8sGet = fleetK8sGet;
13
+ const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
14
+ const apiRequests_1 = require("../internal/apiRequests");
15
+ const isHubRequest_1 = require("../internal/isHubRequest");
16
+ /**
17
+ * A fleet version of [`k8sGet`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8sget) from
18
+ * 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.
19
+ *
20
+ * If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
21
+ *
22
+ * If the name is provided it returns resource, else it returns all the resources matching the model.
23
+ * @param options Which are passed as key-value pairs in the map
24
+ * @param options.cluster - the cluster from which to fetch the resource
25
+ * @param options.model - Kubernetes model
26
+ * @param options.name - The name of the resource, if not provided then it looks for all the resources matching the model.
27
+ * @param options.ns - The namespace to look into, should not be specified for cluster-scoped resources.
28
+ * @param options.path - Appends as subpath if provided
29
+ * @param options.queryParams - The query parameters to be included in the URL.
30
+ * @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
31
+ * @returns 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.
32
+ */
33
+ function fleetK8sGet(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.k8sGet)(optionsWithoutCluster)
39
+ : (0, dynamic_plugin_sdk_1.consoleFetchJSON)(yield (0, apiRequests_1.getResourceURLFromOptions)(options), 'GET', options.requestInit);
40
+ return Object.assign(Object.assign({}, (yield result)), { cluster });
41
+ });
42
+ }
43
+ //# sourceMappingURL=fleetK8sGet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sGet.js","sourceRoot":"","sources":["../../src/api/fleetK8sGet.ts"],"names":[],"mappings":";;;;;;;;;;;AAwBA,kCAQC;AA9BD,8EAAgF;AAChF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAsB,WAAW,CAAmC,OAA2B;;QAC7F,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,2BAAM,EAAI,qBAAqB,CAAC;YAClC,CAAC,CAAE,IAAA,qCAAgB,EAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAgB,CAAA;QAC1G,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
@@ -0,0 +1,28 @@
1
+ import { FleetK8sListOptions, FleetK8sResourceCommon } from '../types';
2
+ /**
3
+ * A fleet version of [`k8sList`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slist) from
4
+ * 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.
5
+ *
6
+ * If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
7
+ * @param options Which are passed as key-value pairs in the map.
8
+ * @param options.cluster - the cluster from which to list the resources
9
+ * @param options.model - Kubernetes model
10
+ * @param options.queryParams - The query parameters to be included in the URL. It can also pass label selectors by using the `labelSelector` key.
11
+ * @param 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
12
+ * @returns A promise that resolves to the response
13
+ */
14
+ export declare function fleetK8sList<R extends FleetK8sResourceCommon>(options: FleetK8sListOptions): Promise<R[]>;
15
+ /**
16
+ * A fleet version of [`k8sListItems`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slistitems) from
17
+ * 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.
18
+ *
19
+ * If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
20
+ * @param options Which are passed as key-value pairs in the map.
21
+ * @param options.cluster - the cluster from which to list the resources
22
+ * @param options.model - Kubernetes model
23
+ * @param options.queryParams - The query parameters to be included in the URL. It can also pass label selectors by using the `labelSelector` key.
24
+ * @param 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
25
+ * @returns A promise that resolves to the response
26
+ */
27
+ export declare function fleetK8sListItems<R extends FleetK8sResourceCommon>(options: FleetK8sListOptions): Promise<R[]>;
28
+ //# sourceMappingURL=fleetK8sList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sList.d.ts","sourceRoot":"","sources":["../../src/api/fleetK8sList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAMtE;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,CAAC,SAAS,sBAAsB,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAoB/G;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,sBAAsB,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAEpH"}
@@ -0,0 +1,60 @@
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.fleetK8sList = fleetK8sList;
13
+ exports.fleetK8sListItems = fleetK8sListItems;
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 [`k8sList`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slist) from
19
+ * 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.
20
+ *
21
+ * If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
22
+ * @param options Which are passed as key-value pairs in the map.
23
+ * @param options.cluster - the cluster from which to list the resources
24
+ * @param options.model - Kubernetes model
25
+ * @param options.queryParams - The query parameters to be included in the URL. It can also pass label selectors by using the `labelSelector` key.
26
+ * @param 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
27
+ * @returns A promise that resolves to the response
28
+ */
29
+ function fleetK8sList(options) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ var _a;
32
+ const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
33
+ const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
34
+ const items = (yield (0, isHubRequest_1.isHubRequest)(cluster))
35
+ ? (0, dynamic_plugin_sdk_1.k8sList)(optionsWithoutCluster)
36
+ : (0, dynamic_plugin_sdk_1.consoleFetchJSON)(yield (0, apiRequests_1.getResourceURLFromOptions)(options), 'GET', options.requestInit).then((result) => {
37
+ var _a;
38
+ return (_a = result.items) === null || _a === void 0 ? void 0 : _a.map((i) => (Object.assign({ kind: options.model.kind, apiVersion: result.apiVersion }, i)));
39
+ });
40
+ return (_a = (yield items)) === null || _a === void 0 ? void 0 : _a.map((i) => (Object.assign(Object.assign({}, i), { cluster })));
41
+ });
42
+ }
43
+ /**
44
+ * A fleet version of [`k8sListItems`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slistitems) from
45
+ * 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.
46
+ *
47
+ * If the cluster name is not specified or matches the name of the hub cluster, the implementation from the dynamic plugin SDK is used.
48
+ * @param options Which are passed as key-value pairs in the map.
49
+ * @param options.cluster - the cluster from which to list the resources
50
+ * @param options.model - Kubernetes model
51
+ * @param options.queryParams - The query parameters to be included in the URL. It can also pass label selectors by using the `labelSelector` key.
52
+ * @param 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
53
+ * @returns A promise that resolves to the response
54
+ */
55
+ function fleetK8sListItems(options) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ return fleetK8sList(options);
58
+ });
59
+ }
60
+ //# sourceMappingURL=fleetK8sList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sList.js","sourceRoot":"","sources":["../../src/api/fleetK8sList.ts"],"names":[],"mappings":";;;;;;;;;;;AAmBA,oCAoBC;AAcD,8CAEC;AArDD,8EAAiF;AACjF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;GAWG;AACH,SAAsB,YAAY,CAAmC,OAA4B;;;QAC/F,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,KAAK,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YACzC,CAAC,CAAE,IAAA,4BAAO,EAAC,qBAAqB,CAAkB;YAClD,CAAC,CACG,IAAA,qCAAgB,EAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAKtF,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;;gBAChB,OAAA,MAAA,MAAM,CAAC,KAAK,0CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBACvB,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EACxB,UAAU,EAAE,MAAM,CAAC,UAAU,IAC1B,CAAC,EACJ,CAAC,CAAA;aAAA,CACJ,CAAA;QACL,OAAO,MAAA,CAAC,MAAM,KAAK,CAAC,0CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iCAAM,CAAC,KAAE,OAAO,IAAG,CAAC,CAAA;IACvD,CAAC;CAAA;AAED;;;;;;;;;;;GAWG;AACH,SAAsB,iBAAiB,CAAmC,OAA4B;;QACpG,OAAO,YAAY,CAAC,OAAO,CAAC,CAAA;IAC9B,CAAC;CAAA"}
@@ -0,0 +1,23 @@
1
+ import { FleetK8sPatchOptions, FleetK8sResourceCommon } from '../types';
2
+ /**
3
+ * A fleet version of [`k8sPatch`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slist) from
4
+ * 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.
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
+ * When a client needs to perform the partial update, the client can use `fleetK8sPatch`.
10
+ * Alternatively, the client can use `fleetK8sUpdate` to replace an existing resource entirely.
11
+ * See more https://datatracker.ietf.org/doc/html/rfc6902
12
+ * @param options Which are passed as key-value pairs in the map.
13
+ * @param options.cluster - the cluster on which to patch the resource
14
+ * @param options.model - Kubernetes model
15
+ * @param options.resource - The resource to be patched.
16
+ * @param options.data - Only the data to be patched on existing resource with the operation, path, and value.
17
+ * @param options.path - Appends as subpath if provided.
18
+ * @param options.queryParams - The query parameters to be included in the URL.
19
+ * @returns A promise that resolves to the response of the resource patched.
20
+ * In case of failure promise gets rejected with HTTP error response.
21
+ */
22
+ export declare function fleetK8sPatch<R extends FleetK8sResourceCommon>(options: FleetK8sPatchOptions<R>): Promise<R>;
23
+ //# sourceMappingURL=fleetK8sPatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sPatch.d.ts","sourceRoot":"","sources":["../../src/api/fleetK8sPatch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAOvE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,sBAAsB,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAYlH"}
@@ -0,0 +1,50 @@
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.fleetK8sPatch = fleetK8sPatch;
13
+ const lodash_1 = require("lodash");
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 [`k8sPatch`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slist) from
19
+ * 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.
20
+ *
21
+ * The cluster name can be specified in options or the resource, 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
+ * When a client needs to perform the partial update, the client can use `fleetK8sPatch`.
25
+ * Alternatively, the client can use `fleetK8sUpdate` to replace an existing resource entirely.
26
+ * See more https://datatracker.ietf.org/doc/html/rfc6902
27
+ * @param options Which are passed as key-value pairs in the map.
28
+ * @param options.cluster - the cluster on which to patch the resource
29
+ * @param options.model - Kubernetes model
30
+ * @param options.resource - The resource to be patched.
31
+ * @param options.data - Only the data to be patched on existing resource with the operation, path, and value.
32
+ * @param options.path - Appends as subpath if provided.
33
+ * @param options.queryParams - The query parameters to be included in the URL.
34
+ * @returns A promise that resolves to the response of the resource patched.
35
+ * In case of failure promise gets rejected with HTTP error response.
36
+ */
37
+ function fleetK8sPatch(options) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
40
+ const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
41
+ const patches = (0, lodash_1.compact)(options.data);
42
+ const result = (yield (0, isHubRequest_1.isHubRequest)(cluster))
43
+ ? (0, dynamic_plugin_sdk_1.k8sPatch)(optionsWithoutCluster)
44
+ : (0, lodash_1.isEmpty)(patches)
45
+ ? Promise.resolve(options.resource)
46
+ : dynamic_plugin_sdk_1.consoleFetchJSON.patch(yield (0, apiRequests_1.getResourceURLFromOptions)(options), patches);
47
+ return Object.assign(Object.assign({}, (yield result)), { cluster });
48
+ });
49
+ }
50
+ //# sourceMappingURL=fleetK8sPatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sPatch.js","sourceRoot":"","sources":["../../src/api/fleetK8sPatch.ts"],"names":[],"mappings":";;;;;;;;;;;AA4BA,sCAYC;AAtCD,mCAAyC;AACzC,8EAAkF;AAClF,yDAAoH;AAEpH,2DAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAsB,aAAa,CAAmC,OAAgC;;QACpG,MAAM,OAAO,GAAG,IAAA,mCAAqB,EAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,qBAAqB,GAAG,IAAA,sCAAwB,EAAC,OAAO,CAAC,CAAA;QAE/D,MAAM,OAAO,GAAG,IAAA,gBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAErC,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,CAAC;YAC1C,CAAC,CAAC,IAAA,6BAAQ,EAAC,qBAAqB,CAAC;YACjC,CAAC,CAAC,IAAA,gBAAO,EAAC,OAAO,CAAC;gBAChB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;gBACnC,CAAC,CAAE,qCAAgB,CAAC,KAAK,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,OAAO,CAAgB,CAAA;QAC/F,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
@@ -0,0 +1,23 @@
1
+ import { FleetK8sCreateUpdateOptions, FleetK8sResourceCommon } from '../types';
2
+ /**
3
+ * A fleet version of [`k8sPatch`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slist) from
4
+ * 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.
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
+ * When a client needs to replace an existing resource entirely, the client can use `fleetK8sUpdate`.
10
+ * Alternatively, the client can use `fleetK8sPatch` to perform the partial update.
11
+ * @param options which are passed as key-value pair in the map
12
+ * @param options.cluster - the cluster on which to update the resource
13
+ * @param options.model - Kubernetes model
14
+ * @param options.data - payload for the Kubernetes resource to be updated
15
+ * @param options.ns - namespace to look into, it should not be specified for cluster-scoped resources.
16
+ * @param options.name - resource name to be updated.
17
+ * @param options.path - appends as subpath if provided.
18
+ * @param options.queryParams - The query parameters to be included in the URL.
19
+ * @returns A promise that resolves to the response of the resource updated.
20
+ * In case of failure promise gets rejected with HTTP error response.
21
+ */
22
+ export declare function fleetK8sUpdate<R extends FleetK8sResourceCommon>(options: FleetK8sCreateUpdateOptions<R>): Promise<R>;
23
+ //# sourceMappingURL=fleetK8sUpdate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sUpdate.d.ts","sourceRoot":"","sources":["../../src/api/fleetK8sUpdate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAM9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,sBAAsB,EACnE,OAAO,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACtC,OAAO,CAAC,CAAC,CAAC,CAQZ"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /* Copyright Contributors to the Open Cluster Management project */
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.fleetK8sUpdate = fleetK8sUpdate;
14
+ const apiRequests_1 = require("../internal/apiRequests");
15
+ const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk");
16
+ const isHubRequest_1 = require("../internal/isHubRequest");
17
+ /**
18
+ * A fleet version of [`k8sPatch`](https://github.com/openshift/console/blob/main/frontend/packages/console-dynamic-plugin-sdk/docs/api.md#k8slist) from
19
+ * 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.
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
+ * When a client needs to replace an existing resource entirely, the client can use `fleetK8sUpdate`.
25
+ * Alternatively, the client can use `fleetK8sPatch` to perform the partial update.
26
+ * @param options which are passed as key-value pair in the map
27
+ * @param options.cluster - the cluster on which to update the resource
28
+ * @param options.model - Kubernetes model
29
+ * @param options.data - payload for the Kubernetes resource to be updated
30
+ * @param options.ns - namespace to look into, it should not be specified for cluster-scoped resources.
31
+ * @param options.name - resource name to be updated.
32
+ * @param options.path - appends as subpath if provided.
33
+ * @param options.queryParams - The query parameters to be included in the URL.
34
+ * @returns A promise that resolves to the response of the resource updated.
35
+ * In case of failure promise gets rejected with HTTP error response.
36
+ */
37
+ function fleetK8sUpdate(options) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const cluster = (0, apiRequests_1.getClusterFromOptions)(options);
40
+ const optionsWithoutCluster = (0, apiRequests_1.getOptionsWithoutCluster)(options);
41
+ const result = (yield (0, isHubRequest_1.isHubRequest)(cluster))
42
+ ? (0, dynamic_plugin_sdk_1.k8sUpdate)(optionsWithoutCluster)
43
+ : dynamic_plugin_sdk_1.consoleFetchJSON.put(yield (0, apiRequests_1.getResourceURLFromOptions)(options), optionsWithoutCluster.data);
44
+ return Object.assign(Object.assign({}, (yield result)), { cluster });
45
+ });
46
+ }
47
+ //# sourceMappingURL=fleetK8sUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleetK8sUpdate.js","sourceRoot":"","sources":["../../src/api/fleetK8sUpdate.ts"],"names":[],"mappings":";AAAA,mEAAmE;;;;;;;;;;;AA4BnE,wCAUC;AAnCD,yDAAoH;AAEpH,8EAAmF;AACnF,2DAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;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,GAAG,CAAC,MAAM,IAAA,uCAAyB,EAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC,IAAI,CAAgB,CAAA;QAC9G,uCAAY,CAAC,MAAM,MAAM,CAAC,KAAE,OAAO,IAAE;IACvC,CAAC;CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Function that provides the k8s API path for the fleet.
3
+ *
4
+ * @param cluster - The cluster name.
5
+ * @returns The k8s API path for the fleet.
6
+ */
7
+ export declare const getFleetK8sAPIPath: (cluster?: string) => Promise<string>;
8
+ //# sourceMappingURL=getFleetK8sAPIPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFleetK8sAPIPath.d.ts","sourceRoot":"","sources":["../../src/api/getFleetK8sAPIPath.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB,GAAU,UAAU,MAAM,oBAMxD,CAAA"}
@@ -0,0 +1,32 @@
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.getFleetK8sAPIPath = void 0;
13
+ /* Copyright Contributors to the Open Cluster Management project */
14
+ const constants_1 = require("../internal/constants");
15
+ const apiRequests_1 = require("../internal/apiRequests");
16
+ const isHubRequest_1 = require("../internal/isHubRequest");
17
+ /**
18
+ * Function that provides the k8s API path for the fleet.
19
+ *
20
+ * @param cluster - The cluster name.
21
+ * @returns The k8s API path for the fleet.
22
+ */
23
+ const getFleetK8sAPIPath = (cluster) => __awaiter(void 0, void 0, void 0, function* () {
24
+ if (yield (0, isHubRequest_1.isHubRequest)(cluster)) {
25
+ return constants_1.BASE_K8S_API_PATH;
26
+ }
27
+ else {
28
+ return `${(0, apiRequests_1.getBackendUrl)()}/${constants_1.MANAGED_CLUSTER_API_PATH}/${cluster}`;
29
+ }
30
+ });
31
+ exports.getFleetK8sAPIPath = getFleetK8sAPIPath;
32
+ //# sourceMappingURL=getFleetK8sAPIPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFleetK8sAPIPath.js","sourceRoot":"","sources":["../../src/api/getFleetK8sAPIPath.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAmE;AACnE,qDAAmF;AAEnF,yDAAuD;AACvD,2DAAuD;AAEvD;;;;;GAKG;AAEI,MAAM,kBAAkB,GAAG,CAAO,OAAgB,EAAE,EAAE;IAC3D,IAAI,MAAM,IAAA,2BAAY,EAAC,OAAO,CAAC,EAAE,CAAC;QAChC,OAAO,6BAAiB,CAAA;IAC1B,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,IAAA,2BAAa,GAAE,IAAI,oCAAwB,IAAI,OAAO,EAAE,CAAA;IACpE,CAAC;AACH,CAAC,CAAA,CAAA;AANY,QAAA,kBAAkB,sBAM9B"}
@@ -1,13 +1,19 @@
1
1
  export * from './constants';
2
+ export * from './fleetK8sCreate';
3
+ export * from './fleetK8sDelete';
4
+ export * from './fleetK8sGet';
5
+ export * from './fleetK8sList';
6
+ export * from './fleetK8sPatch';
7
+ export * from './fleetK8sUpdate';
2
8
  export * from './FleetResourceLink';
9
+ export * from './useFleetAccessReview';
10
+ export * from './useFleetClusterNames';
3
11
  export * from './useFleetK8sAPIPath';
4
12
  export * from './useFleetK8sWatchResource';
5
- export * from './useFleetClusterNames';
13
+ export * from './useFleetPrometheusPoll';
6
14
  export * from './useFleetSearchPoll';
7
- export * from './apiRequests';
8
15
  export * from './useHubClusterName';
9
- export * from './useFleetPrometheusPoll';
10
- export * from './useFleetAccessReview';
11
16
  export * from './useIsFleetAvailable';
12
17
  export * from './useIsFleetObservabilityInstalled';
18
+ export * from './getFleetK8sAPIPath';
13
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oCAAoC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oCAAoC,CAAA;AAClD,cAAc,sBAAsB,CAAA"}
package/lib/api/index.js CHANGED
@@ -16,15 +16,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /* Copyright Contributors to the Open Cluster Management project */
18
18
  __exportStar(require("./constants"), exports);
19
+ __exportStar(require("./fleetK8sCreate"), exports);
20
+ __exportStar(require("./fleetK8sDelete"), exports);
21
+ __exportStar(require("./fleetK8sGet"), exports);
22
+ __exportStar(require("./fleetK8sList"), exports);
23
+ __exportStar(require("./fleetK8sPatch"), exports);
24
+ __exportStar(require("./fleetK8sUpdate"), exports);
19
25
  __exportStar(require("./FleetResourceLink"), exports);
26
+ __exportStar(require("./useFleetAccessReview"), exports);
27
+ __exportStar(require("./useFleetClusterNames"), exports);
20
28
  __exportStar(require("./useFleetK8sAPIPath"), exports);
21
29
  __exportStar(require("./useFleetK8sWatchResource"), exports);
22
- __exportStar(require("./useFleetClusterNames"), exports);
30
+ __exportStar(require("./useFleetPrometheusPoll"), exports);
23
31
  __exportStar(require("./useFleetSearchPoll"), exports);
24
- __exportStar(require("./apiRequests"), exports);
25
32
  __exportStar(require("./useHubClusterName"), exports);
26
- __exportStar(require("./useFleetPrometheusPoll"), exports);
27
- __exportStar(require("./useFleetAccessReview"), exports);
28
33
  __exportStar(require("./useIsFleetAvailable"), exports);
29
34
  __exportStar(require("./useIsFleetObservabilityInstalled"), exports);
35
+ __exportStar(require("./getFleetK8sAPIPath"), exports);
30
36
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,8CAA2B;AAC3B,sDAAmC;AACnC,uDAAoC;AACpC,6DAA0C;AAC1C,yDAAsC;AACtC,uDAAoC;AACpC,gDAA6B;AAC7B,sDAAmC;AACnC,2DAAwC;AACxC,yDAAsC;AACtC,wDAAqC;AACrC,qEAAkD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,8CAA2B;AAC3B,mDAAgC;AAChC,mDAAgC;AAChC,gDAA6B;AAC7B,iDAA8B;AAC9B,kDAA+B;AAC/B,mDAAgC;AAChC,sDAAmC;AACnC,yDAAsC;AACtC,yDAAsC;AACtC,uDAAoC;AACpC,6DAA0C;AAC1C,2DAAwC;AACxC,uDAAoC;AACpC,sDAAmC;AACnC,wDAAqC;AACrC,qEAAkD;AAClD,uDAAoC"}
@@ -1,4 +1,9 @@
1
1
  import { UseFleetK8sAPIPath } from '../types';
2
+ /**
3
+ * Hook that provides the k8s API path for the fleet.
4
+ *
5
+ * @param cluster - The cluster name.
6
+ * @returns Array with `k8sAPIPath`, `loaded` and `error` values.
7
+ */
2
8
  export declare const useFleetK8sAPIPath: UseFleetK8sAPIPath;
3
- export declare const getFleetK8sAPIPath: (cluster?: string) => Promise<string>;
4
9
  //# sourceMappingURL=useFleetK8sAPIPath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFleetK8sAPIPath.d.ts","sourceRoot":"","sources":["../../src/api/useFleetK8sAPIPath.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAM7C,eAAO,MAAM,kBAAkB,EAAE,kBAQhC,CAAA;AAID,eAAO,MAAM,kBAAkB,GAAU,UAAU,MAAM,oBAexD,CAAA"}
1
+ {"version":3,"file":"useFleetK8sAPIPath.d.ts","sourceRoot":"","sources":["../../src/api/useFleetK8sAPIPath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAK7C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAQhC,CAAA"}
@@ -1,23 +1,17 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getFleetK8sAPIPath = exports.useFleetK8sAPIPath = void 0;
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("./apiRequests");
3
+ exports.useFleetK8sAPIPath = void 0;
4
+ const apiRequests_1 = require("../internal/apiRequests");
16
5
  const constants_1 = require("../internal/constants");
17
- const models_1 = require("../internal/models");
18
- const useHubClusterName_1 = require("./useHubClusterName");
6
+ const useHubConfigurationItem_1 = require("../internal/useHubConfigurationItem");
7
+ /**
8
+ * Hook that provides the k8s API path for the fleet.
9
+ *
10
+ * @param cluster - The cluster name.
11
+ * @returns Array with `k8sAPIPath`, `loaded` and `error` values.
12
+ */
19
13
  const useFleetK8sAPIPath = (cluster) => {
20
- const [hubClusterName, loaded, error] = (0, useHubClusterName_1.useHubClusterName)();
14
+ const [hubClusterName, loaded, error] = (0, useHubConfigurationItem_1.useHubConfigurationItem)('localHubName');
21
15
  if (!loaded)
22
16
  return [undefined, false, error];
23
17
  if (!cluster || cluster === hubClusterName)
@@ -25,22 +19,4 @@ const useFleetK8sAPIPath = (cluster) => {
25
19
  return [`${(0, apiRequests_1.getBackendUrl)()}/${constants_1.MANAGED_CLUSTER_API_PATH}/${cluster}`, loaded, error];
26
20
  };
27
21
  exports.useFleetK8sAPIPath = useFleetK8sAPIPath;
28
- let cachedHubClusterName = undefined;
29
- const getFleetK8sAPIPath = (cluster) => __awaiter(void 0, void 0, void 0, function* () {
30
- var _a, _b;
31
- if (!cachedHubClusterName) {
32
- const hubClusters = yield (0, dynamic_plugin_sdk_1.k8sListItems)({
33
- model: models_1.ManagedClusterModel,
34
- queryParams: { labelSelector: { matchLabels: { [constants_1.LOCAL_CLUSTER_LABEL]: true } } },
35
- });
36
- cachedHubClusterName = (_b = (_a = hubClusters === null || hubClusters === void 0 ? void 0 : hubClusters[0]) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.name;
37
- }
38
- if (cluster && cachedHubClusterName !== cluster) {
39
- return `${(0, apiRequests_1.getBackendUrl)()}/${constants_1.MANAGED_CLUSTER_API_PATH}/${cluster}`;
40
- }
41
- else {
42
- return constants_1.BASE_K8S_API_PATH;
43
- }
44
- });
45
- exports.getFleetK8sAPIPath = getFleetK8sAPIPath;
46
22
  //# sourceMappingURL=useFleetK8sAPIPath.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFleetK8sAPIPath.js","sourceRoot":"","sources":["../../src/api/useFleetK8sAPIPath.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAmE;AACnE,8EAAoE;AAEpE,+CAA6C;AAC7C,qDAAwG;AACxG,+CAAwD;AACxD,2DAAuD;AAEhD,MAAM,kBAAkB,GAAuB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,IAAA,qCAAiB,GAAE,CAAA;IAE3D,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IAE7C,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,cAAc;QAAE,OAAO,CAAC,6BAAiB,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IAEvF,OAAO,CAAC,GAAG,IAAA,2BAAa,GAAE,IAAI,oCAAwB,IAAI,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AACrF,CAAC,CAAA;AARY,QAAA,kBAAkB,sBAQ9B;AAED,IAAI,oBAAoB,GAAuB,SAAS,CAAA;AAEjD,MAAM,kBAAkB,GAAG,CAAO,OAAgB,EAAE,EAAE;;IAC3D,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,MAAM,WAAW,GAAG,MAAM,IAAA,iCAAY,EAAC;YACrC,KAAK,EAAE,4BAAmB;YAC1B,WAAW,EAAE,EAAE,aAAa,EAAE,EAAE,WAAW,EAAE,EAAE,CAAC,+BAAmB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;SACjF,CAAC,CAAA;QAEF,oBAAoB,GAAG,MAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,CAAC,CAAC,0CAAE,QAAQ,0CAAE,IAAI,CAAA;IACzD,CAAC;IAED,IAAI,OAAO,IAAI,oBAAoB,KAAK,OAAO,EAAE,CAAC;QAChD,OAAO,GAAG,IAAA,2BAAa,GAAE,IAAI,oCAAwB,IAAI,OAAO,EAAE,CAAA;IACpE,CAAC;SAAM,CAAC;QACN,OAAO,6BAAiB,CAAA;IAC1B,CAAC;AACH,CAAC,CAAA,CAAA;AAfY,QAAA,kBAAkB,sBAe9B"}
1
+ {"version":3,"file":"useFleetK8sAPIPath.js","sourceRoot":"","sources":["../../src/api/useFleetK8sAPIPath.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AACvD,qDAAmF;AACnF,iFAA6E;AAE7E;;;;;GAKG;AACI,MAAM,kBAAkB,GAAuB,CAAC,OAAO,EAAE,EAAE;IAChE,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,IAAA,iDAAuB,EAAC,cAAc,CAAC,CAAA;IAE/E,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IAE7C,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,cAAc;QAAE,OAAO,CAAC,6BAAiB,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IAEvF,OAAO,CAAC,GAAG,IAAA,2BAAa,GAAE,IAAI,oCAAwB,IAAI,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AACrF,CAAC,CAAA;AARY,QAAA,kBAAkB,sBAQ9B"}