import { captureEvent } from "../../../common/analytics/lib.js";
import { authenticate } from "../../../common/middleware/authentication.js";
import { identify } from "../../../common/middleware/user-identification.js";
import setBlocking from "../../../common/output.js";
import { updateServices, } from "../../../tunnel/services/update/handler.js";
import { configure } from "../../../common/middleware/user-configuration.js";
import { fetchAccount } from "../../../common/middleware/get-account-param.js";
export default {
    desc: "Updates the services for this tunnel",
    command: "update",
    builder: (yargs) => {
        return yargs
            .option("configuration-file", {
            type: "string",
            describe: "The path to the configuration file",
        })
            .option("tunnel-id", {
            type: "string",
            describe: "The ID of the tunnel containing the services",
        })
            .option("api-key", {
            type: "string",
            describe: "The API Key from Zuplo",
            envVar: "API_KEY",
        })
            .demandOption(["configuration-file", "tunnel-id"])
            .demandOption("api-key", "You must provide an API key with --api-key")
            .middleware([
            setBlocking,
            authenticate,
            configure,
            fetchAccount,
            identify,
        ]);
    },
    handler: async (argv) => {
        await captureEvent({ argv, event: "zuplo tunnel services update" });
        await updateServices(argv);
    },
};
//# sourceMappingURL=update.js.map