UNPKG

@webda/shell

Version:

Deploy a Webda app or configure it

89 lines (88 loc) 2.29 kB
import { AbstractDeployer, Application, DeployerResources, Logger } from "@webda/core"; import { WorkerLogLevel } from "@webda/workout"; import { SourceApplication } from "../code/sourceapplication.js"; import { DeploymentManager } from "../handlers/deploymentmanager.js"; /** * **Deployer** represent one type of deploy like: *S3* or *Docker* or *Lambda+API Gateway* or *Fargate* * * This is an abstract class that should be extended to implement new one * @module DeploymentSystem */ export declare abstract class Deployer<T extends DeployerResources> extends AbstractDeployer<T> { /** * Service who manage all deployments * @see DeploymentManager */ manager: DeploymentManager; /** * Current application being deployed */ app: SourceApplication; /** * Package description from package.json */ packageDescription: any; _defaulted: boolean; /** * Logger to use */ logger: Logger; name: string; type: string; /** * Current date */ now: number; parameters: any; constructor(manager: DeploymentManager, resources?: T); /** * Set the deployer name * @param name */ setName(name: string): void; /** * Set the deployer name * @param name */ setType(type: string): void; /** * Return the Webda Application */ getApplication(): Application; /** * Initiate the default value for resources */ defaultResources(): Promise<void>; /** * Load default resources */ loadDefaults(): Promise<void>; /** * Deploy the application */ abstract deploy(): Promise<any>; /** * Replace variables in resources * * @param obj to replace variables from */ replaceVariables(obj: any): any; /** * Replace the resources variables * * ``` * this.resources = this.replaceVariables(this.resources); * ``` */ replaceResourcesVariables(): void; /** * * @param script command to execute * @param stdin */ execute(command: string, stdin?: string, resolveOnError?: boolean, logLevel?: WorkerLogLevel): Promise<{ status: number; output: string; error: string; }>; }