hcloud-sdk 15.0.0 → 17.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 (108) hide show
  1. package/changelog.md +78 -33
  2. package/lib/Hcloud.d.ts +3 -0
  3. package/lib/Hcloud.js +7 -0
  4. package/lib/helper/ValidationHelper.d.ts +66 -0
  5. package/lib/helper/ValidationHelper.js +312 -0
  6. package/lib/interfaces/auditor/index.d.ts +10 -4
  7. package/lib/interfaces/auditor/index.js +4 -0
  8. package/lib/interfaces/friday/index.d.ts +3 -0
  9. package/lib/interfaces/friday/index.js +19 -0
  10. package/lib/interfaces/friday/space/database/document/index.d.ts +34 -0
  11. package/lib/interfaces/friday/space/database/document/index.js +13 -0
  12. package/lib/interfaces/friday/space/database/index.d.ts +12 -0
  13. package/lib/interfaces/friday/space/database/index.js +2 -0
  14. package/lib/interfaces/friday/space/index.d.ts +21 -0
  15. package/lib/interfaces/friday/space/index.js +11 -0
  16. package/lib/interfaces/frontend/config/index.d.ts +1 -0
  17. package/lib/interfaces/fuse/space/index.d.ts +1 -0
  18. package/lib/interfaces/global/Products.d.ts +3 -1
  19. package/lib/interfaces/global/Products.js +2 -0
  20. package/lib/interfaces/global/Views.d.ts +2 -1
  21. package/lib/interfaces/global/Views.js +1 -0
  22. package/lib/interfaces/high5/execution/index.d.ts +43 -0
  23. package/lib/interfaces/high5/execution/index.js +12 -0
  24. package/lib/interfaces/high5/index.d.ts +2 -2
  25. package/lib/interfaces/high5/index.js +2 -2
  26. package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +1 -0
  27. package/lib/interfaces/high5/space/event/stream/node/index.d.ts +22 -1
  28. package/lib/interfaces/high5/space/event/stream/node/index.js +6 -1
  29. package/lib/interfaces/high5/space/execution/index.d.ts +57 -1
  30. package/lib/interfaces/high5/space/execution/index.js +8 -0
  31. package/lib/interfaces/high5/space/index.d.ts +2 -0
  32. package/lib/interfaces/high5/space/pool/index.d.ts +28 -0
  33. package/lib/interfaces/high5/space/pool/index.js +2 -0
  34. package/lib/interfaces/high5/space/webhook/index.d.ts +3 -1
  35. package/lib/interfaces/high5/wave/index.d.ts +26 -4
  36. package/lib/interfaces/high5/wave/index.js +4 -0
  37. package/lib/interfaces/idp/index.d.ts +1 -0
  38. package/lib/interfaces/idp/index.js +1 -0
  39. package/lib/interfaces/idp/organization/license/index.d.ts +11 -0
  40. package/lib/interfaces/idp/organization/member/index.d.ts +3 -0
  41. package/lib/interfaces/idp/organization/service-accounts.d.ts +8 -0
  42. package/lib/interfaces/idp/organization/service-accounts.js +2 -0
  43. package/lib/interfaces/idp/organization/settings/oauthApp/index.d.ts +1 -0
  44. package/lib/interfaces/idp/user/GeneralSettings.d.ts +1 -0
  45. package/lib/interfaces/idp/user/GeneralSettings.js +1 -0
  46. package/lib/interfaces/idp/user/Scopes.d.ts +15 -2
  47. package/lib/interfaces/idp/user/Scopes.js +39 -1
  48. package/lib/interfaces/idp/user/Totp.d.ts +4 -2
  49. package/lib/interfaces/idp/user/index.d.ts +1 -0
  50. package/lib/interfaces/nats/index.d.ts +92 -5
  51. package/lib/interfaces/nats/index.js +155 -11
  52. package/lib/service/agent/bundle/dev/index.d.ts +3 -0
  53. package/lib/service/agent/bundle/dev/index.js +16 -0
  54. package/lib/service/agent/context/index.d.ts +5 -0
  55. package/lib/service/agent/context/index.js +14 -0
  56. package/lib/service/dali/DaliAvatar.d.ts +22 -4
  57. package/lib/service/dali/DaliAvatar.js +32 -2
  58. package/lib/service/dali/avatar/DaliCosmoSpace.d.ts +26 -0
  59. package/lib/service/dali/avatar/DaliCosmoSpace.js +58 -0
  60. package/lib/service/dali/avatar/DaliFuseSpace.d.ts +1 -1
  61. package/lib/service/dali/avatar/DaliFuseSpace.js +3 -3
  62. package/lib/service/dali/avatar/DaliHigh5Pool.d.ts +29 -0
  63. package/lib/service/dali/avatar/DaliHigh5Pool.js +61 -0
  64. package/lib/service/dali/avatar/DaliHigh5Space.d.ts +1 -1
  65. package/lib/service/dali/avatar/DaliHigh5Space.js +3 -3
  66. package/lib/service/dali/avatar/DaliServiceAccount.d.ts +26 -0
  67. package/lib/service/dali/avatar/DaliServiceAccount.js +58 -0
  68. package/lib/service/friday/index.d.ts +13 -0
  69. package/lib/service/friday/index.js +35 -0
  70. package/lib/service/friday/space/database/document/index.d.ts +58 -0
  71. package/lib/service/friday/space/database/document/index.js +97 -0
  72. package/lib/service/friday/space/database/index.d.ts +55 -0
  73. package/lib/service/friday/space/database/index.js +101 -0
  74. package/lib/service/friday/space/index.d.ts +81 -0
  75. package/lib/service/friday/space/index.js +150 -0
  76. package/lib/service/high5/execution/index.d.ts +8 -0
  77. package/lib/service/high5/execution/index.js +21 -0
  78. package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +1 -2
  79. package/lib/service/high5/space/event/stream/design/DesignOperations.js +5 -1
  80. package/lib/service/high5/space/execution/index.d.ts +31 -1
  81. package/lib/service/high5/space/execution/index.js +47 -2
  82. package/lib/service/high5/space/execution/status/index.d.ts +13 -6
  83. package/lib/service/high5/space/execution/status/index.js +20 -8
  84. package/lib/service/high5/space/index.d.ts +18 -6
  85. package/lib/service/high5/space/index.js +30 -7
  86. package/lib/service/high5/space/pool/index.d.ts +97 -0
  87. package/lib/service/high5/space/pool/index.js +171 -0
  88. package/lib/service/high5/wave/s3/index.d.ts +8 -1
  89. package/lib/service/high5/wave/s3/index.js +29 -8
  90. package/lib/service/idp/oauth/index.d.ts +2 -2
  91. package/lib/service/idp/oauth/index.js +12 -13
  92. package/lib/service/idp/organization/index.d.ts +6 -0
  93. package/lib/service/idp/organization/index.js +10 -0
  94. package/lib/service/idp/organization/member/index.d.ts +2 -1
  95. package/lib/service/idp/organization/member/index.js +2 -1
  96. package/lib/service/idp/organization/service-accounts/index.d.ts +64 -0
  97. package/lib/service/idp/organization/service-accounts/index.js +108 -0
  98. package/lib/service/idp/registration/index.d.ts +1 -1
  99. package/lib/service/idp/registration/index.js +2 -2
  100. package/lib/service/idp/user/index.d.ts +4 -0
  101. package/lib/service/idp/user/index.js +9 -0
  102. package/lib/service/idp/user/password/index.js +1 -1
  103. package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +1 -1
  104. package/lib/service/idp/user/settings/twoFactor/totp/index.js +1 -1
  105. package/lib/service/mothership/index.js +0 -1
  106. package/lib/service/nats/index.js +2 -3
  107. package/lib/utils/bouncer/features/Provider.js +0 -3
  108. package/package.json +22 -24
