hcloud-sdk 22.48.0 → 22.50.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 +2 -2
- package/lib/interfaces/global/Storage.d.ts +21 -0
- package/lib/interfaces/idp/organization/license/index.d.ts +11 -0
- package/lib/service/idp/organization/settings/domain/index.d.ts +10 -0
- package/lib/service/idp/organization/settings/domain/index.js +15 -0
- 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,5 @@
|
|
|
1
|
-
## [22.
|
|
1
|
+
## [22.50.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.49.0...v22.50.0) (2026-10-07)
|
|
2
2
|
|
|
3
3
|
### Features
|
|
4
4
|
|
|
5
|
-
*
|
|
5
|
+
* add renameDomain method to allow renaming of existing domains ([3e2775c](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/3e2775c42363d739b8568fd3828c5dd551ecd7bb))
|
|
@@ -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;
|
|
@@ -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
|
};
|
|
@@ -33,6 +33,16 @@ export declare class IdpDomain extends Base {
|
|
|
33
33
|
verifyDomain<R extends boolean = false>(orgName: string, domainName: string, raw?: {
|
|
34
34
|
raw: R;
|
|
35
35
|
}): Promise<MaybeRaw<R, Domain>>;
|
|
36
|
+
/**
|
|
37
|
+
* Renames a Domain. The renamed Domain is no longer verified and has to be verified again with the same uuid.
|
|
38
|
+
* @param orgName Name of the organization
|
|
39
|
+
* @param domainName Current name of the Domain
|
|
40
|
+
* @param newDomainName New name of the Domain
|
|
41
|
+
* @returns the renamed Domain
|
|
42
|
+
*/
|
|
43
|
+
renameDomain<R extends boolean = false>(orgName: string, domainName: string, newDomainName: string, raw?: {
|
|
44
|
+
raw: R;
|
|
45
|
+
}): Promise<MaybeRaw<R, Domain>>;
|
|
36
46
|
/**
|
|
37
47
|
* Retrieves the SSO provider of a Domain.
|
|
38
48
|
* @param orgName Name of the organization
|
|
@@ -62,6 +62,21 @@ class IdpDomain extends Base_1.default {
|
|
|
62
62
|
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Renames a Domain. The renamed Domain is no longer verified and has to be verified again with the same uuid.
|
|
67
|
+
* @param orgName Name of the organization
|
|
68
|
+
* @param domainName Current name of the Domain
|
|
69
|
+
* @param newDomainName New name of the Domain
|
|
70
|
+
* @returns the renamed Domain
|
|
71
|
+
*/
|
|
72
|
+
renameDomain(orgName, domainName, newDomainName, raw) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/settings/domains/${domainName}`), {
|
|
75
|
+
name: newDomainName,
|
|
76
|
+
});
|
|
77
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
65
80
|
/**
|
|
66
81
|
* Retrieves the SSO provider of a Domain.
|
|
67
82
|
* @param orgName Name of the organization
|
|
@@ -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
|
}
|