GOOD SHELL MAS BOY
Server: Apache/2.4.52 (Ubuntu)
System: Linux vmi1836763.contaboserver.net 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
User: www-data (33)
PHP: 8.4.10
Disabled: NONE
Upload Files
File: //usr/local/lib/node_modules/firebase-tools/lib/commands/apphosting-backends-delete.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.command = void 0;
const command_1 = require("../command");
const projectUtils_1 = require("../projectUtils");
const error_1 = require("../error");
const prompt_1 = require("../prompt");
const utils = require("../utils");
const apphosting = require("../gcp/apphosting");
const apphosting_backends_list_1 = require("./apphosting-backends-list");
const backend_1 = require("../apphosting/backend");
const ora = require("ora");
exports.command = new command_1.Command("apphosting:backends:delete <backend>")
    .description("delete a Firebase App Hosting backend")
    .option("-l, --location <location>", "specify the location of the backend", "-")
    .withForce()
    .before(apphosting.ensureApiEnabled)
    .action(async (backendId, options) => {
    const projectId = (0, projectUtils_1.needProjectId)(options);
    let location = options.location;
    let backend;
    if (location === "-" || location === "") {
        backend = await (0, backend_1.getBackendForAmbiguousLocation)(projectId, backendId, "Please select the location of the backend you'd like to delete:");
        location = apphosting.parseBackendName(backend.name).location;
    }
    else {
        backend = await (0, backend_1.getBackendForLocation)(projectId, location, backendId);
    }
    utils.logWarning("You are about to permanently delete this backend:");
    (0, apphosting_backends_list_1.printBackendsTable)([backend]);
    const confirmDeletion = await (0, prompt_1.promptOnce)({
        type: "confirm",
        name: "force",
        default: false,
        message: "Are you sure?",
    }, options);
    if (!confirmDeletion) {
        return;
    }
    const spinner = ora("Deleting backend...").start();
    try {
        await (0, backend_1.deleteBackendAndPoll)(projectId, location, backendId);
        spinner.succeed(`Successfully deleted the backend: ${backendId}`);
    }
    catch (err) {
        spinner.stop();
        throw new error_1.FirebaseError(`Failed to delete backend: ${backendId}.`, {
            original: (0, error_1.getError)(err),
        });
    }
});