@@ -0,0 +1,97 @@
1
+ import { AxiosInstance } from "axios";
2
+ import Base, { Options } from "../../../../Base";
3
+ import { PaginatedResponse, SearchParams } from "../../../../interfaces/global";
4
+ import { Pool, PoolChange, PoolQueryOptions, PoolTargetPatch } from "../../../../interfaces/high5/space/pool";
5
+ import { OrganizationMember } from "../../../../interfaces/idp";
6
+ export default class High5Pool extends Base {
7
+ constructor(options: Options, axios: AxiosInstance);
8
+ /**
9
+ * Get a pool from a space
10
+ *
11
+ * @param orgName - Name of the organization
12
+ * @param spaceName - Name of the space
13
+ * @param name - Name of the pool
14
+ * @returns Pool
15
+ */
16
+ getPool(orgName: string, spaceName: string, name: string): Promise<Pool>;
17
+ /**
18
+ * Replace a pool of a space
19
+ *
20
+ * @param orgName - Name of the organization
21
+ * @param spaceName - Name of the space
22
+ * @param poolName - Name of the old/current pool
23
+ * @param name - New name for the pool
24
+ * @param targets - Execution targets that compromise the pool
25
+ * @returns The new Pool
26
+ */
27
+ replacePool(orgName: string, spaceName: string, poolName: string, name: string, targets: string[]): Promise<PoolChange>;
28
+ /**
29
+ * Patch a pool of a space
30
+ *
31
+ * @param orgName - Name of the organization
32
+ * @param spaceName - Name of the space
33
+ * @param poolName - Name of the pool
34
+ * @param name - New name for the pool
35
+ * @param targets - Execution targets that compromise the pool
36
+ * @returns The patched Pool
37
+ */
38
+ patchPool(orgName: string, spaceName: string, poolName: string, name?: string, targets?: PoolTargetPatch): Promise<PoolChange>;
39
+ /**
40
+ * Delete a pool of a space
41
+ *
42
+ * @param orgName - Name of the organization
43
+ * @param spaceName - Name of the space
44
+ * @param poolName - Name of the pool
45
+ */
46
+ deletePool(orgName: string, spaceName: string, poolName: string): Promise<void>;
47
+ /**
48
+ * Retrieves all pools of a High5 Space which match the provided search filter(s). Will return all pools of the Space if no filter is provided.
49
+ *
50
+ * @param orgName Name of the Organization
51
+ * @param spaceName Name of the Space
52
+ * @param filters (optional) Array of search filters
53
+ * @param sorting (optional) Sorting object
54
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
55
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
56
+ * @returns Object containing an array of Pool and the total number of results found in the database (independent of limit and page)
57
+ */
58
+ searchPools({ orgName, spaceName, filters, sorting, options, limit, page, }: SearchParams & {
59
+ orgName: string;
60
+ spaceName: string;
61
+ options?: PoolQueryOptions;
62
+ }): Promise<PaginatedResponse<Pool>>;
63
+ /**
64
+ * Add a pool to a space
65
+ *
66
+ * @param orgName - Name of the organization
67
+ * @param spaceName - Name of the space
68
+ * @param name - Name of the pool
69
+ * @param targets - Execution targets that compromise the pool
70
+ * @returns The created Pool
71
+ */
72
+ addPool(orgName: string, spaceName: string, name: string, targets: string[]): Promise<PoolChange>;
73
+ /**
74
+ * Retrieves all the pools the current user is assigned to as an execution target
75
+ *
76
+ * @returns Array of pools the user is assigned to as execution target
77
+ */
78
+ getPools(): Promise<Pool[]>;
79
+ /**
80
+ * Retrieves all targets of a pool which match the provided search filter(s). Will return all targets of the pool if no filter is provided.
81
+ *
82
+ * @param orgName Name of the Organization
83
+ * @param spaceName Name of the Space
84
+ * @param poolName Name of the pool
85
+ * @param filters (optional) Array of search filters
86
+ * @param sorting (optional) Sorting object
87
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
88
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
89
+ * @returns Object containing an array of OrganizationMember and the total number of results found in the database (independent of limit and page)
90
+ */
91
+ searchTargetsOfPool({ orgName, spaceName, poolName, filters, sorting, limit, page, }: SearchParams & {
92
+ orgName: string;
93
+ spaceName: string;
94
+ poolName: string;
95
+ }): Promise<PaginatedResponse<OrganizationMember>>;
96
+ protected getEndpoint(endpoint: string): string;
97
+ }
@@ -0,0 +1,171 @@
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
+ const Base_1 = require("../../../../Base");
13
+ const paginatedResponseHelper_1 = require("../../../../helper/paginatedResponseHelper");
14
+ const searchFilter_1 = require("../../../../helper/searchFilter");
15
+ class High5Pool extends Base_1.default {
16
+ constructor(options, axios) {
17
+ super(options, axios);
18
+ }
19
+ /**
20
+ * Get a pool from a space
21
+ *
22
+ * @param orgName - Name of the organization
23
+ * @param spaceName - Name of the space
24
+ * @param name - Name of the pool
25
+ * @returns Pool
26
+ */
27
+ getPool(orgName, spaceName, name) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/pools/${name}`));
30
+ return resp.data;
31
+ });
32
+ }
33
+ /**
34
+ * Replace a pool of a space
35
+ *
36
+ * @param orgName - Name of the organization
37
+ * @param spaceName - Name of the space
38
+ * @param poolName - Name of the old/current pool
39
+ * @param name - New name for the pool
40
+ * @param targets - Execution targets that compromise the pool
41
+ * @returns The new Pool
42
+ */
43
+ replacePool(orgName, spaceName, poolName, name, targets) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const resp = yield this.axios.put(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/pools/${poolName}`), {
46
+ name,
47
+ targets,
48
+ });
49
+ return resp.data;
50
+ });
51
+ }
52
+ /**
53
+ * Patch a pool of a space
54
+ *
55
+ * @param orgName - Name of the organization
56
+ * @param spaceName - Name of the space
57
+ * @param poolName - Name of the pool
58
+ * @param name - New name for the pool
59
+ * @param targets - Execution targets that compromise the pool
60
+ * @returns The patched Pool
61
+ */
62
+ patchPool(orgName, spaceName, poolName, name, targets) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ if (name === undefined && targets === undefined) {
65
+ throw new Error("unable to patch pool when there are no arguments to send");
66
+ }
67
+ const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/pools/${poolName}`), {
68
+ name,
69
+ targets,
70
+ });
71
+ return resp.data;
72
+ });
73
+ }
74
+ /**
75
+ * Delete a pool of a space
76
+ *
77
+ * @param orgName - Name of the organization
78
+ * @param spaceName - Name of the space
79
+ * @param poolName - Name of the pool
80
+ */
81
+ deletePool(orgName, spaceName, poolName) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/pools/${poolName}`));
84
+ });
85
+ }
86
+ /**
87
+ * Retrieves all pools of a High5 Space which match the provided search filter(s). Will return all pools of the Space if no filter is provided.
88
+ *
89
+ * @param orgName Name of the Organization
90
+ * @param spaceName Name of the Space
91
+ * @param filters (optional) Array of search filters
92
+ * @param sorting (optional) Sorting object
93
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
94
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
95
+ * @returns Object containing an array of Pool and the total number of results found in the database (independent of limit and page)
96
+ */
97
+ searchPools(_a) {
98
+ return __awaiter(this, arguments, void 0, function* ({ orgName, spaceName, filters, sorting, options, limit = 25, page = 0, }) {
99
+ const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => new searchFilter_1.SearchFilterDTO(f));
100
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/pools/search`), {
101
+ filters: filtersDTO,
102
+ sorting: sorting,
103
+ }, {
104
+ params: {
105
+ limit,
106
+ page,
107
+ totalTargetCount: options === null || options === void 0 ? void 0 : options.getTotalTargetCount,
108
+ targetsSample: options === null || options === void 0 ? void 0 : options.getTargetsSample,
109
+ },
110
+ });
111
+ return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
112
+ });
113
+ }
114
+ /**
115
+ * Add a pool to a space
116
+ *
117
+ * @param orgName - Name of the organization
118
+ * @param spaceName - Name of the space
119
+ * @param name - Name of the pool
120
+ * @param targets - Execution targets that compromise the pool
121
+ * @returns The created Pool
122
+ */
123
+ addPool(orgName, spaceName, name, targets) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/pools`), { name, targets });
126
+ return resp.data;
127
+ });
128
+ }
129
+ /**
130
+ * Retrieves all the pools the current user is assigned to as an execution target
131
+ *
132
+ * @returns Array of pools the user is assigned to as execution target
133
+ */
134
+ getPools() {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ const resp = yield this.axios.get(this.getEndpoint("/v1/pools"));
137
+ return resp.data;
138
+ });
139
+ }
140
+ /**
141
+ * Retrieves all targets of a pool which match the provided search filter(s). Will return all targets of the pool if no filter is provided.
142
+ *
143
+ * @param orgName Name of the Organization
144
+ * @param spaceName Name of the Space
145
+ * @param poolName Name of the pool
146
+ * @param filters (optional) Array of search filters
147
+ * @param sorting (optional) Sorting object
148
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
149
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
150
+ * @returns Object containing an array of OrganizationMember and the total number of results found in the database (independent of limit and page)
151
+ */
152
+ searchTargetsOfPool(_a) {
153
+ return __awaiter(this, arguments, void 0, function* ({ orgName, spaceName, poolName, filters, sorting, limit = 25, page = 0, }) {
154
+ const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => new searchFilter_1.SearchFilterDTO(f));
155
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/pools/${poolName}/targets/search`), {
156
+ filters: filtersDTO,
157
+ sorting: sorting,
158
+ }, {
159
+ params: {
160
+ page,
161
+ limit,
162
+ },
163
+ });
164
+ return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
165
+ });
166
+ }
167
+ getEndpoint(endpoint) {
168
+ return `${this.options.server}/api/high5${endpoint}`;
169
+ }
170
+ }
171
+ exports.default = High5Pool;
@@ -1,6 +1,6 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import Base, { Options } from "../../../../Base";
3
- import { Catalog, CatalogRegistry, Engine, EngineRegistry, StreamNodeSpecifications, StreamNodeSpecificationWrappedWithEngineVersion } from "../../../../interfaces/high5";
3
+ import { Catalog, CatalogRegistry, Engine, EngineRegistry, StreamNodeSpecifications, StreamNodeSpecificationWrappedWithEngineVersion, WildcardRegistry } from "../../../../interfaces/high5";
4
4
  /**
5
5
  * Class for reading the S3 bucket of a wave engine and catalogs
6
6
  */
@@ -30,6 +30,13 @@ export declare class S3 extends Base {
30
30
  * @returns index.json of catalog
31
31
  */
32
32
  getEngine(engineUrl: string): Promise<Engine>;
33
+ /**
34
+ * Get a list of available wildcards of a specific engine version from the S3 bucket
35
+ * @param engineUrl Public url of the engine
36
+ * @param engineVersion Version of the enigne
37
+ * @returns Wildcards.json list of available wildcards
38
+ */
39
+ getWildcardsOfEngine(engineUrl: string, engineVersion: string): Promise<WildcardRegistry>;
33
40
  /**
34
41
  * Get the node specifications of all nodes of a specific catalog version from the S3 bucket
35
42
  * @param catalogUrl Public url of the catalog
@@ -10,8 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.S3 = void 0;
13
+ const axios_1 = require("axios");
14
+ const package_json_1 = require("../../../../../package.json");
13
15
  const Base_1 = require("../../../../Base");
14
- const axios_1 = require("../../../../interfaces/axios");
16
+ const axios_2 = require("../../../../interfaces/axios");
17
+ const sdkVersion = "hcloud-sdk-js/v" + package_json_1.version;
15
18
  /**
16
19
  * Class for reading the S3 bucket of a wave engine and catalogs
17
20
  */
@@ -26,7 +29,9 @@ class S3 extends Base_1.default {
26
29
  */
27
30
  getCatalogRegistry(waveBucketUrl) {
28
31
  return __awaiter(this, void 0, void 0, function* () {
29
- const resp = yield this.axios.get(`${waveBucketUrl}/catalogs/registry.json`, { headers: axios_1.disableCacheHeaders });
32
+ const resp = yield axios_1.default.get(`${waveBucketUrl}/catalogs/registry.json`, {
33
+ headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
34
+ });
30
35
  return resp.data;
31
36
  });
32
37
  }
@@ -37,7 +42,9 @@ class S3 extends Base_1.default {
37
42
  */
38
43
  getEngineRegistry(waveBucketUrl) {
39
44
  return __awaiter(this, void 0, void 0, function* () {
40
- const resp = yield this.axios.get(`${waveBucketUrl}/engines/registry.json`, { headers: axios_1.disableCacheHeaders });
45
+ const resp = yield axios_1.default.get(`${waveBucketUrl}/engines/registry.json`, {
46
+ headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
47
+ });
41
48
  return resp.data;
42
49
  });
43
50
  }
@@ -48,7 +55,7 @@ class S3 extends Base_1.default {
48
55
  */
49
56
  getCatalog(catalogUrl) {
50
57
  return __awaiter(this, void 0, void 0, function* () {
51
- const resp = yield this.axios.get(`${catalogUrl}`, { headers: axios_1.disableCacheHeaders });
58
+ const resp = yield axios_1.default.get(`${catalogUrl}`, { headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }) });
52
59
  return resp.data;
53
60
  });
54
61
  }
@@ -59,7 +66,21 @@ class S3 extends Base_1.default {
59
66
  */
60
67
  getEngine(engineUrl) {
61
68
  return __awaiter(this, void 0, void 0, function* () {
62
- const resp = yield this.axios.get(`${engineUrl}`, { headers: axios_1.disableCacheHeaders });
69
+ const resp = yield axios_1.default.get(`${engineUrl}`, { headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }) });
70
+ return resp.data;
71
+ });
72
+ }
73
+ /**
74
+ * Get a list of available wildcards of a specific engine version from the S3 bucket
75
+ * @param engineUrl Public url of the engine
76
+ * @param engineVersion Version of the enigne
77
+ * @returns Wildcards.json list of available wildcards
78
+ */
79
+ getWildcardsOfEngine(engineUrl, engineVersion) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const resp = yield axios_1.default.get(`${engineUrl.replace("/index.json", "")}/${engineVersion}/wildcards.json`, {
82
+ headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
83
+ });
63
84
  return resp.data;
64
85
  });
65
86
  }
@@ -72,8 +93,8 @@ class S3 extends Base_1.default {
72
93
  getCatalogVersion(catalogUrl, version) {
73
94
  return __awaiter(this, void 0, void 0, function* () {
74
95
  const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + "/" + version + "/specification.json";
75
- const resp = yield this.axios.get(specificationUrl, {
76
- headers: axios_1.disableCacheHeaders,
96
+ const resp = yield axios_1.default.get(specificationUrl, {
97
+ headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
77
98
  });
78
99
  return resp.data;
79
100
  });
@@ -87,7 +108,7 @@ class S3 extends Base_1.default {
87
108
  getNodeDocumentation(catalogUrl, version, nodeName) {
88
109
  return __awaiter(this, void 0, void 0, function* () {
89
110
  const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + `/${version}/docs/${nodeName}.md`;
90
- const resp = yield this.axios.get(specificationUrl).catch(err => {
111
+ const resp = yield axios_1.default.get(specificationUrl).catch(err => {
91
112
  throw new Error(`Node documentation not found: ${err}`);
92
113
  });
93
114
  return resp.data;
@@ -1,6 +1,6 @@
1
1
  import Base from "../../../Base";
2
2
  import { OAuthToken, OAuthTokenRequest } from "../../../interfaces/idp/oauth";
3
- import { OAuthAppWithConsent } from "../../../interfaces/idp/organization/settings/oauthApp";
3
+ import { OAuthAppPublicInfo } from "../../../interfaces/idp/organization/settings/oauthApp";
4
4
  export declare class IdpOAuth extends Base {
5
5
  /**
6
6
  * getAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
@@ -44,6 +44,6 @@ export declare class IdpOAuth extends Base {
44
44
  * @param clientId {string} - Client ID of the OAuth app
45
45
  * @returns Public OAuth app information
46
46
  */
47
- getOAuthAppInfo: (clientId: string) => Promise<OAuthAppWithConsent>;
47
+ getOAuthAppInfo(clientId: string): Promise<OAuthAppPublicInfo>;
48
48
  protected getEndpoint(endpoint: string): string;
49
49
  }
@@ -12,19 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.IdpOAuth = void 0;
13
13
  const Base_1 = require("../../../Base");
14
14
  class IdpOAuth extends Base_1.default {
15
- constructor() {
16
- super(...arguments);
17
- /**
18
- * Get OAuth app public information via client ID
19
- *
20
- * @param clientId {string} - Client ID of the OAuth app
21
- * @returns Public OAuth app information
22
- */
23
- this.getOAuthAppInfo = (clientId) => __awaiter(this, void 0, void 0, function* () {
24
- const response = yield this.axios.get(this.getEndpoint(`/v1/login/oauth/app/${clientId}`));
25
- return response.data;
26
- });
27
- }
28
15
  /**
29
16
  * getAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
30
17
  * It returns the redirect URL with the code, which is used to redirect to the client application,
@@ -110,6 +97,18 @@ class IdpOAuth extends Base_1.default {
110
97
  return response.data;
111
98
  });
112
99
  }
100
+ /**
101
+ * Get OAuth app public information via client ID
102
+ *
103
+ * @param clientId {string} - Client ID of the OAuth app
104
+ * @returns Public OAuth app information
105
+ */
106
+ getOAuthAppInfo(clientId) {
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ const response = yield this.axios.get(this.getEndpoint(`/v1/login/oauth/app/${clientId}`));
109
+ return response.data;
110
+ });
111
+ }
113
112
  getEndpoint(endpoint) {
114
113
  return `${this.options.server}/api/account${endpoint}`;
115
114
  }
@@ -2,6 +2,7 @@ import Base from "../../../Base";
2
2
  import { Organization, OrganizationQueryOptions } from "../../../interfaces/idp/organization";
3
3
  import { IdpOrganizationLicense } from "./license";
4
4
  import { IdpOrganizationMember } from "./member";
5
+ import IdpOrganizationServiceAccounts from "./service-accounts";
5
6
  import IdpOrganizationSettings from "./settings";
6
7
  import { IdpOrganizationTeams } from "./team";
7
8
  export declare class IdpOrganization extends Base {
@@ -25,6 +26,11 @@ export declare class IdpOrganization extends Base {
25
26
  */
26
27
  get license(): IdpOrganizationLicense;
27
28
  private _license?;
29
+ /**
30
+ * Handles everything around organization service accounts
31
+ */
32
+ get serviceAccounts(): IdpOrganizationServiceAccounts;
33
+ private _serviceAccounts?;
28
34
  /**
29
35
  * Updates an Organization.
30
36
  * @param orgName Current name of the Organization
@@ -13,6 +13,7 @@ exports.IdpOrganization = void 0;
13
13
  const Base_1 = require("../../../Base");
14
14
  const license_1 = require("./license");
15
15
  const member_1 = require("./member");
16
+ const service_accounts_1 = require("./service-accounts");
16
17
  const settings_1 = require("./settings");
17
18
  const team_1 = require("./team");
18
19
  class IdpOrganization extends Base_1.default {
@@ -52,6 +53,15 @@ class IdpOrganization extends Base_1.default {
52
53
  }
53
54
  return this._license;
54
55
  }
56
+ /**
57
+ * Handles everything around organization service accounts
58
+ */
59
+ get serviceAccounts() {
60
+ if (this._serviceAccounts === undefined) {
61
+ this._serviceAccounts = new service_accounts_1.default(this.options, this.axios);
62
+ }
63
+ return this._serviceAccounts;
64
+ }
55
65
  /**
56
66
  * Updates an Organization.
57
67
  * @param orgName Current name of the Organization
@@ -15,9 +15,10 @@ export declare class IdpOrganizationMember extends Base {
15
15
  * @param page (optional) Page number to skip the first (page * limit) results (defaults to 0)
16
16
  * @returns Object containing an array of Organization Members and the total number of results found in the database (independent of limit and page)
17
17
  */
18
- searchOrganizationMembers({ orgName, filters, excludeTeamByName, sorting, limit, page, }: SearchParams & {
18
+ searchOrganizationMembers({ orgName, filters, excludeTeamByName, excludeServiceAccounts, sorting, limit, page, }: SearchParams & {
19
19
  orgName: string;
20
20
  excludeTeamByName?: string;
21
+ excludeServiceAccounts?: boolean;
21
22
  }): Promise<PaginatedResponse<OrganizationMember>>;
22
23
  /**
23
24
  * Retrieves an organization member by its user ID.
@@ -32,7 +32,7 @@ class IdpOrganizationMember extends Base_1.default {
32
32
  * @returns Object containing an array of Organization Members and the total number of results found in the database (independent of limit and page)
33
33
  */
34
34
  searchOrganizationMembers(_a) {
35
- return __awaiter(this, arguments, void 0, function* ({ orgName, filters, excludeTeamByName, sorting, limit = 25, page = 0, }) {
35
+ return __awaiter(this, arguments, void 0, function* ({ orgName, filters, excludeTeamByName, excludeServiceAccounts, sorting, limit = 25, page = 0, }) {
36
36
  const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => {
37
37
  return new searchFilter_1.SearchFilterDTO(f);
38
38
  });
@@ -40,6 +40,7 @@ class IdpOrganizationMember extends Base_1.default {
40
40
  filters: filtersDTO,
41
41
  sorting,
42
42
  excludeTeamByName,
43
+ excludeServiceAccounts,
43
44
  });
44
45
  return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
45
46
  });
@@ -0,0 +1,64 @@
1
+ import Base from "../../../../Base";
2
+ import { PaginatedResponse, SearchFilter, Sorting } from "../../../../interfaces/global";
3
+ import { ServiceAccount, ServiceAccountNoToken } from "../../../../interfaces/idp/organization/service-accounts";
4
+ export default class IdpOrganizationServiceAccounts extends Base {
5
+ /**
6
+ * Create a service account
7
+ *
8
+ * @param orgName {string} Organization name
9
+ * @param name {string} Name for the service account
10
+ * @returns {ServiceAccount} Created service account
11
+ */
12
+ create(orgName: string, name: string): Promise<ServiceAccount>;
13
+ /**
14
+ * Delete a service account
15
+ *
16
+ * @param orgName {string} Organization name
17
+ * @param id {string} Service account ID
18
+ * @returns {void}
19
+ */
20
+ delete(orgName: string, id: string): Promise<void>;
21
+ /**
22
+ * Fetch a service account by ID
23
+ *
24
+ * @param orgName {string} Organization name
25
+ * @param id {string} Service account ID
26
+ * @returns {ServiceAccountNoToken} The service account's token is only visible on creation or token regeneration
27
+ */
28
+ get(orgName: string, id: string): Promise<ServiceAccountNoToken>;
29
+ /**
30
+ * Search the service accounts of the organization
31
+ *
32
+ * @param orgName {string} Organization name
33
+ * @param filters {SearchFilter[]} Filters to apply
34
+ * @param sorting {Sorting|undefined} Sorting to apply
35
+ * @param limit {number|undefined} Page size
36
+ * @param page {number|undefined} Page number
37
+ * @returns {PaginatedResponse<ServiceAccountNoToken>} A paginated response containing the service accounts that matched the search parameters
38
+ */
39
+ search(params: {
40
+ orgName: string;
41
+ filters: SearchFilter[];
42
+ sorting?: Sorting;
43
+ limit?: number;
44
+ page?: number;
45
+ }): Promise<PaginatedResponse<ServiceAccountNoToken>>;
46
+ /**
47
+ * Regenerate a service account's token
48
+ *
49
+ * @param orgName {string} Organization name
50
+ * @param id {string} Service account ID
51
+ * @returns {ServiceAccount}
52
+ */
53
+ regenerateToken(orgName: string, id: string): Promise<ServiceAccount>;
54
+ /**
55
+ * Rename a service account
56
+ *
57
+ * @param orgName {string} Organization name
58
+ * @param id {string} Service account ID
59
+ * @param newName {string} Service account's new name
60
+ * @returns {ServiceAccountNoToken}
61
+ */
62
+ rename(orgName: string, id: string, newName: string): Promise<ServiceAccountNoToken>;
63
+ protected getEndpoint(endpoint: string): string;
64
+ }