@puls-atlas/cli
Version:
The Puls Atlas CLI tool for managing Atlas projects
82 lines • 2.04 kB
JavaScript
import { ServiceDescriptor } from './ServiceDescriptor.js';
export class ServiceLifecycle {
constructor(descriptor) {
if (!(descriptor instanceof ServiceDescriptor)) {
throw new Error('Atlas services must be constructed with a ServiceDescriptor instance.');
}
this.descriptor = descriptor;
}
get id() {
return this.descriptor.id;
}
get name() {
return this.descriptor.id;
}
get displayName() {
return this.descriptor.displayName;
}
get configSectionKey() {
return this.descriptor.configSectionKey;
}
get description() {
return this.descriptor.description;
}
get defaultModuleSource() {
return this.descriptor.defaultModuleSource;
}
get defaultRootDir() {
return this.descriptor.defaultRootDir;
}
get moduleRelativePath() {
return this.descriptor.moduleRelativePath;
}
get templateRootDirectories() {
return this.descriptor.templateRootDirectories;
}
get capabilities() {
return this.descriptor.capabilities;
}
resolveDeployHints() {
return {};
}
resolveManagedPlatformClusterConfig() {
return null;
}
#notImplemented(methodName) {
throw new Error(`Atlas service ${this.id} must implement ${methodName}().`);
}
createDefaultConfigSection() {
this.#notImplemented('createDefaultConfigSection');
}
validateConfigSection() {
this.#notImplemented('validateConfigSection');
}
createTerraformPayload() {
this.#notImplemented('createTerraformPayload');
}
createSecretPayload() {
this.#notImplemented('createSecretPayload');
}
async resolveSelection(currentConfig = {}) {
return {
...this.createDefaultConfigSection(),
...currentConfig
};
}
getTerraformImportTargets() {
return [];
}
async doesTerraformImportTargetExist() {
return false;
}
async resolveRuntimeInputs() {
return {};
}
async logTerraformApplyFailureDetails() {
return undefined;
}
async validateDeployment() {
return undefined;
}
}
export default ServiceLifecycle;