Rework actions to be loaded dynamically

This commit is contained in:
Tom Wiesing 2023-11-08 10:29:09 +01:00
parent e49f89d4ee
commit 08ab7b4383
No known key found for this signature in database
22 changed files with 934 additions and 81 deletions

View file

@ -0,0 +1,83 @@
import type { WebSocketCall } from ".";
/** Backup backups everything */
export function Backup(): WebSocketCall {
return {
'call': 'backup',
'params': [],
}
}
type ProvisionParams = {
Slug: string;
Flavor?: "Drupal 10" | "Drupal 9",
System: SystemParams
}
type SystemParams = {
PHP: "Default (8.1)" | "8.0" | "8.1" | "8.2",
OpCacheDevelopment: boolean,
ContentSecurityPolicy: string,
}
/** Provision provisions a new instance */
export function Provision(params: ProvisionParams): WebSocketCall {
return {
'call': 'provision',
'params': [
JSON.stringify(params)
],
}
}
/** Snapshot makes a snapshot of an instance */
export function Snapshot(Slug: string): WebSocketCall {
return {
'call': 'snapshot',
'params': [Slug],
}
}
/** Rebuild rebuilds an instance */
export function Rebuild(Slug: string, params: SystemParams): WebSocketCall {
return {
'call': 'rebuild',
'params': [
Slug,
JSON.stringify(params)
],
}
}
/** Update updates a specific instance */
export function Update(Slug: string): WebSocketCall {
return {
'call': 'update',
'params': [Slug],
}
}
/** Start starts a specific instance */
export function Start(Slug: string): WebSocketCall {
return {
'call': 'start',
'params': [Slug],
}
}
/** Stop stops a specific instance */
export function Stop(Slug: string): WebSocketCall {
return {
'call': 'stop',
'params': [Slug],
}
}
/** Purge purges a specific instance */
export function Purge(Slug: string): WebSocketCall {
return {
'call': 'purge',
'params': [Slug],
}
}