import * as plugins from '../cloudly.plugins.js'; /* * cluster defines a swarmkit cluster */ @plugins.smartdata.Manager() export class Server extends plugins.smartdata.SmartDataDbDoc { // STATIC public static async createFromHetznerServer( hetznerServerArg: plugins.hetznercloud.HetznerServer ) { const newServer = new Server(); newServer.id = plugins.smartunique.shortId(8); const data: plugins.servezoneInterfaces.data.IServer['data'] = { assignedClusterId: hetznerServerArg.data.labels.clusterId, requiredDebianPackages: [], sshKeys: [], type: 'hetzner', } Object.assign(newServer, { data }); await newServer.save(); return newServer; } // INSTANCE @plugins.smartdata.unI() public id: string; @plugins.smartdata.svDb() public data: plugins.servezoneInterfaces.data.IServer['data']; constructor() { super(); } public async getServices(): Promise { return []; } }