@redhat-cloud-services/rhsm-subscriptions-utilization-client 1.0.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 (43) hide show
  1. package/.eslintrc.json +27 -0
  2. package/LICENSE +201 -0
  3. package/README.md +57 -0
  4. package/dist/GetOrgPreferences/index.d.ts +22 -0
  5. package/dist/GetOrgPreferences/index.js +67 -0
  6. package/dist/GetOrgPreferences/index.js.map +1 -0
  7. package/dist/UpdateOrgPreferences/index.d.ts +28 -0
  8. package/dist/UpdateOrgPreferences/index.js +69 -0
  9. package/dist/UpdateOrgPreferences/index.js.map +1 -0
  10. package/dist/api.d.ts +9 -0
  11. package/dist/api.js +15 -0
  12. package/dist/api.js.map +1 -0
  13. package/dist/esm/GetOrgPreferences/index.d.ts +22 -0
  14. package/dist/esm/GetOrgPreferences/index.js +63 -0
  15. package/dist/esm/GetOrgPreferences/index.js.map +1 -0
  16. package/dist/esm/UpdateOrgPreferences/index.d.ts +28 -0
  17. package/dist/esm/UpdateOrgPreferences/index.js +65 -0
  18. package/dist/esm/UpdateOrgPreferences/index.js.map +1 -0
  19. package/dist/esm/api.d.ts +9 -0
  20. package/dist/esm/api.js +11 -0
  21. package/dist/esm/api.js.map +1 -0
  22. package/dist/esm/index.d.ts +3 -0
  23. package/dist/esm/index.js +4 -0
  24. package/dist/esm/index.js.map +1 -0
  25. package/dist/esm/types/index.d.ts +32 -0
  26. package/dist/esm/types/index.js +2 -0
  27. package/dist/esm/types/index.js.map +1 -0
  28. package/dist/index.d.ts +3 -0
  29. package/dist/index.js +10 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/package.json +54 -0
  32. package/dist/types/index.d.ts +32 -0
  33. package/dist/types/index.js +3 -0
  34. package/dist/types/index.js.map +1 -0
  35. package/jest.config.ts +10 -0
  36. package/openapi.yaml +140 -0
  37. package/openapitools.json +7 -0
  38. package/package.json +54 -0
  39. package/project.json +70 -0
  40. package/tsconfig.cjs.json +6 -0
  41. package/tsconfig.esm.json +13 -0
  42. package/tsconfig.json +18 -0
  43. package/typedoc.json +9 -0
