chore: update cloudly dependency stack
Align Cloudly with the current typedserver, smartconfig, smartstate, and Docker tooling releases so builds and Docker output stay compatible with the upgraded stack.
This commit is contained in:
@@ -22,16 +22,19 @@ export class ClusterManager {
|
||||
this.cloudlyRef.typedrouter.addTypedRouter(this.typedrouter);
|
||||
|
||||
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.cluster.IRequest_CreateCluster>(
|
||||
new plugins.typedrequest.TypedHandler('createCluster', async (dataArg) => {
|
||||
// TODO: guards
|
||||
new plugins.typedrequest.TypedHandler('createCluster', async (dataArg, toolsArg) => {
|
||||
await toolsArg!.passGuards([this.cloudlyRef.authManager.adminIdentityGuard], dataArg);
|
||||
const setupMode = dataArg.setupMode || 'manual'; // Default to manual if not specified
|
||||
const cluster = await this.createCluster({
|
||||
id: plugins.smartunique.uniSimple('cluster'),
|
||||
data: {
|
||||
userId: null, // this is created by the createCluster method
|
||||
userId: '', // this is created by the createCluster method
|
||||
name: dataArg.clusterName,
|
||||
setupMode: setupMode,
|
||||
acmeInfo: null,
|
||||
acmeInfo: {
|
||||
serverAddress: '',
|
||||
serverSecret: '',
|
||||
},
|
||||
cloudlyUrl: `https://${this.cloudlyRef.config.data.publicUrl}:${this.cloudlyRef.config.data.publicPort}/`,
|
||||
nodes: [],
|
||||
sshKeys: [],
|
||||
@@ -51,8 +54,8 @@ export class ClusterManager {
|
||||
);
|
||||
|
||||
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.cluster.IReq_Any_Cloudly_GetClusters>(
|
||||
new plugins.typedrequest.TypedHandler('getClusters', async (dataArg) => {
|
||||
// TODO: do authentication here
|
||||
new plugins.typedrequest.TypedHandler('getClusters', async (dataArg, toolsArg) => {
|
||||
await toolsArg!.passGuards([this.cloudlyRef.authManager.adminIdentityGuard], dataArg);
|
||||
const clusters = await this.getAllClusters();
|
||||
return {
|
||||
clusters: await Promise.all(
|
||||
@@ -62,10 +65,41 @@ export class ClusterManager {
|
||||
}),
|
||||
);
|
||||
|
||||
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.cluster.IReq_Any_Cloudly_GetClusterById>(
|
||||
new plugins.typedrequest.TypedHandler('getClusterById', async (dataArg, toolsArg) => {
|
||||
await toolsArg!.passGuards([this.cloudlyRef.authManager.adminIdentityGuard], dataArg);
|
||||
const cluster = await this.CCluster.getInstance({ id: (dataArg as any).clusterId });
|
||||
if (!cluster) {
|
||||
throw new plugins.typedrequest.TypedResponseError('Cluster not found');
|
||||
}
|
||||
return {
|
||||
cluster: await cluster.createSavableObject(),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.cluster.IReq_Any_Cloudly_UpdateCluster>(
|
||||
new plugins.typedrequest.TypedHandler('updateCluster', async (dataArg, toolsArg) => {
|
||||
await toolsArg!.passGuards([this.cloudlyRef.authManager.adminIdentityGuard], dataArg);
|
||||
const cluster = await this.CCluster.getInstance({ id: (dataArg as any).clusterId });
|
||||
if (!cluster) {
|
||||
throw new plugins.typedrequest.TypedResponseError('Cluster not found');
|
||||
}
|
||||
cluster.data = {
|
||||
...cluster.data,
|
||||
...dataArg.clusterData,
|
||||
};
|
||||
await cluster.save();
|
||||
return {
|
||||
resultCluster: await cluster.createSavableObject(),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
// delete cluster
|
||||
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.cluster.IReq_Any_Cloudly_DeleteClusterById>(
|
||||
new plugins.typedrequest.TypedHandler('deleteClusterById', async (reqDataArg, toolsArg) => {
|
||||
await toolsArg.passGuards([this.cloudlyRef.authManager.adminIdentityGuard], reqDataArg);
|
||||
await toolsArg!.passGuards([this.cloudlyRef.authManager.adminIdentityGuard], reqDataArg);
|
||||
await this.deleteCluster(reqDataArg.clusterId);
|
||||
return {
|
||||
ok: true,
|
||||
@@ -134,7 +168,6 @@ export class ClusterManager {
|
||||
* @param configObjectArg
|
||||
*/
|
||||
public async createCluster(configObjectArg: plugins.servezoneInterfaces.data.ICluster) {
|
||||
// TODO: guards
|
||||
// lets create the cluster user
|
||||
const clusterUser = new this.cloudlyRef.authManager.CUser({
|
||||
id: await this.cloudlyRef.authManager.CUser.getNewId(),
|
||||
|
||||
Reference in New Issue
Block a user