import { logger } from "../../common/logger.js";
import { printDiagnosticsToConsole, printResultToConsoleAndExitGracefully, textOrJson, } from "../../common/output.js";
import settings from "../../common/settings.js";
export async function describe(argv) {
    const { account, fleet } = argv;
    const describeResponse = await fetch(`${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/accounts/${account}/fleets/${fleet}/proxy-configuration`, {
        method: "GET",
        headers: {
            Authorization: `Bearer ${argv.authToken}`,
        },
    });
    if (describeResponse.ok) {
        const proxyConfig = await describeResponse.json();
        await printResultToConsoleAndExitGracefully(JSON.stringify(proxyConfig, null, 2));
    }
    else {
        const response = textOrJson(await describeResponse.text());
        logger.error({
            status: describeResponse.status,
            statusText: describeResponse.statusText,
            response,
        }, "Failed to describe proxy configuration");
        printDiagnosticsToConsole("Error: Failed to describe proxy configuration. Check the arguments.", response);
        process.exit(1);
    }
}
//# sourceMappingURL=handler.js.map