@camunda/ccma-api 5.3.0 → 5.4.1
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/dist/index.d.ts +4 -4
- package/dist/index.js.map +2 -2
- package/dist/services/accounts/approvals.m2m.service.d.ts +46 -0
- package/dist/services/accounts/approvals.m2m.service.js +63 -30
- package/dist/services/accounts/approvals.m2m.service.js.map +2 -2
- package/dist/services/console/console.admin.service.d.ts +29 -1
- package/dist/services/console/console.admin.service.js +78 -0
- package/dist/services/console/console.admin.service.js.map +2 -2
- package/dist/services/console/console.approvals.m2m.service.d.ts +58 -2
- package/dist/services/console/console.approvals.m2m.service.js +110 -24
- package/dist/services/console/console.approvals.m2m.service.js.map +2 -2
- package/dist/services/control/control.approvals.service.d.ts +51 -6
- package/dist/services/control/control.approvals.service.js +33 -0
- package/dist/services/control/control.approvals.service.js.map +2 -2
- package/dist/services/custom-generations.approvals.spec.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApprovalM2mActor, BackupDto, ChangeClusterPlanTypeResult, ClusterBulkStepRequestDto, ClusterBulkStepResultDto, MoveClusterOwnerResult } from '@camunda/ccma-shared-types';
|
|
1
|
+
import type { ApprovalM2mActor, BackupDto, ChangeClusterPlanTypeResult, ClusterBulkStepRequestDto, ClusterBulkStepResultDto, ClusterTtlDeletionResult, MoveClusterOwnerResult } from '@camunda/ccma-shared-types';
|
|
2
2
|
import type { RequestBaseParams } from '../../types/general.types.js';
|
|
3
3
|
/**
|
|
4
4
|
* The route of `api/admin/approvals` in console-backend.
|
|
@@ -66,6 +66,16 @@ export interface DeleteInternalBackupThroughApprovalRequest extends RequestBaseP
|
|
|
66
66
|
actor: ApprovalM2mActor;
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
+
export interface DeleteClusterPastTtlThroughApprovalRequest extends RequestBaseParams {
|
|
70
|
+
params: {
|
|
71
|
+
clusterId: string;
|
|
72
|
+
};
|
|
73
|
+
body: {
|
|
74
|
+
actor: ApprovalM2mActor;
|
|
75
|
+
/** The owner that the request names. Console keeps a cluster with another. */
|
|
76
|
+
orgId: string;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
69
79
|
export interface CreateCustomClusterPlanThroughApprovalRequest extends RequestBaseParams {
|
|
70
80
|
body: {
|
|
71
81
|
actor: ApprovalM2mActor;
|
|
@@ -95,6 +105,36 @@ export interface DeleteCustomClusterPlanThroughApprovalRequest extends RequestBa
|
|
|
95
105
|
export interface CustomClusterPlanThroughApprovalResult {
|
|
96
106
|
clusterPlanId: string;
|
|
97
107
|
}
|
|
108
|
+
export interface CreateCustomGenerationThroughApprovalRequest extends RequestBaseParams {
|
|
109
|
+
body: {
|
|
110
|
+
actor: ApprovalM2mActor;
|
|
111
|
+
generationId: string;
|
|
112
|
+
name: string;
|
|
113
|
+
versions: Record<string, string>;
|
|
114
|
+
upgradeableFrom?: string[];
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export interface CheckCustomGenerationRemovalRequest extends RequestBaseParams {
|
|
118
|
+
params: {
|
|
119
|
+
generationId: string;
|
|
120
|
+
};
|
|
121
|
+
body: {
|
|
122
|
+
actor: ApprovalM2mActor;
|
|
123
|
+
forDelete: boolean;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export interface DeleteCustomGenerationThroughApprovalRequest extends RequestBaseParams {
|
|
127
|
+
params: {
|
|
128
|
+
generationId: string;
|
|
129
|
+
};
|
|
130
|
+
body: {
|
|
131
|
+
actor: ApprovalM2mActor;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** What console answers for a custom generation call. */
|
|
135
|
+
export interface CustomGenerationThroughApprovalResult {
|
|
136
|
+
generationId: string;
|
|
137
|
+
}
|
|
98
138
|
export declare class ConsoleApprovalsM2MService {
|
|
99
139
|
static moveClusterOwner(params: MoveClusterOwnerThroughApprovalRequest): Promise<MoveClusterOwnerResult>;
|
|
100
140
|
/**
|
|
@@ -128,6 +168,11 @@ export declare class ConsoleApprovalsM2MService {
|
|
|
128
168
|
static announceClusterBulkPlanUpdate(params: AnnounceClusterBulkPlanUpdateRequest): Promise<void>;
|
|
129
169
|
/** Deletes an internal (incident) backup of a cluster. It cannot be undone. */
|
|
130
170
|
static deleteInternalBackup(params: DeleteInternalBackupThroughApprovalRequest): Promise<BackupDto>;
|
|
171
|
+
/**
|
|
172
|
+
* Deletes a cluster whose TTL ran out. Console tests the TTL and the owner
|
|
173
|
+
* again first, and answers `kept` when the cluster stays.
|
|
174
|
+
*/
|
|
175
|
+
static deleteClusterPastTtl(params: DeleteClusterPastTtlThroughApprovalRequest): Promise<ClusterTtlDeletionResult>;
|
|
131
176
|
/** Creates a cluster plan for a Camundi, with the uuid that the caller gives. */
|
|
132
177
|
static createCustomClusterPlan(params: CreateCustomClusterPlanThroughApprovalRequest): Promise<CustomClusterPlanThroughApprovalResult>;
|
|
133
178
|
/**
|
|
@@ -137,5 +182,16 @@ export declare class ConsoleApprovalsM2MService {
|
|
|
137
182
|
static checkCustomClusterPlanRemoval(params: CheckCustomClusterPlanRemovalRequest): Promise<CustomClusterPlanThroughApprovalResult>;
|
|
138
183
|
/** Deletes a cluster plan that the Camundi created. It cannot be undone. */
|
|
139
184
|
static deleteCustomClusterPlan(params: DeleteCustomClusterPlanThroughApprovalRequest): Promise<CustomClusterPlanThroughApprovalResult>;
|
|
140
|
-
|
|
185
|
+
/** Creates a bespoke generation for a Camundi, with the uuid that the caller gives. */
|
|
186
|
+
static createCustomGeneration(params: CreateCustomGenerationThroughApprovalRequest): Promise<CustomGenerationThroughApprovalResult>;
|
|
187
|
+
/**
|
|
188
|
+
* Asks whether a Camundi may remove a generation. Console answers 404 for a
|
|
189
|
+
* generation of another person, or a generation that is not bespoke, and 409
|
|
190
|
+
* for a delete that it refuses. A bespoke generation that the Camundi
|
|
191
|
+
* created in the admin tool counts as theirs.
|
|
192
|
+
*/
|
|
193
|
+
static checkCustomGenerationRemoval(params: CheckCustomGenerationRemovalRequest): Promise<CustomGenerationThroughApprovalResult>;
|
|
194
|
+
/** Deletes a custom generation that the Camundi created. It cannot be undone. */
|
|
195
|
+
static deleteCustomGeneration(params: DeleteCustomGenerationThroughApprovalRequest): Promise<CustomGenerationThroughApprovalResult>;
|
|
196
|
+
private static callApprovalRoute;
|
|
141
197
|
}
|
|
@@ -173,16 +173,52 @@ class ConsoleApprovalsM2MService {
|
|
|
173
173
|
}
|
|
174
174
|
return response.body;
|
|
175
175
|
}
|
|
176
|
-
/**
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Deletes a cluster whose TTL ran out. Console tests the TTL and the owner
|
|
178
|
+
* again first, and answers `kept` when the cluster stays.
|
|
179
|
+
*/
|
|
180
|
+
static async deleteClusterPastTtl(params) {
|
|
181
|
+
const { clusterId } = params.params;
|
|
182
|
+
const serviceContext = {
|
|
183
|
+
method: {
|
|
184
|
+
name: "ConsoleApprovalsM2MService.deleteClusterPastTtl",
|
|
185
|
+
url: `api/admin/approvals/clusters/${clusterId}/ttl-expiry`,
|
|
186
|
+
normalizedUrl: "api/admin/approvals/clusters/:clusterId/ttl-expiry",
|
|
187
|
+
type: "delete"
|
|
188
|
+
},
|
|
189
|
+
source: params.config.metrics?.source || "unset",
|
|
190
|
+
target: { name: "console", type: "internal" }
|
|
191
|
+
};
|
|
192
|
+
const response = await request({
|
|
179
193
|
config: params.config,
|
|
180
|
-
|
|
181
|
-
url:
|
|
182
|
-
|
|
183
|
-
|
|
194
|
+
base: { id: "console" },
|
|
195
|
+
url: serviceContext.method.url,
|
|
196
|
+
method: serviceContext.method.type,
|
|
197
|
+
metricsDetails: serviceContext,
|
|
198
|
+
responseType: "json",
|
|
184
199
|
body: params.body
|
|
185
200
|
});
|
|
201
|
+
if (!response.ok) {
|
|
202
|
+
throw new HttpError(
|
|
203
|
+
`${serviceContext.method.name}: ${response.status} ${response.statusText}`,
|
|
204
|
+
response.status,
|
|
205
|
+
response.statusText
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
return response.body;
|
|
209
|
+
}
|
|
210
|
+
/** Creates a cluster plan for a Camundi, with the uuid that the caller gives. */
|
|
211
|
+
static async createCustomClusterPlan(params) {
|
|
212
|
+
return ConsoleApprovalsM2MService.callApprovalRoute(
|
|
213
|
+
{
|
|
214
|
+
config: params.config,
|
|
215
|
+
name: "ConsoleApprovalsM2MService.createCustomClusterPlan",
|
|
216
|
+
url: "api/admin/approvals/cluster-plans",
|
|
217
|
+
normalizedUrl: "api/admin/approvals/cluster-plans",
|
|
218
|
+
type: "post",
|
|
219
|
+
body: params.body
|
|
220
|
+
}
|
|
221
|
+
);
|
|
186
222
|
}
|
|
187
223
|
/**
|
|
188
224
|
* Asks whether a Camundi may remove a plan. Console answers 403 for a plan
|
|
@@ -190,28 +226,78 @@ class ConsoleApprovalsM2MService {
|
|
|
190
226
|
*/
|
|
191
227
|
static async checkCustomClusterPlanRemoval(params) {
|
|
192
228
|
const { clusterPlanId } = params.params;
|
|
193
|
-
return ConsoleApprovalsM2MService.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
229
|
+
return ConsoleApprovalsM2MService.callApprovalRoute(
|
|
230
|
+
{
|
|
231
|
+
config: params.config,
|
|
232
|
+
name: "ConsoleApprovalsM2MService.checkCustomClusterPlanRemoval",
|
|
233
|
+
url: `api/admin/approvals/cluster-plans/${clusterPlanId}/removal-check`,
|
|
234
|
+
normalizedUrl: "api/admin/approvals/cluster-plans/:clusterPlanId/removal-check",
|
|
235
|
+
type: "post",
|
|
236
|
+
body: params.body
|
|
237
|
+
}
|
|
238
|
+
);
|
|
201
239
|
}
|
|
202
240
|
/** Deletes a cluster plan that the Camundi created. It cannot be undone. */
|
|
203
241
|
static async deleteCustomClusterPlan(params) {
|
|
204
242
|
const { clusterPlanId } = params.params;
|
|
205
|
-
return ConsoleApprovalsM2MService.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
243
|
+
return ConsoleApprovalsM2MService.callApprovalRoute(
|
|
244
|
+
{
|
|
245
|
+
config: params.config,
|
|
246
|
+
name: "ConsoleApprovalsM2MService.deleteCustomClusterPlan",
|
|
247
|
+
url: `api/admin/approvals/cluster-plans/${clusterPlanId}`,
|
|
248
|
+
normalizedUrl: "api/admin/approvals/cluster-plans/:clusterPlanId",
|
|
249
|
+
type: "delete",
|
|
250
|
+
body: params.body
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
/** Creates a bespoke generation for a Camundi, with the uuid that the caller gives. */
|
|
255
|
+
static async createCustomGeneration(params) {
|
|
256
|
+
return ConsoleApprovalsM2MService.callApprovalRoute(
|
|
257
|
+
{
|
|
258
|
+
config: params.config,
|
|
259
|
+
name: "ConsoleApprovalsM2MService.createCustomGeneration",
|
|
260
|
+
url: "api/admin/approvals/generations",
|
|
261
|
+
normalizedUrl: "api/admin/approvals/generations",
|
|
262
|
+
type: "post",
|
|
263
|
+
body: params.body
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Asks whether a Camundi may remove a generation. Console answers 404 for a
|
|
269
|
+
* generation of another person, or a generation that is not bespoke, and 409
|
|
270
|
+
* for a delete that it refuses. A bespoke generation that the Camundi
|
|
271
|
+
* created in the admin tool counts as theirs.
|
|
272
|
+
*/
|
|
273
|
+
static async checkCustomGenerationRemoval(params) {
|
|
274
|
+
const { generationId } = params.params;
|
|
275
|
+
return ConsoleApprovalsM2MService.callApprovalRoute(
|
|
276
|
+
{
|
|
277
|
+
config: params.config,
|
|
278
|
+
name: "ConsoleApprovalsM2MService.checkCustomGenerationRemoval",
|
|
279
|
+
url: `api/admin/approvals/generations/${generationId}/removal-check`,
|
|
280
|
+
normalizedUrl: "api/admin/approvals/generations/:generationId/removal-check",
|
|
281
|
+
type: "post",
|
|
282
|
+
body: params.body
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
/** Deletes a custom generation that the Camundi created. It cannot be undone. */
|
|
287
|
+
static async deleteCustomGeneration(params) {
|
|
288
|
+
const { generationId } = params.params;
|
|
289
|
+
return ConsoleApprovalsM2MService.callApprovalRoute(
|
|
290
|
+
{
|
|
291
|
+
config: params.config,
|
|
292
|
+
name: "ConsoleApprovalsM2MService.deleteCustomGeneration",
|
|
293
|
+
url: `api/admin/approvals/generations/${generationId}`,
|
|
294
|
+
normalizedUrl: "api/admin/approvals/generations/:generationId",
|
|
295
|
+
type: "delete",
|
|
296
|
+
body: params.body
|
|
297
|
+
}
|
|
298
|
+
);
|
|
213
299
|
}
|
|
214
|
-
static async
|
|
300
|
+
static async callApprovalRoute(args) {
|
|
215
301
|
const serviceContext = {
|
|
216
302
|
method: {
|
|
217
303
|
name: args.name,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/services/console/console.approvals.m2m.service.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport type {\n ApprovalM2mActor,\n BackupDto,\n ChangeClusterPlanTypeResult,\n ClusterBulkStepRequestDto,\n ClusterBulkStepResultDto,\n MoveClusterOwnerResult,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseParams,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\n\n/**\n * The route of `api/admin/approvals` in console-backend.\n *\n * The twin of `AccountsApprovalsM2MService`. Read the note there.\n */\n\nexport interface MoveClusterOwnerThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterId: string }\n body: {\n actor: ApprovalM2mActor\n ownerId: string\n }\n}\n\nexport interface ChangeClusterPlanTypeThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterId: string }\n body: {\n actor: ApprovalM2mActor\n /** The organization that owns the cluster. Console refuses another one. */\n orgId: string\n toPlanTypeUuid: string\n numberOfAllocatedHwPackages: number\n /**\n * The plan type that the person who asked READ. Console compares it with\n * the plan type of the cluster when the action runs, and changes nothing\n * when the two differ.\n */\n expectedPlanTypeUuid: string\n /** The packages the person READ, 1 for a cluster that holds none. */\n expectedNumberOfAllocatedHwPackages: number\n /** The plan the cluster ran when the person read it. */\n expectedClusterPlanUuid: string\n /** The active modification config the person read, absent for none. */\n expectedActiveModificationConfigUuid?: string\n /** The active plan of the new plan type the person read. */\n expectedTargetPlanUuid: string\n /** Whether the cluster plan moves to that plan, as the person read it. */\n expectedClusterPlanUpdate: boolean\n }\n}\n\nexport interface RunClusterBulkStepThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterId: string }\n body: ClusterBulkStepRequestDto & { actor: ApprovalM2mActor }\n}\n\nexport interface AnnounceClusterBulkPlanUpdateRequest\n extends RequestBaseParams {\n body: {\n actor: ApprovalM2mActor\n toPlanUuid: string\n doneCount: number\n }\n}\n\nexport interface DeleteInternalBackupThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterId: string; backupName: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface CreateCustomClusterPlanThroughApprovalRequest\n extends RequestBaseParams {\n body: {\n actor: ApprovalM2mActor\n clusterPlanId: string\n name: string\n plan: Record<string, unknown>\n }\n}\n\nexport interface CheckCustomClusterPlanRemovalRequest\n extends RequestBaseParams {\n params: { clusterPlanId: string }\n body: { actor: ApprovalM2mActor; forDelete: boolean }\n}\n\nexport interface DeleteCustomClusterPlanThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterPlanId: string }\n body: { actor: ApprovalM2mActor }\n}\n\n/** What console answers for a custom cluster plan call. */\nexport interface CustomClusterPlanThroughApprovalResult {\n clusterPlanId: string\n}\n\nexport class ConsoleApprovalsM2MService {\n public static async moveClusterOwner(\n params: MoveClusterOwnerThroughApprovalRequest,\n ): Promise<MoveClusterOwnerResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.moveClusterOwner',\n url: `api/admin/approvals/clusters/${params.params.clusterId}/owner`,\n normalizedUrl: 'api/admin/approvals/clusters/:clusterId/owner',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<MoveClusterOwnerResult>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n // This route is new, so there is no older backend that answers 204 with no\n // body for the same-owner case. `ConsoleClusterService.moveClusterOwner`\n // carries that case, and this one does not need it.\n return response.body!\n }\n\n /**\n * Changes the plan type and the hardware packages of one cluster.\n *\n * Console checks the reservations of the organization, and it moves the\n * cluster plan to the active plan of the new type when that plan is\n * migratable from the plan of the cluster. It answers 409 when one of the\n * `expected\u2026` fields of the body differs at the run: the plan type, the\n * hardware packages, the cluster plan or the active modification config\n * of the cluster, or the active plan of the new type. A cluster that runs\n * no plan and a type that has no active plan meet that guard too, because\n * both fields of the body are required. It answers 400 when the request\n * changes nothing, when the new type is retired, when its active plan is\n * neither the plan of the cluster nor migratable from it, or when the\n * organization has no free reservation.\n */\n public static async changeClusterPlanType(\n params: ChangeClusterPlanTypeThroughApprovalRequest,\n ): Promise<ChangeClusterPlanTypeResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.changeClusterPlanType',\n url: `api/admin/approvals/clusters/${params.params.clusterId}/plan-type`,\n normalizedUrl: 'api/admin/approvals/clusters/:clusterId/plan-type',\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ChangeClusterPlanTypeResult>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body\n }\n\n /**\n * Runs one step of a cluster bulk operation on one cluster.\n *\n * Every outcome of the STEP answers 200, including a cluster that refused.\n * A thrown `HttpError` says that the CALL failed, and the caller then\n * leaves the cluster to run again.\n */\n public static async runClusterBulkStep(\n params: RunClusterBulkStepThroughApprovalRequest,\n ): Promise<ClusterBulkStepResultDto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.runClusterBulkStep',\n url: `api/admin/approvals/clusters/${params.params.clusterId}/bulk-step`,\n normalizedUrl: 'api/admin/approvals/clusters/:clusterId/bulk-step',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterBulkStepResultDto>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body\n }\n\n /**\n * Posts the Slack message that ends an approved bulk plan update. The bulk\n * operation of console-backend posts the same message after its run.\n */\n public static async announceClusterBulkPlanUpdate(\n params: AnnounceClusterBulkPlanUpdateRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.announceClusterBulkPlanUpdate',\n url: 'api/admin/approvals/cluster-bulk/plan-update-announcement',\n normalizedUrl:\n 'api/admin/approvals/cluster-bulk/plan-update-announcement',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n body: params.body,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Deletes an internal (incident) backup of a cluster. It cannot be undone. */\n public static async deleteInternalBackup(\n params: DeleteInternalBackupThroughApprovalRequest,\n ): Promise<BackupDto> {\n const { clusterId, backupName } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.deleteInternalBackup',\n url: `api/admin/approvals/clusters/${clusterId}/internal-backups/${encodeURIComponent(backupName)}`,\n normalizedUrl:\n 'api/admin/approvals/clusters/:clusterId/internal-backups/:backupName',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<BackupDto>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /** Creates a cluster plan for a Camundi, with the uuid that the caller gives. */\n public static async createCustomClusterPlan(\n params: CreateCustomClusterPlanThroughApprovalRequest,\n ): Promise<CustomClusterPlanThroughApprovalResult> {\n return ConsoleApprovalsM2MService.callClusterPlan({\n config: params.config,\n name: 'ConsoleApprovalsM2MService.createCustomClusterPlan',\n url: 'api/admin/approvals/cluster-plans',\n normalizedUrl: 'api/admin/approvals/cluster-plans',\n type: 'post',\n body: params.body,\n })\n }\n\n /**\n * Asks whether a Camundi may remove a plan. Console answers 403 for a plan\n * of another person, and 409 for a plan that a cluster uses.\n */\n public static async checkCustomClusterPlanRemoval(\n params: CheckCustomClusterPlanRemovalRequest,\n ): Promise<CustomClusterPlanThroughApprovalResult> {\n const { clusterPlanId } = params.params\n return ConsoleApprovalsM2MService.callClusterPlan({\n config: params.config,\n name: 'ConsoleApprovalsM2MService.checkCustomClusterPlanRemoval',\n url: `api/admin/approvals/cluster-plans/${clusterPlanId}/removal-check`,\n normalizedUrl:\n 'api/admin/approvals/cluster-plans/:clusterPlanId/removal-check',\n type: 'post',\n body: params.body,\n })\n }\n\n /** Deletes a cluster plan that the Camundi created. It cannot be undone. */\n public static async deleteCustomClusterPlan(\n params: DeleteCustomClusterPlanThroughApprovalRequest,\n ): Promise<CustomClusterPlanThroughApprovalResult> {\n const { clusterPlanId } = params.params\n return ConsoleApprovalsM2MService.callClusterPlan({\n config: params.config,\n name: 'ConsoleApprovalsM2MService.deleteCustomClusterPlan',\n url: `api/admin/approvals/cluster-plans/${clusterPlanId}`,\n normalizedUrl: 'api/admin/approvals/cluster-plans/:clusterPlanId',\n type: 'delete',\n body: params.body,\n })\n }\n\n private static async callClusterPlan(args: {\n config: RequestBaseParams['config']\n name: string\n url: string\n normalizedUrl: string\n type: 'post' | 'delete'\n body: unknown\n }): Promise<CustomClusterPlanThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: args.name,\n url: args.url,\n normalizedUrl: args.normalizedUrl,\n type: args.type,\n },\n source: args.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<CustomClusterPlanThroughApprovalResult>({\n config: args.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: args.body,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport type {\n ApprovalM2mActor,\n BackupDto,\n ChangeClusterPlanTypeResult,\n ClusterBulkStepRequestDto,\n ClusterBulkStepResultDto,\n ClusterTtlDeletionResult,\n MoveClusterOwnerResult,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseParams,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\n\n/**\n * The route of `api/admin/approvals` in console-backend.\n *\n * The twin of `AccountsApprovalsM2MService`. Read the note there.\n */\n\nexport interface MoveClusterOwnerThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterId: string }\n body: {\n actor: ApprovalM2mActor\n ownerId: string\n }\n}\n\nexport interface ChangeClusterPlanTypeThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterId: string }\n body: {\n actor: ApprovalM2mActor\n /** The organization that owns the cluster. Console refuses another one. */\n orgId: string\n toPlanTypeUuid: string\n numberOfAllocatedHwPackages: number\n /**\n * The plan type that the person who asked READ. Console compares it with\n * the plan type of the cluster when the action runs, and changes nothing\n * when the two differ.\n */\n expectedPlanTypeUuid: string\n /** The packages the person READ, 1 for a cluster that holds none. */\n expectedNumberOfAllocatedHwPackages: number\n /** The plan the cluster ran when the person read it. */\n expectedClusterPlanUuid: string\n /** The active modification config the person read, absent for none. */\n expectedActiveModificationConfigUuid?: string\n /** The active plan of the new plan type the person read. */\n expectedTargetPlanUuid: string\n /** Whether the cluster plan moves to that plan, as the person read it. */\n expectedClusterPlanUpdate: boolean\n }\n}\n\nexport interface RunClusterBulkStepThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterId: string }\n body: ClusterBulkStepRequestDto & { actor: ApprovalM2mActor }\n}\n\nexport interface AnnounceClusterBulkPlanUpdateRequest\n extends RequestBaseParams {\n body: {\n actor: ApprovalM2mActor\n toPlanUuid: string\n doneCount: number\n }\n}\n\nexport interface DeleteInternalBackupThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterId: string; backupName: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface DeleteClusterPastTtlThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterId: string }\n body: {\n actor: ApprovalM2mActor\n /** The owner that the request names. Console keeps a cluster with another. */\n orgId: string\n }\n}\n\nexport interface CreateCustomClusterPlanThroughApprovalRequest\n extends RequestBaseParams {\n body: {\n actor: ApprovalM2mActor\n clusterPlanId: string\n name: string\n plan: Record<string, unknown>\n }\n}\n\nexport interface CheckCustomClusterPlanRemovalRequest\n extends RequestBaseParams {\n params: { clusterPlanId: string }\n body: { actor: ApprovalM2mActor; forDelete: boolean }\n}\n\nexport interface DeleteCustomClusterPlanThroughApprovalRequest\n extends RequestBaseParams {\n params: { clusterPlanId: string }\n body: { actor: ApprovalM2mActor }\n}\n\n/** What console answers for a custom cluster plan call. */\nexport interface CustomClusterPlanThroughApprovalResult {\n clusterPlanId: string\n}\n\nexport interface CreateCustomGenerationThroughApprovalRequest\n extends RequestBaseParams {\n body: {\n actor: ApprovalM2mActor\n generationId: string\n name: string\n versions: Record<string, string>\n upgradeableFrom?: string[]\n }\n}\n\nexport interface CheckCustomGenerationRemovalRequest extends RequestBaseParams {\n params: { generationId: string }\n body: { actor: ApprovalM2mActor; forDelete: boolean }\n}\n\nexport interface DeleteCustomGenerationThroughApprovalRequest\n extends RequestBaseParams {\n params: { generationId: string }\n body: { actor: ApprovalM2mActor }\n}\n\n/** What console answers for a custom generation call. */\nexport interface CustomGenerationThroughApprovalResult {\n generationId: string\n}\n\nexport class ConsoleApprovalsM2MService {\n public static async moveClusterOwner(\n params: MoveClusterOwnerThroughApprovalRequest,\n ): Promise<MoveClusterOwnerResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.moveClusterOwner',\n url: `api/admin/approvals/clusters/${params.params.clusterId}/owner`,\n normalizedUrl: 'api/admin/approvals/clusters/:clusterId/owner',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<MoveClusterOwnerResult>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n // This route is new, so there is no older backend that answers 204 with no\n // body for the same-owner case. `ConsoleClusterService.moveClusterOwner`\n // carries that case, and this one does not need it.\n return response.body!\n }\n\n /**\n * Changes the plan type and the hardware packages of one cluster.\n *\n * Console checks the reservations of the organization, and it moves the\n * cluster plan to the active plan of the new type when that plan is\n * migratable from the plan of the cluster. It answers 409 when one of the\n * `expected\u2026` fields of the body differs at the run: the plan type, the\n * hardware packages, the cluster plan or the active modification config\n * of the cluster, or the active plan of the new type. A cluster that runs\n * no plan and a type that has no active plan meet that guard too, because\n * both fields of the body are required. It answers 400 when the request\n * changes nothing, when the new type is retired, when its active plan is\n * neither the plan of the cluster nor migratable from it, or when the\n * organization has no free reservation.\n */\n public static async changeClusterPlanType(\n params: ChangeClusterPlanTypeThroughApprovalRequest,\n ): Promise<ChangeClusterPlanTypeResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.changeClusterPlanType',\n url: `api/admin/approvals/clusters/${params.params.clusterId}/plan-type`,\n normalizedUrl: 'api/admin/approvals/clusters/:clusterId/plan-type',\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ChangeClusterPlanTypeResult>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body\n }\n\n /**\n * Runs one step of a cluster bulk operation on one cluster.\n *\n * Every outcome of the STEP answers 200, including a cluster that refused.\n * A thrown `HttpError` says that the CALL failed, and the caller then\n * leaves the cluster to run again.\n */\n public static async runClusterBulkStep(\n params: RunClusterBulkStepThroughApprovalRequest,\n ): Promise<ClusterBulkStepResultDto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.runClusterBulkStep',\n url: `api/admin/approvals/clusters/${params.params.clusterId}/bulk-step`,\n normalizedUrl: 'api/admin/approvals/clusters/:clusterId/bulk-step',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterBulkStepResultDto>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body\n }\n\n /**\n * Posts the Slack message that ends an approved bulk plan update. The bulk\n * operation of console-backend posts the same message after its run.\n */\n public static async announceClusterBulkPlanUpdate(\n params: AnnounceClusterBulkPlanUpdateRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.announceClusterBulkPlanUpdate',\n url: 'api/admin/approvals/cluster-bulk/plan-update-announcement',\n normalizedUrl:\n 'api/admin/approvals/cluster-bulk/plan-update-announcement',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'none',\n body: params.body,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n /** Deletes an internal (incident) backup of a cluster. It cannot be undone. */\n public static async deleteInternalBackup(\n params: DeleteInternalBackupThroughApprovalRequest,\n ): Promise<BackupDto> {\n const { clusterId, backupName } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.deleteInternalBackup',\n url: `api/admin/approvals/clusters/${clusterId}/internal-backups/${encodeURIComponent(backupName)}`,\n normalizedUrl:\n 'api/admin/approvals/clusters/:clusterId/internal-backups/:backupName',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<BackupDto>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /**\n * Deletes a cluster whose TTL ran out. Console tests the TTL and the owner\n * again first, and answers `kept` when the cluster stays.\n */\n public static async deleteClusterPastTtl(\n params: DeleteClusterPastTtlThroughApprovalRequest,\n ): Promise<ClusterTtlDeletionResult> {\n const { clusterId } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleApprovalsM2MService.deleteClusterPastTtl',\n url: `api/admin/approvals/clusters/${clusterId}/ttl-expiry`,\n normalizedUrl: 'api/admin/approvals/clusters/:clusterId/ttl-expiry',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterTtlDeletionResult>({\n config: params.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /** Creates a cluster plan for a Camundi, with the uuid that the caller gives. */\n public static async createCustomClusterPlan(\n params: CreateCustomClusterPlanThroughApprovalRequest,\n ): Promise<CustomClusterPlanThroughApprovalResult> {\n return ConsoleApprovalsM2MService.callApprovalRoute<CustomClusterPlanThroughApprovalResult>(\n {\n config: params.config,\n name: 'ConsoleApprovalsM2MService.createCustomClusterPlan',\n url: 'api/admin/approvals/cluster-plans',\n normalizedUrl: 'api/admin/approvals/cluster-plans',\n type: 'post',\n body: params.body,\n },\n )\n }\n\n /**\n * Asks whether a Camundi may remove a plan. Console answers 403 for a plan\n * of another person, and 409 for a plan that a cluster uses.\n */\n public static async checkCustomClusterPlanRemoval(\n params: CheckCustomClusterPlanRemovalRequest,\n ): Promise<CustomClusterPlanThroughApprovalResult> {\n const { clusterPlanId } = params.params\n return ConsoleApprovalsM2MService.callApprovalRoute<CustomClusterPlanThroughApprovalResult>(\n {\n config: params.config,\n name: 'ConsoleApprovalsM2MService.checkCustomClusterPlanRemoval',\n url: `api/admin/approvals/cluster-plans/${clusterPlanId}/removal-check`,\n normalizedUrl:\n 'api/admin/approvals/cluster-plans/:clusterPlanId/removal-check',\n type: 'post',\n body: params.body,\n },\n )\n }\n\n /** Deletes a cluster plan that the Camundi created. It cannot be undone. */\n public static async deleteCustomClusterPlan(\n params: DeleteCustomClusterPlanThroughApprovalRequest,\n ): Promise<CustomClusterPlanThroughApprovalResult> {\n const { clusterPlanId } = params.params\n return ConsoleApprovalsM2MService.callApprovalRoute<CustomClusterPlanThroughApprovalResult>(\n {\n config: params.config,\n name: 'ConsoleApprovalsM2MService.deleteCustomClusterPlan',\n url: `api/admin/approvals/cluster-plans/${clusterPlanId}`,\n normalizedUrl: 'api/admin/approvals/cluster-plans/:clusterPlanId',\n type: 'delete',\n body: params.body,\n },\n )\n }\n\n /** Creates a bespoke generation for a Camundi, with the uuid that the caller gives. */\n public static async createCustomGeneration(\n params: CreateCustomGenerationThroughApprovalRequest,\n ): Promise<CustomGenerationThroughApprovalResult> {\n return ConsoleApprovalsM2MService.callApprovalRoute<CustomGenerationThroughApprovalResult>(\n {\n config: params.config,\n name: 'ConsoleApprovalsM2MService.createCustomGeneration',\n url: 'api/admin/approvals/generations',\n normalizedUrl: 'api/admin/approvals/generations',\n type: 'post',\n body: params.body,\n },\n )\n }\n\n /**\n * Asks whether a Camundi may remove a generation. Console answers 404 for a\n * generation of another person, or a generation that is not bespoke, and 409\n * for a delete that it refuses. A bespoke generation that the Camundi\n * created in the admin tool counts as theirs.\n */\n public static async checkCustomGenerationRemoval(\n params: CheckCustomGenerationRemovalRequest,\n ): Promise<CustomGenerationThroughApprovalResult> {\n const { generationId } = params.params\n return ConsoleApprovalsM2MService.callApprovalRoute<CustomGenerationThroughApprovalResult>(\n {\n config: params.config,\n name: 'ConsoleApprovalsM2MService.checkCustomGenerationRemoval',\n url: `api/admin/approvals/generations/${generationId}/removal-check`,\n normalizedUrl:\n 'api/admin/approvals/generations/:generationId/removal-check',\n type: 'post',\n body: params.body,\n },\n )\n }\n\n /** Deletes a custom generation that the Camundi created. It cannot be undone. */\n public static async deleteCustomGeneration(\n params: DeleteCustomGenerationThroughApprovalRequest,\n ): Promise<CustomGenerationThroughApprovalResult> {\n const { generationId } = params.params\n return ConsoleApprovalsM2MService.callApprovalRoute<CustomGenerationThroughApprovalResult>(\n {\n config: params.config,\n name: 'ConsoleApprovalsM2MService.deleteCustomGeneration',\n url: `api/admin/approvals/generations/${generationId}`,\n normalizedUrl: 'api/admin/approvals/generations/:generationId',\n type: 'delete',\n body: params.body,\n },\n )\n }\n\n private static async callApprovalRoute<T>(args: {\n config: RequestBaseParams['config']\n name: string\n url: string\n normalizedUrl: string\n type: 'post' | 'delete'\n body: unknown\n }): Promise<T> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: args.name,\n url: args.url,\n normalizedUrl: args.normalizedUrl,\n type: args.type,\n },\n source: args.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<T>({\n config: args.config,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: args.body,\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n}\n"],
|
|
5
|
+
"mappings": "AAmBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAkInB,MAAM,2BAA2B;AAAA,EACtC,aAAoB,iBAClB,QACiC;AACjC,UAAM,iBAA4C;AAAA,MAChD,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,KAAK,gCAAgC,OAAO,OAAO,SAAS;AAAA,QAC5D,eAAe;AAAA,QACf,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,OAAO,OAAO,SAAS,UAAU;AAAA,MACzC,QAAQ,EAAE,MAAM,WAAW,MAAM,WAAW;AAAA,IAC9C;AAEA,UAAM,WAAW,MAAM,QAAgC;AAAA,MACrD,QAAQ,OAAO;AAAA,MACf,MAAM,EAAE,IAAI,UAAU;AAAA,MACtB,KAAK,eAAe,OAAO;AAAA,MAC3B,QAAQ,eAAe,OAAO;AAAA,MAC9B,gBAAgB;AAAA,MAChB,cAAc;AAAA,MACd,MAAM,OAAO;AAAA,IACf,CAAC;AAED,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI,KAAK,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,QACxE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AAKA,WAAO,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,aAAoB,sBAClB,QACsC;AACtC,UAAM,iB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pD,eACE;AAAA,QACF,MAAM;AAAA,QACN,MAAM,OAAO;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA,aAAoB,uBAClB,QACgD;AAChD,UAAM,EAAE,aAAa,IAAI,OAAO;AAChC,WAAO,2BAA2B;AAAA,MAChC;AAAA,QACE,QAAQ,OAAO;AAAA,QACf,MAAM;AAAA,QACN,KAAK,mCAAmC,YAAY;AAAA,QACpD,eAAe;AAAA,QACf,MAAM;AAAA,QACN,MAAM,OAAO;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA,EAEA,aAAqB,kBAAqB,MAO3B;AACb,UAAM,iBAA4C;AAAA,MAChD,QAAQ;AAAA,QACN,MAAM,KAAK;AAAA,QACX,KAAK,KAAK;AAAA,QACV,eAAe,KAAK;AAAA,QACpB,MAAM,KAAK;AAAA,MACb;AAAA,MACA,QAAQ,KAAK,OAAO,SAAS,UAAU;AAAA,MACvC,QAAQ,EAAE,MAAM,WAAW,MAAM,WAAW;AAAA,IAC9C;AAEA,UAAM,WAAW,MAAM,QAAW;AAAA,MAChC,QAAQ,KAAK;AAAA,MACb,MAAM,EAAE,IAAI,UAAU;AAAA,MACtB,KAAK,eAAe,OAAO;AAAA,MAC3B,QAAQ,eAAe,OAAO;AAAA,MAC9B,gBAAgB;AAAA,MAChB,cAAc;AAAA,MACd,MAAM,KAAK;AAAA,IACb,CAAC;AAED,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI,KAAK,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,QACxE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AACA,WAAO,SAAS;AAAA,EAClB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApprovalEntityType, ApprovalJobDto, ApprovalJobStatus, ApprovalSortField, ApprovalSortOrder, ApprovalStatusCountsDto, ApprovalUseCaseDto, ClusterBulkOperationPayloadDto, ClusterBulkOperationType, EnterpriseIncludingValueMetrics, LicensingModelType } from '@camunda/ccma-shared-types';
|
|
1
|
+
import type { ApprovalEntityType, ApprovalJobDto, ApprovalJobStatus, ApprovalSortField, ApprovalSortOrder, ApprovalStatusCountsDto, ApprovalUseCaseDto, ClusterBulkOperationPayloadDto, ClusterBulkOperationType, ClusterTtlDeletionPayload, EnterpriseIncludingValueMetrics, LicensingModelType } from '@camunda/ccma-shared-types';
|
|
2
2
|
import type { RequestBaseParams } from '../../types/general.types.js';
|
|
3
3
|
export interface ApprovalPageDto {
|
|
4
4
|
approvals: ApprovalJobDto[];
|
|
@@ -116,6 +116,13 @@ export interface CreatePersonalOrganisationRequest extends RequestBaseParams {
|
|
|
116
116
|
reason?: string;
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
|
+
/** The create call of `cluster-ttl-deletion`. It has no `requiredAcks`. */
|
|
120
|
+
export interface CreateClusterTtlDeletionRequest extends RequestBaseParams {
|
|
121
|
+
params: {
|
|
122
|
+
payload: ClusterTtlDeletionPayload;
|
|
123
|
+
reason?: string;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
119
126
|
export interface CreateCustomHardwareSizingPayloadDto {
|
|
120
127
|
/** The organization that gets the plan. The requester must own it. */
|
|
121
128
|
orgId: string;
|
|
@@ -136,16 +143,42 @@ export type RemoveCustomHardwareSizingPayloadDto = {
|
|
|
136
143
|
mode: 'delete';
|
|
137
144
|
clusterPlanId: string;
|
|
138
145
|
};
|
|
146
|
+
export interface CreateCustomGenerationPayloadDto {
|
|
147
|
+
/** The organization that gets the generation. The requester must own it. */
|
|
148
|
+
orgId: string;
|
|
149
|
+
/** 3 to 100 characters, after the spaces at both ends are cut. */
|
|
150
|
+
name: string;
|
|
151
|
+
/** The images and env vars, in the format of the generation route of the admin tool. */
|
|
152
|
+
versions: Record<string, string>;
|
|
153
|
+
/** Generations whose clusters can upgrade to this one. */
|
|
154
|
+
upgradeableFrom?: string[];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* `unlink` removes the generation from one organization that the requester
|
|
158
|
+
* owns. `delete` removes it from every organization of the requester, and
|
|
159
|
+
* deletes it.
|
|
160
|
+
*/
|
|
161
|
+
export type RemoveCustomGenerationPayloadDto = {
|
|
162
|
+
mode: 'unlink';
|
|
163
|
+
generationId: string;
|
|
164
|
+
orgId: string;
|
|
165
|
+
} | {
|
|
166
|
+
mode: 'delete';
|
|
167
|
+
generationId: string;
|
|
168
|
+
};
|
|
139
169
|
/**
|
|
140
|
-
* The
|
|
141
|
-
* `CreatePersonalOrganisationRequest`, it has no
|
|
170
|
+
* The call of a self-service use case: custom hardware sizing and custom
|
|
171
|
+
* generations. Like `CreatePersonalOrganisationRequest`, it has no
|
|
172
|
+
* `requiredAcks`.
|
|
142
173
|
*/
|
|
143
|
-
export interface
|
|
174
|
+
export interface SelfServiceApprovalRequest<TPayload> extends RequestBaseParams {
|
|
144
175
|
params: {
|
|
145
176
|
payload: TPayload;
|
|
146
177
|
reason?: string;
|
|
147
178
|
};
|
|
148
179
|
}
|
|
180
|
+
/** @deprecated Use `SelfServiceApprovalRequest`. */
|
|
181
|
+
export type CustomHardwareSizingRequest<TPayload> = SelfServiceApprovalRequest<TPayload>;
|
|
149
182
|
export interface ExtendTrialPayloadDto {
|
|
150
183
|
orgId: string;
|
|
151
184
|
orgName?: string;
|
|
@@ -667,14 +700,26 @@ export declare class ControlApprovalsService {
|
|
|
667
700
|
* and the route answers 404 while `control.personalOrganisation` is off.
|
|
668
701
|
*/
|
|
669
702
|
static createPersonalOrganisation(params: CreatePersonalOrganisationRequest): Promise<ApprovalJobDto>;
|
|
703
|
+
/**
|
|
704
|
+
* Opens a cluster-ttl-deletion request. Only the delete cron of
|
|
705
|
+
* console-backend can, with an m2m token that holds `cmctd`.
|
|
706
|
+
*
|
|
707
|
+
* The request needs no approval, so the answer already holds the outcome.
|
|
708
|
+
* For a cluster with a live request, the answer is that request.
|
|
709
|
+
*/
|
|
710
|
+
static createClusterTtlDeletion(params: CreateClusterTtlDeletionRequest): Promise<ApprovalJobDto>;
|
|
670
711
|
/**
|
|
671
712
|
* Opens a create-custom-hardware-sizing request. Any signed-in Camundi
|
|
672
713
|
* can. It runs on dev only, needs no approval, and the route answers 403
|
|
673
714
|
* on every other stage.
|
|
674
715
|
*/
|
|
675
|
-
static createCustomHardwareSizing(params:
|
|
716
|
+
static createCustomHardwareSizing(params: SelfServiceApprovalRequest<CreateCustomHardwareSizingPayloadDto>): Promise<ApprovalJobDto>;
|
|
676
717
|
/** Opens a remove-custom-hardware-sizing request. See the one above. */
|
|
677
|
-
static removeCustomHardwareSizing(params:
|
|
718
|
+
static removeCustomHardwareSizing(params: SelfServiceApprovalRequest<RemoveCustomHardwareSizingPayloadDto>): Promise<ApprovalJobDto>;
|
|
719
|
+
/** Opens a create-custom-generation request. Dev only, no approval. */
|
|
720
|
+
static createCustomGeneration(params: SelfServiceApprovalRequest<CreateCustomGenerationPayloadDto>): Promise<ApprovalJobDto>;
|
|
721
|
+
/** Opens a remove-custom-generation request. See the one above. */
|
|
722
|
+
static removeCustomGeneration(params: SelfServiceApprovalRequest<RemoveCustomGenerationPayloadDto>): Promise<ApprovalJobDto>;
|
|
678
723
|
/**
|
|
679
724
|
* The shared half of every call that answers one request.
|
|
680
725
|
*
|
|
@@ -435,6 +435,21 @@ class ControlApprovalsService {
|
|
|
435
435
|
);
|
|
436
436
|
return approval;
|
|
437
437
|
}
|
|
438
|
+
/**
|
|
439
|
+
* Opens a cluster-ttl-deletion request. Only the delete cron of
|
|
440
|
+
* console-backend can, with an m2m token that holds `cmctd`.
|
|
441
|
+
*
|
|
442
|
+
* The request needs no approval, so the answer already holds the outcome.
|
|
443
|
+
* For a cluster with a live request, the answer is that request.
|
|
444
|
+
*/
|
|
445
|
+
static async createClusterTtlDeletion(params) {
|
|
446
|
+
const { approval } = await ControlApprovalsService.create(
|
|
447
|
+
params,
|
|
448
|
+
"createClusterTtlDeletion",
|
|
449
|
+
"api/approvals/cluster-ttl-deletion"
|
|
450
|
+
);
|
|
451
|
+
return approval;
|
|
452
|
+
}
|
|
438
453
|
/**
|
|
439
454
|
* Opens a create-custom-hardware-sizing request. Any signed-in Camundi
|
|
440
455
|
* can. It runs on dev only, needs no approval, and the route answers 403
|
|
@@ -457,6 +472,24 @@ class ControlApprovalsService {
|
|
|
457
472
|
);
|
|
458
473
|
return approval;
|
|
459
474
|
}
|
|
475
|
+
/** Opens a create-custom-generation request. Dev only, no approval. */
|
|
476
|
+
static async createCustomGeneration(params) {
|
|
477
|
+
const { approval } = await ControlApprovalsService.create(
|
|
478
|
+
params,
|
|
479
|
+
"createCustomGeneration",
|
|
480
|
+
"api/approvals/create-custom-generation"
|
|
481
|
+
);
|
|
482
|
+
return approval;
|
|
483
|
+
}
|
|
484
|
+
/** Opens a remove-custom-generation request. See the one above. */
|
|
485
|
+
static async removeCustomGeneration(params) {
|
|
486
|
+
const { approval } = await ControlApprovalsService.create(
|
|
487
|
+
params,
|
|
488
|
+
"removeCustomGeneration",
|
|
489
|
+
"api/approvals/remove-custom-generation"
|
|
490
|
+
);
|
|
491
|
+
return approval;
|
|
492
|
+
}
|
|
460
493
|
/**
|
|
461
494
|
* The shared half of every call that answers one request.
|
|
462
495
|
*
|