UNPKG

@nasriya/orchestriq

Version:

A package to generate Docker files

40 lines (39 loc) 1.49 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const StackVolume_1 = __importDefault(require("./StackVolume")); class ServicesVolumesManager { #_container; #_volumes = {}; constructor(container) { this.#_container = container; } /** * Returns a record of all volumes in the container. * @returns {Record<string, StackVolume>} A record of all volumes in the container. */ get list() { return this.#_volumes; } /** * Creates a new volume and adds it to the container. * * @param volume The volume to define, which includes properties such as: * - name: The name of the volume. * - driver: The driver to use for the volume. * - driverOpts: Options specific to the driver. * - labels: Labels for the volume. * - mount: The mount path for the volume. * - size: The size of the volume. * - accessMode: The access mode for the volume (e.g., 'read-write'). * @returns {StackVolume} The created volume. */ create(volume) { const vol = new StackVolume_1.default(volume, this.#_container); this.#_volumes[vol.name] = vol; return vol; } } exports.default = ServicesVolumesManager;