@@ -0,0 +1,65 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
2
+ import { AuthTypeEnum, DUMMY_BASE_URL, setSearchParams } from '@redhat-cloud-services/javascript-clients-shared/common';
3
+ var isUpdateOrgPreferencesObjectParams = function (params) {
4
+ var l = params.length === 1;
5
+ if (l && typeof params[0] === 'object' && !Array.isArray(params[0])) {
6
+ return true && Object.prototype.hasOwnProperty.call(params[0], 'xRhIdentity') && Object.prototype.hasOwnProperty.call(params[0], 'orgPreferencesRequest');
7
+ }
8
+ return false;
9
+ };
10
+ /**
11
+ * Accepts organization utilization preferences (for example custom over-usage threshold) and persists them for the organization resolved from the authenticated x-rh-identity header.
12
+ * @summary Update organization utilization preferences
13
+ * @param {UpdateOrgPreferencesParams} config with all available params.
14
+ * @param {*} [options] Override http request option.
15
+ * @throws {RequiredError}
16
+ */
17
+ export var updateOrgPreferencesParamCreator = function (sendRequest) {
18
+ var config = [];
19
+ for (var _i = 1; _i < arguments.length; _i++) {
20
+ config[_i - 1] = arguments[_i];
21
+ }
22
+ return __awaiter(void 0, void 0, void 0, function () {
23
+ var params, xRhIdentity, orgPreferencesRequest, _a, options, localVarPath, localVarUrlObj, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, args;
24
+ return __generator(this, function (_b) {
25
+ params = isUpdateOrgPreferencesObjectParams(config) ? config[0] : ['xRhIdentity', 'orgPreferencesRequest', 'options'].reduce(function (acc, curr, index) {
26
+ var _a;
27
+ return (__assign(__assign({}, acc), (_a = {}, _a[curr] = config[index], _a)));
28
+ }, {});
29
+ xRhIdentity = params.xRhIdentity, orgPreferencesRequest = params.orgPreferencesRequest, _a = params.options, options = _a === void 0 ? {} : _a;
30
+ localVarPath = "/api/rhsm-subscriptions/v1/utilization/org-preferences";
31
+ localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
32
+ localVarRequestOptions = __assign({ method: 'POST' }, options);
33
+ localVarHeaderParameter = {};
34
+ localVarQueryParameter = {};
35
+ if (xRhIdentity != null) {
36
+ localVarHeaderParameter['x-rh-identity'] = String(xRhIdentity);
37
+ }
38
+ localVarHeaderParameter['Content-Type'] = 'application/json';
39
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
40
+ localVarRequestOptions.headers = __assign(__assign({}, localVarHeaderParameter), options.headers);
41
+ args = {
42
+ urlObj: localVarUrlObj,
43
+ options: localVarRequestOptions,
44
+ serializeData: orgPreferencesRequest,
45
+ auth: [
46
+ {
47
+ // authentication org_admin required
48
+ // in header with key required
49
+ authType: AuthTypeEnum.InHeader,
50
+ authKey: "x-rh-identity"
51
+ },
52
+ {
53
+ // authentication service required
54
+ // in header with key required
55
+ authType: AuthTypeEnum.InHeader,
56
+ authKey: "x-rh-swatch-psk"
57
+ }
58
+ ]
59
+ };
60
+ return [2 /*return*/, sendRequest(Promise.resolve(args))];
61
+ });
62
+ });
63
+ };
64
+ export default updateOrgPreferencesParamCreator;
65
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/UpdateOrgPreferences/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAqC,YAAY,EAAE,cAAc,EAAuG,eAAe,EAA8D,MAAM,yDAAyD,CAAC;AA0B5T,IAAM,kCAAkC,GAAG,UAAC,MAAgD;IAC1F,IAAM,CAAC,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAA;IAC7B,IAAG,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,OAAO,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAA;IAC3J,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AACD;;;;;;EAME;AACF,MAAM,CAAC,IAAM,gCAAgC,GAAG,UAAO,WAAmC;IAAE,gBAA+F;SAA/F,UAA+F,EAA/F,qBAA+F,EAA/F,IAA+F;QAA/F,+BAA+F;;;;;YACjL,MAAM,GAAG,kCAAkC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,uBAAuB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,IAAI,EAAE,KAAK;;gBAAK,OAAA,uBAAM,GAAG,gBAAG,IAAI,IAAG,MAAM,CAAC,KAAK,CAAC,OAAG;YAAnC,CAAmC,EAAE,EAAE,CAA+B,CAAC;YACxN,WAAW,GAA0C,MAAM,YAAhD,EAAE,qBAAqB,GAAmB,MAAM,sBAAzB,EAAE,KAAiB,MAAM,QAAX,EAAZ,OAAO,mBAAG,EAAE,KAAA,CAAY;YAC9D,YAAY,GAAG,wDAAwD,CAAC;YAExE,cAAc,GAAG,IAAI,GAAG,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;YACvD,sBAAsB,cAAK,MAAM,EAAE,MAAgB,IAAK,OAAO,CAAC,CAAC;YACjE,uBAAuB,GAAG,EAAS,CAAC;YACpC,sBAAsB,GAAG,EAAS,CAAC;YAEzC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;gBACtB,uBAAuB,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;YACnE,CAAC;YAID,uBAAuB,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;YAE7D,eAAe,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAC;YACxD,sBAAsB,CAAC,OAAO,yBAAO,uBAAuB,GAAK,OAAO,CAAC,OAAO,CAAC,CAAC;YAE5E,IAAI,GAAG;gBACT,MAAM,EAAE,cAAc;gBACtB,OAAO,EAAE,sBAAsB;gBAC/B,aAAa,EAAE,qBAAqB;gBACpC,IAAI,EAAC;oBACL;wBACA,oCAAoC;wBACpC,8BAA8B;wBAC9B,QAAQ,EAAE,YAAY,CAAC,QAAQ;wBAC/B,OAAO,EAAE,eAAe;qBACvB;oBACD;wBACA,kCAAkC;wBAClC,8BAA8B;wBAC9B,QAAQ,EAAE,YAAY,CAAC,QAAQ;wBAC/B,OAAO,EAAE,iBAAiB;qBACzB;iBACA;aACJ,CAAC;YAEF,sBAAO,WAAW,CAAiC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAC;;;CAC7E,CAAA;AAED,eAAe,gCAAgC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ApiConfig } from '@redhat-cloud-services/javascript-clients-shared/common';
2
+ export declare const RhsmSubscriptionsUtilizationClient: (BASE_PATH: string, instance?: ApiConfig) => import("packages/shared/dist/base").BaseAPI & import("@redhat-cloud-services/javascript-clients-shared/utils").APIFactoryResponse<{
3
+ getOrgPreferences: (sendRequest: import("packages/shared/dist/base").BaseAPI["sendRequest"], ...config: ([import("./GetOrgPreferences").GetOrgPreferencesParams] | [string, import("axios").AxiosRequestConfig])) => Promise<import("axios").AxiosResponse<import("./types").OrgPreferencesResponse, any, {}>>;
4
+ updateOrgPreferences: (sendRequest: import("packages/shared/dist/base").BaseAPI["sendRequest"], ...config: ([import("./UpdateOrgPreferences").UpdateOrgPreferencesParams] | [string, import("./types").OrgPreferencesRequest, import("axios").AxiosRequestConfig])) => Promise<import("axios").AxiosResponse<import("./types").OrgPreferencesResponse, any, {}>>;
5
+ }, {
6
+ getOrgPreferences: Promise<import("axios").AxiosResponse<import("./types").OrgPreferencesResponse, any, {}>>;
7
+ updateOrgPreferences: Promise<import("axios").AxiosResponse<import("./types").OrgPreferencesResponse, any, {}>>;
8
+ }>;
9
+ export default RhsmSubscriptionsUtilizationClient;
@@ -0,0 +1,11 @@
1
+ import { APIFactory } from '@redhat-cloud-services/javascript-clients-shared/utils';
2
+ import { getOrgPreferences, updateOrgPreferences, } from './index';
3
+ var endpointList = {
4
+ getOrgPreferences: getOrgPreferences,
5
+ updateOrgPreferences: updateOrgPreferences,
6
+ };
7
+ export var RhsmSubscriptionsUtilizationClient = function (BASE_PATH, instance) {
8
+ return APIFactory(BASE_PATH, endpointList, instance);
9
+ };
10
+ export default RhsmSubscriptionsUtilizationClient;
11
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wDAAwD,CAAC;AAEpF,OAAO,EACH,iBAAiB,EACjB,oBAAoB,GAErB,MAAM,SAAS,CAAC;AAEnB,IAAM,YAAY,GAAG;IACf,iBAAiB,mBAAA;IACnB,oBAAoB,sBAAA;CAGvB,CAAC;AAEF,MAAM,CAAC,IAAM,kCAAkC,GAAG,UAAC,SAAiB,EAAE,QAAoB;IACxF,OAAO,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;AACvD,CAAC,CAAA;AAED,eAAe,kCAAkC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as getOrgPreferences, type GetOrgPreferencesReturnType } from './GetOrgPreferences';
2
+ export { default as updateOrgPreferences, type UpdateOrgPreferencesReturnType } from './UpdateOrgPreferences';
3
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ export { default as getOrgPreferences } from './GetOrgPreferences';
2
+ export { default as updateOrgPreferences } from './UpdateOrgPreferences';
3
+ export * from './types';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAoC,MAAM,qBAAqB,CAAA;AAEpG,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAuC,MAAM,wBAAwB,CAAA;AAG7G,cAAc,SAAS,CAAA"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ *
3
+ * @export
4
+ * @interface OrgPreferencesRequest
5
+ */
6
+ export interface OrgPreferencesRequest {
7
+ /**
8
+ * Over-usage threshold margin as a whole-number percentage (e.g. 5 means 5%).
9
+ * @type {number}
10
+ * @memberof OrgPreferencesRequest
11
+ */
12
+ 'custom_threshold': number;
13
+ }
14
+ /**
15
+ *
16
+ * @export
17
+ * @interface OrgPreferencesResponse
18
+ */
19
+ export interface OrgPreferencesResponse {
20
+ /**
21
+ * Persisted over-usage threshold margin as a whole-number percentage.
22
+ * @type {number}
23
+ * @memberof OrgPreferencesResponse
24
+ */
25
+ 'custom_threshold': number;
26
+ /**
27
+ * UTC timestamp when preferences were last persisted. Omitted when the organization has not configured custom preferences and the system default threshold is returned.
28
+ * @type {string}
29
+ * @memberof OrgPreferencesResponse
30
+ */
31
+ 'last_modified'?: string;
32
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export { default as getOrgPreferences, type GetOrgPreferencesReturnType } from './GetOrgPreferences';
2
+ export { default as updateOrgPreferences, type UpdateOrgPreferencesReturnType } from './UpdateOrgPreferences';
3
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateOrgPreferences = exports.getOrgPreferences = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var GetOrgPreferences_1 = require("./GetOrgPreferences");
6
+ Object.defineProperty(exports, "getOrgPreferences", { enumerable: true, get: function () { return GetOrgPreferences_1.default; } });
7
+ var UpdateOrgPreferences_1 = require("./UpdateOrgPreferences");
8
+ Object.defineProperty(exports, "updateOrgPreferences", { enumerable: true, get: function () { return UpdateOrgPreferences_1.default; } });
9
+ tslib_1.__exportStar(require("./types"), exports);
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,yDAAoG;AAA3F,sHAAA,OAAO,OAAqB;AAErC,+DAA6G;AAApG,4HAAA,OAAO,OAAwB;AAGxC,kDAAuB"}
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@redhat-cloud-services/rhsm-subscriptions-utilization-client",
3
+ "version": "1.0.0",
4
+ "description": "JavaScript client for Red Hat Subscription Watch utilization APIs",
5
+ "main": "./index.js",
6
+ "typings": "./index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./index.d.ts",
10
+ "import": "./esm/index.js",
11
+ "default": "./index.js"
12
+ },
13
+ "./api": {
14
+ "types": "./api.d.ts",
15
+ "import": "./esm/api.js",
16
+ "default": "./api.js"
17
+ },
18
+ "./*": {
19
+ "types": "./*/index.d.ts",
20
+ "import": "./esm/*/index.js",
21
+ "default": "./*/index.js"
22
+ }
23
+ },
24
+ "typesVersions": {
25
+ "*": {
26
+ "api": [
27
+ "./api.d.ts"
28
+ ],
29
+ "*": [
30
+ "./*/index.d.ts"
31
+ ]
32
+ }
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/RedHatInsights/javascript-clients.git"
40
+ },
41
+ "author": "",
42
+ "license": "Apache-2.0",
43
+ "bugs": {
44
+ "url": "https://github.com/RedHatInsights/javascript-clients/issues"
45
+ },
46
+ "homepage": "https://github.com/RedHatInsights/javascript-clients#readme",
47
+ "scripts": {
48
+ "doc": "typedoc"
49
+ },
50
+ "dependencies": {
51
+ "@redhat-cloud-services/javascript-clients-shared": "^2.0.5",
52
+ "tslib": "^2.6.2"
53
+ }
54
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ *
3
+ * @export
4
+ * @interface OrgPreferencesRequest
5
+ */
6
+ export interface OrgPreferencesRequest {
7
+ /**
8
+ * Over-usage threshold margin as a whole-number percentage (e.g. 5 means 5%).
9
+ * @type {number}
10
+ * @memberof OrgPreferencesRequest
11
+ */
12
+ 'custom_threshold': number;
13
+ }
14
+ /**
15
+ *
16
+ * @export
17
+ * @interface OrgPreferencesResponse
18
+ */
19
+ export interface OrgPreferencesResponse {
20
+ /**
21
+ * Persisted over-usage threshold margin as a whole-number percentage.
22
+ * @type {number}
23
+ * @memberof OrgPreferencesResponse
24
+ */
25
+ 'custom_threshold': number;
26
+ /**
27
+ * UTC timestamp when preferences were last persisted. Omitted when the organization has not configured custom preferences and the system default threshold is returned.
28
+ * @type {string}
29
+ * @memberof OrgPreferencesResponse
30
+ */
31
+ 'last_modified'?: string;
32
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
package/jest.config.ts ADDED
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ export default {
3
+ displayName: 'rhsm-subscriptions-utilization-client',
4
+ preset: '../../jest.preset.js',
5
+ transform: {
6
+ '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
7
+ },
8
+ moduleFileExtensions: ['ts', 'js', 'html'],
9
+ coverageDirectory: '../../coverage/packages/rhsm-subscriptions-utilization',
10
+ };
package/openapi.yaml ADDED
@@ -0,0 +1,140 @@
1
+ ---
2
+ openapi: 3.0.2
3
+ info:
4
+ title: Swatch Utilization API
5
+ version: 1.0.0
6
+ description: Subscription Watch utilization HTTP APIs
7
+ contact:
8
+ name: SWATCH Dev
9
+ url: https://github.com/RedHatInsights/rhsm-subscriptions
10
+ servers:
11
+ - url: https://console.redhat.com
12
+ - url: https://console.stage.redhat.com
13
+ tags:
14
+ - name: OrgPreferences
15
+ description: Organization-level utilization preferences
16
+ paths:
17
+ /api/rhsm-subscriptions/v1/utilization/org-preferences:
18
+ get:
19
+ tags:
20
+ - OrgPreferences
21
+ operationId: getOrgPreferences
22
+ security:
23
+ - customer: []
24
+ - service: []
25
+ summary: Get organization utilization preferences
26
+ description: >-
27
+ Retrieves the organization utilization preferences for the organization resolved
28
+ from the authenticated x-rh-identity header.
29
+ parameters:
30
+ - name: x-rh-identity
31
+ in: header
32
+ required: true
33
+ schema:
34
+ type: string
35
+ description: >-
36
+ Base64-encoded JSON identity document for x-rh-identity (must include org_id for User
37
+ and ServiceAccount identities, per the authenticated principal).
38
+ responses:
39
+ "200":
40
+ description: Preferences retrieved successfully. Returns system default threshold if not configured.
41
+ content:
42
+ application/json:
43
+ schema:
44
+ $ref: "#/components/schemas/OrgPreferencesResponse"
45
+ "403":
46
+ $ref: "#/components/responses/Forbidden"
47
+ "500":
48
+ $ref: "#/components/responses/InternalServerError"
49
+ post:
50
+ tags:
51
+ - OrgPreferences
52
+ operationId: updateOrgPreferences
53
+ security:
54
+ - org_admin: []
55
+ - service: []
56
+ summary: Update organization utilization preferences
57
+ description: >-
58
+ Accepts organization utilization preferences (for example custom over-usage threshold)
59
+ and persists them for the organization resolved from the authenticated x-rh-identity header.
60
+ parameters:
61
+ - name: x-rh-identity
62
+ in: header
63
+ required: true
64
+ schema:
65
+ type: string
66
+ description: >-
67
+ Base64-encoded JSON identity document for x-rh-identity (must include org_id for User
68
+ and ServiceAccount identities, per the authenticated principal).
69
+ requestBody:
70
+ required: true
71
+ content:
72
+ application/json:
73
+ schema:
74
+ $ref: "#/components/schemas/OrgPreferencesRequest"
75
+ responses:
76
+ "200":
77
+ description: Preferences were applied successfully.
78
+ content:
79
+ application/json:
80
+ schema:
81
+ $ref: "#/components/schemas/OrgPreferencesResponse"
82
+ "400":
83
+ $ref: "#/components/responses/BadRequest"
84
+ "403":
85
+ $ref: "#/components/responses/Forbidden"
86
+ "500":
87
+ $ref: "#/components/responses/InternalServerError"
88
+ components:
89
+ securitySchemes:
90
+ customer:
91
+ type: apiKey
92
+ description: customer facing API
93
+ name: x-rh-identity
94
+ in: header
95
+ org_admin:
96
+ type: apiKey
97
+ description: API is available for organization administrators (is_org_admin=true in x-rh-identity)
98
+ name: x-rh-identity
99
+ in: header
100
+ service:
101
+ type: apiKey
102
+ description: API is available for services
103
+ name: x-rh-swatch-psk
104
+ in: header
105
+ responses:
106
+ BadRequest:
107
+ description: The server could not process the current request.
108
+ Forbidden:
109
+ description: The request was valid, but the request was refused by the server.
110
+ InternalServerError:
111
+ description: An internal server error has occurred and is not recoverable.
112
+ schemas:
113
+ OrgPreferencesRequest:
114
+ type: object
115
+ required:
116
+ - custom_threshold
117
+ properties:
118
+ custom_threshold:
119
+ type: integer
120
+ format: int32
121
+ minimum: 0
122
+ maximum: 100
123
+ description: Over-usage threshold margin as a whole-number percentage (e.g. 5 means 5%).
124
+ OrgPreferencesResponse:
125
+ type: object
126
+ required:
127
+ - custom_threshold
128
+ properties:
129
+ custom_threshold:
130
+ type: integer
131
+ format: int32
132
+ minimum: 0
133
+ maximum: 100
134
+ description: Persisted over-usage threshold margin as a whole-number percentage.
135
+ last_modified:
136
+ type: string
137
+ format: date-time
138
+ description: >-
139
+ UTC timestamp when preferences were last persisted. Omitted when the organization
140
+ has not configured custom preferences and the system default threshold is returned.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
3
+ "spaces": 2,
4
+ "generator-cli": {
5
+ "version": "7.0.0"
6
+ }
7
+ }
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@redhat-cloud-services/rhsm-subscriptions-utilization-client",
3
+ "version": "1.0.0",
4
+ "description": "JavaScript client for Red Hat Subscription Watch utilization APIs",
5
+ "main": "./index.js",
6
+ "typings": "./index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./index.d.ts",
10
+ "import": "./esm/index.js",
11
+ "default": "./index.js"
12
+ },
13
+ "./api": {
14
+ "types": "./api.d.ts",
15
+ "import": "./esm/api.js",
16
+ "default": "./api.js"
17
+ },
18
+ "./*": {
19
+ "types": "./*/index.d.ts",
20
+ "import": "./esm/*/index.js",
21
+ "default": "./*/index.js"
22
+ }
23
+ },
24
+ "typesVersions": {
25
+ "*": {
26
+ "api": [
27
+ "./api.d.ts"
28
+ ],
29
+ "*": [
30
+ "./*/index.d.ts"
31
+ ]
32
+ }
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/RedHatInsights/javascript-clients.git"
40
+ },
41
+ "author": "",
42
+ "license": "Apache-2.0",
43
+ "bugs": {
44
+ "url": "https://github.com/RedHatInsights/javascript-clients/issues"
45
+ },
46
+ "homepage": "https://github.com/RedHatInsights/javascript-clients#readme",
47
+ "scripts": {
48
+ "doc": "typedoc"
49
+ },
50
+ "dependencies": {
51
+ "@redhat-cloud-services/javascript-clients-shared": "^2.0.5",
52
+ "tslib": "^2.6.2"
53
+ }
54
+ }
package/project.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@redhat-cloud-services/rhsm-subscriptions-utilization-client",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/rhsm-subscriptions-utilization",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "clean-generate": {
8
+ "command": "rm -rf packages/rhsm-subscriptions-utilization/src"
9
+ },
10
+ "generate": {
11
+ "dependsOn": ["clean-generate"],
12
+ "executor": "@redhat-cloud-services/build-utils:client-generator",
13
+ "options": {
14
+ "outputPath": "packages/rhsm-subscriptions-utilization/src",
15
+ "specs": {
16
+ "default": "openapi.yaml"
17
+ },
18
+ "clientName": "RhsmSubscriptionsUtilizationClient"
19
+ }
20
+ },
21
+ "clean-build": {
22
+ "command": "rm -rf packages/rhsm-subscriptions-utilization/dist"
23
+ },
24
+ "build": {
25
+ "dependsOn": ["clean-build", "^build"],
26
+ "executor": "@redhat-cloud-services/build-utils:builder",
27
+ "options": {
28
+ "inputPath": "packages/rhsm-subscriptions-utilization/src",
29
+ "outputPath": "packages/rhsm-subscriptions-utilization/dist",
30
+ "main": "packages/rhsm-subscriptions-utilization/src/index.ts",
31
+ "esmTsConfig": "packages/rhsm-subscriptions-utilization/tsconfig.esm.json",
32
+ "cjsTsConfig": "packages/rhsm-subscriptions-utilization/tsconfig.cjs.json",
33
+ "assets": [".npmignore"]
34
+ }
35
+ },
36
+ "publish": {
37
+ "command": "node tools/scripts/publish.mjs @redhat-cloud-services/rhsm-subscriptions-utilization-client {args.ver} {args.tag}",
38
+ "dependsOn": ["build"]
39
+ },
40
+ "lint": {
41
+ "executor": "@nx/eslint:lint",
42
+ "outputs": ["{options.outputFile}"],
43
+ "options": {
44
+ "lintFilePatterns": [
45
+ "packages/rhsm-subscriptions-utilization/**/*.ts",
46
+ "packages/rhsm-subscriptions-utilization/*.json"
47
+ ]
48
+ }
49
+ },
50
+ "test": {
51
+ "executor": "@nx/jest:jest",
52
+ "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
53
+ "options": {
54
+ "jestConfig": "packages/rhsm-subscriptions-utilization/jest.config.ts"
55
+ }
56
+ },
57
+ "nx-release-publish": {
58
+ "options": {
59
+ "packageRoot": "{projectRoot}/dist"
60
+ }
61
+ },
62
+ "npm": {
63
+ "executor": "ngx-deploy-npm:deploy",
64
+ "options": {
65
+ "access": "public"
66
+ }
67
+ }
68
+ },
69
+ "tags": []
70
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig.esm.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS"
5
+ }
6
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "declaration": true,
6
+ "types": ["node"],
7
+ "module": "ES2015",
8
+ "target": "ES5",
9
+ "rootDir": "./"
10
+ },
11
+ "include": ["*.ts", "**/*.ts"],
12
+ "exclude": ["jest.config.ts", "dist"]
13
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "forceConsistentCasingInFileNames": true,
6
+ "strict": true,
7
+ "noImplicitOverride": false,
8
+ "noPropertyAccessFromIndexSignature": false,
9
+ "noImplicitReturns": true,
10
+ "noFallthroughCasesInSwitch": true
11
+ },
12
+ "files": [],
13
+ "references": [
14
+ {
15
+ "path": "./tsconfig.esm.json"
16
+ }
17
+ ]
18
+ }
package/typedoc.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "entryPoints": ["index.ts"],
3
+ "out": "doc",
4
+ "plugin": [
5
+ "typedoc-plugin-markdown"
6
+ ],
7
+ "theme": "markdown",
8
+ "gitRevision": "main"
9
+ }