hcloud-sdk 22.47.0 → 22.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +8 -2
- package/lib/interfaces/global/Storage.d.ts +21 -0
- package/lib/interfaces/high5/space/execution/index.d.ts +22 -1
- package/lib/interfaces/idp/organization/license/index.d.ts +11 -0
- package/lib/service/high5/execution/status/index.d.ts +31 -5
- package/lib/service/high5/execution/status/index.js +39 -3
- package/lib/service/idp/organization/storage/index.d.ts +16 -1
- package/lib/service/idp/organization/storage/index.js +24 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
## [22.
|
|
1
|
+
## [22.49.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.48.0...v22.49.0) (2026-10-07)
|
|
2
2
|
|
|
3
3
|
### Features
|
|
4
4
|
|
|
5
|
-
* add
|
|
5
|
+
* add a capacityInGB quota for default storage as well ([3b4ae0c](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/3b4ae0cf85bb1a85e5ba8d070c805ff216196169))
|
|
6
|
+
* add capacityInGB which reflects license quota as max usable capacity ([75a1dea](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/75a1dea437d657eacd967abaad9ae3e5688bd468))
|
|
7
|
+
* reflect new introduced byos license endpoint and interfaces ([efcb701](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/efcb701645e1e0f06800ba8e7c13c117d547c444))
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* default license quota determination and application ([e228077](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/e2280774fec9b1a4969743b8c70ded3e307625fd))
|
|
@@ -17,7 +17,13 @@ export type Storage = {
|
|
|
17
17
|
spaces: (ReducedSpace & {
|
|
18
18
|
storageUsed: number;
|
|
19
19
|
})[];
|
|
20
|
+
/** Total bytes used across all spaces assigned to this storage. For the default storage only the spaces of the requesting organization. */
|
|
20
21
|
storageUsed: number;
|
|
22
|
+
/**
|
|
23
|
+
* Licensed maximum capacity in GB (1 GB = 1024³ bytes). For the default storage the default storage quota of the organization.
|
|
24
|
+
* For own storages the storages quota of the organization, shared across all of its own storages (0 if own storages are not allowed).
|
|
25
|
+
*/
|
|
26
|
+
capacityInGB: number;
|
|
21
27
|
valid: boolean;
|
|
22
28
|
errorMessage?: string;
|
|
23
29
|
};
|
|
@@ -32,6 +38,21 @@ export type StorageConfiguration = {
|
|
|
32
38
|
isDefault: boolean;
|
|
33
39
|
valid: boolean;
|
|
34
40
|
};
|
|
41
|
+
export type StorageCapacity = {
|
|
42
|
+
storageId: string;
|
|
43
|
+
/** Organization the capacity was determined for. For own storages the owner, for the default storage the requested organization. */
|
|
44
|
+
organizationId: string;
|
|
45
|
+
/** Whether the storage is the default storage */
|
|
46
|
+
isDefault: boolean;
|
|
47
|
+
/** Whether the license of the organization allows own storages */
|
|
48
|
+
byos: boolean;
|
|
49
|
+
/** Licensed capacity in bytes. For own storages across all own storages of the organization, for the default storage the default storage quota of the organization. */
|
|
50
|
+
capacityBytes?: number;
|
|
51
|
+
/** Current usage in bytes. For own storages across all own storages of the organization, for the default storage by the spaces of the organization. */
|
|
52
|
+
usedBytes?: number;
|
|
53
|
+
/** Whether an upload of the requested size would exceed the licensed capacity */
|
|
54
|
+
exceeded: boolean;
|
|
55
|
+
};
|
|
35
56
|
export type StorageDto = Omit<Storage, "accessKeyId" | "secretAccessKey">;
|
|
36
57
|
export type StorageCreateDto = Pick<Storage, "name" | "endpoint" | "bucket" | "region"> & {
|
|
37
58
|
accessKeyId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HCloud } from "../../../../Hcloud";
|
|
2
|
-
import { ReducedSpace } from "../../../global";
|
|
2
|
+
import { PaginatedResponse, ReducedSpace } from "../../../global";
|
|
3
3
|
import { ReducedOrganization, ReducedUser } from "../../../idp";
|
|
4
4
|
import { WaveCatalog, WaveEngine } from "../../wave";
|
|
5
5
|
import { ReducedEvent } from "../event";
|
|
@@ -159,6 +159,27 @@ export interface High5ExecutionStatus {
|
|
|
159
159
|
startTime?: number;
|
|
160
160
|
currentRetry?: number;
|
|
161
161
|
assignedClient?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Plaintext payload data of the execution, only set when searching execution states by payload
|
|
164
|
+
* (filter keys "payload" or "payload.<path>"). JSON payloads are returned as JSON value, generic payloads as string.
|
|
165
|
+
*/
|
|
166
|
+
payload?: unknown;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Response of an execution state search. Searches with payload filters count at most 1000 matches,
|
|
170
|
+
* a higher number of matches is reported with total = 1000 and totalCapped = true.
|
|
171
|
+
*/
|
|
172
|
+
export interface High5ExecutionStatusSearchResponse extends PaginatedResponse<High5ExecutionStatus> {
|
|
173
|
+
/** True if total holds the capped count of a payload search instead of the exact number of matches */
|
|
174
|
+
totalCapped: boolean;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Response of a full execution state search by payload, which considers all executions but skips the count
|
|
178
|
+
*/
|
|
179
|
+
export interface High5ExecutionStatusFullSearchResponse {
|
|
180
|
+
items: High5ExecutionStatus[];
|
|
181
|
+
/** True if a next page exists */
|
|
182
|
+
hasMore: boolean;
|
|
162
183
|
}
|
|
163
184
|
export interface High5ExecutionLog {
|
|
164
185
|
_id: string;
|
|
@@ -24,6 +24,17 @@ type LicenseQuotaBase = {
|
|
|
24
24
|
domains: {
|
|
25
25
|
quota: number;
|
|
26
26
|
};
|
|
27
|
+
/** Bring your own storage quota. Absent on older licenses, in which case own storages are not allowed. */
|
|
28
|
+
storages?: {
|
|
29
|
+
byos: boolean;
|
|
30
|
+
quota: number;
|
|
31
|
+
capacityInGB: number;
|
|
32
|
+
};
|
|
33
|
+
/** Default (hcloud provided) storage quota. Absent on older licenses, in which case a capacity of 1 GB applies. */
|
|
34
|
+
defaultStorage?: {
|
|
35
|
+
/** Maximum usage of the default storage in GB (1 GB = 1024³ bytes). */
|
|
36
|
+
capacityInGB: number;
|
|
37
|
+
};
|
|
27
38
|
logPeriodInDays: number;
|
|
28
39
|
};
|
|
29
40
|
};
|
|
@@ -1,20 +1,46 @@
|
|
|
1
1
|
import Base, { MaybeRaw } from "../../../../Base";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { SearchParams } from "../../../../interfaces/global";
|
|
3
|
+
import { High5ExecutionStatusFullSearchResponse, High5ExecutionStatusSearchResponse } from "../../../../interfaces/high5/space/execution";
|
|
4
4
|
export declare class High5OrganizationExecutionStates extends Base {
|
|
5
5
|
/**
|
|
6
|
-
* Retrieves
|
|
6
|
+
* Retrieves the stream execution states of an organization.
|
|
7
|
+
*
|
|
8
|
+
* Besides the fields of the execution state, filters can target the payload of the execution:
|
|
9
|
+
* - `payload.<path>` filters JSON payloads by the value at the given property path, e.g. `payload.user.id`.
|
|
10
|
+
* `is` matches the exact value (numbers and booleans keep their type), `starts with` is case-sensitive, `contains` and `ends with` are case-insensitive.
|
|
11
|
+
* - `payload` with `contains` is a case-insensitive text search over all string values of the payload. A single word only matches
|
|
12
|
+
* whole words, values with separators are searched as phrase. Only the newest 10000 matching executions are considered,
|
|
13
|
+
* use {@link fullSearchExecutionStates} to consider all of them.
|
|
14
|
+
*
|
|
15
|
+
* When filtering by payload, each state contains the `payload` of its execution and the total is capped at 1000 (see `totalCapped`).
|
|
7
16
|
* @param orgName Name of the Organization
|
|
8
17
|
* @param filters (optional) Array of search filters
|
|
9
18
|
* @param sorting (optional) Sorting object
|
|
10
19
|
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
11
20
|
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
12
|
-
* @returns Object containing an array of Stream execution
|
|
21
|
+
* @returns Object containing an array of Stream execution states, the total number of results and whether the total is capped
|
|
13
22
|
*/
|
|
14
23
|
searchExecutionStates<R extends boolean = false>({ orgName, filters, sorting, limit, page }: SearchParams & {
|
|
15
24
|
orgName: string;
|
|
16
25
|
}, raw?: {
|
|
17
26
|
raw: R;
|
|
18
|
-
}): Promise<MaybeRaw<R,
|
|
27
|
+
}): Promise<MaybeRaw<R, High5ExecutionStatusSearchResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves the stream execution states of an organization by payload, considering all executions without limits.
|
|
30
|
+
* The count is skipped, so instead of a total the response tells whether a next page exists. Takes the same filters as
|
|
31
|
+
* {@link searchExecutionStates}, but can take considerably longer for payload filters matching many executions.
|
|
32
|
+
* Searches without payload filters behave like {@link searchExecutionStates}.
|
|
33
|
+
* @param orgName Name of the Organization
|
|
34
|
+
* @param filters (optional) Array of search filters
|
|
35
|
+
* @param sorting (optional) Sorting object
|
|
36
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
37
|
+
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
38
|
+
* @returns Object containing an array of Stream execution states and whether a next page exists
|
|
39
|
+
*/
|
|
40
|
+
fullSearchExecutionStates<R extends boolean = false>({ orgName, filters, sorting, limit, page }: SearchParams & {
|
|
41
|
+
orgName: string;
|
|
42
|
+
}, raw?: {
|
|
43
|
+
raw: R;
|
|
44
|
+
}): Promise<MaybeRaw<R, High5ExecutionStatusFullSearchResponse>>;
|
|
19
45
|
protected getEndpoint(endpoint: string): string;
|
|
20
46
|
}
|
|
@@ -18,13 +18,22 @@ const paginatedResponseHelper_1 = require("../../../../helper/paginatedResponseH
|
|
|
18
18
|
const searchFilter_1 = require("../../../../helper/searchFilter");
|
|
19
19
|
class High5OrganizationExecutionStates extends Base_1.default {
|
|
20
20
|
/**
|
|
21
|
-
* Retrieves
|
|
21
|
+
* Retrieves the stream execution states of an organization.
|
|
22
|
+
*
|
|
23
|
+
* Besides the fields of the execution state, filters can target the payload of the execution:
|
|
24
|
+
* - `payload.<path>` filters JSON payloads by the value at the given property path, e.g. `payload.user.id`.
|
|
25
|
+
* `is` matches the exact value (numbers and booleans keep their type), `starts with` is case-sensitive, `contains` and `ends with` are case-insensitive.
|
|
26
|
+
* - `payload` with `contains` is a case-insensitive text search over all string values of the payload. A single word only matches
|
|
27
|
+
* whole words, values with separators are searched as phrase. Only the newest 10000 matching executions are considered,
|
|
28
|
+
* use {@link fullSearchExecutionStates} to consider all of them.
|
|
29
|
+
*
|
|
30
|
+
* When filtering by payload, each state contains the `payload` of its execution and the total is capped at 1000 (see `totalCapped`).
|
|
22
31
|
* @param orgName Name of the Organization
|
|
23
32
|
* @param filters (optional) Array of search filters
|
|
24
33
|
* @param sorting (optional) Sorting object
|
|
25
34
|
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
26
35
|
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
27
|
-
* @returns Object containing an array of Stream execution
|
|
36
|
+
* @returns Object containing an array of Stream execution states, the total number of results and whether the total is capped
|
|
28
37
|
*/
|
|
29
38
|
searchExecutionStates(_a, raw_1) {
|
|
30
39
|
return __awaiter(this, arguments, void 0, function* ({ orgName, filters, sorting, limit = 25, page = 0 }, raw) {
|
|
@@ -33,7 +42,34 @@ class High5OrganizationExecutionStates extends Base_1.default {
|
|
|
33
42
|
filters: filtersDTO,
|
|
34
43
|
sorting: sorting,
|
|
35
44
|
});
|
|
36
|
-
|
|
45
|
+
const data = Object.assign(Object.assign({}, (0, paginatedResponseHelper_1.createPaginatedResponse)(resp)), { totalCapped: resp.headers["total-capped"] === "true" });
|
|
46
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? Object.assign(Object.assign({}, resp), { data }) : data);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Retrieves the stream execution states of an organization by payload, considering all executions without limits.
|
|
51
|
+
* The count is skipped, so instead of a total the response tells whether a next page exists. Takes the same filters as
|
|
52
|
+
* {@link searchExecutionStates}, but can take considerably longer for payload filters matching many executions.
|
|
53
|
+
* Searches without payload filters behave like {@link searchExecutionStates}.
|
|
54
|
+
* @param orgName Name of the Organization
|
|
55
|
+
* @param filters (optional) Array of search filters
|
|
56
|
+
* @param sorting (optional) Sorting object
|
|
57
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
58
|
+
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
59
|
+
* @returns Object containing an array of Stream execution states and whether a next page exists
|
|
60
|
+
*/
|
|
61
|
+
fullSearchExecutionStates(_a, raw_1) {
|
|
62
|
+
return __awaiter(this, arguments, void 0, function* ({ orgName, filters, sorting, limit = 25, page = 0 }, raw) {
|
|
63
|
+
const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => new searchFilter_1.SearchFilterDTO(f));
|
|
64
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/execution/status/search?page=${page}&limit=${limit}&fullSearch=true`), {
|
|
65
|
+
filters: filtersDTO,
|
|
66
|
+
sorting: sorting,
|
|
67
|
+
});
|
|
68
|
+
// searches without payload filters are not full searches and report a total instead
|
|
69
|
+
const hasMoreHeader = resp.headers["has-more"];
|
|
70
|
+
const hasMore = hasMoreHeader !== undefined ? hasMoreHeader === "true" : (page + 1) * limit < parseInt(String(resp.headers["total"]), 10);
|
|
71
|
+
const data = { items: resp.data, hasMore };
|
|
72
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? Object.assign(Object.assign({}, resp), { data }) : data);
|
|
37
73
|
});
|
|
38
74
|
}
|
|
39
75
|
getEndpoint(endpoint) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Base, { MaybeRaw } from "../../../../Base";
|
|
2
2
|
import { PaginatedResponse, SearchFilter, Sorting } from "../../../../interfaces/global";
|
|
3
|
-
import { StorageDto as Storage, StorageConfiguration, StorageCreateDto, StoragePatchDto } from "../../../../interfaces/global/Storage";
|
|
3
|
+
import { StorageDto as Storage, StorageCapacity, StorageConfiguration, StorageCreateDto, StoragePatchDto } from "../../../../interfaces/global/Storage";
|
|
4
4
|
export declare class IdpOrganizationStorages extends Base {
|
|
5
5
|
/**
|
|
6
6
|
* Creates a new Storage in the specified Organization.
|
|
@@ -82,5 +82,20 @@ export declare class IdpOrganizationStorages extends Base {
|
|
|
82
82
|
getStorageConfig<R extends boolean = false>(pat: string, storageId?: string, decrypt?: boolean, raw?: {
|
|
83
83
|
raw: R;
|
|
84
84
|
}): Promise<MaybeRaw<R, StorageConfiguration>>;
|
|
85
|
+
/**
|
|
86
|
+
* Checks whether the specified Storage can take an upload of the given size according to the license of an Organization.
|
|
87
|
+
* Own Storages are limited by the storages quota of the owning Organization, the default Storage by the default storage quota
|
|
88
|
+
* of the given Organization (counting only its Spaces). Requires a Personal Access Token (PAT) with appropriate permissions.
|
|
89
|
+
*
|
|
90
|
+
* @param pat Personal Access Token
|
|
91
|
+
* @param storageId (optional) ID of storage. If not provided or "default", the default storage is checked.
|
|
92
|
+
* @param uploadSize (optional) Size of the upload that is about to start in bytes. If omitted, it is checked whether the capacity is already reached.
|
|
93
|
+
* @param orgName (optional) Name of the Organization the upload belongs to. Required for the default storage, must be the owner for own storages.
|
|
94
|
+
* @param raw (optional) If true, returns the raw Axios response instead of the data
|
|
95
|
+
* @returns The Storage capacity
|
|
96
|
+
*/
|
|
97
|
+
getStorageCapacity<R extends boolean = false>(pat: string, storageId?: string, uploadSize?: number, orgName?: string, raw?: {
|
|
98
|
+
raw: R;
|
|
99
|
+
}): Promise<MaybeRaw<R, StorageCapacity>>;
|
|
85
100
|
protected getEndpoint(endpoint: string): string;
|
|
86
101
|
}
|
|
@@ -129,6 +129,30 @@ class IdpOrganizationStorages extends Base_1.default {
|
|
|
129
129
|
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Checks whether the specified Storage can take an upload of the given size according to the license of an Organization.
|
|
134
|
+
* Own Storages are limited by the storages quota of the owning Organization, the default Storage by the default storage quota
|
|
135
|
+
* of the given Organization (counting only its Spaces). Requires a Personal Access Token (PAT) with appropriate permissions.
|
|
136
|
+
*
|
|
137
|
+
* @param pat Personal Access Token
|
|
138
|
+
* @param storageId (optional) ID of storage. If not provided or "default", the default storage is checked.
|
|
139
|
+
* @param uploadSize (optional) Size of the upload that is about to start in bytes. If omitted, it is checked whether the capacity is already reached.
|
|
140
|
+
* @param orgName (optional) Name of the Organization the upload belongs to. Required for the default storage, must be the owner for own storages.
|
|
141
|
+
* @param raw (optional) If true, returns the raw Axios response instead of the data
|
|
142
|
+
* @returns The Storage capacity
|
|
143
|
+
*/
|
|
144
|
+
getStorageCapacity(pat_1) {
|
|
145
|
+
return __awaiter(this, arguments, void 0, function* (pat, storageId = "default", uploadSize, orgName, raw) {
|
|
146
|
+
const resp = yield this.axios.get(`${this.options.server}/api/account/v1/storage/${storageId}/capacity`, {
|
|
147
|
+
params: Object.assign(Object.assign({}, (uploadSize !== undefined ? { uploadSize } : {})), (orgName !== undefined ? { orgName } : {})),
|
|
148
|
+
headers: {
|
|
149
|
+
Authorization: `Bearer ${pat}`,
|
|
150
|
+
"x-hcloud-login-enforce": "true",
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
132
156
|
getEndpoint(endpoint) {
|
|
133
157
|
return `${this.options.server}/api/account/v1/org${endpoint}`;
|
|
134
158
|
}
|