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