UNPKG

@nasriya/orchestriq

Version:

A package to generate Docker files

31 lines (30 loc) 1.08 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const StackNetwork_1 = __importDefault(require("./StackNetwork")); class ServicesNetworksManager { #_container; #_networks = {}; constructor(container) { this.#_container = container; } /** * Creates a new network and adds it to the container. * @param network The data for the network to create. * @returns The created network. * @throws {Error} If a network with the same name already exists. */ create(network) { const nw = new StackNetwork_1.default(network, this.#_container); this.#_networks[nw.name] = nw; return nw; } /** * Returns a record of all networks in the container. * @returns {Record<string, StackNetwork>} A record of all networks in the container. */ get list() { return this.#_networks; } } exports.default = ServicesNetworksManager;