@bifos/nhncloud-cli 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -2
- package/dist/index.js +2109 -286
- package/package.json +1 -1
- package/skills/nhncloud-cli/SKILL.md +3 -1
- package/skills/nhncloud-cli/references/ncs.md +167 -0
package/dist/index.js
CHANGED
|
@@ -24,8 +24,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
|
|
26
26
|
// src/index.ts
|
|
27
|
-
var
|
|
28
|
-
var
|
|
27
|
+
var import_commander48 = require("commander");
|
|
28
|
+
var import_chalk18 = __toESM(require("chalk"));
|
|
29
29
|
|
|
30
30
|
// src/utils/spinner.ts
|
|
31
31
|
var import_ora = __toESM(require("ora"));
|
|
@@ -567,15 +567,29 @@ function nksHost(region) {
|
|
|
567
567
|
}
|
|
568
568
|
return host;
|
|
569
569
|
}
|
|
570
|
+
var NCS_HOST = {
|
|
571
|
+
kr1: "kr1-ncs.api.nhncloudservice.com",
|
|
572
|
+
kr3: "kr3-ncs.api.nhncloudservice.com"
|
|
573
|
+
};
|
|
574
|
+
function ncsHost(region) {
|
|
575
|
+
const host = NCS_HOST[region];
|
|
576
|
+
if (!host) {
|
|
577
|
+
throw new NhnCloudCliError(
|
|
578
|
+
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 NCS region \uC785\uB2C8\uB2E4: "${region}". \uC0AC\uC6A9 \uAC00\uB2A5\uD55C region: ${Object.keys(NCS_HOST).join(", ")}`,
|
|
579
|
+
EXIT_PARAM_ERROR
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
return host;
|
|
583
|
+
}
|
|
570
584
|
|
|
571
585
|
// src/api/keystone.ts
|
|
572
586
|
function isKeystoneTokenResponse(val) {
|
|
573
587
|
if (typeof val !== "object" || val === null) return false;
|
|
574
588
|
const obj = val;
|
|
575
589
|
if (typeof obj["access"] !== "object" || obj["access"] === null) return false;
|
|
576
|
-
const
|
|
577
|
-
if (typeof
|
|
578
|
-
const token =
|
|
590
|
+
const access4 = obj["access"];
|
|
591
|
+
if (typeof access4["token"] !== "object" || access4["token"] === null) return false;
|
|
592
|
+
const token = access4["token"];
|
|
579
593
|
return typeof token["id"] === "string" && typeof token["expires"] === "string";
|
|
580
594
|
}
|
|
581
595
|
async function getIaasToken(profile, iaas, forceRefresh = false) {
|
|
@@ -1135,8 +1149,209 @@ var configureCommand = new import_commander.Command("configure").description("\u
|
|
|
1135
1149
|
}
|
|
1136
1150
|
});
|
|
1137
1151
|
|
|
1138
|
-
// src/commands/
|
|
1152
|
+
// src/commands/skills.ts
|
|
1139
1153
|
var import_commander2 = require("commander");
|
|
1154
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
1155
|
+
var import_promises4 = require("fs/promises");
|
|
1156
|
+
|
|
1157
|
+
// src/utils/skill-install.ts
|
|
1158
|
+
var import_node_os3 = require("os");
|
|
1159
|
+
var import_node_path3 = __toESM(require("path"));
|
|
1160
|
+
var import_promises3 = require("fs/promises");
|
|
1161
|
+
var SKILL_NAME = "nhncloud-cli";
|
|
1162
|
+
function claudeDir() {
|
|
1163
|
+
return import_node_path3.default.join((0, import_node_os3.homedir)(), ".claude");
|
|
1164
|
+
}
|
|
1165
|
+
function skillDestPath() {
|
|
1166
|
+
return import_node_path3.default.join(claudeDir(), "skills", SKILL_NAME);
|
|
1167
|
+
}
|
|
1168
|
+
function skillSourceFrom(bundleDir) {
|
|
1169
|
+
return import_node_path3.default.resolve(bundleDir, "..", "skills", SKILL_NAME);
|
|
1170
|
+
}
|
|
1171
|
+
function isNpxRuntime(bundleDir) {
|
|
1172
|
+
return /_npx[/\\]/.test(bundleDir) || /\.npm[/\\]_npx/.test(bundleDir) || /npx-/.test(bundleDir);
|
|
1173
|
+
}
|
|
1174
|
+
async function getSkillStatus(dst) {
|
|
1175
|
+
let stat;
|
|
1176
|
+
try {
|
|
1177
|
+
stat = await (0, import_promises3.lstat)(dst);
|
|
1178
|
+
} catch {
|
|
1179
|
+
return { state: "not-installed" };
|
|
1180
|
+
}
|
|
1181
|
+
if (!stat.isSymbolicLink()) {
|
|
1182
|
+
return { state: "installed-copy" };
|
|
1183
|
+
}
|
|
1184
|
+
const raw = await (0, import_promises3.readlink)(dst);
|
|
1185
|
+
const target = import_node_path3.default.isAbsolute(raw) ? raw : import_node_path3.default.resolve(import_node_path3.default.dirname(dst), raw);
|
|
1186
|
+
const targetExists = await (0, import_promises3.access)(target).then(() => true).catch(() => false);
|
|
1187
|
+
return targetExists ? { state: "installed-link", target } : { state: "broken-link", target };
|
|
1188
|
+
}
|
|
1189
|
+
async function installSkillSymlink(src, dst, force) {
|
|
1190
|
+
const srcExists = await (0, import_promises3.access)(src).then(() => true).catch(() => false);
|
|
1191
|
+
if (!srcExists) {
|
|
1192
|
+
throw new NhnCloudCliError(`skill \uC6D0\uBCF8\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${src}`, EXIT_PARAM_ERROR);
|
|
1193
|
+
}
|
|
1194
|
+
const status = await getSkillStatus(dst);
|
|
1195
|
+
if (status.state === "installed-copy" && !force) {
|
|
1196
|
+
throw new NhnCloudCliError(
|
|
1197
|
+
`${dst} \uC5D0 \uC2EC\uBCFC\uB9AD \uB9C1\uD06C\uAC00 \uC544\uB2CC \uC2E4\uC81C \uD56D\uBAA9\uC774 \uC788\uC2B5\uB2C8\uB2E4. --force \uB85C \uB36E\uC5B4\uC4F0\uC138\uC694.`,
|
|
1198
|
+
EXIT_PARAM_ERROR
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
let result = "linked";
|
|
1202
|
+
if (status.state === "installed-copy") {
|
|
1203
|
+
await (0, import_promises3.rm)(dst, { recursive: true, force: true });
|
|
1204
|
+
result = "replaced-copy";
|
|
1205
|
+
} else if (status.state !== "not-installed") {
|
|
1206
|
+
await (0, import_promises3.rm)(dst, { force: true });
|
|
1207
|
+
result = "relinked";
|
|
1208
|
+
}
|
|
1209
|
+
await (0, import_promises3.mkdir)(import_node_path3.default.dirname(dst), { recursive: true });
|
|
1210
|
+
await (0, import_promises3.symlink)(src, dst);
|
|
1211
|
+
return result;
|
|
1212
|
+
}
|
|
1213
|
+
async function uninstallSkill(dst) {
|
|
1214
|
+
const status = await getSkillStatus(dst);
|
|
1215
|
+
if (status.state === "not-installed") {
|
|
1216
|
+
return "absent";
|
|
1217
|
+
}
|
|
1218
|
+
if (status.state === "installed-copy") {
|
|
1219
|
+
throw new NhnCloudCliError(
|
|
1220
|
+
`${dst} \uB294 \uC2EC\uBCFC\uB9AD \uB9C1\uD06C\uAC00 \uC544\uB2C8\uB77C \uC2E4\uC81C \uB514\uB809\uD130\uB9AC\uC785\uB2C8\uB2E4. \uC9C1\uC811 \uD655\uC778 \uD6C4 \uC81C\uAC70\uD558\uC138\uC694.`,
|
|
1221
|
+
EXIT_PARAM_ERROR
|
|
1222
|
+
);
|
|
1223
|
+
}
|
|
1224
|
+
await (0, import_promises3.rm)(dst, { force: true });
|
|
1225
|
+
return "removed";
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
// src/commands/skills.ts
|
|
1229
|
+
function describeStatus(status) {
|
|
1230
|
+
switch (status.state) {
|
|
1231
|
+
case "installed-link":
|
|
1232
|
+
return import_chalk2.default.green(`\u2713 \uC124\uCE58\uB428 (\uC2EC\uBCFC\uB9AD \uB9C1\uD06C \u2192 ${status.target})`);
|
|
1233
|
+
case "broken-link":
|
|
1234
|
+
return import_chalk2.default.yellow(`\u26A0 \uB9C1\uD06C \uAE68\uC9D0 (${status.target} \uC5C6\uC74C) \u2014 skills install \uB85C \uC7AC\uC124\uCE58`);
|
|
1235
|
+
case "installed-copy":
|
|
1236
|
+
return import_chalk2.default.green("\u2713 \uC124\uCE58\uB428 (\uC2E4\uC81C \uBCF5\uC0AC\uBCF8)");
|
|
1237
|
+
case "not-installed":
|
|
1238
|
+
return import_chalk2.default.gray("\uBBF8\uC124\uCE58 \u2014 nhncloud skills install \uB85C \uC124\uCE58");
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
var installCommand = new import_commander2.Command("install").description("Claude Code \uC2A4\uD0AC\uC744 ~/.claude/skills \uC5D0 \uC2EC\uBCFC\uB9AD \uB9C1\uD06C\uB85C \uC124\uCE58\uD55C\uB2E4").option("--force", "\uC2EC\uBCFC\uB9AD \uB9C1\uD06C\uAC00 \uC544\uB2CC \uAE30\uC874 \uD56D\uBAA9\uB3C4 \uB36E\uC5B4\uC4F4\uB2E4").action(async (opts) => {
|
|
1242
|
+
const hasClaude = await (0, import_promises4.access)(claudeDir()).then(() => true).catch(() => false);
|
|
1243
|
+
if (!hasClaude) {
|
|
1244
|
+
throw new NhnCloudCliError(
|
|
1245
|
+
`Claude Code \uC124\uC815 \uB514\uB809\uD130\uB9AC(${claudeDir()})\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. Claude Code \uC124\uCE58 \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.`,
|
|
1246
|
+
EXIT_PARAM_ERROR
|
|
1247
|
+
);
|
|
1248
|
+
}
|
|
1249
|
+
if (isNpxRuntime(__dirname)) {
|
|
1250
|
+
throw new NhnCloudCliError(
|
|
1251
|
+
"npx \uD658\uACBD\uC5D0\uC11C\uB294 \uC2A4\uD0AC \uC124\uCE58\uAC00 \uBD88\uAC00\uD569\uB2C8\uB2E4(\uC784\uC2DC \uACBD\uB85C). npm i -g @bifos/nhncloud-cli \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",
|
|
1252
|
+
EXIT_PARAM_ERROR
|
|
1253
|
+
);
|
|
1254
|
+
}
|
|
1255
|
+
const src = skillSourceFrom(__dirname);
|
|
1256
|
+
const dst = skillDestPath();
|
|
1257
|
+
const result = await installSkillSymlink(src, dst, opts.force ?? false);
|
|
1258
|
+
if (result === "replaced-copy") {
|
|
1259
|
+
console.error(import_chalk2.default.yellow(`\uAE30\uC874 \uC2E4\uC81C \uB514\uB809\uD130\uB9AC\uB97C \uC81C\uAC70\uD558\uACE0 \uC2EC\uBCFC\uB9AD \uB9C1\uD06C\uB85C \uAD50\uCCB4\uD588\uC2B5\uB2C8\uB2E4: ${dst}`));
|
|
1260
|
+
}
|
|
1261
|
+
console.log(import_chalk2.default.green(`\u2713 \uC2A4\uD0AC ${result === "linked" ? "\uC124\uCE58" : "\uC7AC\uC124\uCE58"} \uC644\uB8CC: ${dst}`));
|
|
1262
|
+
});
|
|
1263
|
+
var uninstallCommand = new import_commander2.Command("uninstall").description("\uC124\uCE58\uB41C Claude Code \uC2A4\uD0AC \uC2EC\uBCFC\uB9AD \uB9C1\uD06C\uB97C \uC81C\uAC70\uD55C\uB2E4").action(async () => {
|
|
1264
|
+
const dst = skillDestPath();
|
|
1265
|
+
const result = await uninstallSkill(dst);
|
|
1266
|
+
if (result === "absent") {
|
|
1267
|
+
console.log(import_chalk2.default.gray("\uC124\uCE58\uB41C \uC2A4\uD0AC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."));
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
console.log(import_chalk2.default.green(`\u2713 \uC2A4\uD0AC \uC81C\uAC70 \uC644\uB8CC: ${dst}`));
|
|
1271
|
+
});
|
|
1272
|
+
var skillsCommand = new import_commander2.Command("skills").description(`Claude Code \uC2A4\uD0AC(${SKILL_NAME}) \uC124\uCE58 \uAD00\uB9AC`).addCommand(installCommand).addCommand(uninstallCommand).action(async () => {
|
|
1273
|
+
const status = await getSkillStatus(skillDestPath());
|
|
1274
|
+
console.log(`Claude Code \uC2A4\uD0AC (${SKILL_NAME}): ${describeStatus(status)}`);
|
|
1275
|
+
});
|
|
1276
|
+
|
|
1277
|
+
// src/commands/doctor.ts
|
|
1278
|
+
var import_commander3 = require("commander");
|
|
1279
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
1280
|
+
var import_promises5 = require("fs/promises");
|
|
1281
|
+
var import_node_os4 = require("os");
|
|
1282
|
+
var import_node_path4 = __toESM(require("path"));
|
|
1283
|
+
var CREDENTIALS_PATH2 = import_node_path4.default.join((0, import_node_os4.homedir)(), ".nhncloud", "credentials.json");
|
|
1284
|
+
var CONFIG_PATH2 = import_node_path4.default.join((0, import_node_os4.homedir)(), ".nhncloud", "config.json");
|
|
1285
|
+
async function readProfiles() {
|
|
1286
|
+
let raw;
|
|
1287
|
+
try {
|
|
1288
|
+
raw = await (0, import_promises5.readFile)(CREDENTIALS_PATH2, "utf-8");
|
|
1289
|
+
} catch {
|
|
1290
|
+
return { profiles: [], parseError: false, missing: true };
|
|
1291
|
+
}
|
|
1292
|
+
try {
|
|
1293
|
+
const parsed = JSON.parse(raw);
|
|
1294
|
+
return { profiles: Object.keys(parsed.profiles ?? {}), parseError: false, missing: false };
|
|
1295
|
+
} catch {
|
|
1296
|
+
return { profiles: [], parseError: true, missing: false };
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
async function readDefaultProfile() {
|
|
1300
|
+
try {
|
|
1301
|
+
const raw = await (0, import_promises5.readFile)(CONFIG_PATH2, "utf-8");
|
|
1302
|
+
const parsed = JSON.parse(raw);
|
|
1303
|
+
return parsed.defaultProfile ?? null;
|
|
1304
|
+
} catch {
|
|
1305
|
+
return null;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
var doctorCommand = new import_commander3.Command("doctor").description("\uC790\uACA9\uC99D\uBA85\xB7\uC2A4\uD0AC \uC124\uCE58 \uC0C1\uD0DC\uB97C \uC9C4\uB2E8\uD55C\uB2E4(\uC624\uD504\uB77C\uC778 \u2014 \uC5F0\uACB0 \uD14C\uC2A4\uD2B8\uB294 configure \uB85C)").action(async () => {
|
|
1309
|
+
console.log(import_chalk3.default.bold("\n\u{1F50D} nhncloud-cli \uC9C4\uB2E8\n"));
|
|
1310
|
+
const creds = await readProfiles();
|
|
1311
|
+
const defaultProfile = await readDefaultProfile();
|
|
1312
|
+
console.log(import_chalk3.default.bold("\uC790\uACA9\uC99D\uBA85"));
|
|
1313
|
+
if (creds.missing) {
|
|
1314
|
+
console.log(` ${import_chalk3.default.red("\u274C \uBBF8\uC124\uC815")} \u2014 ${CREDENTIALS_PATH2} \uC5C6\uC74C. nhncloud configure \uB85C \uC124\uC815\uD558\uC138\uC694.`);
|
|
1315
|
+
} else if (creds.parseError) {
|
|
1316
|
+
console.log(` ${import_chalk3.default.red("\u274C \uD30C\uC2F1 \uC624\uB958")} \u2014 ${CREDENTIALS_PATH2} \uAC00 \uC62C\uBC14\uB978 JSON \uC778\uC9C0 \uD655\uC778\uD558\uC138\uC694.`);
|
|
1317
|
+
} else if (creds.profiles.length === 0) {
|
|
1318
|
+
console.log(` ${import_chalk3.default.yellow("\u26A0 profile \uC5C6\uC74C")} \u2014 nhncloud configure \uB85C \uC124\uC815\uD558\uC138\uC694.`);
|
|
1319
|
+
} else {
|
|
1320
|
+
console.log(` ${import_chalk3.default.green("\u2713 \uC124\uC815\uB428")} \u2014 profile: ${creds.profiles.join(", ")}`);
|
|
1321
|
+
console.log(` \uAE30\uBCF8 profile: ${defaultProfile ? import_chalk3.default.green(defaultProfile) : import_chalk3.default.gray("\uBBF8\uC9C0\uC815 (default \uC0AC\uC6A9)")}`);
|
|
1322
|
+
}
|
|
1323
|
+
console.log(import_chalk3.default.bold("\nClaude Code \uC2A4\uD0AC"));
|
|
1324
|
+
const hasClaude = await (0, import_promises5.access)(claudeDir()).then(() => true).catch(() => false);
|
|
1325
|
+
if (!hasClaude) {
|
|
1326
|
+
console.log(` ${import_chalk3.default.gray("Claude Code \uBBF8\uC124\uCE58")} \u2014 ${claudeDir()} \uC5C6\uC74C`);
|
|
1327
|
+
} else {
|
|
1328
|
+
const status = await getSkillStatus(skillDestPath());
|
|
1329
|
+
switch (status.state) {
|
|
1330
|
+
case "installed-link":
|
|
1331
|
+
console.log(` ${SKILL_NAME}: ${import_chalk3.default.green("\u2713 \uC124\uCE58\uB428 (\uC2EC\uBCFC\uB9AD \uB9C1\uD06C)")}`);
|
|
1332
|
+
break;
|
|
1333
|
+
case "broken-link":
|
|
1334
|
+
console.log(` ${SKILL_NAME}: ${import_chalk3.default.yellow("\u26A0 \uB9C1\uD06C \uAE68\uC9D0 \u2014 nhncloud skills install \uB85C \uC7AC\uC124\uCE58")}`);
|
|
1335
|
+
break;
|
|
1336
|
+
case "installed-copy":
|
|
1337
|
+
console.log(` ${SKILL_NAME}: ${import_chalk3.default.green("\u2713 \uC124\uCE58\uB428 (\uC2E4\uC81C \uBCF5\uC0AC\uBCF8)")}`);
|
|
1338
|
+
break;
|
|
1339
|
+
case "not-installed":
|
|
1340
|
+
console.log(` ${SKILL_NAME}: ${import_chalk3.default.gray("\uBBF8\uC124\uCE58 \u2014 nhncloud skills install \uB85C \uC124\uCE58")}`);
|
|
1341
|
+
break;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
console.log();
|
|
1345
|
+
if (!creds.missing && !creds.parseError && creds.profiles.length > 0) {
|
|
1346
|
+
console.log(import_chalk3.default.green("\u2713 \uAE30\uBCF8 \uC124\uC815\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."));
|
|
1347
|
+
} else {
|
|
1348
|
+
console.log(import_chalk3.default.yellow("\u26A0 \uC124\uC815\uC774 \uD544\uC694\uD569\uB2C8\uB2E4: nhncloud configure"));
|
|
1349
|
+
}
|
|
1350
|
+
console.log();
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
// src/commands/logncrash/search.ts
|
|
1354
|
+
var import_commander4 = require("commander");
|
|
1140
1355
|
|
|
1141
1356
|
// src/utils/time.ts
|
|
1142
1357
|
function toLocalISOString(date) {
|
|
@@ -1282,7 +1497,7 @@ function formatLogRow(log) {
|
|
|
1282
1497
|
const body = truncate(getString(log["logBody"] ?? log["body"] ?? log["message"] ?? ""), 60);
|
|
1283
1498
|
return [logTime, logType, body];
|
|
1284
1499
|
}
|
|
1285
|
-
var searchCommand = new
|
|
1500
|
+
var searchCommand = new import_commander4.Command("search").description("Log & Crash \uB85C\uADF8 \uAC80\uC0C9").option("--query <lucene>", "Lucene \uC9C8\uC758 \uBB38\uC790\uC5F4 (\uD544\uC218)").option("--from <time>", "\uAC80\uC0C9 \uC2DC\uC791: ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (1h/30m/2d/now) (\uD544\uC218)").option("--to <time>", "\uAC80\uC0C9 \uB05D: ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (\uD544\uC218)").option("--page <n>", "pageNumber (\uAE30\uBCF8 0)", "0").option("--size <n>", "pageSize (\uAE30\uBCF8 10, \uCD5C\uB300 100)", "10").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
1286
1501
|
const opts = cmd.optsWithGlobals();
|
|
1287
1502
|
if (!opts.query) {
|
|
1288
1503
|
throw new NhnCloudCliError(`--query \uC635\uC158\uC740 \uD544\uC218\uC785\uB2C8\uB2E4. \uC608: --query 'logType:"NORMAL"'`, EXIT_PARAM_ERROR);
|
|
@@ -1346,7 +1561,7 @@ credentials.json \uC5D0 "secret": "<secretkey>" \uB97C \uCD94\uAC00\uD558\uC138\
|
|
|
1346
1561
|
});
|
|
1347
1562
|
|
|
1348
1563
|
// src/commands/logncrash/send.ts
|
|
1349
|
-
var
|
|
1564
|
+
var import_commander5 = require("commander");
|
|
1350
1565
|
var import_node_fs = require("fs");
|
|
1351
1566
|
var MAX_LOG_BYTES = 8 * 1024 * 1024;
|
|
1352
1567
|
var VALID_LEVELS = ["DEBUG", "INFO", "WARN", "ERROR", "FATAL"];
|
|
@@ -1379,7 +1594,7 @@ function resolveBody(opts) {
|
|
|
1379
1594
|
EXIT_PARAM_ERROR
|
|
1380
1595
|
);
|
|
1381
1596
|
}
|
|
1382
|
-
var sendCommand = new
|
|
1597
|
+
var sendCommand = new import_commander5.Command("send").description("\uB85C\uADF8 \uD55C \uAC74\uC744 Log & Crash \uB85C \uC804\uC1A1\uD55C\uB2E4 (--body / --file / stdin)").option("--body <text>", "\uB85C\uADF8 \uBA54\uC2DC\uC9C0 \uBCF8\uBB38 (\uBBF8\uC9C0\uC815 \uC2DC --file \uB610\uB294 stdin)").option("--file <path>", "\uB85C\uADF8 \uBCF8\uBB38\uC744 \uC77D\uC744 \uD30C\uC77C \uACBD\uB85C").option("--level <level>", "\uB85C\uADF8 \uB808\uBCA8 (DEBUG/INFO/WARN/ERROR/FATAL)").option("--app-version <ver>", "projectVersion (\uBBF8\uC9C0\uC815 \uC2DC \uAE30\uBCF8 '1.0.0')").option("--source <source>", "logSource (collector \uAE30\uBCF8 'http')").option("--type <type>", "logType (collector \uAE30\uBCF8 'log')").option("--host <host>", "\uB85C\uADF8\uB97C \uBCF4\uB0B8 host \uC2DD\uBCC4").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
1383
1598
|
const opts = cmd.optsWithGlobals();
|
|
1384
1599
|
const body = resolveBody(opts);
|
|
1385
1600
|
const bytes = Buffer.byteLength(body, "utf-8");
|
|
@@ -1434,26 +1649,26 @@ credentials.json \uC5D0 "appkey": "<appkey>" \uB97C \uCD94\uAC00\uD558\uC138\uC6
|
|
|
1434
1649
|
});
|
|
1435
1650
|
|
|
1436
1651
|
// src/commands/logncrash/export.ts
|
|
1437
|
-
var
|
|
1438
|
-
var
|
|
1652
|
+
var import_commander6 = require("commander");
|
|
1653
|
+
var import_promises6 = require("fs/promises");
|
|
1439
1654
|
var import_node_fs2 = require("fs");
|
|
1440
1655
|
var import_node_crypto2 = require("crypto");
|
|
1441
1656
|
var MAX_TOTAL = 1e5;
|
|
1442
|
-
function assertWritable(
|
|
1657
|
+
function assertWritable(path3, force) {
|
|
1443
1658
|
if (force) return;
|
|
1444
1659
|
try {
|
|
1445
|
-
(0, import_node_fs2.statSync)(
|
|
1660
|
+
(0, import_node_fs2.statSync)(path3);
|
|
1446
1661
|
} catch (e) {
|
|
1447
1662
|
if (e.code === "ENOENT") return;
|
|
1448
1663
|
const reason = e.code ?? (e instanceof Error ? e.message : String(e));
|
|
1449
|
-
throw new NhnCloudCliError(`--output \uACBD\uB85C\uB97C \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${
|
|
1664
|
+
throw new NhnCloudCliError(`--output \uACBD\uB85C\uB97C \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${path3} (${reason})`, EXIT_PARAM_ERROR);
|
|
1450
1665
|
}
|
|
1451
1666
|
throw new NhnCloudCliError(
|
|
1452
|
-
`--output \uB300\uC0C1\uC774 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4: ${
|
|
1667
|
+
`--output \uB300\uC0C1\uC774 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4: ${path3}. \uB36E\uC5B4\uC4F0\uB824\uBA74 --force \uB97C \uC4F0\uC138\uC694.`,
|
|
1453
1668
|
EXIT_PARAM_ERROR
|
|
1454
1669
|
);
|
|
1455
1670
|
}
|
|
1456
|
-
var exportCommand = new
|
|
1671
|
+
var exportCommand = new import_commander6.Command("export").description("Log & Crash \uB85C\uADF8\uB97C scroll \uB85C \uC804\uCCB4 \uCD94\uCD9C\uD574 \uD30C\uC77C\uB85C \uC800\uC7A5 (\uB300\uB7C9 \uCD94\uCD9C)").option("--query <lucene>", "Lucene \uC9C8\uC758 \uBB38\uC790\uC5F4 (\uD544\uC218)").option("--from <time>", "\uAC80\uC0C9 \uC2DC\uC791: ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (1h/30m/2d/now) (\uD544\uC218)").option("--to <time>", "\uAC80\uC0C9 \uB05D: ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (\uD544\uC218)").option("--output <file>", "\uCD9C\uB825 \uD30C\uC77C \uACBD\uB85C (\uD544\uC218)").option("--format <fmt>", "\uCD9C\uB825 \uD615\uC2DD: jsonl(\uAE30\uBCF8, \uD55C \uC904\uB2F9 \uD55C \uB85C\uADF8) \uB610\uB294 json(\uBC30\uC5F4)", "jsonl").option("--size <n>", "scroll \uD398\uC774\uC9C0 \uD06C\uAE30 (docs \uBC94\uC704 10~100, \uAE30\uBCF8 100)", "100").option("--force", "\uCD9C\uB825 \uD30C\uC77C\uC774 \uC788\uC73C\uBA74 \uB36E\uC5B4\uC4F4\uB2E4").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
1457
1672
|
const opts = cmd.optsWithGlobals();
|
|
1458
1673
|
if (!opts.query) {
|
|
1459
1674
|
throw new NhnCloudCliError(`--query \uC635\uC158\uC740 \uD544\uC218\uC785\uB2C8\uB2E4. \uC608: --query 'logType:"NORMAL"'`, EXIT_PARAM_ERROR);
|
|
@@ -1534,15 +1749,15 @@ credentials.json \uC5D0 "secret": "<secret>" \uB97C \uCD94\uAC00\uD558\uC138\uC6
|
|
|
1534
1749
|
} catch (err) {
|
|
1535
1750
|
stopSpinner(false);
|
|
1536
1751
|
stream.destroy();
|
|
1537
|
-
await (0,
|
|
1752
|
+
await (0, import_promises6.rm)(tmp, { force: true }).catch(() => {
|
|
1538
1753
|
});
|
|
1539
1754
|
throw err;
|
|
1540
1755
|
}
|
|
1541
1756
|
stopSpinner(true, `${count}\uAC74 \uCD94\uCD9C \uC644\uB8CC`);
|
|
1542
1757
|
try {
|
|
1543
|
-
await (0,
|
|
1758
|
+
await (0, import_promises6.rename)(tmp, opts.output);
|
|
1544
1759
|
} catch (err) {
|
|
1545
|
-
await (0,
|
|
1760
|
+
await (0, import_promises6.rm)(tmp, { force: true }).catch(() => {
|
|
1546
1761
|
});
|
|
1547
1762
|
const reason = err.code ?? (err instanceof Error ? err.message : String(err));
|
|
1548
1763
|
throw new NhnCloudCliError(`\uCD9C\uB825 \uD30C\uC77C\uC744 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${opts.output} (${reason})`, EXIT_PARAM_ERROR);
|
|
@@ -1571,7 +1786,7 @@ async function scrollNextOrExpire(client, scrollKey) {
|
|
|
1571
1786
|
}
|
|
1572
1787
|
|
|
1573
1788
|
// src/commands/deploy/run.ts
|
|
1574
|
-
var
|
|
1789
|
+
var import_commander7 = require("commander");
|
|
1575
1790
|
|
|
1576
1791
|
// src/services/deploy/client.ts
|
|
1577
1792
|
var import_ky6 = __toESM(require("ky"));
|
|
@@ -1820,7 +2035,7 @@ async function createDeployClient(profileOpt) {
|
|
|
1820
2035
|
}
|
|
1821
2036
|
|
|
1822
2037
|
// src/commands/deploy/run.ts
|
|
1823
|
-
var runCommand = new
|
|
2038
|
+
var runCommand = new import_commander7.Command("run").description("\uBC30\uD3EC\uB97C \uC2E4\uD589\uD55C\uB2E4").argument("<target>", "config.json \uC5D0 \uC815\uC758\uB41C deploy target \uC774\uB984").option("--app-key <k>", "target \uC758 appKey override").option("--artifact-id <id>", "target \uC758 artifactId override").option("--server-group-id <id>", "target \uC758 serverGroupId override").option("--scenario-ids <csv>", "target \uC758 scenarioIds override").option("--target-hosts <csv>", "\uB300\uC0C1 \uD638\uC2A4\uD2B8 (\uC0DD\uB7B5 \uC2DC \uC11C\uBC84\uADF8\uB8F9 \uC804\uCCB4)").option("--concurrent <n>", "\uBCD1\uB82C \uBC30\uD3EC \uC218 (\uAE30\uBCF8 1)", "1").option("--next-when-fail", "\uC2DC\uB098\uB9AC\uC624 \uC2E4\uD328 \uC2DC\uC5D0\uB3C4 \uC9C4\uD589").option("--note <s>", "\uBC30\uD3EC \uBA54\uBAA8").option("--async", "\uC989\uC2DC \uBC18\uD658 (\uAE30\uBCF8\uC740 \uC644\uB8CC \uB300\uAE30)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (targetName, _opts, cmd) => {
|
|
1824
2039
|
const opts = cmd.optsWithGlobals();
|
|
1825
2040
|
const concurrentNum = parsePositiveIntegerOption(opts.concurrent ?? "1", "--concurrent");
|
|
1826
2041
|
const target = await getDeployTarget(targetName);
|
|
@@ -1857,8 +2072,8 @@ var runCommand = new import_commander5.Command("run").description("\uBC30\uD3EC\
|
|
|
1857
2072
|
});
|
|
1858
2073
|
|
|
1859
2074
|
// src/commands/deploy/artifacts.ts
|
|
1860
|
-
var
|
|
1861
|
-
var artifactsCommand = new
|
|
2075
|
+
var import_commander8 = require("commander");
|
|
2076
|
+
var artifactsCommand = new import_commander8.Command("artifacts").description("\uC544\uD2F0\uD329\uD2B8 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("[target]", "config.json \uC5D0 \uC815\uC758\uB41C deploy target \uC774\uB984 (--app-key \uB85C \uB300\uCCB4 \uAC00\uB2A5)").option("--app-key <k>", "appKey \uC9C1\uC811 \uC9C0\uC815 (target \uC5C6\uC774 \uC0AC\uC6A9 \uAC00\uB2A5)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (targetName, _opts, cmd) => {
|
|
1862
2077
|
const opts = cmd.optsWithGlobals();
|
|
1863
2078
|
let appKey;
|
|
1864
2079
|
if (opts.appKey) {
|
|
@@ -1898,8 +2113,8 @@ var artifactsCommand = new import_commander6.Command("artifacts").description("\
|
|
|
1898
2113
|
});
|
|
1899
2114
|
|
|
1900
2115
|
// src/commands/deploy/server-groups.ts
|
|
1901
|
-
var
|
|
1902
|
-
var serverGroupsCommand = new
|
|
2116
|
+
var import_commander9 = require("commander");
|
|
2117
|
+
var serverGroupsCommand = new import_commander9.Command("server-groups").description("\uC11C\uBC84\uADF8\uB8F9 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<target>", "config.json \uC5D0 \uC815\uC758\uB41C deploy target \uC774\uB984").option("--app-key <k>", "target \uC758 appKey override").option("--artifact-id <id>", "target \uC758 artifactId override").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (targetName, _opts, cmd) => {
|
|
1903
2118
|
const opts = cmd.optsWithGlobals();
|
|
1904
2119
|
const target = await getDeployTarget(targetName);
|
|
1905
2120
|
const appKey = opts.appKey ?? target.appKey;
|
|
@@ -1923,8 +2138,8 @@ var serverGroupsCommand = new import_commander7.Command("server-groups").descrip
|
|
|
1923
2138
|
});
|
|
1924
2139
|
|
|
1925
2140
|
// src/commands/deploy/histories.ts
|
|
1926
|
-
var
|
|
1927
|
-
var historiesCommand = new
|
|
2141
|
+
var import_commander10 = require("commander");
|
|
2142
|
+
var historiesCommand = new import_commander10.Command("histories").description("\uBC30\uD3EC \uC774\uB825\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<target>", "config.json \uC5D0 \uC815\uC758\uB41C deploy target \uC774\uB984").option("--app-key <k>", "target \uC758 appKey override").option("--artifact-id <id>", "target \uC758 artifactId override").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (targetName, _opts, cmd) => {
|
|
1928
2143
|
const opts = cmd.optsWithGlobals();
|
|
1929
2144
|
const target = await getDeployTarget(targetName);
|
|
1930
2145
|
const appKey = opts.appKey ?? target.appKey;
|
|
@@ -1948,8 +2163,8 @@ var historiesCommand = new import_commander8.Command("histories").description("\
|
|
|
1948
2163
|
});
|
|
1949
2164
|
|
|
1950
2165
|
// src/commands/deploy/binary-groups.ts
|
|
1951
|
-
var
|
|
1952
|
-
var binaryGroupsCommand = new
|
|
2166
|
+
var import_commander11 = require("commander");
|
|
2167
|
+
var binaryGroupsCommand = new import_commander11.Command("binary-groups").description("\uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<target>", "config.json \uC5D0 \uC815\uC758\uB41C deploy target \uC774\uB984").option("--app-key <k>", "target \uC758 appKey override").option("--artifact-id <id>", "target \uC758 artifactId override").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (targetName, _opts, cmd) => {
|
|
1953
2168
|
const opts = cmd.optsWithGlobals();
|
|
1954
2169
|
const target = await getDeployTarget(targetName);
|
|
1955
2170
|
const appKey = opts.appKey ?? target.appKey;
|
|
@@ -1981,7 +2196,7 @@ var binaryGroupsCommand = new import_commander9.Command("binary-groups").descrip
|
|
|
1981
2196
|
});
|
|
1982
2197
|
|
|
1983
2198
|
// src/commands/deploy/binaries.ts
|
|
1984
|
-
var
|
|
2199
|
+
var import_commander12 = require("commander");
|
|
1985
2200
|
function parsePositiveInt(value, flag) {
|
|
1986
2201
|
if (value === void 0) return void 0;
|
|
1987
2202
|
if (!/^[1-9]\d*$/.test(value)) {
|
|
@@ -1992,7 +2207,7 @@ function parsePositiveInt(value, flag) {
|
|
|
1992
2207
|
}
|
|
1993
2208
|
return Number(value);
|
|
1994
2209
|
}
|
|
1995
|
-
var binariesCommand = new
|
|
2210
|
+
var binariesCommand = new import_commander12.Command("binaries").description("\uD2B9\uC815 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9\uC758 \uBC14\uC774\uB108\uB9AC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<target>", "config.json \uC5D0 \uC815\uC758\uB41C deploy target \uC774\uB984").requiredOption("--binary-group <key>", "\uC870\uD68C\uD560 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 key (binary-groups \uB85C \uD655\uC778)").option("--page-num <n>", "\uD398\uC774\uC9C0 \uBC88\uD638 (1 \uC774\uC0C1)").option("--page-size <n>", "\uD398\uC774\uC9C0 \uD06C\uAE30 (1 \uC774\uC0C1)").option("--sort-key <k>", "\uC815\uB82C \uAE30\uC900 (\uC608: UPLOAD_DATE)").option("--sort-direction <d>", "\uC815\uB82C \uBC29\uD5A5 (\uC608: DESC)").option("--app-key <k>", "target \uC758 appKey override").option("--artifact-id <id>", "target \uC758 artifactId override").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (targetName, _opts, cmd) => {
|
|
1996
2211
|
const opts = cmd.optsWithGlobals();
|
|
1997
2212
|
const binaryGroupKey = parsePositiveInt(opts.binaryGroup, "--binary-group");
|
|
1998
2213
|
if (binaryGroupKey === void 0) {
|
|
@@ -2037,9 +2252,9 @@ var binariesCommand = new import_commander10.Command("binaries").description("\u
|
|
|
2037
2252
|
});
|
|
2038
2253
|
|
|
2039
2254
|
// src/commands/deploy/upload.ts
|
|
2040
|
-
var
|
|
2255
|
+
var import_commander13 = require("commander");
|
|
2041
2256
|
var import_node_fs3 = require("fs");
|
|
2042
|
-
var
|
|
2257
|
+
var import_node_path5 = require("path");
|
|
2043
2258
|
var MAX_UPLOAD_BYTES = 512 * 1024 * 1024;
|
|
2044
2259
|
function parsePositiveInt2(value, flag) {
|
|
2045
2260
|
if (value === void 0) return void 0;
|
|
@@ -2051,7 +2266,7 @@ function parsePositiveInt2(value, flag) {
|
|
|
2051
2266
|
}
|
|
2052
2267
|
return Number(value);
|
|
2053
2268
|
}
|
|
2054
|
-
var uploadCommand = new
|
|
2269
|
+
var uploadCommand = new import_commander13.Command("upload").description("\uB85C\uCEEC \uD30C\uC77C\uC744 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9\uC5D0 \uC5C5\uB85C\uB4DC\uD55C\uB2E4").argument("<target>", "config.json \uC5D0 \uC815\uC758\uB41C deploy target \uC774\uB984").requiredOption("--file <path>", "\uC5C5\uB85C\uB4DC\uD560 \uD30C\uC77C \uACBD\uB85C").requiredOption("--binary-group <key>", "\uC5C5\uB85C\uB4DC \uB300\uC0C1 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 key (binary-groups \uB85C \uD655\uC778)").option("--application-type <type>", "applicationType (\uC608: server)", "server").option("--description <text>", "\uBC14\uC774\uB108\uB9AC \uC124\uBA85").option("--app-key <k>", "target \uC758 appKey override").option("--artifact-id <id>", "target \uC758 artifactId override").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (targetName, _opts, cmd) => {
|
|
2055
2270
|
const opts = cmd.optsWithGlobals();
|
|
2056
2271
|
const binaryGroupKey = parsePositiveInt2(opts.binaryGroup, "--binary-group");
|
|
2057
2272
|
if (binaryGroupKey === void 0) {
|
|
@@ -2078,7 +2293,7 @@ var uploadCommand = new import_commander11.Command("upload").description("\uB85C
|
|
|
2078
2293
|
);
|
|
2079
2294
|
}
|
|
2080
2295
|
const fileBuffer = (0, import_node_fs3.readFileSync)(filePath);
|
|
2081
|
-
const fileName = (0,
|
|
2296
|
+
const fileName = (0, import_node_path5.basename)(filePath);
|
|
2082
2297
|
const target = await getDeployTarget(targetName);
|
|
2083
2298
|
const appKey = opts.appKey ?? target.appKey;
|
|
2084
2299
|
const artifactId = opts.artifactId ?? target.artifactId;
|
|
@@ -2113,9 +2328,9 @@ var uploadCommand = new import_commander11.Command("upload").description("\uB85C
|
|
|
2113
2328
|
});
|
|
2114
2329
|
|
|
2115
2330
|
// src/commands/deploy/download.ts
|
|
2116
|
-
var
|
|
2331
|
+
var import_commander14 = require("commander");
|
|
2117
2332
|
var import_node_fs4 = require("fs");
|
|
2118
|
-
var
|
|
2333
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
2119
2334
|
function parsePositiveInt3(value, flag) {
|
|
2120
2335
|
if (value === void 0) return void 0;
|
|
2121
2336
|
if (!/^[1-9]\d*$/.test(value)) {
|
|
@@ -2126,24 +2341,24 @@ function parsePositiveInt3(value, flag) {
|
|
|
2126
2341
|
}
|
|
2127
2342
|
return Number(value);
|
|
2128
2343
|
}
|
|
2129
|
-
function assertWritable2(
|
|
2344
|
+
function assertWritable2(path3, force) {
|
|
2130
2345
|
if (force) return;
|
|
2131
2346
|
try {
|
|
2132
|
-
(0, import_node_fs4.statSync)(
|
|
2347
|
+
(0, import_node_fs4.statSync)(path3);
|
|
2133
2348
|
} catch (e) {
|
|
2134
2349
|
if (e.code === "ENOENT") return;
|
|
2135
2350
|
const reason = e.code ?? (e instanceof Error ? e.message : String(e));
|
|
2136
2351
|
throw new NhnCloudCliError(
|
|
2137
|
-
`-o \uACBD\uB85C\uB97C \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${
|
|
2352
|
+
`-o \uACBD\uB85C\uB97C \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${path3} (${reason})`,
|
|
2138
2353
|
EXIT_PARAM_ERROR
|
|
2139
2354
|
);
|
|
2140
2355
|
}
|
|
2141
2356
|
throw new NhnCloudCliError(
|
|
2142
|
-
`-o \uB300\uC0C1\uC774 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4: ${
|
|
2357
|
+
`-o \uB300\uC0C1\uC774 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4: ${path3}. \uB36E\uC5B4\uC4F0\uB824\uBA74 --force \uB97C \uC4F0\uC138\uC694.`,
|
|
2143
2358
|
EXIT_PARAM_ERROR
|
|
2144
2359
|
);
|
|
2145
2360
|
}
|
|
2146
|
-
var downloadCommand = new
|
|
2361
|
+
var downloadCommand = new import_commander14.Command("download").description("\uBC14\uC774\uB108\uB9AC\uB97C \uB85C\uCEEC \uD30C\uC77C\uB85C \uB2E4\uC6B4\uB85C\uB4DC\uD55C\uB2E4").argument("<target>", "config.json \uC5D0 \uC815\uC758\uB41C deploy target \uC774\uB984").requiredOption("--binary-group <key>", "\uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 key (binary-groups \uB85C \uD655\uC778)").requiredOption("--binary-key <key>", "\uB2E4\uC6B4\uB85C\uB4DC\uD560 \uBC14\uC774\uB108\uB9AC key (binaries \uB610\uB294 upload \uB85C \uD655\uC778)").requiredOption("-o, --output <file>", "\uC800\uC7A5\uD560 \uD30C\uC77C \uACBD\uB85C").option("--force", "\uB300\uC0C1 \uD30C\uC77C\uC774 \uC788\uC73C\uBA74 \uB36E\uC5B4\uC4F4\uB2E4").option("--app-key <k>", "target \uC758 appKey override").option("--artifact-id <id>", "target \uC758 artifactId override").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (targetName, _opts, cmd) => {
|
|
2147
2362
|
const opts = cmd.optsWithGlobals();
|
|
2148
2363
|
const binaryGroupKey = parsePositiveInt3(opts.binaryGroup, "--binary-group");
|
|
2149
2364
|
const binaryKey = parsePositiveInt3(opts.binaryKey, "--binary-key");
|
|
@@ -2166,13 +2381,13 @@ var downloadCommand = new import_commander12.Command("download").description("\u
|
|
|
2166
2381
|
}
|
|
2167
2382
|
stopSpinner(true);
|
|
2168
2383
|
if (!opts.quiet) {
|
|
2169
|
-
process.stderr.write(
|
|
2384
|
+
process.stderr.write(import_chalk4.default.green(` \uC800\uC7A5\uB428: ${outPath}
|
|
2170
2385
|
`));
|
|
2171
2386
|
}
|
|
2172
2387
|
});
|
|
2173
2388
|
|
|
2174
2389
|
// src/commands/instance/list.ts
|
|
2175
|
-
var
|
|
2390
|
+
var import_commander15 = require("commander");
|
|
2176
2391
|
|
|
2177
2392
|
// src/commands/iaas.ts
|
|
2178
2393
|
async function resolveIaasTokenContext(opts) {
|
|
@@ -2475,8 +2690,8 @@ var InstanceClient = class {
|
|
|
2475
2690
|
return this.serverAction(id, { revertResize: null });
|
|
2476
2691
|
}
|
|
2477
2692
|
async listFlavors(params = {}) {
|
|
2478
|
-
const
|
|
2479
|
-
const url = `${this.computeEndpoint}${
|
|
2693
|
+
const path3 = params.detail ? "/flavors/detail" : "/flavors";
|
|
2694
|
+
const url = `${this.computeEndpoint}${path3}`;
|
|
2480
2695
|
const searchParams = {};
|
|
2481
2696
|
if (params.minDisk !== void 0) searchParams["minDisk"] = params.minDisk;
|
|
2482
2697
|
if (params.minRam !== void 0) searchParams["minRam"] = params.minRam;
|
|
@@ -2738,7 +2953,7 @@ async function resolveInstanceClient(opts) {
|
|
|
2738
2953
|
function getIps(server) {
|
|
2739
2954
|
return Object.values(server.addresses).flat().map((a) => a.addr).join(", ");
|
|
2740
2955
|
}
|
|
2741
|
-
var listCommand = new
|
|
2956
|
+
var listCommand = new import_commander15.Command("list").description("\uC778\uC2A4\uD134\uC2A4 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
2742
2957
|
const opts = cmd.optsWithGlobals();
|
|
2743
2958
|
const { client } = await resolveInstanceClient(opts);
|
|
2744
2959
|
startSpinner("\uC778\uC2A4\uD134\uC2A4 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -2759,7 +2974,7 @@ var listCommand = new import_commander13.Command("list").description("\uC778\uC2
|
|
|
2759
2974
|
});
|
|
2760
2975
|
|
|
2761
2976
|
// src/commands/volume/list.ts
|
|
2762
|
-
var
|
|
2977
|
+
var import_commander16 = require("commander");
|
|
2763
2978
|
|
|
2764
2979
|
// src/services/blockstorage/client.ts
|
|
2765
2980
|
var import_ky8 = __toESM(require("ky"));
|
|
@@ -2870,7 +3085,7 @@ function parsePositiveInt4(value, flag) {
|
|
|
2870
3085
|
}
|
|
2871
3086
|
return Number(value);
|
|
2872
3087
|
}
|
|
2873
|
-
var listCommand2 = new
|
|
3088
|
+
var listCommand2 = new import_commander16.Command("list").description("\uBCFC\uB968 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--sort <key:dir>", "\uC815\uB82C \uAE30\uC900 (\uC608: created_at:desc)").option("--limit <n>", "\uCD5C\uB300 \uBC18\uD658 \uAC1C\uC218").option("--offset <n>", "\uD398\uC774\uC9C0 \uC2DC\uC791 \uC624\uD504\uC14B").option("--marker <id>", "\uD398\uC774\uC9C0\uB124\uC774\uC158 \uB9C8\uCEE4 \uBCFC\uB968 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
2874
3089
|
const opts = cmd.optsWithGlobals();
|
|
2875
3090
|
const limitNum = opts.limit !== void 0 ? parsePositiveInt4(opts.limit, "--limit") : void 0;
|
|
2876
3091
|
const offsetNum = opts.offset !== void 0 ? parsePositiveInt4(opts.offset, "--offset") : void 0;
|
|
@@ -2904,8 +3119,8 @@ var listCommand2 = new import_commander14.Command("list").description("\uBCFC\uB
|
|
|
2904
3119
|
});
|
|
2905
3120
|
|
|
2906
3121
|
// src/commands/volume/get.ts
|
|
2907
|
-
var
|
|
2908
|
-
var getCommand = new
|
|
3122
|
+
var import_commander17 = require("commander");
|
|
3123
|
+
var getCommand = new import_commander17.Command("get").description("\uB2E8\uC77C \uBCFC\uB968 \uC0C1\uD0DC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "\uBCFC\uB968 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
2909
3124
|
const opts = cmd.optsWithGlobals();
|
|
2910
3125
|
const { client } = await resolveVolumeClient(opts);
|
|
2911
3126
|
startSpinner("\uBCFC\uB968 \uC870\uD68C \uC911...");
|
|
@@ -2936,9 +3151,9 @@ var getCommand = new import_commander15.Command("get").description("\uB2E8\uC77C
|
|
|
2936
3151
|
});
|
|
2937
3152
|
|
|
2938
3153
|
// src/commands/volume/create.ts
|
|
2939
|
-
var
|
|
2940
|
-
var
|
|
2941
|
-
var createCommand = new
|
|
3154
|
+
var import_commander18 = require("commander");
|
|
3155
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
3156
|
+
var createCommand = new import_commander18.Command("create").description("\uBCFC\uB968\uC744 \uBC1C\uAE09\uD55C\uB2E4").requiredOption("--size <gb>", "\uBCFC\uB968 \uD06C\uAE30(GB) \u2014 \uD544\uC218").option("--name <name>", "\uBCFC\uB968 \uC774\uB984").option("--description <text>", "\uBCFC\uB968 \uC124\uBA85").option("--volume-type <type>", "\uBCFC\uB968 \uD0C0\uC785").option("--availability-zone <az>", "\uAC00\uC6A9\uC131 \uC601\uC5ED(AZ). instance availability-zones \uB85C \uC870\uD68C\uD55C zoneName \uC9C0\uC815").option("--snapshot-id <id>", "\uC2A4\uB0C5\uC0F7 ID (\uC2A4\uB0C5\uC0F7\uC5D0\uC11C \uBCFC\uB968 \uC0DD\uC131)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
2942
3157
|
const opts = cmd.optsWithGlobals();
|
|
2943
3158
|
if (!/^[1-9]\d*$/.test(opts.size)) {
|
|
2944
3159
|
throw new NhnCloudCliError(
|
|
@@ -2971,7 +3186,7 @@ var createCommand = new import_commander16.Command("create").description("\uBCFC
|
|
|
2971
3186
|
throw err;
|
|
2972
3187
|
}
|
|
2973
3188
|
stopSpinner(true);
|
|
2974
|
-
process.stderr.write(
|
|
3189
|
+
process.stderr.write(import_chalk5.default.green(`\uBCFC\uB968 \uBC1C\uAE09 \uC694\uCCAD \uC644\uB8CC (id: ${volume.id}, status: ${volume.status})
|
|
2975
3190
|
`));
|
|
2976
3191
|
const rows = [
|
|
2977
3192
|
["id", volume.id],
|
|
@@ -2991,7 +3206,7 @@ var createCommand = new import_commander16.Command("create").description("\uBCFC
|
|
|
2991
3206
|
});
|
|
2992
3207
|
|
|
2993
3208
|
// src/commands/network/list.ts
|
|
2994
|
-
var
|
|
3209
|
+
var import_commander19 = require("commander");
|
|
2995
3210
|
|
|
2996
3211
|
// src/services/network/client.ts
|
|
2997
3212
|
var import_ky9 = __toESM(require("ky"));
|
|
@@ -3171,7 +3386,7 @@ async function resolveNetworkClient(opts) {
|
|
|
3171
3386
|
}
|
|
3172
3387
|
|
|
3173
3388
|
// src/commands/network/list.ts
|
|
3174
|
-
var listCommand3 = new
|
|
3389
|
+
var listCommand3 = new import_commander19.Command("list").description("VPC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3175
3390
|
const opts = cmd.optsWithGlobals();
|
|
3176
3391
|
const { client } = await resolveNetworkClient(opts);
|
|
3177
3392
|
startSpinner("VPC \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -3192,8 +3407,8 @@ var listCommand3 = new import_commander17.Command("list").description("VPC \uBAA
|
|
|
3192
3407
|
});
|
|
3193
3408
|
|
|
3194
3409
|
// src/commands/network/subnet.ts
|
|
3195
|
-
var
|
|
3196
|
-
var subnetListCommand = new
|
|
3410
|
+
var import_commander20 = require("commander");
|
|
3411
|
+
var subnetListCommand = new import_commander20.Command("list").description("\uC11C\uBE0C\uB137 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3197
3412
|
const opts = cmd.optsWithGlobals();
|
|
3198
3413
|
const { client } = await resolveNetworkClient(opts);
|
|
3199
3414
|
startSpinner("\uC11C\uBE0C\uB137 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -3218,11 +3433,11 @@ var subnetListCommand = new import_commander18.Command("list").description("\uC1
|
|
|
3218
3433
|
ids: subnets.map((s) => s.id)
|
|
3219
3434
|
});
|
|
3220
3435
|
});
|
|
3221
|
-
var subnetCommand = new
|
|
3436
|
+
var subnetCommand = new import_commander20.Command("subnet").description("\uC11C\uBE0C\uB137 \uAD00\uB828 \uBA85\uB839").addCommand(subnetListCommand);
|
|
3222
3437
|
|
|
3223
3438
|
// src/commands/floatingip/list.ts
|
|
3224
|
-
var
|
|
3225
|
-
var listCommand4 = new
|
|
3439
|
+
var import_commander21 = require("commander");
|
|
3440
|
+
var listCommand4 = new import_commander21.Command("list").description("Floating IP \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3226
3441
|
const opts = cmd.optsWithGlobals();
|
|
3227
3442
|
const { client } = await resolveNetworkClient(opts);
|
|
3228
3443
|
startSpinner("Floating IP \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -3249,9 +3464,9 @@ var listCommand4 = new import_commander19.Command("list").description("Floating
|
|
|
3249
3464
|
});
|
|
3250
3465
|
|
|
3251
3466
|
// src/commands/floatingip/create.ts
|
|
3252
|
-
var
|
|
3253
|
-
var
|
|
3254
|
-
var createCommand2 = new
|
|
3467
|
+
var import_commander22 = require("commander");
|
|
3468
|
+
var import_chalk6 = __toESM(require("chalk"));
|
|
3469
|
+
var createCommand2 = new import_commander22.Command("create").description("Floating IP \uB97C \uBC1C\uAE09\uD55C\uB2E4 (--network \uBBF8\uC9C0\uC815 \uC2DC \uC678\uBD80 VPC \uC790\uB3D9 \uC870\uD68C)").option("--network <id>", "\uC678\uBD80 \uB124\uD2B8\uC6CC\uD06C(VPC) id (\uBBF8\uC9C0\uC815 \uC2DC router:external=true \uC790\uB3D9 \uC870\uD68C)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3255
3470
|
const opts = cmd.optsWithGlobals();
|
|
3256
3471
|
const { client } = await resolveNetworkClient(opts);
|
|
3257
3472
|
let networkId = opts.network;
|
|
@@ -3282,7 +3497,7 @@ var createCommand2 = new import_commander20.Command("create").description("Float
|
|
|
3282
3497
|
}
|
|
3283
3498
|
stopSpinner(true);
|
|
3284
3499
|
process.stderr.write(
|
|
3285
|
-
|
|
3500
|
+
import_chalk6.default.green(`\u2713 Floating IP "${fip.floating_ip_address}" \uB97C \uBC1C\uAE09\uD588\uC2B5\uB2C8\uB2E4 (id: ${fip.id}).
|
|
3286
3501
|
`)
|
|
3287
3502
|
);
|
|
3288
3503
|
output(opts, {
|
|
@@ -3294,9 +3509,9 @@ var createCommand2 = new import_commander20.Command("create").description("Float
|
|
|
3294
3509
|
});
|
|
3295
3510
|
|
|
3296
3511
|
// src/commands/floatingip/delete.ts
|
|
3297
|
-
var
|
|
3298
|
-
var
|
|
3299
|
-
var deleteCommand = new
|
|
3512
|
+
var import_commander23 = require("commander");
|
|
3513
|
+
var import_chalk7 = __toESM(require("chalk"));
|
|
3514
|
+
var deleteCommand = new import_commander23.Command("delete").description("Floating IP \uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "Floating IP ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3300
3515
|
const opts = cmd.optsWithGlobals();
|
|
3301
3516
|
const isTTY = process.stdin.isTTY;
|
|
3302
3517
|
if (!isTTY && !opts.yes) {
|
|
@@ -3312,7 +3527,7 @@ var deleteCommand = new import_commander21.Command("delete").description("Floati
|
|
|
3312
3527
|
default: false
|
|
3313
3528
|
});
|
|
3314
3529
|
if (!ok) {
|
|
3315
|
-
process.stderr.write(
|
|
3530
|
+
process.stderr.write(import_chalk7.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
3316
3531
|
return;
|
|
3317
3532
|
}
|
|
3318
3533
|
}
|
|
@@ -3325,13 +3540,13 @@ var deleteCommand = new import_commander21.Command("delete").description("Floati
|
|
|
3325
3540
|
throw err;
|
|
3326
3541
|
}
|
|
3327
3542
|
stopSpinner(true);
|
|
3328
|
-
process.stderr.write(
|
|
3543
|
+
process.stderr.write(import_chalk7.default.green(`\u2713 Floating IP "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
3329
3544
|
`));
|
|
3330
3545
|
});
|
|
3331
3546
|
|
|
3332
3547
|
// src/commands/instance/flavors.ts
|
|
3333
|
-
var
|
|
3334
|
-
var flavorsCommand = new
|
|
3548
|
+
var import_commander24 = require("commander");
|
|
3549
|
+
var flavorsCommand = new import_commander24.Command("flavors").description("\uC778\uC2A4\uD134\uC2A4 \uD0C0\uC785(flavor)\uC744 \uC870\uD68C\uD55C\uB2E4 (\uAE30\uBCF8 id\xB7name, --detail \uB85C \uC2A4\uD399, \uC804\uCCB4 \uD544\uB4DC\uB294 --json)").option("--detail", "vcpus\xB7ram\xB7disk \uB4F1 \uC2A4\uD399 \uD3EC\uD568 (GET /flavors/detail)").option("--min-disk <gb>", "\uCD5C\uC18C \uBE14\uB85D \uC2A4\uD1A0\uB9AC\uC9C0 \uD06C\uAE30(GB) \uC774\uC0C1\uB9CC \uD544\uD130").option("--min-ram <mb>", "\uCD5C\uC18C RAM \uD06C\uAE30(MB) \uC774\uC0C1\uB9CC \uD544\uD130").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3335
3550
|
const opts = cmd.optsWithGlobals();
|
|
3336
3551
|
const minDisk = parseNonNegativeIntegerOption(opts.minDisk, "--min-disk");
|
|
3337
3552
|
const minRam = parseNonNegativeIntegerOption(opts.minRam, "--min-ram");
|
|
@@ -3374,8 +3589,8 @@ function isDetailList(flavors) {
|
|
|
3374
3589
|
}
|
|
3375
3590
|
|
|
3376
3591
|
// src/commands/instance/availability-zones.ts
|
|
3377
|
-
var
|
|
3378
|
-
var availabilityZonesCommand = new
|
|
3592
|
+
var import_commander25 = require("commander");
|
|
3593
|
+
var availabilityZonesCommand = new import_commander25.Command("availability-zones").description("\uAC00\uC6A9\uC131 \uC601\uC5ED(availability zone) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (zoneName\xB7available)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3379
3594
|
const opts = cmd.optsWithGlobals();
|
|
3380
3595
|
const { client } = await resolveInstanceClient(opts);
|
|
3381
3596
|
startSpinner("\uAC00\uC6A9\uC131 \uC601\uC5ED \uC870\uD68C \uC911...");
|
|
@@ -3396,14 +3611,14 @@ var availabilityZonesCommand = new import_commander23.Command("availability-zone
|
|
|
3396
3611
|
});
|
|
3397
3612
|
|
|
3398
3613
|
// src/commands/instance/get.ts
|
|
3399
|
-
var
|
|
3614
|
+
var import_commander26 = require("commander");
|
|
3400
3615
|
function getIps2(server) {
|
|
3401
3616
|
return Object.values(server.addresses).flat().map((a) => a.addr).join(", ");
|
|
3402
3617
|
}
|
|
3403
3618
|
function getImageId(server) {
|
|
3404
3619
|
return typeof server.image === "object" ? server.image.id : "";
|
|
3405
3620
|
}
|
|
3406
|
-
var getCommand2 = new
|
|
3621
|
+
var getCommand2 = new import_commander26.Command("get").description("\uB2E8\uC77C \uC778\uC2A4\uD134\uC2A4 \uC0C1\uD0DC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3407
3622
|
const opts = cmd.optsWithGlobals();
|
|
3408
3623
|
const { client } = await resolveInstanceClient(opts);
|
|
3409
3624
|
startSpinner("\uC778\uC2A4\uD134\uC2A4 \uC870\uD68C \uC911...");
|
|
@@ -3435,9 +3650,9 @@ var getCommand2 = new import_commander24.Command("get").description("\uB2E8\uC77
|
|
|
3435
3650
|
});
|
|
3436
3651
|
|
|
3437
3652
|
// src/commands/instance/create.ts
|
|
3438
|
-
var
|
|
3653
|
+
var import_commander27 = require("commander");
|
|
3439
3654
|
var import_node_fs5 = require("fs");
|
|
3440
|
-
var
|
|
3655
|
+
var import_chalk8 = __toESM(require("chalk"));
|
|
3441
3656
|
function getFirstIp(server) {
|
|
3442
3657
|
for (const list of Object.values(server.addresses)) {
|
|
3443
3658
|
for (const addr of list) {
|
|
@@ -3452,7 +3667,7 @@ function getIps3(server) {
|
|
|
3452
3667
|
function getImageId2(server) {
|
|
3453
3668
|
return typeof server.image === "object" ? server.image.id : "";
|
|
3454
3669
|
}
|
|
3455
|
-
var createCommand3 = new
|
|
3670
|
+
var createCommand3 = new import_commander27.Command("create").description("\uC778\uC2A4\uD134\uC2A4\uB97C \uC0DD\uC131\uD55C\uB2E4").requiredOption("--name <name>", "\uC778\uC2A4\uD134\uC2A4 \uC774\uB984").requiredOption("--flavor <id>", "flavor ID").requiredOption("--image <id>", "\uC774\uBBF8\uC9C0 ID").requiredOption("--network <uuid>", "\uB124\uD2B8\uC6CC\uD06C UUID (\uC5EC\uB7EC \uAC1C: \uBC18\uBCF5 \uC9C0\uC815)", (v, prev) => [...prev, v], []).option("--boot-volume-size <gb>", "boot-from-volume root \uBCFC\uB968 \uD06C\uAE30 (GB). GPU(g2) \uB4F1 boot-from-volume \uD544\uC218 flavor \uC5D0 \uC9C0\uC815").option("--key-name <name>", "\uD0A4\uD398\uC5B4 \uC774\uB984").option("--security-group <name>", "\uBCF4\uC548 \uADF8\uB8F9 \uC774\uB984 (\uC5EC\uB7EC \uAC1C: \uBC18\uBCF5 \uC9C0\uC815)", (v, prev) => [...prev, v], []).option("--ephemeral-disk-size <gb>", "\uC784\uC2DC \uB514\uC2A4\uD06C \uD06C\uAE30 (GB, NHN \uD655\uC7A5)").option("--protect", "\uC0AD\uC81C \uBC29\uC9C0 \uC124\uC815 (NHN \uD655\uC7A5)").option("--user-data <path>", "cloud-init user-data \uD30C\uC77C \uACBD\uB85C (base64 \uC778\uCF54\uB529\uD574 \uC8FC\uC785, \uC778\uCF54\uB529 \uD6C4 65535 \uBC14\uC774\uD2B8 \uD55C\uB3C4)").option("--wait", "ACTIVE \uC0C1\uD0DC\uAC00 \uB420 \uB54C\uAE4C\uC9C0 \uB300\uAE30").option("--timeout <sec>", "wait \uD0C0\uC784\uC544\uC6C3 (\uCD08, \uAE30\uBCF8 300)", "300").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3456
3671
|
const opts = cmd.optsWithGlobals();
|
|
3457
3672
|
const networks = opts.network ?? [];
|
|
3458
3673
|
if (networks.length === 0) {
|
|
@@ -3531,7 +3746,7 @@ var createCommand3 = new import_commander25.Command("create").description("\uC77
|
|
|
3531
3746
|
return;
|
|
3532
3747
|
}
|
|
3533
3748
|
if (opts.wait) {
|
|
3534
|
-
process.stderr.write(
|
|
3749
|
+
process.stderr.write(import_chalk8.default.green(` IP: ${getIps3(server)}
|
|
3535
3750
|
`));
|
|
3536
3751
|
}
|
|
3537
3752
|
const rows = [
|
|
@@ -3551,9 +3766,9 @@ var createCommand3 = new import_commander25.Command("create").description("\uC77
|
|
|
3551
3766
|
});
|
|
3552
3767
|
|
|
3553
3768
|
// src/commands/instance/delete.ts
|
|
3554
|
-
var
|
|
3555
|
-
var
|
|
3556
|
-
var deleteCommand2 = new
|
|
3769
|
+
var import_commander28 = require("commander");
|
|
3770
|
+
var import_chalk9 = __toESM(require("chalk"));
|
|
3771
|
+
var deleteCommand2 = new import_commander28.Command("delete").description("\uC778\uC2A4\uD134\uC2A4\uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3557
3772
|
const opts = cmd.optsWithGlobals();
|
|
3558
3773
|
const isTTY = process.stdin.isTTY;
|
|
3559
3774
|
if (!isTTY && !opts.yes) {
|
|
@@ -3569,7 +3784,7 @@ var deleteCommand2 = new import_commander26.Command("delete").description("\uC77
|
|
|
3569
3784
|
default: false
|
|
3570
3785
|
});
|
|
3571
3786
|
if (!ok) {
|
|
3572
|
-
process.stderr.write(
|
|
3787
|
+
process.stderr.write(import_chalk9.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
3573
3788
|
return;
|
|
3574
3789
|
}
|
|
3575
3790
|
}
|
|
@@ -3582,14 +3797,14 @@ var deleteCommand2 = new import_commander26.Command("delete").description("\uC77
|
|
|
3582
3797
|
throw err;
|
|
3583
3798
|
}
|
|
3584
3799
|
stopSpinner(true);
|
|
3585
|
-
process.stderr.write(
|
|
3800
|
+
process.stderr.write(import_chalk9.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
3586
3801
|
`));
|
|
3587
3802
|
});
|
|
3588
3803
|
|
|
3589
3804
|
// src/commands/instance/power.ts
|
|
3590
|
-
var
|
|
3591
|
-
var
|
|
3592
|
-
var startCommand = new
|
|
3805
|
+
var import_commander29 = require("commander");
|
|
3806
|
+
var import_chalk10 = __toESM(require("chalk"));
|
|
3807
|
+
var startCommand = new import_commander29.Command("start").description("\uC778\uC2A4\uD134\uC2A4\uB97C \uC2DC\uC791\uD55C\uB2E4 (SHUTOFF \u2192 ACTIVE)").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3593
3808
|
const opts = cmd.optsWithGlobals();
|
|
3594
3809
|
const { client } = await resolveInstanceClient(opts);
|
|
3595
3810
|
startSpinner(`\uC778\uC2A4\uD134\uC2A4 \uC2DC\uC791 \uC911... (id: ${id})`);
|
|
@@ -3600,10 +3815,10 @@ var startCommand = new import_commander27.Command("start").description("\uC778\u
|
|
|
3600
3815
|
throw err;
|
|
3601
3816
|
}
|
|
3602
3817
|
stopSpinner(true);
|
|
3603
|
-
process.stderr.write(
|
|
3818
|
+
process.stderr.write(import_chalk10.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uC2DC\uC791\uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\u2192 ACTIVE).
|
|
3604
3819
|
`));
|
|
3605
3820
|
});
|
|
3606
|
-
var stopCommand = new
|
|
3821
|
+
var stopCommand = new import_commander29.Command("stop").description("\uC778\uC2A4\uD134\uC2A4\uB97C \uC815\uC9C0\uD55C\uB2E4 (ACTIVE/ERROR \u2192 SHUTOFF)").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3607
3822
|
const opts = cmd.optsWithGlobals();
|
|
3608
3823
|
const { client } = await resolveInstanceClient(opts);
|
|
3609
3824
|
startSpinner(`\uC778\uC2A4\uD134\uC2A4 \uC815\uC9C0 \uC911... (id: ${id})`);
|
|
@@ -3614,10 +3829,10 @@ var stopCommand = new import_commander27.Command("stop").description("\uC778\uC2
|
|
|
3614
3829
|
throw err;
|
|
3615
3830
|
}
|
|
3616
3831
|
stopSpinner(true);
|
|
3617
|
-
process.stderr.write(
|
|
3832
|
+
process.stderr.write(import_chalk10.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uC815\uC9C0\uB97C \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\u2192 SHUTOFF).
|
|
3618
3833
|
`));
|
|
3619
3834
|
});
|
|
3620
|
-
var rebootCommand = new
|
|
3835
|
+
var rebootCommand = new import_commander29.Command("reboot").description("\uC778\uC2A4\uD134\uC2A4\uB97C \uC7AC\uBD80\uD305\uD55C\uB2E4 (\uAE30\uBCF8 SOFT, --hard \uB85C HARD)").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--hard", "HARD \uC7AC\uBD80\uD305 (\uAC15\uC81C \uC804\uC6D0 cycle, \uAE30\uBCF8\uC740 SOFT)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3621
3836
|
const opts = cmd.optsWithGlobals();
|
|
3622
3837
|
const { client } = await resolveInstanceClient(opts);
|
|
3623
3838
|
const type = opts.hard ? "HARD" : "SOFT";
|
|
@@ -3629,14 +3844,14 @@ var rebootCommand = new import_commander27.Command("reboot").description("\uC778
|
|
|
3629
3844
|
throw err;
|
|
3630
3845
|
}
|
|
3631
3846
|
stopSpinner(true);
|
|
3632
|
-
process.stderr.write(
|
|
3847
|
+
process.stderr.write(import_chalk10.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" ${type} \uC7AC\uBD80\uD305\uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4.
|
|
3633
3848
|
`));
|
|
3634
3849
|
});
|
|
3635
3850
|
|
|
3636
3851
|
// src/commands/instance/resize.ts
|
|
3637
|
-
var
|
|
3638
|
-
var
|
|
3639
|
-
var resizeCommand = new
|
|
3852
|
+
var import_commander30 = require("commander");
|
|
3853
|
+
var import_chalk11 = __toESM(require("chalk"));
|
|
3854
|
+
var resizeCommand = new import_commander30.Command("resize").description("\uC778\uC2A4\uD134\uC2A4 \uD0C0\uC785(flavor)\uC744 \uBCC0\uACBD\uD55C\uB2E4").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").requiredOption("--flavor <id>", "\uBCC0\uACBD\uD560 flavor ID (instance flavors \uB85C \uD6C4\uBCF4 \uC870\uD68C)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3640
3855
|
const opts = cmd.optsWithGlobals();
|
|
3641
3856
|
const { client } = await resolveInstanceClient(opts);
|
|
3642
3857
|
startSpinner(`\uC778\uC2A4\uD134\uC2A4 \uD0C0\uC785 \uBCC0\uACBD \uC911... (id: ${id})`);
|
|
@@ -3648,13 +3863,13 @@ var resizeCommand = new import_commander28.Command("resize").description("\uC778
|
|
|
3648
3863
|
}
|
|
3649
3864
|
stopSpinner(true);
|
|
3650
3865
|
process.stderr.write(
|
|
3651
|
-
|
|
3866
|
+
import_chalk11.default.green(
|
|
3652
3867
|
`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uD0C0\uC785 \uBCC0\uACBD(flavor: ${opts.flavor}) \uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\u2192 VERIFY_RESIZE, instance get \uC73C\uB85C \uD655\uC778 \uD6C4 resize-confirm/resize-revert).
|
|
3653
3868
|
`
|
|
3654
3869
|
)
|
|
3655
3870
|
);
|
|
3656
3871
|
});
|
|
3657
|
-
var resizeConfirmCommand = new
|
|
3872
|
+
var resizeConfirmCommand = new import_commander30.Command("resize-confirm").description("resize \uB97C \uD655\uC815\uD55C\uB2E4 (VERIFY_RESIZE \u2192 ACTIVE, \uC0C8 flavor \uB85C \uACE0\uC815)").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3658
3873
|
const opts = cmd.optsWithGlobals();
|
|
3659
3874
|
const { client } = await resolveInstanceClient(opts);
|
|
3660
3875
|
startSpinner(`resize \uD655\uC815 \uC911... (id: ${id})`);
|
|
@@ -3665,10 +3880,10 @@ var resizeConfirmCommand = new import_commander28.Command("resize-confirm").desc
|
|
|
3665
3880
|
throw err;
|
|
3666
3881
|
}
|
|
3667
3882
|
stopSpinner(true);
|
|
3668
|
-
process.stderr.write(
|
|
3883
|
+
process.stderr.write(import_chalk11.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" resize \uD655\uC815\uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\u2192 ACTIVE).
|
|
3669
3884
|
`));
|
|
3670
3885
|
});
|
|
3671
|
-
var resizeRevertCommand = new
|
|
3886
|
+
var resizeRevertCommand = new import_commander30.Command("resize-revert").description("resize \uB97C \uB864\uBC31\uD55C\uB2E4 (VERIFY_RESIZE \u2192 ACTIVE, \uC774\uC804 flavor \uB85C \uBCF5\uADC0)").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3672
3887
|
const opts = cmd.optsWithGlobals();
|
|
3673
3888
|
const { client } = await resolveInstanceClient(opts);
|
|
3674
3889
|
startSpinner(`resize \uB864\uBC31 \uC911... (id: ${id})`);
|
|
@@ -3680,15 +3895,15 @@ var resizeRevertCommand = new import_commander28.Command("resize-revert").descri
|
|
|
3680
3895
|
}
|
|
3681
3896
|
stopSpinner(true);
|
|
3682
3897
|
process.stderr.write(
|
|
3683
|
-
|
|
3898
|
+
import_chalk11.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" resize \uB864\uBC31\uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\uC774\uC804 flavor \uB85C \uBCF5\uADC0).
|
|
3684
3899
|
`)
|
|
3685
3900
|
);
|
|
3686
3901
|
});
|
|
3687
3902
|
|
|
3688
3903
|
// src/commands/instance/images.ts
|
|
3689
|
-
var
|
|
3904
|
+
var import_commander31 = require("commander");
|
|
3690
3905
|
var VISIBILITY_VALUES = ["public", "private", "shared"];
|
|
3691
|
-
var imagesCommand = new
|
|
3906
|
+
var imagesCommand = new import_commander31.Command("images").description("\uC774\uBBF8\uC9C0 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (create --image <id> \uC18C\uC2A4, \uC804\uCCB4 \uD544\uB4DC\uB294 --json)").option("--limit <n>", "\uD55C \uD398\uC774\uC9C0 \uCD5C\uB300 \uAC1C\uC218 (\uAE30\uBCF8: \uC11C\uBC84 \uAE30\uBCF8\uAC12 25)").option("--marker <id>", "\uC774 image id \uB2E4\uC74C\uBD80\uD130 \uC870\uD68C (\uD398\uC774\uC9C0\uB124\uC774\uC158)").option("--name <name>", "\uC774\uB984\uC73C\uB85C \uD544\uD130").option("--visibility <v>", `\uB178\uCD9C \uBC94\uC704 \uD544\uD130 (${VISIBILITY_VALUES.join("|")})`).option("--owner <id>", "\uC18C\uC720\uC790(\uD504\uB85C\uC81D\uD2B8 id)\uB85C \uD544\uD130").option("--status <status>", "\uC0C1\uD0DC\uB85C \uD544\uD130 (\uC608: active)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3692
3907
|
const opts = cmd.optsWithGlobals();
|
|
3693
3908
|
const limit = parsePositiveIntegerOption(opts.limit, "--limit");
|
|
3694
3909
|
if (opts.visibility !== void 0 && !VISIBILITY_VALUES.includes(opts.visibility)) {
|
|
@@ -3736,8 +3951,8 @@ var imagesCommand = new import_commander29.Command("images").description("\uC774
|
|
|
3736
3951
|
});
|
|
3737
3952
|
|
|
3738
3953
|
// src/commands/instance/keypairs.ts
|
|
3739
|
-
var
|
|
3740
|
-
var keypairsCommand = new
|
|
3954
|
+
var import_commander32 = require("commander");
|
|
3955
|
+
var keypairsCommand = new import_commander32.Command("keypairs").description("\uD0A4\uD398\uC5B4 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (name\xB7fingerprint, \uC804\uCCB4 \uD544\uB4DC\uB294 --json)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3741
3956
|
const opts = cmd.optsWithGlobals();
|
|
3742
3957
|
const { client } = await resolveInstanceClient(opts);
|
|
3743
3958
|
startSpinner("\uD0A4\uD398\uC5B4 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -3758,10 +3973,10 @@ var keypairsCommand = new import_commander30.Command("keypairs").description("\u
|
|
|
3758
3973
|
});
|
|
3759
3974
|
|
|
3760
3975
|
// src/commands/instance/keypair.ts
|
|
3761
|
-
var
|
|
3976
|
+
var import_commander33 = require("commander");
|
|
3762
3977
|
var import_node_fs6 = require("fs");
|
|
3763
3978
|
var import_node_crypto3 = require("crypto");
|
|
3764
|
-
var
|
|
3979
|
+
var import_chalk12 = __toESM(require("chalk"));
|
|
3765
3980
|
function resolvePublicKey(value) {
|
|
3766
3981
|
let stat;
|
|
3767
3982
|
try {
|
|
@@ -3801,7 +4016,7 @@ function savePrivateKey(filePath, privateKey) {
|
|
|
3801
4016
|
);
|
|
3802
4017
|
}
|
|
3803
4018
|
}
|
|
3804
|
-
var getKeypairCmd = new
|
|
4019
|
+
var getKeypairCmd = new import_commander33.Command("get").description("\uB2E8\uC77C \uD0A4\uD398\uC5B4\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<name>", "\uD0A4\uD398\uC5B4 \uC774\uB984").option("--region <region>", "region override").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (name, _opts, cmd) => {
|
|
3805
4020
|
const opts = cmd.optsWithGlobals();
|
|
3806
4021
|
const { client } = await resolveInstanceClient(opts);
|
|
3807
4022
|
startSpinner("\uD0A4\uD398\uC5B4 \uC870\uD68C \uC911...");
|
|
@@ -3826,7 +4041,7 @@ var getKeypairCmd = new import_commander31.Command("get").description("\uB2E8\uC
|
|
|
3826
4041
|
ids: [kp.name]
|
|
3827
4042
|
});
|
|
3828
4043
|
});
|
|
3829
|
-
var createKeypairCmd = new
|
|
4044
|
+
var createKeypairCmd = new import_commander33.Command("create").description("\uD0A4\uD398\uC5B4\uB97C \uC0DD\uC131\uD55C\uB2E4 (--public-key \uBBF8\uC9C0\uC815 \uC2DC NHN \uC774 \uD0A4\uC30D \uC0DD\uC131 \u2014 private_key 1\uD68C\uC131)").argument("<name>", "\uD0A4\uD398\uC5B4 \uC774\uB984").option("--public-key <path|key>", "\uAE30\uC874 \uACF5\uAC1C\uD0A4 (\uD30C\uC77C \uACBD\uB85C \uB610\uB294 \uD0A4 \uBB38\uC790\uC5F4). \uC9C0\uC815 \uC2DC private_key \uBBF8\uBC18\uD658").option("-o, --output <keyfile>", "\uC0DD\uC131\uB41C private_key \uB97C \uD30C\uC77C(mode 0600)\uB85C \uC800\uC7A5").option("--region <region>", "region override").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (name, _opts, cmd) => {
|
|
3830
4045
|
const opts = cmd.optsWithGlobals();
|
|
3831
4046
|
const publicKey = opts.publicKey !== void 0 ? resolvePublicKey(opts.publicKey) : void 0;
|
|
3832
4047
|
if (opts.output !== void 0 && publicKey !== void 0) {
|
|
@@ -3855,19 +4070,19 @@ var createKeypairCmd = new import_commander31.Command("create").description("\uD
|
|
|
3855
4070
|
if (opts.output !== void 0) {
|
|
3856
4071
|
try {
|
|
3857
4072
|
savePrivateKey(opts.output, result.private_key);
|
|
3858
|
-
process.stderr.write(
|
|
4073
|
+
process.stderr.write(import_chalk12.default.green(` private_key \uB97C ${opts.output} \uC5D0 \uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4 (mode 0600).
|
|
3859
4074
|
`));
|
|
3860
4075
|
} catch (saveErr) {
|
|
3861
4076
|
const reason = saveErr instanceof Error ? saveErr.message : String(saveErr);
|
|
3862
4077
|
process.stderr.write(
|
|
3863
|
-
|
|
4078
|
+
import_chalk12.default.red(` \u26A0 private_key \uD30C\uC77C \uC800\uC7A5 \uC2E4\uD328 (${reason}). \uC720\uC2E4 \uBC29\uC9C0\uB97C \uC704\uD574 \uC544\uB798\uC5D0 \uCD9C\uB825\uD569\uB2C8\uB2E4 \u2014 \uC989\uC2DC \uC548\uC804\uD55C \uACF3\uC5D0 \uBCF4\uAD00\uD558\uC138\uC694.
|
|
3864
4079
|
`)
|
|
3865
4080
|
);
|
|
3866
4081
|
process.stdout.write(result.private_key + "\n");
|
|
3867
4082
|
}
|
|
3868
4083
|
} else {
|
|
3869
4084
|
process.stderr.write(
|
|
3870
|
-
|
|
4085
|
+
import_chalk12.default.yellow(" \u26A0 private_key \uB294 \uC9C0\uAE08 \uD55C \uBC88\uB9CC \uD45C\uC2DC\uB429\uB2C8\uB2E4. \uBD84\uC2E4 \uC2DC \uBCF5\uAD6C \uBD88\uAC00 \u2014 \uC548\uC804\uD55C \uACF3\uC5D0 \uBCF4\uAD00\uD558\uC138\uC694.\n")
|
|
3871
4086
|
);
|
|
3872
4087
|
process.stdout.write(result.private_key + "\n");
|
|
3873
4088
|
}
|
|
@@ -3885,7 +4100,7 @@ var createKeypairCmd = new import_commander31.Command("create").description("\uD
|
|
|
3885
4100
|
ids: [meta.name]
|
|
3886
4101
|
});
|
|
3887
4102
|
});
|
|
3888
|
-
var deleteKeypairCmd = new
|
|
4103
|
+
var deleteKeypairCmd = new import_commander33.Command("delete").description("\uD0A4\uD398\uC5B4\uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<name>", "\uD0A4\uD398\uC5B4 \uC774\uB984").option("--region <region>", "region override").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (name, _opts, cmd) => {
|
|
3889
4104
|
const opts = cmd.optsWithGlobals();
|
|
3890
4105
|
const { client } = await resolveInstanceClient(opts);
|
|
3891
4106
|
startSpinner("\uD0A4\uD398\uC5B4 \uC0AD\uC81C \uC911...");
|
|
@@ -3896,15 +4111,15 @@ var deleteKeypairCmd = new import_commander31.Command("delete").description("\uD
|
|
|
3896
4111
|
throw err;
|
|
3897
4112
|
}
|
|
3898
4113
|
stopSpinner(true);
|
|
3899
|
-
process.stderr.write(
|
|
4114
|
+
process.stderr.write(import_chalk12.default.green(`\u2713 \uD0A4\uD398\uC5B4 "${name}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
3900
4115
|
`));
|
|
3901
4116
|
});
|
|
3902
|
-
var keypairCommand = new
|
|
4117
|
+
var keypairCommand = new import_commander33.Command("keypair").description("\uD0A4\uD398\uC5B4 \uB2E8\uAC74 \uAD00\uB9AC (get / create / delete)").addCommand(getKeypairCmd).addCommand(createKeypairCmd).addCommand(deleteKeypairCmd);
|
|
3903
4118
|
|
|
3904
4119
|
// src/commands/instance/volume.ts
|
|
3905
|
-
var
|
|
3906
|
-
var
|
|
3907
|
-
var attachCommand = new
|
|
4120
|
+
var import_commander34 = require("commander");
|
|
4121
|
+
var import_chalk13 = __toESM(require("chalk"));
|
|
4122
|
+
var attachCommand = new import_commander34.Command("attach").description("\uBCFC\uB968\uC744 \uC778\uC2A4\uD134\uC2A4\uC5D0 \uC5F0\uACB0\uD55C\uB2E4").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").requiredOption("--volume <volumeId>", "\uC5F0\uACB0\uD560 \uBCFC\uB968 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3908
4123
|
const opts = cmd.optsWithGlobals();
|
|
3909
4124
|
const { client } = await resolveInstanceClient(opts);
|
|
3910
4125
|
startSpinner("\uBCFC\uB968 \uC5F0\uACB0 \uC911...");
|
|
@@ -3917,7 +4132,7 @@ var attachCommand = new import_commander32.Command("attach").description("\uBCFC
|
|
|
3917
4132
|
}
|
|
3918
4133
|
stopSpinner(true);
|
|
3919
4134
|
process.stderr.write(
|
|
3920
|
-
|
|
4135
|
+
import_chalk13.default.green(`\uBCFC\uB968 \uC5F0\uACB0 \uC644\uB8CC (volumeId: ${att.volumeId}, device: ${att.device})
|
|
3921
4136
|
`)
|
|
3922
4137
|
);
|
|
3923
4138
|
output(opts, {
|
|
@@ -3932,7 +4147,7 @@ var attachCommand = new import_commander32.Command("attach").description("\uBCFC
|
|
|
3932
4147
|
ids: [att.id]
|
|
3933
4148
|
});
|
|
3934
4149
|
});
|
|
3935
|
-
var detachCommand = new
|
|
4150
|
+
var detachCommand = new import_commander34.Command("detach").description("\uBCFC\uB968 \uC5F0\uACB0\uC744 \uD574\uC81C\uD55C\uB2E4").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").argument("<volumeId>", "\uD574\uC81C\uD560 \uBCFC\uB968 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, volumeId, _opts, cmd) => {
|
|
3936
4151
|
const opts = cmd.optsWithGlobals();
|
|
3937
4152
|
const { client } = await resolveInstanceClient(opts);
|
|
3938
4153
|
startSpinner("\uBCFC\uB968 \uC5F0\uACB0 \uD574\uC81C \uC911...");
|
|
@@ -3944,19 +4159,19 @@ var detachCommand = new import_commander32.Command("detach").description("\uBCFC
|
|
|
3944
4159
|
}
|
|
3945
4160
|
stopSpinner(true);
|
|
3946
4161
|
process.stderr.write(
|
|
3947
|
-
|
|
4162
|
+
import_chalk13.default.green(`\uBCFC\uB968 \uC5F0\uACB0 \uD574\uC81C \uC694\uCCAD \uC644\uB8CC (volumeId: ${volumeId})
|
|
3948
4163
|
`)
|
|
3949
4164
|
);
|
|
3950
4165
|
});
|
|
3951
|
-
var volumeCommand = new
|
|
4166
|
+
var volumeCommand = new import_commander34.Command("volume").description(
|
|
3952
4167
|
"\uC778\uC2A4\uD134\uC2A4 \uBCFC\uB968 \uC5F0\uACB0/\uD574\uC81C"
|
|
3953
4168
|
);
|
|
3954
4169
|
volumeCommand.addCommand(attachCommand);
|
|
3955
4170
|
volumeCommand.addCommand(detachCommand);
|
|
3956
4171
|
|
|
3957
4172
|
// src/commands/instance/volumes.ts
|
|
3958
|
-
var
|
|
3959
|
-
var volumesCommand = new
|
|
4173
|
+
var import_commander35 = require("commander");
|
|
4174
|
+
var volumesCommand = new import_commander35.Command("volumes").description("\uC778\uC2A4\uD134\uC2A4\uC5D0 \uC5F0\uACB0\uB41C \uBCFC\uB968 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
3960
4175
|
const opts = cmd.optsWithGlobals();
|
|
3961
4176
|
const { client } = await resolveInstanceClient(opts);
|
|
3962
4177
|
startSpinner("\uBCFC\uB968 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -3977,7 +4192,7 @@ var volumesCommand = new import_commander33.Command("volumes").description("\uC7
|
|
|
3977
4192
|
});
|
|
3978
4193
|
|
|
3979
4194
|
// src/commands/ncr/list.ts
|
|
3980
|
-
var
|
|
4195
|
+
var import_commander36 = require("commander");
|
|
3981
4196
|
|
|
3982
4197
|
// src/services/ncr/harbor-client.ts
|
|
3983
4198
|
var import_ky10 = __toESM(require("ky"));
|
|
@@ -4004,12 +4219,12 @@ var HarborClient = class {
|
|
|
4004
4219
|
* ky.get() 이 Response 를 반환하므로 .json() 과 .headers.get("link") 를 함께 사용한다
|
|
4005
4220
|
* (체이닝하면 헤더를 못 본다 — 기존 NCR client 의 .json<T>() 체이닝 패턴과 다름).
|
|
4006
4221
|
*/
|
|
4007
|
-
async getAllPages(
|
|
4222
|
+
async getAllPages(path3) {
|
|
4008
4223
|
const acc = [];
|
|
4009
4224
|
let page = 1;
|
|
4010
4225
|
try {
|
|
4011
4226
|
for (; ; ) {
|
|
4012
|
-
const url = `https://${this.host}${
|
|
4227
|
+
const url = `https://${this.host}${path3}?page=${page}&page_size=${PAGE_SIZE}`;
|
|
4013
4228
|
const res = await import_ky10.default.get(url, {
|
|
4014
4229
|
headers: this.basicAuthHeaders(),
|
|
4015
4230
|
retry: 0,
|
|
@@ -4116,7 +4331,7 @@ function parseHarborHost(uri) {
|
|
|
4116
4331
|
}
|
|
4117
4332
|
|
|
4118
4333
|
// src/commands/ncr/list.ts
|
|
4119
|
-
var listCommand5 = new
|
|
4334
|
+
var listCommand5 = new import_commander36.Command("list").description("NCR \uB808\uC9C0\uC2A4\uD2B8\uB9AC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--app-key <key>", "NCR appKey (profile \uC758 ncr.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
4120
4335
|
const opts = cmd.optsWithGlobals();
|
|
4121
4336
|
const { client, profileName } = await createNcrClient(opts);
|
|
4122
4337
|
const appKey = await resolveAppKey(profileName, opts.appKey);
|
|
@@ -4142,8 +4357,8 @@ var listCommand5 = new import_commander34.Command("list").description("NCR \uB80
|
|
|
4142
4357
|
});
|
|
4143
4358
|
|
|
4144
4359
|
// src/commands/ncr/get.ts
|
|
4145
|
-
var
|
|
4146
|
-
var getCommand3 = new
|
|
4360
|
+
var import_commander37 = require("commander");
|
|
4361
|
+
var getCommand3 = new import_commander37.Command("get").description("\uB2E8\uC77C NCR \uB808\uC9C0\uC2A4\uD2B8\uB9AC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<registry>", "\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uC774\uB984 \uB610\uB294 ID").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--app-key <key>", "NCR appKey (profile \uC758 ncr.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (registry, _opts, cmd) => {
|
|
4147
4362
|
const opts = cmd.optsWithGlobals();
|
|
4148
4363
|
if (!registry.trim()) {
|
|
4149
4364
|
throw new NhnCloudCliError(
|
|
@@ -4171,8 +4386,8 @@ var getCommand3 = new import_commander35.Command("get").description("\uB2E8\uC77
|
|
|
4171
4386
|
});
|
|
4172
4387
|
|
|
4173
4388
|
// src/commands/ncr/images.ts
|
|
4174
|
-
var
|
|
4175
|
-
var imagesCommand2 = new
|
|
4389
|
+
var import_commander38 = require("commander");
|
|
4390
|
+
var imagesCommand2 = new import_commander38.Command("images").description("\uB808\uC9C0\uC2A4\uD2B8\uB9AC\uC758 \uC774\uBBF8\uC9C0(repository) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<registry>", "\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uC774\uB984").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--app-key <key>", "NCR appKey (profile \uC758 ncr.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (registry, _opts, cmd) => {
|
|
4176
4391
|
const opts = cmd.optsWithGlobals();
|
|
4177
4392
|
if (!registry.trim()) {
|
|
4178
4393
|
throw new NhnCloudCliError(
|
|
@@ -4206,8 +4421,8 @@ var imagesCommand2 = new import_commander36.Command("images").description("\uB80
|
|
|
4206
4421
|
});
|
|
4207
4422
|
|
|
4208
4423
|
// src/commands/ncr/tags.ts
|
|
4209
|
-
var
|
|
4210
|
-
var tagsCommand = new
|
|
4424
|
+
var import_commander39 = require("commander");
|
|
4425
|
+
var tagsCommand = new import_commander39.Command("tags").description("\uD2B9\uC815 \uC774\uBBF8\uC9C0\uC758 \uD0DC\uADF8 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<registry>", "\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uC774\uB984").argument("<repository>", "\uC774\uBBF8\uC9C0(repository) \uC774\uB984 (\uC9E7\uC740 \uC774\uB984 \uB610\uB294 {project}/{repo})").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--app-key <key>", "NCR appKey (profile \uC758 ncr.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (registry, repository, _opts, cmd) => {
|
|
4211
4426
|
const opts = cmd.optsWithGlobals();
|
|
4212
4427
|
if (!registry.trim()) {
|
|
4213
4428
|
throw new NhnCloudCliError(
|
|
@@ -4248,7 +4463,7 @@ var tagsCommand = new import_commander37.Command("tags").description("\uD2B9\uC8
|
|
|
4248
4463
|
});
|
|
4249
4464
|
|
|
4250
4465
|
// src/commands/commands.ts
|
|
4251
|
-
var
|
|
4466
|
+
var import_commander40 = require("commander");
|
|
4252
4467
|
function commandPath(command) {
|
|
4253
4468
|
const names = [];
|
|
4254
4469
|
let current2 = command;
|
|
@@ -4259,15 +4474,15 @@ function commandPath(command) {
|
|
|
4259
4474
|
return names.join(" ");
|
|
4260
4475
|
}
|
|
4261
4476
|
function collectCommand(command) {
|
|
4262
|
-
const
|
|
4263
|
-
if (!
|
|
4477
|
+
const path3 = commandPath(command);
|
|
4478
|
+
if (!path3 || path3 === "help") return null;
|
|
4264
4479
|
return {
|
|
4265
|
-
path,
|
|
4480
|
+
path: path3,
|
|
4266
4481
|
description: command.description() || command.summary() || "",
|
|
4267
4482
|
arguments: command.registeredArguments.map((arg) => arg.name()),
|
|
4268
4483
|
options: command.options.filter((option) => !option.hidden).map((option) => option.flags),
|
|
4269
4484
|
subcommands: command.commands.map((subcommand) => subcommand.name()).filter((name) => name !== "help"),
|
|
4270
|
-
...
|
|
4485
|
+
...path3 === "commands" ? { metadata: true } : {}
|
|
4271
4486
|
};
|
|
4272
4487
|
}
|
|
4273
4488
|
function collectCommandCatalog(program2) {
|
|
@@ -4286,7 +4501,7 @@ function collectCommandCatalog(program2) {
|
|
|
4286
4501
|
return { commands };
|
|
4287
4502
|
}
|
|
4288
4503
|
function createCommandsCommand(program2) {
|
|
4289
|
-
return new
|
|
4504
|
+
return new import_commander40.Command("commands").description("\uBA85\uB839 \uACBD\uB85C\uC640 \uC635\uC158 catalog\uB97C \uCD9C\uB825\uD55C\uB2E4").action((_opts, cmd) => {
|
|
4290
4505
|
const opts = cmd.optsWithGlobals();
|
|
4291
4506
|
const catalog = collectCommandCatalog(program2);
|
|
4292
4507
|
output(opts, {
|
|
@@ -4303,10 +4518,10 @@ function createCommandsCommand(program2) {
|
|
|
4303
4518
|
}
|
|
4304
4519
|
|
|
4305
4520
|
// src/commands/nks/supports.ts
|
|
4306
|
-
var
|
|
4521
|
+
var import_commander41 = require("commander");
|
|
4307
4522
|
|
|
4308
4523
|
// src/commands/nks/helpers.ts
|
|
4309
|
-
var
|
|
4524
|
+
var import_promises7 = require("fs/promises");
|
|
4310
4525
|
|
|
4311
4526
|
// src/services/nks/client.ts
|
|
4312
4527
|
var import_ky11 = __toESM(require("ky"));
|
|
@@ -4315,7 +4530,13 @@ var import_ky11 = __toESM(require("ky"));
|
|
|
4315
4530
|
function isNksClusterSummary(val) {
|
|
4316
4531
|
if (typeof val !== "object" || val === null) return false;
|
|
4317
4532
|
const obj = val;
|
|
4318
|
-
return typeof obj["uuid"] === "string" && typeof obj["name"] === "string" && typeof obj["status"] === "string" && typeof obj["health_status"] === "string" && (typeof obj["node_count"] === "number" || typeof obj["node_count"] === "string")
|
|
4533
|
+
return typeof obj["uuid"] === "string" && typeof obj["name"] === "string" && typeof obj["status"] === "string" && typeof obj["health_status"] === "string" && (typeof obj["node_count"] === "number" || typeof obj["node_count"] === "string");
|
|
4534
|
+
}
|
|
4535
|
+
function nksClusterKubeTag(cluster) {
|
|
4536
|
+
const fromLabels = cluster.labels?.["kube_tag"];
|
|
4537
|
+
if (typeof fromLabels === "string") return fromLabels;
|
|
4538
|
+
if (typeof cluster.kube_tag === "string") return cluster.kube_tag;
|
|
4539
|
+
return "-";
|
|
4319
4540
|
}
|
|
4320
4541
|
function isNksSupports(val) {
|
|
4321
4542
|
if (typeof val !== "object" || val === null) return false;
|
|
@@ -4735,22 +4956,22 @@ var NksClient = class {
|
|
|
4735
4956
|
throw toNhnCloudCliError(err);
|
|
4736
4957
|
}
|
|
4737
4958
|
}
|
|
4738
|
-
async getNamedResourceArray(key,
|
|
4739
|
-
const raw = await this.getJson(
|
|
4959
|
+
async getNamedResourceArray(key, path3, errorMessage) {
|
|
4960
|
+
const raw = await this.getJson(path3);
|
|
4740
4961
|
if (!isNamedResourceArrayResponse(key, raw)) {
|
|
4741
4962
|
throw new NhnCloudCliError(errorMessage, EXIT_API_ERROR);
|
|
4742
4963
|
}
|
|
4743
4964
|
return raw[key];
|
|
4744
4965
|
}
|
|
4745
|
-
async getFlatNamedResource(
|
|
4746
|
-
const raw = await this.getJson(
|
|
4966
|
+
async getFlatNamedResource(path3, errorMessage) {
|
|
4967
|
+
const raw = await this.getJson(path3);
|
|
4747
4968
|
if (!isNksNamedResource(raw)) {
|
|
4748
4969
|
throw new NhnCloudCliError(errorMessage, EXIT_API_ERROR);
|
|
4749
4970
|
}
|
|
4750
4971
|
return raw;
|
|
4751
4972
|
}
|
|
4752
|
-
async getJson(
|
|
4753
|
-
const url = `${this.nksEndpoint}${
|
|
4973
|
+
async getJson(path3, searchParams) {
|
|
4974
|
+
const url = `${this.nksEndpoint}${path3}`;
|
|
4754
4975
|
try {
|
|
4755
4976
|
return await import_ky11.default.get(url, {
|
|
4756
4977
|
headers: this.authHeaders(),
|
|
@@ -4762,15 +4983,15 @@ var NksClient = class {
|
|
|
4762
4983
|
throw toNhnCloudCliError(err);
|
|
4763
4984
|
}
|
|
4764
4985
|
}
|
|
4765
|
-
async requestUuid(method,
|
|
4766
|
-
const raw = await this.requestJson(method,
|
|
4986
|
+
async requestUuid(method, path3, payload, errorMessage) {
|
|
4987
|
+
const raw = await this.requestJson(method, path3, payload);
|
|
4767
4988
|
if (!isNksUuidResponse(raw)) {
|
|
4768
4989
|
throw new NhnCloudCliError(errorMessage, EXIT_API_ERROR);
|
|
4769
4990
|
}
|
|
4770
4991
|
return raw;
|
|
4771
4992
|
}
|
|
4772
|
-
async requestNoBody(method,
|
|
4773
|
-
const url = `${this.nksEndpoint}${
|
|
4993
|
+
async requestNoBody(method, path3, payload) {
|
|
4994
|
+
const url = `${this.nksEndpoint}${path3}`;
|
|
4774
4995
|
try {
|
|
4775
4996
|
if (method === "delete") {
|
|
4776
4997
|
await import_ky11.default.delete(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS7 });
|
|
@@ -4781,8 +5002,8 @@ var NksClient = class {
|
|
|
4781
5002
|
throw toNhnCloudCliError(err);
|
|
4782
5003
|
}
|
|
4783
5004
|
}
|
|
4784
|
-
async requestJson(method,
|
|
4785
|
-
const url = `${this.nksEndpoint}${
|
|
5005
|
+
async requestJson(method, path3, payload) {
|
|
5006
|
+
const url = `${this.nksEndpoint}${path3}`;
|
|
4786
5007
|
try {
|
|
4787
5008
|
const options = { headers: this.authHeaders(), json: payload, retry: 0, timeout: DEFAULT_TIMEOUT_MS7 };
|
|
4788
5009
|
return method === "post" ? await import_ky11.default.post(url, options).json() : await import_ky11.default.patch(url, options).json();
|
|
@@ -4805,13 +5026,13 @@ async function resolveNksClient(opts) {
|
|
|
4805
5026
|
const { profileName, tokenId, nksEndpoint } = await resolveIaasTokenContext(opts);
|
|
4806
5027
|
return { client: new NksClient(tokenId, nksEndpoint), profileName };
|
|
4807
5028
|
}
|
|
4808
|
-
async function readJsonFile(
|
|
5029
|
+
async function readJsonFile(path3) {
|
|
4809
5030
|
let raw;
|
|
4810
5031
|
try {
|
|
4811
|
-
raw = await (0,
|
|
5032
|
+
raw = await (0, import_promises7.readFile)(path3, "utf-8");
|
|
4812
5033
|
} catch (err) {
|
|
4813
5034
|
const message = err instanceof Error ? err.message : String(err);
|
|
4814
|
-
throw new NhnCloudCliError(`JSON \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${
|
|
5035
|
+
throw new NhnCloudCliError(`JSON \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${path3} (${message})`, EXIT_PARAM_ERROR);
|
|
4815
5036
|
}
|
|
4816
5037
|
try {
|
|
4817
5038
|
const parsed = JSON.parse(raw);
|
|
@@ -4821,15 +5042,15 @@ async function readJsonFile(path) {
|
|
|
4821
5042
|
return parsed;
|
|
4822
5043
|
} catch (err) {
|
|
4823
5044
|
const message = err instanceof Error ? err.message : String(err);
|
|
4824
|
-
throw new NhnCloudCliError(`JSON \uD30C\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: ${
|
|
5045
|
+
throw new NhnCloudCliError(`JSON \uD30C\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: ${path3} (${message})`, EXIT_PARAM_ERROR);
|
|
4825
5046
|
}
|
|
4826
5047
|
}
|
|
4827
|
-
async function readTextFile(
|
|
5048
|
+
async function readTextFile(path3) {
|
|
4828
5049
|
try {
|
|
4829
|
-
return await (0,
|
|
5050
|
+
return await (0, import_promises7.readFile)(path3, "utf-8");
|
|
4830
5051
|
} catch (err) {
|
|
4831
5052
|
const message = err instanceof Error ? err.message : String(err);
|
|
4832
|
-
throw new NhnCloudCliError(`\uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${
|
|
5053
|
+
throw new NhnCloudCliError(`\uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${path3} (${message})`, EXIT_PARAM_ERROR);
|
|
4833
5054
|
}
|
|
4834
5055
|
}
|
|
4835
5056
|
function parsePositiveInteger(value, optionName) {
|
|
@@ -4846,7 +5067,7 @@ function parseNonNegativeInteger(value, optionName) {
|
|
|
4846
5067
|
}
|
|
4847
5068
|
|
|
4848
5069
|
// src/commands/nks/supports.ts
|
|
4849
|
-
var supportsCommand = new
|
|
5070
|
+
var supportsCommand = new import_commander41.Command("supports").description("NKS \uC9C0\uC6D0 Kubernetes \uBC84\uC804\uACFC event type \uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
4850
5071
|
const opts = cmd.optsWithGlobals();
|
|
4851
5072
|
const { client } = await resolveNksClient(opts);
|
|
4852
5073
|
startSpinner("NKS \uC9C0\uC6D0 \uC815\uBCF4 \uC870\uD68C \uC911...");
|
|
@@ -4870,10 +5091,10 @@ var supportsCommand = new import_commander39.Command("supports").description("NK
|
|
|
4870
5091
|
});
|
|
4871
5092
|
|
|
4872
5093
|
// src/commands/nks/cluster.ts
|
|
4873
|
-
var
|
|
4874
|
-
var
|
|
4875
|
-
var
|
|
4876
|
-
var listCommand6 = new
|
|
5094
|
+
var import_promises8 = require("fs/promises");
|
|
5095
|
+
var import_commander42 = require("commander");
|
|
5096
|
+
var import_chalk14 = __toESM(require("chalk"));
|
|
5097
|
+
var listCommand6 = new import_commander42.Command("list").description("NKS \uD074\uB7EC\uC2A4\uD130 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
4877
5098
|
const opts = cmd.optsWithGlobals();
|
|
4878
5099
|
const { client } = await resolveNksClient(opts);
|
|
4879
5100
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -4893,7 +5114,7 @@ var listCommand6 = new import_commander40.Command("list").description("NKS \uD07
|
|
|
4893
5114
|
cluster.status,
|
|
4894
5115
|
cluster.health_status,
|
|
4895
5116
|
String(cluster.node_count),
|
|
4896
|
-
cluster
|
|
5117
|
+
nksClusterKubeTag(cluster)
|
|
4897
5118
|
]),
|
|
4898
5119
|
raw: clusters,
|
|
4899
5120
|
ids: clusters.map((cluster) => cluster.uuid)
|
|
@@ -4926,7 +5147,7 @@ function clusterIpAclRow(ipAcl) {
|
|
|
4926
5147
|
];
|
|
4927
5148
|
}
|
|
4928
5149
|
function uuidOutput(opts, result, label) {
|
|
4929
|
-
process.stderr.write(
|
|
5150
|
+
process.stderr.write(import_chalk14.default.green(`\u2713 ${label} \uC694\uCCAD \uC644\uB8CC (uuid: ${result.uuid})
|
|
4930
5151
|
`));
|
|
4931
5152
|
output(opts, {
|
|
4932
5153
|
headers: ["field", "value"],
|
|
@@ -4947,29 +5168,29 @@ async function confirmDangerousAction(message, yes) {
|
|
|
4947
5168
|
const { confirm } = await import("@inquirer/prompts");
|
|
4948
5169
|
const ok = await confirm({ message, default: false });
|
|
4949
5170
|
if (!ok) {
|
|
4950
|
-
process.stderr.write(
|
|
5171
|
+
process.stderr.write(import_chalk14.default.yellow("\uC791\uC5C5\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
4951
5172
|
}
|
|
4952
5173
|
return ok;
|
|
4953
5174
|
}
|
|
4954
|
-
async function writeKubeconfigFile(
|
|
5175
|
+
async function writeKubeconfigFile(path3, contents, force) {
|
|
4955
5176
|
try {
|
|
4956
|
-
await (0,
|
|
5177
|
+
await (0, import_promises8.writeFile)(path3, contents, {
|
|
4957
5178
|
encoding: "utf-8",
|
|
4958
5179
|
mode: 384,
|
|
4959
5180
|
flag: force ? "w" : "wx"
|
|
4960
5181
|
});
|
|
4961
|
-
await (0,
|
|
5182
|
+
await (0, import_promises8.chmod)(path3, 384);
|
|
4962
5183
|
} catch (err) {
|
|
4963
5184
|
if (err instanceof Error && "code" in err && err.code === "EEXIST") {
|
|
4964
5185
|
throw new NhnCloudCliError(
|
|
4965
|
-
`\uD30C\uC77C\uC774 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4: ${
|
|
5186
|
+
`\uD30C\uC77C\uC774 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4: ${path3}. \uB36E\uC5B4\uC4F0\uB824\uBA74 --force \uB97C \uC9C0\uC815\uD558\uC138\uC694.`,
|
|
4966
5187
|
EXIT_PARAM_ERROR
|
|
4967
5188
|
);
|
|
4968
5189
|
}
|
|
4969
5190
|
throw err;
|
|
4970
5191
|
}
|
|
4971
5192
|
}
|
|
4972
|
-
var createCommand4 = new
|
|
5193
|
+
var createCommand4 = new import_commander42.Command("create").description("NKS \uD074\uB7EC\uC2A4\uD130\uB97C \uC0DD\uC131\uD55C\uB2E4").requiredOption("--file <json>", "\uACF5\uC2DD API payload JSON \uD30C\uC77C").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
4973
5194
|
const opts = cmd.optsWithGlobals();
|
|
4974
5195
|
const payload = await readJsonFile(opts.file);
|
|
4975
5196
|
const { client } = await resolveNksClient(opts);
|
|
@@ -4984,7 +5205,7 @@ var createCommand4 = new import_commander40.Command("create").description("NKS \
|
|
|
4984
5205
|
stopSpinner(true);
|
|
4985
5206
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 \uC0DD\uC131");
|
|
4986
5207
|
});
|
|
4987
|
-
var deleteCommand3 = new
|
|
5208
|
+
var deleteCommand3 = new import_commander42.Command("delete").description("NKS \uD074\uB7EC\uC2A4\uD130\uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
4988
5209
|
const opts = cmd.optsWithGlobals();
|
|
4989
5210
|
const ok = await confirmDangerousAction(`NKS \uD074\uB7EC\uC2A4\uD130 "${cluster}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
4990
5211
|
if (!ok) return;
|
|
@@ -4997,15 +5218,15 @@ var deleteCommand3 = new import_commander40.Command("delete").description("NKS \
|
|
|
4997
5218
|
throw err;
|
|
4998
5219
|
}
|
|
4999
5220
|
stopSpinner(true);
|
|
5000
|
-
process.stderr.write(
|
|
5221
|
+
process.stderr.write(import_chalk14.default.green(`\u2713 NKS \uD074\uB7EC\uC2A4\uD130 "${cluster}" \uC0AD\uC81C \uC694\uCCAD \uC644\uB8CC
|
|
5001
5222
|
`));
|
|
5002
5223
|
});
|
|
5003
|
-
var resizeCommand2 = new
|
|
5224
|
+
var resizeCommand2 = new import_commander42.Command("resize").description("NKS \uD074\uB7EC\uC2A4\uD130 \uB178\uB4DC \uADF8\uB8F9 \uD06C\uAE30\uB97C \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--nodegroup <name-or-uuid>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--node-count <n>", "\uBCC0\uACBD\uD560 \uB178\uB4DC \uC218").option("--nodes-to-remove <csv>", "\uC0AD\uC81C\uD560 \uB178\uB4DC \uC774\uB984/ID CSV").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5004
5225
|
const opts = cmd.optsWithGlobals();
|
|
5005
5226
|
const nodeCount = parsePositiveInteger(opts.nodeCount, "--node-count");
|
|
5006
5227
|
const nodesToRemove = opts.nodesToRemove?.split(",").map((node) => node.trim()).filter(Boolean);
|
|
5007
5228
|
if (!nodesToRemove || nodesToRemove.length === 0) {
|
|
5008
|
-
process.stderr.write(
|
|
5229
|
+
process.stderr.write(import_chalk14.default.yellow("\uC8FC\uC758: --nodes-to-remove \uAC00 \uC5C6\uC73C\uBA74 \uAC10\uCD95 \uC2DC API\uAC00 \uC0AD\uC81C \uB178\uB4DC\uB97C \uC120\uD0DD\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n"));
|
|
5009
5230
|
}
|
|
5010
5231
|
const { client } = await resolveNksClient(opts);
|
|
5011
5232
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 resize \uC694\uCCAD \uC911...");
|
|
@@ -5024,7 +5245,7 @@ var resizeCommand2 = new import_commander40.Command("resize").description("NKS \
|
|
|
5024
5245
|
stopSpinner(true);
|
|
5025
5246
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 resize");
|
|
5026
5247
|
});
|
|
5027
|
-
var setIpAclCommand = new
|
|
5248
|
+
var setIpAclCommand = new import_commander42.Command("set-ipacl").description("NKS \uD074\uB7EC\uC2A4\uD130 API endpoint IP ACL \uC744 \uC124\uC815\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--file <json>", "\uACF5\uC2DD API payload JSON \uD30C\uC77C").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5028
5249
|
const opts = cmd.optsWithGlobals();
|
|
5029
5250
|
const payload = await readJsonFile(opts.file);
|
|
5030
5251
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5039,7 +5260,7 @@ var setIpAclCommand = new import_commander40.Command("set-ipacl").description("N
|
|
|
5039
5260
|
stopSpinner(true);
|
|
5040
5261
|
uuidOutput(opts, result, "IP ACL \uC124\uC815");
|
|
5041
5262
|
});
|
|
5042
|
-
var renewCertificateCommand = new
|
|
5263
|
+
var renewCertificateCommand = new import_commander42.Command("renew-certificate").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC778\uC99D\uC11C\uB97C \uAC31\uC2E0\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--term-of-validity <1-5>", "\uC778\uC99D\uC11C \uC720\uD6A8 \uAE30\uAC04(\uB144)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5043
5264
|
const opts = cmd.optsWithGlobals();
|
|
5044
5265
|
const term = parsePositiveInteger(opts.termOfValidity, "--term-of-validity");
|
|
5045
5266
|
if (term < 1 || term > 5) {
|
|
@@ -5057,7 +5278,7 @@ var renewCertificateCommand = new import_commander40.Command("renew-certificate"
|
|
|
5057
5278
|
stopSpinner(true);
|
|
5058
5279
|
uuidOutput(opts, result, "\uC778\uC99D\uC11C \uAC31\uC2E0");
|
|
5059
5280
|
});
|
|
5060
|
-
var updateSgwCommand = new
|
|
5281
|
+
var updateSgwCommand = new import_commander42.Command("update-sgw").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC11C\uBE44\uC2A4 \uAC8C\uC774\uD2B8\uC6E8\uC774\uB97C \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--ncr-sgw <uuid>", "NCR service gateway UUID").requiredOption("--obs-sgw <uuid>", "Object Storage service gateway UUID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5061
5282
|
const opts = cmd.optsWithGlobals();
|
|
5062
5283
|
const { client } = await resolveNksClient(opts);
|
|
5063
5284
|
startSpinner("NKS \uC11C\uBE44\uC2A4 \uAC8C\uC774\uD2B8\uC6E8\uC774 \uBCC0\uACBD \uC694\uCCAD \uC911...");
|
|
@@ -5071,7 +5292,7 @@ var updateSgwCommand = new import_commander40.Command("update-sgw").description(
|
|
|
5071
5292
|
stopSpinner(true);
|
|
5072
5293
|
uuidOutput(opts, result, "\uC11C\uBE44\uC2A4 \uAC8C\uC774\uD2B8\uC6E8\uC774 \uBCC0\uACBD");
|
|
5073
5294
|
});
|
|
5074
|
-
var setControlPlaneLogCommand = new
|
|
5295
|
+
var setControlPlaneLogCommand = new import_commander42.Command("set-control-plane-log").description("NKS \uD074\uB7EC\uC2A4\uD130 control plane log \uC124\uC815\uC744 \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--file <json>", "control_plane_log \uAC1D\uCCB4 JSON \uD30C\uC77C").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5075
5296
|
const opts = cmd.optsWithGlobals();
|
|
5076
5297
|
const controlPlaneLog = await readJsonFile(opts.file);
|
|
5077
5298
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5086,7 +5307,7 @@ var setControlPlaneLogCommand = new import_commander40.Command("set-control-plan
|
|
|
5086
5307
|
stopSpinner(true);
|
|
5087
5308
|
uuidOutput(opts, result, "control plane log \uC124\uC815");
|
|
5088
5309
|
});
|
|
5089
|
-
var getCommand4 = new
|
|
5310
|
+
var getCommand4 = new import_commander42.Command("get").description("NKS \uD074\uB7EC\uC2A4\uD130\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5090
5311
|
const opts = cmd.optsWithGlobals();
|
|
5091
5312
|
const { client } = await resolveNksClient(opts);
|
|
5092
5313
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC870\uD68C \uC911...");
|
|
@@ -5105,7 +5326,7 @@ var getCommand4 = new import_commander40.Command("get").description("NKS \uD074\
|
|
|
5105
5326
|
ids: [resourceId(result)]
|
|
5106
5327
|
});
|
|
5107
5328
|
});
|
|
5108
|
-
var eventsCommand = new
|
|
5329
|
+
var eventsCommand = new import_commander42.Command("events").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC791\uC5C5 \uC774\uB825\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5109
5330
|
const opts = cmd.optsWithGlobals();
|
|
5110
5331
|
const { client } = await resolveNksClient(opts);
|
|
5111
5332
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC791\uC5C5 \uC774\uB825 \uC870\uD68C \uC911...");
|
|
@@ -5124,7 +5345,7 @@ var eventsCommand = new import_commander40.Command("events").description("NKS \u
|
|
|
5124
5345
|
ids: events.map(resourceId)
|
|
5125
5346
|
});
|
|
5126
5347
|
});
|
|
5127
|
-
var eventCommand = new
|
|
5348
|
+
var eventCommand = new import_commander42.Command("event").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC791\uC5C5 \uC774\uB825 \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<event>", "\uC791\uC5C5 \uC774\uB825 UUID \uB610\uB294 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, event, _opts, cmd) => {
|
|
5128
5349
|
const opts = cmd.optsWithGlobals();
|
|
5129
5350
|
const { client } = await resolveNksClient(opts);
|
|
5130
5351
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC791\uC5C5 \uC774\uB825 \uC870\uD68C \uC911...");
|
|
@@ -5143,7 +5364,7 @@ var eventCommand = new import_commander40.Command("event").description("NKS \uD0
|
|
|
5143
5364
|
ids: [resourceId(result)]
|
|
5144
5365
|
});
|
|
5145
5366
|
});
|
|
5146
|
-
var kubeconfigCommand = new
|
|
5367
|
+
var kubeconfigCommand = new import_commander42.Command("kubeconfig").description("NKS \uD074\uB7EC\uC2A4\uD130 kubeconfig \uB97C \uCD9C\uB825\uD558\uAC70\uB098 \uC800\uC7A5\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").option("--output <file>", "kubeconfig \uC800\uC7A5 \uACBD\uB85C").option("--force", "\uAE30\uC874 \uD30C\uC77C \uB36E\uC5B4\uC4F0\uAE30").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5147
5368
|
const opts = cmd.optsWithGlobals();
|
|
5148
5369
|
const { client } = await resolveNksClient(opts);
|
|
5149
5370
|
startSpinner("NKS kubeconfig \uC870\uD68C \uC911...");
|
|
@@ -5157,13 +5378,13 @@ var kubeconfigCommand = new import_commander40.Command("kubeconfig").description
|
|
|
5157
5378
|
stopSpinner(true);
|
|
5158
5379
|
if (opts.output) {
|
|
5159
5380
|
await writeKubeconfigFile(opts.output, kubeconfig, opts.force);
|
|
5160
|
-
process.stderr.write(
|
|
5381
|
+
process.stderr.write(import_chalk14.default.green(`\u2713 kubeconfig \uB97C \uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4: ${opts.output}
|
|
5161
5382
|
`));
|
|
5162
5383
|
return;
|
|
5163
5384
|
}
|
|
5164
5385
|
process.stdout.write(kubeconfig.endsWith("\n") ? kubeconfig : kubeconfig + "\n");
|
|
5165
5386
|
});
|
|
5166
|
-
var ipAclCommand = new
|
|
5387
|
+
var ipAclCommand = new import_commander42.Command("ipacl").description("NKS \uD074\uB7EC\uC2A4\uD130 API endpoint IP ACL \uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5167
5388
|
const opts = cmd.optsWithGlobals();
|
|
5168
5389
|
const { client } = await resolveNksClient(opts);
|
|
5169
5390
|
startSpinner("NKS IP ACL \uC870\uD68C \uC911...");
|
|
@@ -5182,7 +5403,7 @@ var ipAclCommand = new import_commander40.Command("ipacl").description("NKS \uD0
|
|
|
5182
5403
|
ids: [result.cluster_uuid]
|
|
5183
5404
|
});
|
|
5184
5405
|
});
|
|
5185
|
-
var clusterAddonListCommand = new
|
|
5406
|
+
var clusterAddonListCommand = new import_commander42.Command("list").description("NKS \uD074\uB7EC\uC2A4\uD130\uC5D0 \uC124\uCE58\uB41C \uC560\uB4DC\uC628 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5186
5407
|
const opts = cmd.optsWithGlobals();
|
|
5187
5408
|
const { client } = await resolveNksClient(opts);
|
|
5188
5409
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -5201,7 +5422,7 @@ var clusterAddonListCommand = new import_commander40.Command("list").description
|
|
|
5201
5422
|
ids: addons.map((addon) => addon.uuid ?? addon.id ?? addon.name)
|
|
5202
5423
|
});
|
|
5203
5424
|
});
|
|
5204
|
-
var clusterAddonGetCommand = new
|
|
5425
|
+
var clusterAddonGetCommand = new import_commander42.Command("get").description("NKS \uD074\uB7EC\uC2A4\uD130\uC5D0 \uC124\uCE58\uB41C \uC560\uB4DC\uC628\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<addon>", "\uC560\uB4DC\uC628 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, addon, _opts, cmd) => {
|
|
5205
5426
|
const opts = cmd.optsWithGlobals();
|
|
5206
5427
|
const { client } = await resolveNksClient(opts);
|
|
5207
5428
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uC870\uD68C \uC911...");
|
|
@@ -5229,7 +5450,7 @@ function parseResolveConflicts(value) {
|
|
|
5229
5450
|
EXIT_PARAM_ERROR
|
|
5230
5451
|
);
|
|
5231
5452
|
}
|
|
5232
|
-
var clusterAddonInstallCommand = new
|
|
5453
|
+
var clusterAddonInstallCommand = new import_commander42.Command("install").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628\uC744 \uC124\uCE58\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--name <name>", "\uC560\uB4DC\uC628 \uC774\uB984").requiredOption("--version <version>", "\uC560\uB4DC\uC628 \uBC84\uC804").requiredOption("--resolve-conflicts <none|overwrite|preserve>", "\uCDA9\uB3CC \uD574\uACB0 \uC815\uCC45").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5233
5454
|
const opts = cmd.optsWithGlobals();
|
|
5234
5455
|
const resolveConflicts = parseResolveConflicts(opts.resolveConflicts);
|
|
5235
5456
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5248,7 +5469,7 @@ var clusterAddonInstallCommand = new import_commander40.Command("install").descr
|
|
|
5248
5469
|
stopSpinner(true);
|
|
5249
5470
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uC124\uCE58");
|
|
5250
5471
|
});
|
|
5251
|
-
var clusterAddonUpdateCommand = new
|
|
5472
|
+
var clusterAddonUpdateCommand = new import_commander42.Command("update").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628\uC744 \uC5C5\uB370\uC774\uD2B8\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<addon>", "\uC560\uB4DC\uC628 UUID \uB610\uB294 \uC774\uB984").requiredOption("--version <version>", "\uC560\uB4DC\uC628 \uBC84\uC804").requiredOption("--resolve-conflicts <none|overwrite|preserve>", "\uCDA9\uB3CC \uD574\uACB0 \uC815\uCC45").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, addon, _opts, cmd) => {
|
|
5252
5473
|
const opts = cmd.optsWithGlobals();
|
|
5253
5474
|
const resolveConflicts = parseResolveConflicts(opts.resolveConflicts);
|
|
5254
5475
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5266,7 +5487,7 @@ var clusterAddonUpdateCommand = new import_commander40.Command("update").descrip
|
|
|
5266
5487
|
stopSpinner(true);
|
|
5267
5488
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uC5C5\uB370\uC774\uD2B8");
|
|
5268
5489
|
});
|
|
5269
|
-
var clusterAddonRemoveCommand = new
|
|
5490
|
+
var clusterAddonRemoveCommand = new import_commander42.Command("remove").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628\uC744 \uC81C\uAC70\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<addon>", "\uC560\uB4DC\uC628 UUID \uB610\uB294 \uC774\uB984").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, addon, _opts, cmd) => {
|
|
5270
5491
|
const opts = cmd.optsWithGlobals();
|
|
5271
5492
|
const ok = await confirmDangerousAction(`NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 "${addon}" \uC744 \uC81C\uAC70\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
5272
5493
|
if (!ok) return;
|
|
@@ -5282,12 +5503,12 @@ var clusterAddonRemoveCommand = new import_commander40.Command("remove").descrip
|
|
|
5282
5503
|
stopSpinner(true);
|
|
5283
5504
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uC81C\uAC70");
|
|
5284
5505
|
});
|
|
5285
|
-
var clusterAddonCommand = new
|
|
5286
|
-
var clusterCommand = new
|
|
5506
|
+
var clusterAddonCommand = new import_commander42.Command("addon").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uAD00\uB828 \uBA85\uB839").addCommand(clusterAddonListCommand).addCommand(clusterAddonGetCommand).addCommand(clusterAddonInstallCommand).addCommand(clusterAddonUpdateCommand).addCommand(clusterAddonRemoveCommand);
|
|
5507
|
+
var clusterCommand = new import_commander42.Command("cluster").description("NKS \uD074\uB7EC\uC2A4\uD130 \uAD00\uB828 \uBA85\uB839").addCommand(listCommand6).addCommand(getCommand4).addCommand(createCommand4).addCommand(deleteCommand3).addCommand(resizeCommand2).addCommand(eventsCommand).addCommand(eventCommand).addCommand(kubeconfigCommand).addCommand(ipAclCommand).addCommand(setIpAclCommand).addCommand(renewCertificateCommand).addCommand(updateSgwCommand).addCommand(setControlPlaneLogCommand).addCommand(clusterAddonCommand);
|
|
5287
5508
|
|
|
5288
5509
|
// src/commands/nks/nodegroup.ts
|
|
5289
|
-
var
|
|
5290
|
-
var
|
|
5510
|
+
var import_commander43 = require("commander");
|
|
5511
|
+
var import_chalk15 = __toESM(require("chalk"));
|
|
5291
5512
|
function nodeGroupRow(nodegroup) {
|
|
5292
5513
|
return [
|
|
5293
5514
|
nodegroup.uuid,
|
|
@@ -5304,7 +5525,7 @@ function rawObjectRows(resource) {
|
|
|
5304
5525
|
]);
|
|
5305
5526
|
}
|
|
5306
5527
|
function uuidOutput2(opts, result, label) {
|
|
5307
|
-
process.stderr.write(
|
|
5528
|
+
process.stderr.write(import_chalk15.default.green(`\u2713 ${label} \uC694\uCCAD \uC644\uB8CC (uuid: ${result.uuid})
|
|
5308
5529
|
`));
|
|
5309
5530
|
output(opts, {
|
|
5310
5531
|
headers: ["field", "value"],
|
|
@@ -5337,10 +5558,10 @@ async function confirmDangerousAction2(message, yes) {
|
|
|
5337
5558
|
if (!isTTY || yes) return true;
|
|
5338
5559
|
const { confirm } = await import("@inquirer/prompts");
|
|
5339
5560
|
const ok = await confirm({ message, default: false });
|
|
5340
|
-
if (!ok) process.stderr.write(
|
|
5561
|
+
if (!ok) process.stderr.write(import_chalk15.default.yellow("\uC791\uC5C5\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
5341
5562
|
return ok;
|
|
5342
5563
|
}
|
|
5343
|
-
var listCommand7 = new
|
|
5564
|
+
var listCommand7 = new import_commander43.Command("list").description("NKS \uB178\uB4DC \uADF8\uB8F9 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5344
5565
|
const opts = cmd.optsWithGlobals();
|
|
5345
5566
|
const { client } = await resolveNksClient(opts);
|
|
5346
5567
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -5359,7 +5580,7 @@ var listCommand7 = new import_commander41.Command("list").description("NKS \uB17
|
|
|
5359
5580
|
ids: nodegroups.map((nodegroup) => nodegroup.uuid)
|
|
5360
5581
|
});
|
|
5361
5582
|
});
|
|
5362
|
-
var getCommand5 = new
|
|
5583
|
+
var getCommand5 = new import_commander43.Command("get").description("NKS \uB178\uB4DC \uADF8\uB8F9\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5363
5584
|
const opts = cmd.optsWithGlobals();
|
|
5364
5585
|
const { client } = await resolveNksClient(opts);
|
|
5365
5586
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 \uC870\uD68C \uC911...");
|
|
@@ -5378,7 +5599,7 @@ var getCommand5 = new import_commander41.Command("get").description("NKS \uB178\
|
|
|
5378
5599
|
ids: [result.uuid]
|
|
5379
5600
|
});
|
|
5380
5601
|
});
|
|
5381
|
-
var createCommand5 = new
|
|
5602
|
+
var createCommand5 = new import_commander43.Command("create").description("NKS \uB178\uB4DC \uADF8\uB8F9\uC744 \uC0DD\uC131\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--file <json>", "\uACF5\uC2DD API payload JSON \uD30C\uC77C").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
5382
5603
|
const opts = cmd.optsWithGlobals();
|
|
5383
5604
|
const payload = await readJsonFile(opts.file);
|
|
5384
5605
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5393,7 +5614,7 @@ var createCommand5 = new import_commander41.Command("create").description("NKS \
|
|
|
5393
5614
|
stopSpinner(true);
|
|
5394
5615
|
uuidOutput2(opts, result, "\uB178\uB4DC \uADF8\uB8F9 \uC0DD\uC131");
|
|
5395
5616
|
});
|
|
5396
|
-
var deleteCommand4 = new
|
|
5617
|
+
var deleteCommand4 = new import_commander43.Command("delete").description("NKS \uB178\uB4DC \uADF8\uB8F9\uC744 \uC0AD\uC81C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5397
5618
|
const opts = cmd.optsWithGlobals();
|
|
5398
5619
|
const ok = await confirmDangerousAction2(`NKS \uB178\uB4DC \uADF8\uB8F9 "${nodegroup}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
5399
5620
|
if (!ok) return;
|
|
@@ -5406,11 +5627,11 @@ var deleteCommand4 = new import_commander41.Command("delete").description("NKS \
|
|
|
5406
5627
|
throw err;
|
|
5407
5628
|
}
|
|
5408
5629
|
stopSpinner(true);
|
|
5409
|
-
process.stderr.write(
|
|
5630
|
+
process.stderr.write(import_chalk15.default.green(`\u2713 NKS \uB178\uB4DC \uADF8\uB8F9 "${nodegroup}" \uC0AD\uC81C \uC694\uCCAD \uC644\uB8CC
|
|
5410
5631
|
`));
|
|
5411
5632
|
});
|
|
5412
5633
|
function nodeActionCommand(name) {
|
|
5413
|
-
return new
|
|
5634
|
+
return new import_commander43.Command(name).description(`NKS \uB178\uB4DC \uADF8\uB8F9 \uB178\uB4DC\uB97C ${name === "stop-node" ? "\uC911\uC9C0" : "\uC2DC\uC791"}\uD55C\uB2E4`).argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--nodes <csv>", "\uB300\uC0C1 \uB178\uB4DC CSV").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5414
5635
|
const opts = cmd.optsWithGlobals();
|
|
5415
5636
|
const nodes = parseCsv(opts.nodes, "--nodes");
|
|
5416
5637
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5426,7 +5647,7 @@ function nodeActionCommand(name) {
|
|
|
5426
5647
|
uuidOutput2(opts, result, `\uB178\uB4DC ${name === "stop-node" ? "\uC911\uC9C0" : "\uC2DC\uC791"}`);
|
|
5427
5648
|
});
|
|
5428
5649
|
}
|
|
5429
|
-
var autoscaleCommand = new
|
|
5650
|
+
var autoscaleCommand = new import_commander43.Command("autoscale").description("NKS \uB178\uB4DC \uADF8\uB8F9 autoscale \uC124\uC815\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5430
5651
|
const opts = cmd.optsWithGlobals();
|
|
5431
5652
|
const { client } = await resolveNksClient(opts);
|
|
5432
5653
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 autoscale \uC870\uD68C \uC911...");
|
|
@@ -5445,7 +5666,7 @@ var autoscaleCommand = new import_commander41.Command("autoscale").description("
|
|
|
5445
5666
|
ids: []
|
|
5446
5667
|
});
|
|
5447
5668
|
});
|
|
5448
|
-
var setAutoscaleCommand = new
|
|
5669
|
+
var setAutoscaleCommand = new import_commander43.Command("set-autoscale").description("NKS \uB178\uB4DC \uADF8\uB8F9 autoscale \uC124\uC815\uC744 \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--file <json>", "\uACF5\uC2DD API payload JSON \uD30C\uC77C").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5449
5670
|
const opts = cmd.optsWithGlobals();
|
|
5450
5671
|
const payload = await readJsonFile(opts.file);
|
|
5451
5672
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5460,7 +5681,7 @@ var setAutoscaleCommand = new import_commander41.Command("set-autoscale").descri
|
|
|
5460
5681
|
stopSpinner(true);
|
|
5461
5682
|
uuidOutput2(opts, result, "autoscale \uBCC0\uACBD");
|
|
5462
5683
|
});
|
|
5463
|
-
var setMetricAutoscaleCommand = new
|
|
5684
|
+
var setMetricAutoscaleCommand = new import_commander43.Command("set-metric-autoscale").description("NKS \uB178\uB4DC \uADF8\uB8F9 metric autoscale \uC124\uC815\uC744 \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--file <json>", "\uACF5\uC2DD API payload JSON \uD30C\uC77C").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5464
5685
|
const opts = cmd.optsWithGlobals();
|
|
5465
5686
|
const payload = await readJsonFile(opts.file);
|
|
5466
5687
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5475,7 +5696,7 @@ var setMetricAutoscaleCommand = new import_commander41.Command("set-metric-autos
|
|
|
5475
5696
|
stopSpinner(true);
|
|
5476
5697
|
uuidOutput2(opts, result, "metric autoscale \uBCC0\uACBD");
|
|
5477
5698
|
});
|
|
5478
|
-
var upgradeCommand = new
|
|
5699
|
+
var upgradeCommand = new import_commander43.Command("upgrade").description("NKS \uB178\uB4DC \uADF8\uB8F9 Kubernetes version \uC744 \uC5C5\uADF8\uB808\uC774\uB4DC\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--version <v>", "\uB300\uC0C1 Kubernetes version").option("--num-buffer-nodes <n>", "buffer node \uC218").option("--num-max-unavailable-nodes <n>", "\uCD5C\uB300 unavailable node \uC218").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5479
5700
|
const opts = cmd.optsWithGlobals();
|
|
5480
5701
|
const { client } = await resolveNksClient(opts);
|
|
5481
5702
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 upgrade \uC694\uCCAD \uC911...");
|
|
@@ -5493,7 +5714,7 @@ var upgradeCommand = new import_commander41.Command("upgrade").description("NKS
|
|
|
5493
5714
|
stopSpinner(true);
|
|
5494
5715
|
uuidOutput2(opts, result, "\uB178\uB4DC \uADF8\uB8F9 upgrade");
|
|
5495
5716
|
});
|
|
5496
|
-
var setUserscriptCommand = new
|
|
5717
|
+
var setUserscriptCommand = new import_commander43.Command("set-userscript").description("NKS \uB178\uB4DC \uADF8\uB8F9 user script \uB97C \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--file <script>", "script \uD30C\uC77C").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5497
5718
|
const opts = cmd.optsWithGlobals();
|
|
5498
5719
|
const contents = await readTextFile(opts.file);
|
|
5499
5720
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5508,7 +5729,7 @@ var setUserscriptCommand = new import_commander41.Command("set-userscript").desc
|
|
|
5508
5729
|
stopSpinner(true);
|
|
5509
5730
|
uuidOutput2(opts, result, "user script \uBCC0\uACBD");
|
|
5510
5731
|
});
|
|
5511
|
-
var updateFlavorCommand = new
|
|
5732
|
+
var updateFlavorCommand = new import_commander43.Command("update-flavor").description("NKS \uB178\uB4DC \uADF8\uB8F9 flavor \uB97C \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--flavor <uuid>", "\uBCC0\uACBD\uD560 flavor UUID").option("--num-buffer-nodes <n>", "buffer node \uC218").option("--num-max-unavailable-nodes <n>", "\uCD5C\uB300 unavailable node \uC218").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5512
5733
|
const opts = cmd.optsWithGlobals();
|
|
5513
5734
|
const { client } = await resolveNksClient(opts);
|
|
5514
5735
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 flavor \uBCC0\uACBD \uC694\uCCAD \uC911...");
|
|
@@ -5527,7 +5748,7 @@ var updateFlavorCommand = new import_commander41.Command("update-flavor").descri
|
|
|
5527
5748
|
uuidOutput2(opts, result, "flavor \uBCC0\uACBD");
|
|
5528
5749
|
});
|
|
5529
5750
|
function patchPayloadCommand(name) {
|
|
5530
|
-
return new
|
|
5751
|
+
return new import_commander43.Command(name).description(`NKS \uB178\uB4DC \uADF8\uB8F9 ${name === "set-fip-auto-bind" ? "Floating IP \uC790\uB3D9 \uC5F0\uACB0" : "Kubernetes labels"} \uC124\uC815\uC744 \uBCC0\uACBD\uD55C\uB2E4`).argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--file <json>", "\uACF5\uC2DD API payload JSON \uD30C\uC77C").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, nodegroup, _opts, cmd) => {
|
|
5531
5752
|
const opts = cmd.optsWithGlobals();
|
|
5532
5753
|
const payload = await readJsonFile(opts.file);
|
|
5533
5754
|
const { client } = await resolveNksClient(opts);
|
|
@@ -5543,10 +5764,10 @@ function patchPayloadCommand(name) {
|
|
|
5543
5764
|
uuidOutput2(opts, result, name);
|
|
5544
5765
|
});
|
|
5545
5766
|
}
|
|
5546
|
-
var nodegroupCommand = new
|
|
5767
|
+
var nodegroupCommand = new import_commander43.Command("nodegroup").description("NKS \uB178\uB4DC \uADF8\uB8F9 \uAD00\uB828 \uBA85\uB839").addCommand(listCommand7).addCommand(getCommand5).addCommand(createCommand5).addCommand(deleteCommand4).addCommand(nodeActionCommand("stop-node")).addCommand(nodeActionCommand("start-node")).addCommand(autoscaleCommand).addCommand(setAutoscaleCommand).addCommand(setMetricAutoscaleCommand).addCommand(upgradeCommand).addCommand(setUserscriptCommand).addCommand(updateFlavorCommand).addCommand(patchPayloadCommand("set-fip-auto-bind")).addCommand(patchPayloadCommand("set-labels"));
|
|
5547
5768
|
|
|
5548
5769
|
// src/commands/nks/addon.ts
|
|
5549
|
-
var
|
|
5770
|
+
var import_commander44 = require("commander");
|
|
5550
5771
|
function addonTypeRow(addonType) {
|
|
5551
5772
|
return [
|
|
5552
5773
|
addonType.uuid ?? addonType.id ?? addonType.name,
|
|
@@ -5562,7 +5783,7 @@ function addonRow2(addon) {
|
|
|
5562
5783
|
addon.status ?? ""
|
|
5563
5784
|
];
|
|
5564
5785
|
}
|
|
5565
|
-
var addonTypeListCommand = new
|
|
5786
|
+
var addonTypeListCommand = new import_commander44.Command("list").description("NKS \uC560\uB4DC\uC628 \uD0C0\uC785 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
5566
5787
|
const opts = cmd.optsWithGlobals();
|
|
5567
5788
|
const { client } = await resolveNksClient(opts);
|
|
5568
5789
|
startSpinner("NKS \uC560\uB4DC\uC628 \uD0C0\uC785 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -5581,7 +5802,7 @@ var addonTypeListCommand = new import_commander42.Command("list").description("N
|
|
|
5581
5802
|
ids: addonTypes.map((addonType) => addonType.uuid ?? addonType.id ?? addonType.name)
|
|
5582
5803
|
});
|
|
5583
5804
|
});
|
|
5584
|
-
var addonTypeGetCommand = new
|
|
5805
|
+
var addonTypeGetCommand = new import_commander44.Command("get").description("NKS \uC560\uB4DC\uC628 \uD0C0\uC785\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<addon-type>", "\uC560\uB4DC\uC628 \uD0C0\uC785 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (addonType, _opts, cmd) => {
|
|
5585
5806
|
const opts = cmd.optsWithGlobals();
|
|
5586
5807
|
const { client } = await resolveNksClient(opts);
|
|
5587
5808
|
startSpinner("NKS \uC560\uB4DC\uC628 \uD0C0\uC785 \uC870\uD68C \uC911...");
|
|
@@ -5600,8 +5821,8 @@ var addonTypeGetCommand = new import_commander42.Command("get").description("NKS
|
|
|
5600
5821
|
ids: [result.uuid ?? result.id ?? result.name]
|
|
5601
5822
|
});
|
|
5602
5823
|
});
|
|
5603
|
-
var addonTypeCommand = new
|
|
5604
|
-
var addonListCommand = new
|
|
5824
|
+
var addonTypeCommand = new import_commander44.Command("addon-type").description("NKS \uC560\uB4DC\uC628 \uD0C0\uC785 \uAD00\uB828 \uBA85\uB839").addCommand(addonTypeListCommand).addCommand(addonTypeGetCommand);
|
|
5825
|
+
var addonListCommand = new import_commander44.Command("list").description("NKS \uC560\uB4DC\uC628 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--k8s-version <version>", "Kubernetes version filter").option("--image <image>", "image filter").option("--platform-version <version>", "platform version filter").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
5605
5826
|
const opts = cmd.optsWithGlobals();
|
|
5606
5827
|
const { client } = await resolveNksClient(opts);
|
|
5607
5828
|
startSpinner("NKS \uC560\uB4DC\uC628 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -5624,7 +5845,7 @@ var addonListCommand = new import_commander42.Command("list").description("NKS \
|
|
|
5624
5845
|
ids: addons.map((addon) => addon.uuid ?? addon.id ?? addon.name)
|
|
5625
5846
|
});
|
|
5626
5847
|
});
|
|
5627
|
-
var addonGetCommand = new
|
|
5848
|
+
var addonGetCommand = new import_commander44.Command("get").description("NKS \uC560\uB4DC\uC628\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<addon>", "\uC560\uB4DC\uC628 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (addon, _opts, cmd) => {
|
|
5628
5849
|
const opts = cmd.optsWithGlobals();
|
|
5629
5850
|
const { client } = await resolveNksClient(opts);
|
|
5630
5851
|
startSpinner("NKS \uC560\uB4DC\uC628 \uC870\uD68C \uC911...");
|
|
@@ -5643,79 +5864,1674 @@ var addonGetCommand = new import_commander42.Command("get").description("NKS \uC
|
|
|
5643
5864
|
ids: [result.uuid ?? result.id ?? result.name]
|
|
5644
5865
|
});
|
|
5645
5866
|
});
|
|
5646
|
-
var addonCommand = new
|
|
5867
|
+
var addonCommand = new import_commander44.Command("addon").description("NKS \uC560\uB4DC\uC628 \uAD00\uB828 \uBA85\uB839").addCommand(addonListCommand).addCommand(addonGetCommand);
|
|
5647
5868
|
|
|
5648
|
-
// src/
|
|
5649
|
-
var
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5869
|
+
// src/commands/ncs/template.ts
|
|
5870
|
+
var import_commander45 = require("commander");
|
|
5871
|
+
var import_chalk16 = __toESM(require("chalk"));
|
|
5872
|
+
|
|
5873
|
+
// src/commands/ncs/helpers.ts
|
|
5874
|
+
var import_node_fs7 = require("fs");
|
|
5875
|
+
|
|
5876
|
+
// src/services/ncs/client.ts
|
|
5877
|
+
var import_ky12 = __toESM(require("ky"));
|
|
5878
|
+
|
|
5879
|
+
// src/services/ncs/types.ts
|
|
5880
|
+
function isNcsTemplateSummary(val) {
|
|
5881
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5882
|
+
const obj = val;
|
|
5883
|
+
return typeof obj["id"] === "string" && typeof obj["name"] === "string";
|
|
5884
|
+
}
|
|
5885
|
+
function isNcsTemplateDetail(val) {
|
|
5886
|
+
return isNcsTemplateSummary(val);
|
|
5887
|
+
}
|
|
5888
|
+
function isNcsTemplateVersionSummary(val) {
|
|
5889
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5890
|
+
const obj = val;
|
|
5891
|
+
return typeof obj["id"] === "string" && typeof obj["version"] === "string";
|
|
5892
|
+
}
|
|
5893
|
+
function isNcsTemplateVersionDetail(val) {
|
|
5894
|
+
return isNcsTemplateVersionSummary(val);
|
|
5895
|
+
}
|
|
5896
|
+
function isNcsWorkloadSummary(val) {
|
|
5897
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5898
|
+
const obj = val;
|
|
5899
|
+
return typeof obj["id"] === "string" && typeof obj["name"] === "string" && typeof obj["status"] === "string";
|
|
5900
|
+
}
|
|
5901
|
+
function isNcsWorkloadDetail(val) {
|
|
5902
|
+
return isNcsWorkloadSummary(val);
|
|
5903
|
+
}
|
|
5904
|
+
function isNcsWorkloadLog(val) {
|
|
5905
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5906
|
+
const obj = val;
|
|
5907
|
+
return typeof obj["log"] === "string" && typeof obj["time"] === "string";
|
|
5908
|
+
}
|
|
5909
|
+
function isNcsWorkloadEvent(val) {
|
|
5910
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5911
|
+
const obj = val;
|
|
5912
|
+
return typeof obj["type"] === "string" && typeof obj["reason"] === "string" && typeof obj["message"] === "string";
|
|
5913
|
+
}
|
|
5914
|
+
function isNcsWorkloadHistorySummary(val) {
|
|
5915
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5916
|
+
const obj = val;
|
|
5917
|
+
return typeof obj["id"] === "number" && typeof obj["status"] === "string";
|
|
5918
|
+
}
|
|
5919
|
+
function isNcsWorkloadHistoryDetail(val) {
|
|
5920
|
+
return isNcsWorkloadHistorySummary(val);
|
|
5921
|
+
}
|
|
5922
|
+
function isNcsWorkloadScheduleHistory(val) {
|
|
5923
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5924
|
+
const obj = val;
|
|
5925
|
+
return typeof obj["id"] === "string" && typeof obj["status"] === "string";
|
|
5926
|
+
}
|
|
5927
|
+
function isNcsMalwareConfig(val) {
|
|
5928
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5929
|
+
const obj = val;
|
|
5930
|
+
return typeof obj["enabled"] === "boolean";
|
|
5931
|
+
}
|
|
5932
|
+
function isNcsMalwareReport(val) {
|
|
5933
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5934
|
+
const obj = val;
|
|
5935
|
+
return typeof obj["image"] === "string" && typeof obj["result"] === "string";
|
|
5936
|
+
}
|
|
5937
|
+
|
|
5938
|
+
// src/services/ncs/client.ts
|
|
5939
|
+
var DEFAULT_TIMEOUT_MS8 = 3e4;
|
|
5940
|
+
var DEFAULT_WAIT_POLL_INTERVAL_MS = 5e3;
|
|
5941
|
+
var NcsClient = class {
|
|
5942
|
+
accessToken;
|
|
5943
|
+
baseUrl;
|
|
5944
|
+
constructor(accessToken, region, appKey) {
|
|
5945
|
+
this.accessToken = accessToken;
|
|
5946
|
+
this.baseUrl = `https://${ncsHost(region)}/ncs/v1.0/appkeys/${encodeURIComponent(appKey)}`;
|
|
5947
|
+
}
|
|
5948
|
+
authHeaders() {
|
|
5949
|
+
return { "x-nhn-authorization": `Bearer ${this.accessToken}` };
|
|
5950
|
+
}
|
|
5951
|
+
/**
|
|
5952
|
+
* 설계도(template) 목록을 반환한다.
|
|
5953
|
+
* GET /ncs/v1.0/appkeys/{appKey}/templates
|
|
5954
|
+
* 응답: { header, templates: [...] } — body 가 아니라 named 필드(docs 예제 확정).
|
|
5955
|
+
*
|
|
5956
|
+
* pagination: 기본 page size 10(docs 확정). 목록이 앞부분만 조용히 반환(silent truncation)하지
|
|
5957
|
+
* 않도록 page/size 를 그대로 노출한다. 총 개수는 응답 헤더 X-Total-Count 로 온다(docs 확정) —
|
|
5958
|
+
* body/JSON 필드가 아니므로 ky Response 에서 header 를 직접 읽는다(harbor-client.ts 의
|
|
5959
|
+
* .json()+.headers.get() 분리 패턴과 동일 — .json<T>() 체이닝으로는 헤더를 못 본다).
|
|
5960
|
+
*/
|
|
5961
|
+
async listTemplates(query = {}) {
|
|
5962
|
+
const url = `${this.baseUrl}/templates`;
|
|
5963
|
+
const searchParams = {};
|
|
5964
|
+
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
5965
|
+
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
5966
|
+
if (query.disableContainers !== void 0) {
|
|
5967
|
+
searchParams["disable_containers"] = query.disableContainers;
|
|
5968
|
+
}
|
|
5969
|
+
try {
|
|
5970
|
+
const res = await import_ky12.default.get(url, {
|
|
5971
|
+
headers: this.authHeaders(),
|
|
5972
|
+
searchParams,
|
|
5973
|
+
retry: 0,
|
|
5974
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
5975
|
+
});
|
|
5976
|
+
const body = await res.json();
|
|
5977
|
+
unwrapHeader(body);
|
|
5978
|
+
if (!Array.isArray(body.templates)) {
|
|
5979
|
+
if (body.templates === void 0) return { totalCount: 0, templates: [] };
|
|
5980
|
+
throw new NhnCloudCliError(
|
|
5981
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: templates \uAC00 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
5982
|
+
EXIT_API_ERROR
|
|
5983
|
+
);
|
|
5984
|
+
}
|
|
5985
|
+
const templates = body.templates.filter(isNcsTemplateSummary);
|
|
5986
|
+
const headerTotal = res.headers.get("x-total-count");
|
|
5987
|
+
const totalCount = headerTotal !== null && /^\d+$/.test(headerTotal) ? Number(headerTotal) : templates.length;
|
|
5988
|
+
return { totalCount, templates };
|
|
5989
|
+
} catch (err) {
|
|
5990
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
5991
|
+
throw toNhnCloudCliError(err);
|
|
5992
|
+
}
|
|
5993
|
+
}
|
|
5994
|
+
/**
|
|
5995
|
+
* 설계도(template) 단건을 반환한다.
|
|
5996
|
+
* GET /ncs/v1.0/appkeys/{appKey}/templates/{id}
|
|
5997
|
+
* 응답: { header, template: {...} } — named 필드(listTemplates 와 같은 패턴).
|
|
5998
|
+
*/
|
|
5999
|
+
async getTemplate(id) {
|
|
6000
|
+
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}`;
|
|
6001
|
+
try {
|
|
6002
|
+
const res = await import_ky12.default.get(url, {
|
|
6003
|
+
headers: this.authHeaders(),
|
|
6004
|
+
retry: 0,
|
|
6005
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6006
|
+
});
|
|
6007
|
+
const body = await res.json();
|
|
6008
|
+
unwrapHeader(body);
|
|
6009
|
+
if (!isNcsTemplateDetail(body.template)) {
|
|
6010
|
+
throw new NhnCloudCliError(
|
|
6011
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: template \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6012
|
+
EXIT_API_ERROR
|
|
6013
|
+
);
|
|
6014
|
+
}
|
|
6015
|
+
return body.template;
|
|
6016
|
+
} catch (err) {
|
|
6017
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6018
|
+
throw toNhnCloudCliError(err);
|
|
6019
|
+
}
|
|
6020
|
+
}
|
|
6021
|
+
/**
|
|
6022
|
+
* 설계도(template) 의 버전 목록을 반환한다.
|
|
6023
|
+
* GET /ncs/v1.0/appkeys/{appKey}/templates/{id}/versions
|
|
6024
|
+
* 응답: { header, versions: [...] } — named 필드. pagination 은 listTemplates 와 동일하게
|
|
6025
|
+
* X-Total-Count 응답 헤더 + page/size 노출(silent truncation 방지).
|
|
6026
|
+
*/
|
|
6027
|
+
async listTemplateVersions(id, query = {}) {
|
|
6028
|
+
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}/versions`;
|
|
6029
|
+
const searchParams = {};
|
|
6030
|
+
if (query.q !== void 0) searchParams["q"] = query.q;
|
|
6031
|
+
if (query.sort !== void 0) searchParams["sort"] = query.sort;
|
|
6032
|
+
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
6033
|
+
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
6034
|
+
try {
|
|
6035
|
+
const res = await import_ky12.default.get(url, {
|
|
6036
|
+
headers: this.authHeaders(),
|
|
6037
|
+
searchParams,
|
|
6038
|
+
retry: 0,
|
|
6039
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6040
|
+
});
|
|
6041
|
+
const body = await res.json();
|
|
6042
|
+
unwrapHeader(body);
|
|
6043
|
+
if (!Array.isArray(body.versions)) {
|
|
6044
|
+
if (body.versions === void 0) return { totalCount: 0, versions: [] };
|
|
6045
|
+
throw new NhnCloudCliError(
|
|
6046
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: versions \uAC00 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
6047
|
+
EXIT_API_ERROR
|
|
6048
|
+
);
|
|
6049
|
+
}
|
|
6050
|
+
const versions = body.versions.filter(isNcsTemplateVersionSummary);
|
|
6051
|
+
const headerTotal = res.headers.get("x-total-count");
|
|
6052
|
+
const totalCount = headerTotal !== null && /^\d+$/.test(headerTotal) ? Number(headerTotal) : versions.length;
|
|
6053
|
+
return { totalCount, versions };
|
|
6054
|
+
} catch (err) {
|
|
6055
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6056
|
+
throw toNhnCloudCliError(err);
|
|
6057
|
+
}
|
|
6058
|
+
}
|
|
6059
|
+
/**
|
|
6060
|
+
* 설계도(template) 버전 단건을 반환한다.
|
|
6061
|
+
* GET /ncs/v1.0/appkeys/{appKey}/templates/{id}/versions/{version}
|
|
6062
|
+
* 응답: { header, version: {...} } — named 필드.
|
|
6063
|
+
*/
|
|
6064
|
+
async getTemplateVersion(id, version) {
|
|
6065
|
+
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`;
|
|
6066
|
+
try {
|
|
6067
|
+
const res = await import_ky12.default.get(url, {
|
|
6068
|
+
headers: this.authHeaders(),
|
|
6069
|
+
retry: 0,
|
|
6070
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6071
|
+
});
|
|
6072
|
+
const body = await res.json();
|
|
6073
|
+
unwrapHeader(body);
|
|
6074
|
+
if (!isNcsTemplateVersionDetail(body.version)) {
|
|
6075
|
+
throw new NhnCloudCliError(
|
|
6076
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: version \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6077
|
+
EXIT_API_ERROR
|
|
6078
|
+
);
|
|
6079
|
+
}
|
|
6080
|
+
return body.version;
|
|
6081
|
+
} catch (err) {
|
|
6082
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6083
|
+
throw toNhnCloudCliError(err);
|
|
6084
|
+
}
|
|
6085
|
+
}
|
|
6086
|
+
/**
|
|
6087
|
+
* workload(런타임 실행) 목록을 반환한다.
|
|
6088
|
+
* GET /ncs/v1.0/appkeys/{appKey}/workloads
|
|
6089
|
+
* 응답: { header, workloads: [...] } — named 필드(listTemplates 와 동일 패턴).
|
|
6090
|
+
* pagination: X-Total-Count 응답 헤더 + page/size 노출(listTemplates 와 동일 규약).
|
|
6091
|
+
*/
|
|
6092
|
+
async listWorkloads(query = {}) {
|
|
6093
|
+
const url = `${this.baseUrl}/workloads`;
|
|
6094
|
+
const searchParams = {};
|
|
6095
|
+
if (query.q !== void 0) searchParams["q"] = query.q;
|
|
6096
|
+
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
6097
|
+
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
6098
|
+
try {
|
|
6099
|
+
const res = await import_ky12.default.get(url, {
|
|
6100
|
+
headers: this.authHeaders(),
|
|
6101
|
+
searchParams,
|
|
6102
|
+
retry: 0,
|
|
6103
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6104
|
+
});
|
|
6105
|
+
const body = await res.json();
|
|
6106
|
+
unwrapHeader(body);
|
|
6107
|
+
if (!Array.isArray(body.workloads)) {
|
|
6108
|
+
if (body.workloads === void 0) return { totalCount: 0, workloads: [] };
|
|
6109
|
+
throw new NhnCloudCliError(
|
|
6110
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: workloads \uAC00 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
6111
|
+
EXIT_API_ERROR
|
|
6112
|
+
);
|
|
6113
|
+
}
|
|
6114
|
+
const workloads = body.workloads.filter(isNcsWorkloadSummary);
|
|
6115
|
+
const headerTotal = res.headers.get("x-total-count");
|
|
6116
|
+
const totalCount = headerTotal !== null && /^\d+$/.test(headerTotal) ? Number(headerTotal) : workloads.length;
|
|
6117
|
+
return { totalCount, workloads };
|
|
6118
|
+
} catch (err) {
|
|
6119
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6120
|
+
throw toNhnCloudCliError(err);
|
|
6121
|
+
}
|
|
6122
|
+
}
|
|
6123
|
+
/**
|
|
6124
|
+
* workload 단건을 반환한다 (tasks[] 런타임 상태 포함).
|
|
6125
|
+
* GET /ncs/v1.0/appkeys/{appKey}/workloads/{workloadId}
|
|
6126
|
+
* 응답: { header, workload: {...} } — named 필드.
|
|
6127
|
+
*/
|
|
6128
|
+
async getWorkload(id) {
|
|
6129
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}`;
|
|
6130
|
+
try {
|
|
6131
|
+
const res = await import_ky12.default.get(url, {
|
|
6132
|
+
headers: this.authHeaders(),
|
|
6133
|
+
retry: 0,
|
|
6134
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6135
|
+
});
|
|
6136
|
+
const body = await res.json();
|
|
6137
|
+
unwrapHeader(body);
|
|
6138
|
+
if (!isNcsWorkloadDetail(body.workload)) {
|
|
6139
|
+
throw new NhnCloudCliError(
|
|
6140
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: workload \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6141
|
+
EXIT_API_ERROR
|
|
6142
|
+
);
|
|
6143
|
+
}
|
|
6144
|
+
return body.workload;
|
|
6145
|
+
} catch (err) {
|
|
6146
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6147
|
+
throw toNhnCloudCliError(err);
|
|
6148
|
+
}
|
|
6149
|
+
}
|
|
6150
|
+
/**
|
|
6151
|
+
* workload task 의 컨테이너 로그를 반환한다.
|
|
6152
|
+
* GET /ncs/v1.0/appkeys/{appKey}/workloads/{workloadId}/tasks/{taskId}/logs
|
|
6153
|
+
* docs 확정 필수 쿼리는 `containerName` — CLI 시그니처 일관성을 위해 `container` 로 받고 여기서 매핑한다.
|
|
6154
|
+
* container 누락(빈 문자열 포함) 시 EXIT_PARAM_ERROR — API 호출 전 파라미터 검증(1-3 회피).
|
|
6155
|
+
* 응답: { header, logs: [...] } — named 필드. docs 에 X-Total-Count 헤더가 없어 totalCount 는 반환하지 않는다.
|
|
6156
|
+
*/
|
|
6157
|
+
async getWorkloadLogs(id, taskId, query) {
|
|
6158
|
+
if (!query.container || !query.container.trim()) {
|
|
6159
|
+
throw new NhnCloudCliError(
|
|
6160
|
+
"container \uCFFC\uB9AC\uAC00 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4. \uCEE8\uD14C\uC774\uB108 \uC774\uB984\uC744 \uC9C0\uC815\uD558\uC138\uC694.",
|
|
6161
|
+
EXIT_PARAM_ERROR
|
|
6162
|
+
);
|
|
6163
|
+
}
|
|
6164
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/tasks/${encodeURIComponent(taskId)}/logs`;
|
|
6165
|
+
const searchParams = { containerName: query.container };
|
|
6166
|
+
if (query.from !== void 0) searchParams["from"] = query.from;
|
|
6167
|
+
if (query.to !== void 0) searchParams["to"] = query.to;
|
|
6168
|
+
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
6169
|
+
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
6170
|
+
try {
|
|
6171
|
+
const res = await import_ky12.default.get(url, {
|
|
6172
|
+
headers: this.authHeaders(),
|
|
6173
|
+
searchParams,
|
|
6174
|
+
retry: 0,
|
|
6175
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6176
|
+
});
|
|
6177
|
+
const body = await res.json();
|
|
6178
|
+
unwrapHeader(body);
|
|
6179
|
+
if (!Array.isArray(body.logs)) {
|
|
6180
|
+
if (body.logs === void 0) return { logs: [] };
|
|
6181
|
+
throw new NhnCloudCliError(
|
|
6182
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: logs \uAC00 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
6183
|
+
EXIT_API_ERROR
|
|
6184
|
+
);
|
|
6185
|
+
}
|
|
6186
|
+
return { logs: body.logs.filter(isNcsWorkloadLog) };
|
|
6187
|
+
} catch (err) {
|
|
6188
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6189
|
+
throw toNhnCloudCliError(err);
|
|
6190
|
+
}
|
|
6191
|
+
}
|
|
6192
|
+
/**
|
|
6193
|
+
* workload task 의 이벤트 목록을 반환한다.
|
|
6194
|
+
* GET /ncs/v1.0/appkeys/{appKey}/workloads/{workloadId}/tasks/{taskId}/events
|
|
6195
|
+
* 응답: { header, events: [...] } — named 필드.
|
|
6196
|
+
* pagination: X-Total-Count 헤더가 docs 에 명시되진 않았으나, 있으면 정확히 반영하고 없으면
|
|
6197
|
+
* 현재 페이지 길이로 fallback(listTemplates 와 동일한 방어적 패턴 — 실제 헤더 부재와도 호환).
|
|
6198
|
+
*/
|
|
6199
|
+
async getWorkloadEvents(id, taskId, query = {}) {
|
|
6200
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/tasks/${encodeURIComponent(taskId)}/events`;
|
|
6201
|
+
const searchParams = {};
|
|
6202
|
+
if (query.type !== void 0) searchParams["type"] = query.type;
|
|
6203
|
+
if (query.q !== void 0) searchParams["q"] = query.q;
|
|
6204
|
+
if (query.from !== void 0) searchParams["from"] = query.from;
|
|
6205
|
+
if (query.to !== void 0) searchParams["to"] = query.to;
|
|
6206
|
+
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
6207
|
+
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
6208
|
+
try {
|
|
6209
|
+
const res = await import_ky12.default.get(url, {
|
|
6210
|
+
headers: this.authHeaders(),
|
|
6211
|
+
searchParams,
|
|
6212
|
+
retry: 0,
|
|
6213
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6214
|
+
});
|
|
6215
|
+
const body = await res.json();
|
|
6216
|
+
unwrapHeader(body);
|
|
6217
|
+
if (!Array.isArray(body.events)) {
|
|
6218
|
+
if (body.events === void 0) return { totalCount: 0, events: [] };
|
|
6219
|
+
throw new NhnCloudCliError(
|
|
6220
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: events \uAC00 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
6221
|
+
EXIT_API_ERROR
|
|
6222
|
+
);
|
|
6223
|
+
}
|
|
6224
|
+
const events = body.events.filter(isNcsWorkloadEvent);
|
|
6225
|
+
const headerTotal = res.headers.get("x-total-count");
|
|
6226
|
+
const totalCount = headerTotal !== null && /^\d+$/.test(headerTotal) ? Number(headerTotal) : events.length;
|
|
6227
|
+
return { totalCount, events };
|
|
6228
|
+
} catch (err) {
|
|
6229
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6230
|
+
throw toNhnCloudCliError(err);
|
|
6231
|
+
}
|
|
6232
|
+
}
|
|
6233
|
+
/**
|
|
6234
|
+
* workload 의 실행 히스토리 목록을 반환한다.
|
|
6235
|
+
* GET /ncs/v1.0/appkeys/{appKey}/workloads/{workloadId}/history
|
|
6236
|
+
* 응답: { header, history: [...] } — named 필드.
|
|
6237
|
+
* pagination: getWorkloadEvents 와 동일한 방어적 X-Total-Count fallback 패턴.
|
|
6238
|
+
*/
|
|
6239
|
+
async listWorkloadHistory(id, query = {}) {
|
|
6240
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/history`;
|
|
6241
|
+
const searchParams = {};
|
|
6242
|
+
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
6243
|
+
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
6244
|
+
if (query.sort !== void 0) searchParams["sort"] = query.sort;
|
|
6245
|
+
try {
|
|
6246
|
+
const res = await import_ky12.default.get(url, {
|
|
6247
|
+
headers: this.authHeaders(),
|
|
6248
|
+
searchParams,
|
|
6249
|
+
retry: 0,
|
|
6250
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6251
|
+
});
|
|
6252
|
+
const body = await res.json();
|
|
6253
|
+
unwrapHeader(body);
|
|
6254
|
+
if (!Array.isArray(body.history)) {
|
|
6255
|
+
if (body.history === void 0) return { totalCount: 0, history: [] };
|
|
6256
|
+
throw new NhnCloudCliError(
|
|
6257
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: history \uAC00 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
6258
|
+
EXIT_API_ERROR
|
|
6259
|
+
);
|
|
6260
|
+
}
|
|
6261
|
+
const history = body.history.filter(isNcsWorkloadHistorySummary);
|
|
6262
|
+
const headerTotal = res.headers.get("x-total-count");
|
|
6263
|
+
const totalCount = headerTotal !== null && /^\d+$/.test(headerTotal) ? Number(headerTotal) : history.length;
|
|
6264
|
+
return { totalCount, history };
|
|
6265
|
+
} catch (err) {
|
|
6266
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6267
|
+
throw toNhnCloudCliError(err);
|
|
6268
|
+
}
|
|
6269
|
+
}
|
|
6270
|
+
/**
|
|
6271
|
+
* workload 실행 히스토리 단건을 반환한다 (당시 사용한 template 스냅샷 포함).
|
|
6272
|
+
* GET /ncs/v1.0/appkeys/{appKey}/workloads/{workloadId}/history/{historyId}
|
|
6273
|
+
* 응답: { header, history: {...}, template: {...} } — history/template 이 sibling named 필드(docs 예제 확정).
|
|
6274
|
+
*/
|
|
6275
|
+
async getWorkloadHistory(id, historyId) {
|
|
6276
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/history/${encodeURIComponent(historyId)}`;
|
|
6277
|
+
try {
|
|
6278
|
+
const res = await import_ky12.default.get(url, {
|
|
6279
|
+
headers: this.authHeaders(),
|
|
6280
|
+
retry: 0,
|
|
6281
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6282
|
+
});
|
|
6283
|
+
const body = await res.json();
|
|
6284
|
+
unwrapHeader(body);
|
|
6285
|
+
if (!isNcsWorkloadHistoryDetail(body.history)) {
|
|
6286
|
+
throw new NhnCloudCliError(
|
|
6287
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: history \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6288
|
+
EXIT_API_ERROR
|
|
6289
|
+
);
|
|
6290
|
+
}
|
|
6291
|
+
return { ...body.history, template: body.template };
|
|
6292
|
+
} catch (err) {
|
|
6293
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6294
|
+
throw toNhnCloudCliError(err);
|
|
6295
|
+
}
|
|
6296
|
+
}
|
|
6297
|
+
/**
|
|
6298
|
+
* workload 의 예약 실행 히스토리 목록을 반환한다.
|
|
6299
|
+
* GET /ncs/v1.0/appkeys/{appKey}/workloads/{workloadId}/schedulehistory
|
|
6300
|
+
* 응답: { header, schedulehistory: [...] } — named 필드. docs 에 X-Total-Count 헤더가 없어
|
|
6301
|
+
* totalCount 는 반환하지 않는다(phase 범위 — page/size 는 후속 필요 시 추가, ADR-020 표 갱신 불필요한 범위 내 결정).
|
|
6302
|
+
*/
|
|
6303
|
+
async getWorkloadScheduleHistory(id) {
|
|
6304
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/schedulehistory`;
|
|
6305
|
+
try {
|
|
6306
|
+
const res = await import_ky12.default.get(url, {
|
|
6307
|
+
headers: this.authHeaders(),
|
|
6308
|
+
retry: 0,
|
|
6309
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6310
|
+
});
|
|
6311
|
+
const body = await res.json();
|
|
6312
|
+
unwrapHeader(body);
|
|
6313
|
+
if (!Array.isArray(body.schedulehistory)) {
|
|
6314
|
+
if (body.schedulehistory === void 0) return { scheduleHistory: [] };
|
|
6315
|
+
throw new NhnCloudCliError(
|
|
6316
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: schedulehistory \uAC00 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
6317
|
+
EXIT_API_ERROR
|
|
6318
|
+
);
|
|
6319
|
+
}
|
|
6320
|
+
return { scheduleHistory: body.schedulehistory.filter(isNcsWorkloadScheduleHistory) };
|
|
6321
|
+
} catch (err) {
|
|
6322
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6323
|
+
throw toNhnCloudCliError(err);
|
|
6324
|
+
}
|
|
6325
|
+
}
|
|
6326
|
+
/**
|
|
6327
|
+
* 설계도(template) 를 생성한다.
|
|
6328
|
+
* POST /ncs/v1.0/appkeys/{appKey}/templates
|
|
6329
|
+
* 요청 body 는 `--file <json>` 로 읽은 값을 그대로 전달한다(필수값 검증은 API 오류에 위임).
|
|
6330
|
+
* 응답: { header, template: {...} } — named 필드(getTemplate 과 동일 패턴).
|
|
6331
|
+
*/
|
|
6332
|
+
async createTemplate(body) {
|
|
6333
|
+
const url = `${this.baseUrl}/templates`;
|
|
6334
|
+
try {
|
|
6335
|
+
const res = await import_ky12.default.post(url, {
|
|
6336
|
+
headers: this.authHeaders(),
|
|
6337
|
+
json: body,
|
|
6338
|
+
retry: 0,
|
|
6339
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6340
|
+
});
|
|
6341
|
+
const resBody = await res.json();
|
|
6342
|
+
unwrapHeader(resBody);
|
|
6343
|
+
if (!isNcsTemplateDetail(resBody.template)) {
|
|
6344
|
+
throw new NhnCloudCliError(
|
|
6345
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: template \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6346
|
+
EXIT_API_ERROR
|
|
6347
|
+
);
|
|
6348
|
+
}
|
|
6349
|
+
return resBody.template;
|
|
6350
|
+
} catch (err) {
|
|
6351
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6352
|
+
throw toNhnCloudCliError(err);
|
|
6353
|
+
}
|
|
6354
|
+
}
|
|
6355
|
+
/**
|
|
6356
|
+
* 설계도(template) 를 삭제한다.
|
|
6357
|
+
* DELETE /ncs/v1.0/appkeys/{appKey}/templates/{id}
|
|
6358
|
+
*/
|
|
6359
|
+
async deleteTemplate(id) {
|
|
6360
|
+
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}`;
|
|
6361
|
+
try {
|
|
6362
|
+
const res = await import_ky12.default.delete(url, {
|
|
6363
|
+
headers: this.authHeaders(),
|
|
6364
|
+
retry: 0,
|
|
6365
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6366
|
+
});
|
|
6367
|
+
unwrapHeader(await res.json());
|
|
6368
|
+
} catch (err) {
|
|
6369
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6370
|
+
throw toNhnCloudCliError(err);
|
|
6371
|
+
}
|
|
6372
|
+
}
|
|
6373
|
+
/**
|
|
6374
|
+
* 설계도(template) 의 새 버전을 생성한다.
|
|
6375
|
+
* POST /ncs/v1.0/appkeys/{appKey}/templates/{id}/versions
|
|
6376
|
+
* body 에 `sourceVersion` 이 필수(docs 확정)이나 클라이언트는 그대로 전달하고
|
|
6377
|
+
* 필수값 검증은 API 응답 오류에 위임한다(1-3 회피 — API 경로에서 EXIT_PARAM_ERROR 를 만들지 않음).
|
|
6378
|
+
* 응답: { header, version: {...} } — named 필드(getTemplateVersion 과 동일 패턴).
|
|
6379
|
+
*/
|
|
6380
|
+
async createTemplateVersion(id, body) {
|
|
6381
|
+
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}/versions`;
|
|
6382
|
+
try {
|
|
6383
|
+
const res = await import_ky12.default.post(url, {
|
|
6384
|
+
headers: this.authHeaders(),
|
|
6385
|
+
json: body,
|
|
6386
|
+
retry: 0,
|
|
6387
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6388
|
+
});
|
|
6389
|
+
const resBody = await res.json();
|
|
6390
|
+
unwrapHeader(resBody);
|
|
6391
|
+
if (!isNcsTemplateVersionDetail(resBody.version)) {
|
|
6392
|
+
throw new NhnCloudCliError(
|
|
6393
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: version \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6394
|
+
EXIT_API_ERROR
|
|
6395
|
+
);
|
|
6396
|
+
}
|
|
6397
|
+
return resBody.version;
|
|
6398
|
+
} catch (err) {
|
|
6399
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6400
|
+
throw toNhnCloudCliError(err);
|
|
6401
|
+
}
|
|
6402
|
+
}
|
|
6403
|
+
/**
|
|
6404
|
+
* 설계도(template) 버전을 삭제한다.
|
|
6405
|
+
* DELETE /ncs/v1.0/appkeys/{appKey}/templates/{id}/versions/{version}
|
|
6406
|
+
*/
|
|
6407
|
+
async deleteTemplateVersion(id, version) {
|
|
6408
|
+
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`;
|
|
6409
|
+
try {
|
|
6410
|
+
const res = await import_ky12.default.delete(url, {
|
|
6411
|
+
headers: this.authHeaders(),
|
|
6412
|
+
retry: 0,
|
|
6413
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6414
|
+
});
|
|
6415
|
+
unwrapHeader(await res.json());
|
|
6416
|
+
} catch (err) {
|
|
6417
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6418
|
+
throw toNhnCloudCliError(err);
|
|
6419
|
+
}
|
|
6420
|
+
}
|
|
6421
|
+
/**
|
|
6422
|
+
* workload 를 일시정지한다.
|
|
6423
|
+
* POST /ncs/v1.0/appkeys/{appKey}/workloads/{id}/pause
|
|
6424
|
+
*/
|
|
6425
|
+
async pauseWorkload(id) {
|
|
6426
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/pause`;
|
|
6427
|
+
try {
|
|
6428
|
+
const res = await import_ky12.default.post(url, {
|
|
6429
|
+
headers: this.authHeaders(),
|
|
6430
|
+
retry: 0,
|
|
6431
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6432
|
+
});
|
|
6433
|
+
unwrapHeader(await res.json());
|
|
6434
|
+
} catch (err) {
|
|
6435
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6436
|
+
throw toNhnCloudCliError(err);
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
/**
|
|
6440
|
+
* workload 를 재개한다.
|
|
6441
|
+
* POST /ncs/v1.0/appkeys/{appKey}/workloads/{id}/resume
|
|
6442
|
+
*/
|
|
6443
|
+
async resumeWorkload(id) {
|
|
6444
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/resume`;
|
|
6445
|
+
try {
|
|
6446
|
+
const res = await import_ky12.default.post(url, {
|
|
6447
|
+
headers: this.authHeaders(),
|
|
6448
|
+
retry: 0,
|
|
6449
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6450
|
+
});
|
|
6451
|
+
unwrapHeader(await res.json());
|
|
6452
|
+
} catch (err) {
|
|
6453
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6454
|
+
throw toNhnCloudCliError(err);
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6457
|
+
/**
|
|
6458
|
+
* workload task 를 재시작한다.
|
|
6459
|
+
* POST /ncs/v1.0/appkeys/{appKey}/workloads/{id}/tasks/{taskId}/restart
|
|
6460
|
+
*/
|
|
6461
|
+
async restartWorkloadTask(id, taskId) {
|
|
6462
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/tasks/${encodeURIComponent(taskId)}/restart`;
|
|
6463
|
+
try {
|
|
6464
|
+
const res = await import_ky12.default.post(url, {
|
|
6465
|
+
headers: this.authHeaders(),
|
|
6466
|
+
retry: 0,
|
|
6467
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6468
|
+
});
|
|
6469
|
+
unwrapHeader(await res.json());
|
|
6470
|
+
} catch (err) {
|
|
6471
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6472
|
+
throw toNhnCloudCliError(err);
|
|
6473
|
+
}
|
|
6474
|
+
}
|
|
6475
|
+
/**
|
|
6476
|
+
* workload 를 생성한다.
|
|
6477
|
+
* POST /ncs/v1.0/appkeys/{appKey}/workloads
|
|
6478
|
+
* 요청 body 는 `--file <json>` 로 읽은 값을 그대로 전달한다(필수값 검증은 API 오류에 위임 — createTemplate 과 동일).
|
|
6479
|
+
* 응답: { header, workload: {...} } — 생성된 workload 전체 객체(id 만 반환하는 축약 응답 아님, docs 예제 실측 확정).
|
|
6480
|
+
*/
|
|
6481
|
+
async createWorkload(body) {
|
|
6482
|
+
const url = `${this.baseUrl}/workloads`;
|
|
6483
|
+
try {
|
|
6484
|
+
const res = await import_ky12.default.post(url, {
|
|
6485
|
+
headers: this.authHeaders(),
|
|
6486
|
+
json: body,
|
|
6487
|
+
retry: 0,
|
|
6488
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6489
|
+
});
|
|
6490
|
+
const resBody = await res.json();
|
|
6491
|
+
unwrapHeader(resBody);
|
|
6492
|
+
if (!isNcsWorkloadDetail(resBody.workload)) {
|
|
6493
|
+
throw new NhnCloudCliError(
|
|
6494
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: workload \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6495
|
+
EXIT_API_ERROR
|
|
6496
|
+
);
|
|
6497
|
+
}
|
|
6498
|
+
return resBody.workload;
|
|
6499
|
+
} catch (err) {
|
|
6500
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6501
|
+
throw toNhnCloudCliError(err);
|
|
6502
|
+
}
|
|
6503
|
+
}
|
|
6504
|
+
/**
|
|
6505
|
+
* workload 를 전체 교체한다.
|
|
6506
|
+
* PUT /ncs/v1.0/appkeys/{appKey}/workloads/{id}
|
|
6507
|
+
* 응답: { header, workload: {...} } — createWorkload 와 동일한 전체 객체 응답(docs 예제 실측 확정).
|
|
6508
|
+
*/
|
|
6509
|
+
async updateWorkload(id, body) {
|
|
6510
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}`;
|
|
6511
|
+
try {
|
|
6512
|
+
const res = await import_ky12.default.put(url, {
|
|
6513
|
+
headers: this.authHeaders(),
|
|
6514
|
+
json: body,
|
|
6515
|
+
retry: 0,
|
|
6516
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6517
|
+
});
|
|
6518
|
+
const resBody = await res.json();
|
|
6519
|
+
unwrapHeader(resBody);
|
|
6520
|
+
if (!isNcsWorkloadDetail(resBody.workload)) {
|
|
6521
|
+
throw new NhnCloudCliError(
|
|
6522
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: workload \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6523
|
+
EXIT_API_ERROR
|
|
6524
|
+
);
|
|
6525
|
+
}
|
|
6526
|
+
return resBody.workload;
|
|
6527
|
+
} catch (err) {
|
|
6528
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6529
|
+
throw toNhnCloudCliError(err);
|
|
6530
|
+
}
|
|
6531
|
+
}
|
|
6532
|
+
/**
|
|
6533
|
+
* workload 를 부분 변경한다 (JSON Patch 배열, RFC 6902).
|
|
6534
|
+
* PATCH /ncs/v1.0/appkeys/{appKey}/workloads/{id}
|
|
6535
|
+
* Content-Type 이 application/json-patch+json 이어야 한다(docs 확정) — authHeaders() 에 덮어써서 명시 지정.
|
|
6536
|
+
* 응답: { header, workload: {...} } — createWorkload 와 동일한 전체 객체 응답(docs 예제 실측 확정).
|
|
6537
|
+
* redirect/status 분기 불필요 — 공통 봉투 응답(HTTP 200 고정, ADR-006).
|
|
6538
|
+
*/
|
|
6539
|
+
async patchWorkload(id, patch) {
|
|
6540
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}`;
|
|
6541
|
+
try {
|
|
6542
|
+
const res = await import_ky12.default.patch(url, {
|
|
6543
|
+
headers: { ...this.authHeaders(), "Content-Type": "application/json-patch+json" },
|
|
6544
|
+
json: patch,
|
|
6545
|
+
retry: 0,
|
|
6546
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6547
|
+
});
|
|
6548
|
+
const resBody = await res.json();
|
|
6549
|
+
unwrapHeader(resBody);
|
|
6550
|
+
if (!isNcsWorkloadDetail(resBody.workload)) {
|
|
6551
|
+
throw new NhnCloudCliError(
|
|
6552
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: workload \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6553
|
+
EXIT_API_ERROR
|
|
6554
|
+
);
|
|
6555
|
+
}
|
|
6556
|
+
return resBody.workload;
|
|
6557
|
+
} catch (err) {
|
|
6558
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6559
|
+
throw toNhnCloudCliError(err);
|
|
6560
|
+
}
|
|
6561
|
+
}
|
|
6562
|
+
/**
|
|
6563
|
+
* workload 가 `Running` 상태에 도달할 때까지 폴링한다 (instance client 의 waitForActive 선례, ADR-011).
|
|
6564
|
+
* 데드라인을 고정해두고 매 반복 남은 시간만큼만 대기해 timeoutMs 를 초과하지 않는다.
|
|
6565
|
+
* 타임아웃 시 마지막으로 조회한 상태를 메시지에 포함해 NhnCloudCliError(EXIT_API_ERROR) 를 던진다.
|
|
6566
|
+
*/
|
|
6567
|
+
async waitForRunning(id, opts) {
|
|
6568
|
+
const intervalMs = opts.intervalMs ?? DEFAULT_WAIT_POLL_INTERVAL_MS;
|
|
6569
|
+
const deadline = Date.now() + opts.timeoutMs;
|
|
6570
|
+
let lastWorkload = null;
|
|
6571
|
+
while (Date.now() < deadline) {
|
|
6572
|
+
const workload = await this.getWorkload(id);
|
|
6573
|
+
lastWorkload = workload;
|
|
6574
|
+
if (workload.status === "Running") {
|
|
6575
|
+
return workload;
|
|
6576
|
+
}
|
|
6577
|
+
const remaining = deadline - Date.now();
|
|
6578
|
+
if (remaining <= 0) break;
|
|
6579
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(intervalMs, remaining)));
|
|
6580
|
+
}
|
|
6581
|
+
const lastStatus = lastWorkload ? lastWorkload.status : "unknown";
|
|
6582
|
+
throw new NhnCloudCliError(
|
|
6583
|
+
`NCS workload ${id} \uAC00 Running \uC0C1\uD0DC\uAC00 \uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4 (\uB9C8\uC9C0\uB9C9 \uC0C1\uD0DC: ${lastStatus}). --wait \uD0C0\uC784\uC544\uC6C3(${Math.round(opts.timeoutMs / 1e3)}\uCD08) \uCD08\uACFC.`,
|
|
6584
|
+
EXIT_API_ERROR
|
|
6585
|
+
);
|
|
6586
|
+
}
|
|
6587
|
+
/**
|
|
6588
|
+
* workload 를 삭제한다.
|
|
6589
|
+
* DELETE /ncs/v1.0/appkeys/{appKey}/workloads/{id}
|
|
6590
|
+
*/
|
|
6591
|
+
async deleteWorkload(id) {
|
|
6592
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}`;
|
|
6593
|
+
try {
|
|
6594
|
+
const res = await import_ky12.default.delete(url, {
|
|
6595
|
+
headers: this.authHeaders(),
|
|
6596
|
+
retry: 0,
|
|
6597
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6598
|
+
});
|
|
6599
|
+
unwrapHeader(await res.json());
|
|
6600
|
+
} catch (err) {
|
|
6601
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6602
|
+
throw toNhnCloudCliError(err);
|
|
6603
|
+
}
|
|
6604
|
+
}
|
|
6605
|
+
/**
|
|
6606
|
+
* 악성코드 검사 설정을 조회한다.
|
|
6607
|
+
* GET /ncs/v1.0/appkeys/{appKey}/malware/config (appkey-scoped, docs 예제 실측 확정 — 계정 레벨 아님)
|
|
6608
|
+
* 응답: { header, enabled: true|false } — named 필드 없이 header 와 나란히 flat 필드(docs 예제 실측 확정).
|
|
6609
|
+
*/
|
|
6610
|
+
async getMalwareConfig() {
|
|
6611
|
+
const url = `${this.baseUrl}/malware/config`;
|
|
6612
|
+
try {
|
|
6613
|
+
const res = await import_ky12.default.get(url, {
|
|
6614
|
+
headers: this.authHeaders(),
|
|
6615
|
+
retry: 0,
|
|
6616
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6617
|
+
});
|
|
6618
|
+
const body = await res.json();
|
|
6619
|
+
unwrapHeader(body);
|
|
6620
|
+
if (!isNcsMalwareConfig(body)) {
|
|
6621
|
+
throw new NhnCloudCliError(
|
|
6622
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: enabled \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6623
|
+
EXIT_API_ERROR
|
|
6624
|
+
);
|
|
6625
|
+
}
|
|
6626
|
+
return { enabled: body.enabled };
|
|
6627
|
+
} catch (err) {
|
|
6628
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6629
|
+
throw toNhnCloudCliError(err);
|
|
6630
|
+
}
|
|
6631
|
+
}
|
|
6632
|
+
/**
|
|
6633
|
+
* 악성코드 검사 설정을 변경한다.
|
|
6634
|
+
* POST /ncs/v1.0/appkeys/{appKey}/malware/config (method 는 POST — docs 예제 실측 확정, PUT 아님)
|
|
6635
|
+
* 요청 body: { enabled: boolean } — docs 필드 표기는 "String" 이나 예제 JSON 이 quote 없는 boolean
|
|
6636
|
+
* 리터럴이라 실제 wire 타입은 boolean(malware.enabled 실측 확정, ADR-020 트레이드오프 절 참조).
|
|
6637
|
+
* 응답: { header, enabled: true|false } — getMalwareConfig 와 동일한 flat 패턴.
|
|
6638
|
+
*/
|
|
6639
|
+
async setMalwareConfig(enabled) {
|
|
6640
|
+
const url = `${this.baseUrl}/malware/config`;
|
|
6641
|
+
try {
|
|
6642
|
+
const res = await import_ky12.default.post(url, {
|
|
6643
|
+
headers: this.authHeaders(),
|
|
6644
|
+
json: { enabled },
|
|
6645
|
+
retry: 0,
|
|
6646
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6647
|
+
});
|
|
6648
|
+
const body = await res.json();
|
|
6649
|
+
unwrapHeader(body);
|
|
6650
|
+
if (!isNcsMalwareConfig(body)) {
|
|
6651
|
+
throw new NhnCloudCliError(
|
|
6652
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: enabled \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
6653
|
+
EXIT_API_ERROR
|
|
6654
|
+
);
|
|
6655
|
+
}
|
|
6656
|
+
return { enabled: body.enabled };
|
|
6657
|
+
} catch (err) {
|
|
6658
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6659
|
+
throw toNhnCloudCliError(err);
|
|
6660
|
+
}
|
|
6661
|
+
}
|
|
6662
|
+
/**
|
|
6663
|
+
* workload 실행 히스토리의 악성코드 검사 결과를 조회한다.
|
|
6664
|
+
* GET /ncs/v1.0/appkeys/{appKey}/workloads/{workloadId}/history/{historyId}/malware
|
|
6665
|
+
* 응답: { header, scannedAt, infectedFiles, scannedDirectories, scannedFiles, reports: [...] } —
|
|
6666
|
+
* named 필드로 감싸지 않고 header 와 나란히 flat 필드(docs 예제 실측 확정, malware config 와 동일 패턴).
|
|
6667
|
+
* 모든 top-level 필드가 docs 상 optional(미검사 워크로드는 누락 가능) — 존재하면 그대로 통과시킨다.
|
|
6668
|
+
*/
|
|
6669
|
+
async getMalwareResult(workloadId, historyId) {
|
|
6670
|
+
const url = `${this.baseUrl}/workloads/${encodeURIComponent(workloadId)}/history/${encodeURIComponent(historyId)}/malware`;
|
|
6671
|
+
try {
|
|
6672
|
+
const res = await import_ky12.default.get(url, {
|
|
6673
|
+
headers: this.authHeaders(),
|
|
6674
|
+
retry: 0,
|
|
6675
|
+
timeout: DEFAULT_TIMEOUT_MS8
|
|
6676
|
+
});
|
|
6677
|
+
const body = await res.json();
|
|
6678
|
+
unwrapHeader(body);
|
|
6679
|
+
if (body.reports !== void 0 && !Array.isArray(body.reports)) {
|
|
6680
|
+
throw new NhnCloudCliError(
|
|
6681
|
+
"NCS API \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: reports \uAC00 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
6682
|
+
EXIT_API_ERROR
|
|
6683
|
+
);
|
|
6684
|
+
}
|
|
6685
|
+
return {
|
|
6686
|
+
scannedAt: body.scannedAt,
|
|
6687
|
+
infectedFiles: body.infectedFiles,
|
|
6688
|
+
scannedDirectories: body.scannedDirectories,
|
|
6689
|
+
scannedFiles: body.scannedFiles,
|
|
6690
|
+
reports: body.reports?.filter(isNcsMalwareReport) ?? []
|
|
6691
|
+
};
|
|
6692
|
+
} catch (err) {
|
|
6693
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
6694
|
+
throw toNhnCloudCliError(err);
|
|
6695
|
+
}
|
|
6696
|
+
}
|
|
6697
|
+
};
|
|
6698
|
+
|
|
6699
|
+
// src/commands/ncs/helpers.ts
|
|
6700
|
+
var MAX_JSON_PAYLOAD_BYTES = 1e6;
|
|
6701
|
+
async function resolveNcsAppKey(profileName, appKeyOpt) {
|
|
6702
|
+
if (appKeyOpt) return appKeyOpt;
|
|
6703
|
+
let cred;
|
|
6704
|
+
try {
|
|
6705
|
+
cred = await getServiceCredential("ncs", profileName);
|
|
6706
|
+
} catch (err) {
|
|
6707
|
+
if (!(err instanceof NhnCloudCliError) || err.exitCode !== EXIT_CONFIG_ERROR) {
|
|
6708
|
+
throw err;
|
|
6709
|
+
}
|
|
6710
|
+
}
|
|
6711
|
+
if (!cred?.appkey) {
|
|
6712
|
+
throw new NhnCloudCliError(
|
|
6713
|
+
"NCS appKey \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. --app-key \uC635\uC158\uC73C\uB85C \uC9C0\uC815\uD558\uAC70\uB098\n~/.nhncloud/credentials.json \uC758 profiles.<profile>.ncs.appkey \uB97C \uC9C1\uC811 \uCD94\uAC00\uD558\uC138\uC694.\n(nhncloud configure \uB294 \uC544\uC9C1 ncs \uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.)",
|
|
6714
|
+
EXIT_CONFIG_ERROR
|
|
6715
|
+
);
|
|
6716
|
+
}
|
|
6717
|
+
return cred.appkey;
|
|
6718
|
+
}
|
|
6719
|
+
async function resolveNcsClient(opts) {
|
|
6720
|
+
const profileName = await resolveProfileName(opts.profile);
|
|
6721
|
+
const uak = await getUserAccessKey(profileName);
|
|
6722
|
+
const accessToken = await getAccessToken(profileName, uak.id, uak.secret);
|
|
6723
|
+
const appKey = await resolveNcsAppKey(profileName, opts.appKey);
|
|
6724
|
+
const region = opts.region ?? "kr1";
|
|
6725
|
+
return { client: new NcsClient(accessToken, region, appKey), profileName };
|
|
6726
|
+
}
|
|
6727
|
+
function readJsonPayload(filePath) {
|
|
6728
|
+
let stat;
|
|
6729
|
+
try {
|
|
6730
|
+
stat = (0, import_node_fs7.statSync)(filePath);
|
|
6731
|
+
} catch (err) {
|
|
6732
|
+
const reason = err.code ?? (err instanceof Error ? err.message : String(err));
|
|
6733
|
+
throw new NhnCloudCliError(
|
|
6734
|
+
`\uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${filePath} (${reason})`,
|
|
6735
|
+
EXIT_PARAM_ERROR
|
|
6736
|
+
);
|
|
6737
|
+
}
|
|
6738
|
+
if (!stat.isFile()) {
|
|
6739
|
+
throw new NhnCloudCliError(`--file \uC774 \uC77C\uBC18 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${filePath}`, EXIT_PARAM_ERROR);
|
|
6740
|
+
}
|
|
6741
|
+
if (stat.size > MAX_JSON_PAYLOAD_BYTES) {
|
|
6742
|
+
throw new NhnCloudCliError(
|
|
6743
|
+
`--file \uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${stat.size} \uBC14\uC774\uD2B8). JSON spec \uD55C\uB3C4 ${MAX_JSON_PAYLOAD_BYTES} \uBC14\uC774\uD2B8.`,
|
|
6744
|
+
EXIT_PARAM_ERROR
|
|
6745
|
+
);
|
|
6746
|
+
}
|
|
6747
|
+
const raw = (0, import_node_fs7.readFileSync)(filePath, "utf-8");
|
|
6748
|
+
try {
|
|
6749
|
+
return JSON.parse(raw);
|
|
6750
|
+
} catch (err) {
|
|
6751
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
6752
|
+
throw new NhnCloudCliError(
|
|
6753
|
+
`JSON \uD30C\uC2F1\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4: ${filePath} (${detail})`,
|
|
6754
|
+
EXIT_PARAM_ERROR
|
|
6755
|
+
);
|
|
6756
|
+
}
|
|
6757
|
+
}
|
|
6758
|
+
function requireNonEmpty(value, label) {
|
|
6759
|
+
if (!value.trim()) {
|
|
6760
|
+
throw new NhnCloudCliError(`${label} \uC778\uC218\uAC00 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
6761
|
+
}
|
|
6762
|
+
}
|
|
6763
|
+
async function confirmDestructive(message, yes) {
|
|
6764
|
+
const isTTY = process.stdin.isTTY;
|
|
6765
|
+
if (!isTTY && !yes) {
|
|
6766
|
+
throw new NhnCloudCliError(
|
|
6767
|
+
"\uBE44\uB300\uD654\uD615 \uD658\uACBD\uC5D0\uC11C\uB294 --yes \uD50C\uB798\uADF8\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.",
|
|
6768
|
+
EXIT_PARAM_ERROR
|
|
6769
|
+
);
|
|
6770
|
+
}
|
|
6771
|
+
if (isTTY && !yes) {
|
|
6772
|
+
const { confirm } = await import("@inquirer/prompts");
|
|
6773
|
+
return confirm({ message, default: false });
|
|
6774
|
+
}
|
|
6775
|
+
return true;
|
|
6776
|
+
}
|
|
6777
|
+
|
|
6778
|
+
// src/commands/ncs/template.ts
|
|
6779
|
+
var listCommand8 = new import_commander45.Command("list").description("NCS \uC124\uACC4\uB3C4(template) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").option("--page <page>", "\uC870\uD68C\uD560 page \uBC88\uD638").option("--size <size>", "page \uB2F9 \uD56D\uBAA9 \uC218 (\uAE30\uBCF8: API \uAE30\uBCF8\uAC12 10)").action(async (_opts, cmd) => {
|
|
6780
|
+
const opts = cmd.optsWithGlobals();
|
|
6781
|
+
const { client } = await resolveNcsClient(opts);
|
|
6782
|
+
startSpinner("NCS \uC124\uACC4\uB3C4 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
6783
|
+
let totalCount;
|
|
6784
|
+
let templates;
|
|
6785
|
+
try {
|
|
6786
|
+
const result = await client.listTemplates({
|
|
6787
|
+
page: parsePositiveIntegerOption(opts.page, "--page"),
|
|
6788
|
+
size: parsePositiveIntegerOption(opts.size, "--size")
|
|
6789
|
+
});
|
|
6790
|
+
totalCount = result.totalCount;
|
|
6791
|
+
templates = result.templates;
|
|
6792
|
+
} catch (err) {
|
|
6793
|
+
stopSpinner(false);
|
|
6794
|
+
throw err;
|
|
6795
|
+
}
|
|
6796
|
+
stopSpinner(true);
|
|
6797
|
+
output(opts, {
|
|
6798
|
+
headers: ["id", "name", "version", "versionCount", "workloadCount"],
|
|
6799
|
+
rows: templates.map((t) => [
|
|
6800
|
+
t.id,
|
|
6801
|
+
t.name,
|
|
6802
|
+
t.version ?? "",
|
|
6803
|
+
String(t.versionCount ?? ""),
|
|
6804
|
+
String(t.workloadCount ?? "")
|
|
6805
|
+
]),
|
|
6806
|
+
raw: { totalCount, templates },
|
|
6807
|
+
ids: templates.map((t) => t.id)
|
|
6808
|
+
});
|
|
6809
|
+
});
|
|
6810
|
+
var getCommand6 = new import_commander45.Command("get").description("NCS \uC124\uACC4\uB3C4(template) \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "template ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
6811
|
+
const opts = cmd.optsWithGlobals();
|
|
6812
|
+
requireNonEmpty(id, "id");
|
|
6813
|
+
const { client } = await resolveNcsClient(opts);
|
|
6814
|
+
startSpinner(`NCS \uC124\uACC4\uB3C4 "${id}" \uC870\uD68C \uC911...`);
|
|
6815
|
+
let template;
|
|
6816
|
+
try {
|
|
6817
|
+
template = await client.getTemplate(id);
|
|
6818
|
+
} catch (err) {
|
|
6819
|
+
stopSpinner(false);
|
|
6820
|
+
throw err;
|
|
6821
|
+
}
|
|
6822
|
+
stopSpinner(true);
|
|
6823
|
+
output(opts, {
|
|
6824
|
+
headers: ["id", "name", "version", "versionCount", "workloadCount"],
|
|
6825
|
+
rows: [
|
|
6826
|
+
[
|
|
6827
|
+
template.id,
|
|
6828
|
+
template.name,
|
|
6829
|
+
template.version ?? "",
|
|
6830
|
+
String(template.versionCount ?? ""),
|
|
6831
|
+
String(template.workloadCount ?? "")
|
|
6832
|
+
]
|
|
6833
|
+
],
|
|
6834
|
+
raw: template,
|
|
6835
|
+
ids: [template.id]
|
|
6836
|
+
});
|
|
6837
|
+
});
|
|
6838
|
+
var createCommand6 = new import_commander45.Command("create").description("NCS \uC124\uACC4\uB3C4(template) \uB97C \uC0DD\uC131\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC)").requiredOption("--file <path>", "template \uC0DD\uC131 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
6839
|
+
const opts = cmd.optsWithGlobals();
|
|
6840
|
+
const payload = readJsonPayload(opts.file);
|
|
6841
|
+
const { client } = await resolveNcsClient(opts);
|
|
6842
|
+
startSpinner("NCS \uC124\uACC4\uB3C4 \uC0DD\uC131 \uC911...");
|
|
6843
|
+
let template;
|
|
6844
|
+
try {
|
|
6845
|
+
template = await client.createTemplate(payload);
|
|
6846
|
+
} catch (err) {
|
|
6847
|
+
stopSpinner(false);
|
|
6848
|
+
throw err;
|
|
6849
|
+
}
|
|
6850
|
+
stopSpinner(true);
|
|
6851
|
+
output(opts, {
|
|
6852
|
+
headers: ["id", "name", "version", "versionCount", "workloadCount"],
|
|
6853
|
+
rows: [
|
|
6854
|
+
[
|
|
6855
|
+
template.id,
|
|
6856
|
+
template.name,
|
|
6857
|
+
template.version ?? "",
|
|
6858
|
+
String(template.versionCount ?? ""),
|
|
6859
|
+
String(template.workloadCount ?? "")
|
|
6860
|
+
]
|
|
6861
|
+
],
|
|
6862
|
+
raw: template,
|
|
6863
|
+
ids: [template.id]
|
|
6864
|
+
});
|
|
6865
|
+
});
|
|
6866
|
+
var deleteCommand5 = new import_commander45.Command("delete").description("NCS \uC124\uACC4\uB3C4(template) \uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "template ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
6867
|
+
const opts = cmd.optsWithGlobals();
|
|
6868
|
+
requireNonEmpty(id, "id");
|
|
6869
|
+
const ok = await confirmDestructive(`NCS \uC124\uACC4\uB3C4 "${id}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
6870
|
+
if (!ok) {
|
|
6871
|
+
process.stderr.write(import_chalk16.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
6872
|
+
return;
|
|
6873
|
+
}
|
|
6874
|
+
const { client } = await resolveNcsClient(opts);
|
|
6875
|
+
startSpinner(`NCS \uC124\uACC4\uB3C4 \uC0AD\uC81C \uC911... (id: ${id})`);
|
|
6876
|
+
try {
|
|
6877
|
+
await client.deleteTemplate(id);
|
|
6878
|
+
} catch (err) {
|
|
6879
|
+
stopSpinner(false);
|
|
6880
|
+
throw err;
|
|
6881
|
+
}
|
|
6882
|
+
stopSpinner(true);
|
|
6883
|
+
process.stderr.write(import_chalk16.default.green(`\u2713 NCS \uC124\uACC4\uB3C4 "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
6884
|
+
`));
|
|
6885
|
+
});
|
|
6886
|
+
var versionListCommand = new import_commander45.Command("list").description("NCS \uC124\uACC4\uB3C4(template) \uC758 \uBC84\uC804 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "template ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").option("--q <query>", "\uAC80\uC0C9\uC5B4").option("--sort <sort>", "\uC815\uB82C \uC870\uAC74").option("--page <page>", "\uC870\uD68C\uD560 page \uBC88\uD638").option("--size <size>", "page \uB2F9 \uD56D\uBAA9 \uC218 (\uAE30\uBCF8: API \uAE30\uBCF8\uAC12 10)").action(async (id, _opts, cmd) => {
|
|
6887
|
+
const opts = cmd.optsWithGlobals();
|
|
6888
|
+
requireNonEmpty(id, "id");
|
|
6889
|
+
const { client } = await resolveNcsClient(opts);
|
|
6890
|
+
startSpinner(`NCS \uC124\uACC4\uB3C4 "${id}" \uBC84\uC804 \uBAA9\uB85D \uC870\uD68C \uC911...`);
|
|
6891
|
+
let totalCount;
|
|
6892
|
+
let versions;
|
|
6893
|
+
try {
|
|
6894
|
+
const result = await client.listTemplateVersions(id, {
|
|
6895
|
+
q: opts.q,
|
|
6896
|
+
sort: opts.sort,
|
|
6897
|
+
page: parsePositiveIntegerOption(opts.page, "--page"),
|
|
6898
|
+
size: parsePositiveIntegerOption(opts.size, "--size")
|
|
6899
|
+
});
|
|
6900
|
+
totalCount = result.totalCount;
|
|
6901
|
+
versions = result.versions;
|
|
6902
|
+
} catch (err) {
|
|
6903
|
+
stopSpinner(false);
|
|
6904
|
+
throw err;
|
|
6905
|
+
}
|
|
6906
|
+
stopSpinner(true);
|
|
6907
|
+
output(opts, {
|
|
6908
|
+
headers: ["id", "version", "workloadCount", "createdAt"],
|
|
6909
|
+
rows: versions.map((v) => [
|
|
6910
|
+
v.id,
|
|
6911
|
+
v.version,
|
|
6912
|
+
String(v.workloadCount ?? ""),
|
|
6913
|
+
v.createdAt ?? ""
|
|
6914
|
+
]),
|
|
6915
|
+
raw: { totalCount, versions },
|
|
6916
|
+
ids: versions.map((v) => v.id)
|
|
6917
|
+
});
|
|
6918
|
+
});
|
|
6919
|
+
var versionGetCommand = new import_commander45.Command("get").description("NCS \uC124\uACC4\uB3C4(template) \uBC84\uC804 \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "template ID").argument("<version>", "\uBC84\uC804 \uAC12").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, version, _opts, cmd) => {
|
|
6920
|
+
const opts = cmd.optsWithGlobals();
|
|
6921
|
+
requireNonEmpty(id, "id");
|
|
6922
|
+
requireNonEmpty(version, "version");
|
|
6923
|
+
const { client } = await resolveNcsClient(opts);
|
|
6924
|
+
startSpinner(`NCS \uC124\uACC4\uB3C4 "${id}" \uBC84\uC804 "${version}" \uC870\uD68C \uC911...`);
|
|
6925
|
+
let detail;
|
|
6926
|
+
try {
|
|
6927
|
+
detail = await client.getTemplateVersion(id, version);
|
|
6928
|
+
} catch (err) {
|
|
6929
|
+
stopSpinner(false);
|
|
6930
|
+
throw err;
|
|
6931
|
+
}
|
|
6932
|
+
stopSpinner(true);
|
|
6933
|
+
output(opts, {
|
|
6934
|
+
headers: ["id", "version", "workloadCount", "createdAt"],
|
|
6935
|
+
rows: [[detail.id, detail.version, String(detail.workloadCount ?? ""), detail.createdAt ?? ""]],
|
|
6936
|
+
raw: detail,
|
|
6937
|
+
ids: [detail.id]
|
|
6938
|
+
});
|
|
6939
|
+
});
|
|
6940
|
+
var versionCreateCommand = new import_commander45.Command("create").description("NCS \uC124\uACC4\uB3C4(template) \uC758 \uC0C8 \uBC84\uC804\uC744 \uC0DD\uC131\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC, sourceVersion \uD544\uC218)").argument("<id>", "template ID").requiredOption("--file <path>", "\uBC84\uC804 \uC0DD\uC131 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C (sourceVersion \uD544\uB4DC \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
6941
|
+
const opts = cmd.optsWithGlobals();
|
|
6942
|
+
requireNonEmpty(id, "id");
|
|
6943
|
+
const payload = readJsonPayload(opts.file);
|
|
6944
|
+
const { client } = await resolveNcsClient(opts);
|
|
6945
|
+
startSpinner(`NCS \uC124\uACC4\uB3C4 "${id}" \uBC84\uC804 \uC0DD\uC131 \uC911...`);
|
|
6946
|
+
let version;
|
|
6947
|
+
try {
|
|
6948
|
+
version = await client.createTemplateVersion(id, payload);
|
|
6949
|
+
} catch (err) {
|
|
6950
|
+
stopSpinner(false);
|
|
6951
|
+
throw err;
|
|
6952
|
+
}
|
|
6953
|
+
stopSpinner(true);
|
|
6954
|
+
output(opts, {
|
|
6955
|
+
headers: ["id", "version", "workloadCount", "createdAt"],
|
|
6956
|
+
rows: [[version.id, version.version, String(version.workloadCount ?? ""), version.createdAt ?? ""]],
|
|
6957
|
+
raw: version,
|
|
6958
|
+
ids: [version.id]
|
|
6959
|
+
});
|
|
6960
|
+
});
|
|
6961
|
+
var versionDeleteCommand = new import_commander45.Command("delete").description("NCS \uC124\uACC4\uB3C4(template) \uBC84\uC804\uC744 \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "template ID").argument("<version>", "\uBC84\uC804 \uAC12").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, version, _opts, cmd) => {
|
|
6962
|
+
const opts = cmd.optsWithGlobals();
|
|
6963
|
+
requireNonEmpty(id, "id");
|
|
6964
|
+
requireNonEmpty(version, "version");
|
|
6965
|
+
const ok = await confirmDestructive(
|
|
6966
|
+
`NCS \uC124\uACC4\uB3C4 "${id}" \uBC84\uC804 "${version}" \uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`,
|
|
6967
|
+
opts.yes
|
|
6968
|
+
);
|
|
6969
|
+
if (!ok) {
|
|
6970
|
+
process.stderr.write(import_chalk16.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
6971
|
+
return;
|
|
6972
|
+
}
|
|
6973
|
+
const { client } = await resolveNcsClient(opts);
|
|
6974
|
+
startSpinner(`NCS \uC124\uACC4\uB3C4 "${id}" \uBC84\uC804 "${version}" \uC0AD\uC81C \uC911...`);
|
|
6975
|
+
try {
|
|
6976
|
+
await client.deleteTemplateVersion(id, version);
|
|
6977
|
+
} catch (err) {
|
|
6978
|
+
stopSpinner(false);
|
|
6979
|
+
throw err;
|
|
6980
|
+
}
|
|
6981
|
+
stopSpinner(true);
|
|
6982
|
+
process.stderr.write(
|
|
6983
|
+
import_chalk16.default.green(`\u2713 NCS \uC124\uACC4\uB3C4 "${id}" \uBC84\uC804 "${version}" \uC774 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
6984
|
+
`)
|
|
6985
|
+
);
|
|
6986
|
+
});
|
|
6987
|
+
var versionCommand = new import_commander45.Command("version").description("NCS \uC124\uACC4\uB3C4(template) \uBC84\uC804 \uAD00\uB9AC").addCommand(versionListCommand).addCommand(versionGetCommand).addCommand(versionCreateCommand).addCommand(versionDeleteCommand);
|
|
6988
|
+
var templateCommand = new import_commander45.Command("template").description("NCS \uC124\uACC4\uB3C4(template) \uAD00\uB9AC").addCommand(listCommand8).addCommand(getCommand6).addCommand(createCommand6).addCommand(deleteCommand5).addCommand(versionCommand);
|
|
6989
|
+
|
|
6990
|
+
// src/commands/ncs/workload.ts
|
|
6991
|
+
var import_commander46 = require("commander");
|
|
6992
|
+
var import_chalk17 = __toESM(require("chalk"));
|
|
6993
|
+
function workloadRows(w) {
|
|
6994
|
+
return [
|
|
6995
|
+
[
|
|
6996
|
+
w.id,
|
|
6997
|
+
w.name,
|
|
6998
|
+
w.type ?? "",
|
|
6999
|
+
w.status,
|
|
7000
|
+
String(w.desired ?? ""),
|
|
7001
|
+
String(w.available ?? "")
|
|
7002
|
+
]
|
|
7003
|
+
];
|
|
7004
|
+
}
|
|
7005
|
+
var WORKLOAD_HEADERS = ["id", "name", "type", "status", "desired", "available"];
|
|
7006
|
+
var listCommand9 = new import_commander46.Command("list").description("NCS workload(\uB7F0\uD0C0\uC784 \uC2E4\uD589) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").option("--q <query>", "\uC6CC\uD06C\uB85C\uB4DC \uC774\uB984\xB7\uD15C\uD50C\uB9BF ID\xB7\uD15C\uD50C\uB9BF \uBC84\uC804\uC73C\uB85C \uD544\uD130\uB9C1").option("--page <page>", "\uC870\uD68C\uD560 page \uBC88\uD638").option("--size <size>", "page \uB2F9 \uD56D\uBAA9 \uC218 (\uAE30\uBCF8: API \uAE30\uBCF8\uAC12 10)").action(async (_opts, cmd) => {
|
|
7007
|
+
const opts = cmd.optsWithGlobals();
|
|
7008
|
+
const { client } = await resolveNcsClient(opts);
|
|
7009
|
+
startSpinner("NCS workload \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
7010
|
+
let totalCount;
|
|
7011
|
+
let workloads;
|
|
7012
|
+
try {
|
|
7013
|
+
const result = await client.listWorkloads({
|
|
7014
|
+
q: opts.q,
|
|
7015
|
+
page: parsePositiveIntegerOption(opts.page, "--page"),
|
|
7016
|
+
size: parsePositiveIntegerOption(opts.size, "--size")
|
|
7017
|
+
});
|
|
7018
|
+
totalCount = result.totalCount;
|
|
7019
|
+
workloads = result.workloads;
|
|
7020
|
+
} catch (err) {
|
|
7021
|
+
stopSpinner(false);
|
|
7022
|
+
throw err;
|
|
7023
|
+
}
|
|
7024
|
+
stopSpinner(true);
|
|
7025
|
+
output(opts, {
|
|
7026
|
+
headers: ["id", "name", "type", "status", "desired", "available"],
|
|
7027
|
+
rows: workloads.map((w) => [
|
|
7028
|
+
w.id,
|
|
7029
|
+
w.name,
|
|
7030
|
+
w.type ?? "",
|
|
7031
|
+
w.status,
|
|
7032
|
+
String(w.desired ?? ""),
|
|
7033
|
+
String(w.available ?? "")
|
|
7034
|
+
]),
|
|
7035
|
+
raw: { totalCount, workloads },
|
|
7036
|
+
ids: workloads.map((w) => w.id)
|
|
7037
|
+
});
|
|
7038
|
+
});
|
|
7039
|
+
var getCommand7 = new import_commander46.Command("get").description("NCS workload \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7040
|
+
const opts = cmd.optsWithGlobals();
|
|
7041
|
+
requireNonEmpty(id, "id");
|
|
7042
|
+
const { client } = await resolveNcsClient(opts);
|
|
7043
|
+
startSpinner(`NCS workload "${id}" \uC870\uD68C \uC911...`);
|
|
7044
|
+
let workload;
|
|
7045
|
+
try {
|
|
7046
|
+
workload = await client.getWorkload(id);
|
|
7047
|
+
} catch (err) {
|
|
7048
|
+
stopSpinner(false);
|
|
7049
|
+
throw err;
|
|
7050
|
+
}
|
|
7051
|
+
stopSpinner(true);
|
|
7052
|
+
output(opts, {
|
|
7053
|
+
headers: ["id", "name", "type", "status", "desired", "available", "tasks"],
|
|
7054
|
+
rows: [
|
|
7055
|
+
[
|
|
7056
|
+
workload.id,
|
|
7057
|
+
workload.name,
|
|
7058
|
+
workload.type ?? "",
|
|
7059
|
+
workload.status,
|
|
7060
|
+
String(workload.desired ?? ""),
|
|
7061
|
+
String(workload.available ?? ""),
|
|
7062
|
+
String(workload.tasks?.length ?? 0)
|
|
7063
|
+
]
|
|
7064
|
+
],
|
|
7065
|
+
raw: workload,
|
|
7066
|
+
ids: [workload.id]
|
|
7067
|
+
});
|
|
7068
|
+
});
|
|
7069
|
+
var logsCommand = new import_commander46.Command("logs").description("NCS workload task \uC758 \uCEE8\uD14C\uC774\uB108 \uB85C\uADF8\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").option("--task <taskId>", "task ID (\uD544\uC218)").option("--container <name>", "\uCEE8\uD14C\uC774\uB108 \uC774\uB984 (\uD544\uC218)").option("--from <time>", "\uB85C\uADF8 \uC2DC\uC791 \uC2DC\uAC04 (\uAE30\uBCF8: \uD604\uC7AC\uB85C\uBD80\uD130 5\uBD84 \uC804)").option("--to <time>", "\uB85C\uADF8 \uC885\uB8CC \uC2DC\uAC04 (\uAE30\uBCF8: \uD604\uC7AC \uC2DC\uAC04)").option("--page <page>", "\uC870\uD68C\uD560 page \uBC88\uD638").option("--size <size>", "page \uB2F9 \uD56D\uBAA9 \uC218 (\uAE30\uBCF8: API \uAE30\uBCF8\uAC12 100)").action(async (id, _opts, cmd) => {
|
|
7070
|
+
const opts = cmd.optsWithGlobals();
|
|
7071
|
+
requireNonEmpty(id, "id");
|
|
7072
|
+
if (!opts.task || !opts.task.trim()) {
|
|
7073
|
+
throw new NhnCloudCliError(
|
|
7074
|
+
"--task \uC635\uC158\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4. task ID \uB97C \uC9C0\uC815\uD558\uC138\uC694.",
|
|
7075
|
+
EXIT_PARAM_ERROR
|
|
7076
|
+
);
|
|
7077
|
+
}
|
|
7078
|
+
if (!opts.container || !opts.container.trim()) {
|
|
7079
|
+
throw new NhnCloudCliError(
|
|
7080
|
+
"--container \uC635\uC158\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4. \uCEE8\uD14C\uC774\uB108 \uC774\uB984\uC744 \uC9C0\uC815\uD558\uC138\uC694.",
|
|
7081
|
+
EXIT_PARAM_ERROR
|
|
7082
|
+
);
|
|
7083
|
+
}
|
|
7084
|
+
const { client } = await resolveNcsClient(opts);
|
|
7085
|
+
startSpinner(`NCS workload "${id}" task "${opts.task}" \uB85C\uADF8 \uC870\uD68C \uC911...`);
|
|
7086
|
+
let logs;
|
|
7087
|
+
try {
|
|
7088
|
+
const result = await client.getWorkloadLogs(id, opts.task, {
|
|
7089
|
+
container: opts.container,
|
|
7090
|
+
from: opts.from,
|
|
7091
|
+
to: opts.to,
|
|
7092
|
+
page: parsePositiveIntegerOption(opts.page, "--page"),
|
|
7093
|
+
size: parsePositiveIntegerOption(opts.size, "--size")
|
|
7094
|
+
});
|
|
7095
|
+
logs = result.logs;
|
|
7096
|
+
} catch (err) {
|
|
7097
|
+
stopSpinner(false);
|
|
7098
|
+
throw err;
|
|
7099
|
+
}
|
|
7100
|
+
stopSpinner(true);
|
|
7101
|
+
output(opts, {
|
|
7102
|
+
headers: ["time", "log"],
|
|
7103
|
+
rows: logs.map((l) => [l.time, l.log]),
|
|
7104
|
+
raw: { logs },
|
|
7105
|
+
ids: []
|
|
7106
|
+
});
|
|
7107
|
+
});
|
|
7108
|
+
var eventsCommand2 = new import_commander46.Command("events").description("NCS workload task \uC758 \uC774\uBCA4\uD2B8\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").option("--task <taskId>", "task ID (\uD544\uC218)").option("--type <type>", "\uC774\uBCA4\uD2B8 \uD0C0\uC785 (Normal | Warning)").option("--q <query>", "\uC774\uBCA4\uD2B8 \uB0B4\uC6A9 \uD544\uD130\uB9C1").option("--from <time>", "\uC774\uBCA4\uD2B8 \uB9C8\uC9C0\uB9C9 \uBC1C\uC0DD \uC2DC\uC791 \uC2DC\uAC04 (\uAE30\uBCF8: \uD604\uC7AC\uB85C\uBD80\uD130 1\uC2DC\uAC04 \uC804)").option("--to <time>", "\uC774\uBCA4\uD2B8 \uB9C8\uC9C0\uB9C9 \uBC1C\uC0DD \uC885\uB8CC \uC2DC\uAC04 (\uAE30\uBCF8: \uD604\uC7AC \uC2DC\uAC04)").option("--page <page>", "\uC870\uD68C\uD560 page \uBC88\uD638").option("--size <size>", "page \uB2F9 \uD56D\uBAA9 \uC218 (\uAE30\uBCF8: API \uAE30\uBCF8\uAC12 10)").action(async (id, _opts, cmd) => {
|
|
7109
|
+
const opts = cmd.optsWithGlobals();
|
|
7110
|
+
requireNonEmpty(id, "id");
|
|
7111
|
+
if (!opts.task || !opts.task.trim()) {
|
|
7112
|
+
throw new NhnCloudCliError(
|
|
7113
|
+
"--task \uC635\uC158\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4. task ID \uB97C \uC9C0\uC815\uD558\uC138\uC694.",
|
|
7114
|
+
EXIT_PARAM_ERROR
|
|
7115
|
+
);
|
|
7116
|
+
}
|
|
7117
|
+
const { client } = await resolveNcsClient(opts);
|
|
7118
|
+
startSpinner(`NCS workload "${id}" task "${opts.task}" \uC774\uBCA4\uD2B8 \uC870\uD68C \uC911...`);
|
|
7119
|
+
let totalCount;
|
|
7120
|
+
let events;
|
|
7121
|
+
try {
|
|
7122
|
+
const result = await client.getWorkloadEvents(id, opts.task, {
|
|
7123
|
+
type: opts.type,
|
|
7124
|
+
q: opts.q,
|
|
7125
|
+
from: opts.from,
|
|
7126
|
+
to: opts.to,
|
|
7127
|
+
page: parsePositiveIntegerOption(opts.page, "--page"),
|
|
7128
|
+
size: parsePositiveIntegerOption(opts.size, "--size")
|
|
7129
|
+
});
|
|
7130
|
+
totalCount = result.totalCount;
|
|
7131
|
+
events = result.events;
|
|
7132
|
+
} catch (err) {
|
|
7133
|
+
stopSpinner(false);
|
|
7134
|
+
throw err;
|
|
7135
|
+
}
|
|
7136
|
+
stopSpinner(true);
|
|
7137
|
+
output(opts, {
|
|
7138
|
+
headers: ["type", "reason", "message", "count", "lastTimestamp"],
|
|
7139
|
+
rows: events.map((e) => [e.type, e.reason, e.message, String(e.count), e.lastTimestamp]),
|
|
7140
|
+
raw: { totalCount, events },
|
|
7141
|
+
ids: []
|
|
7142
|
+
});
|
|
7143
|
+
});
|
|
7144
|
+
var historyGetCommand = new import_commander46.Command("get").description("NCS workload \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").argument("<historyId>", "\uD788\uC2A4\uD1A0\uB9AC ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, historyId, _opts, cmd) => {
|
|
7145
|
+
const opts = cmd.optsWithGlobals();
|
|
7146
|
+
requireNonEmpty(id, "id");
|
|
7147
|
+
requireNonEmpty(historyId, "historyId");
|
|
7148
|
+
const { client } = await resolveNcsClient(opts);
|
|
7149
|
+
startSpinner(`NCS workload "${id}" \uD788\uC2A4\uD1A0\uB9AC "${historyId}" \uC870\uD68C \uC911...`);
|
|
7150
|
+
let detail;
|
|
7151
|
+
try {
|
|
7152
|
+
detail = await client.getWorkloadHistory(id, historyId);
|
|
7153
|
+
} catch (err) {
|
|
7154
|
+
stopSpinner(false);
|
|
7155
|
+
throw err;
|
|
7156
|
+
}
|
|
7157
|
+
stopSpinner(true);
|
|
7158
|
+
output(opts, {
|
|
7159
|
+
headers: ["id", "status", "templateId", "createdAt", "deletedAt"],
|
|
7160
|
+
rows: [
|
|
7161
|
+
[
|
|
7162
|
+
String(detail.id),
|
|
7163
|
+
detail.status,
|
|
7164
|
+
detail.templateId ?? "",
|
|
7165
|
+
detail.createdAt,
|
|
7166
|
+
detail.deletedAt ?? ""
|
|
7167
|
+
]
|
|
7168
|
+
],
|
|
7169
|
+
raw: detail,
|
|
7170
|
+
ids: [String(detail.id)]
|
|
7171
|
+
});
|
|
7172
|
+
});
|
|
7173
|
+
var historyCommand = new import_commander46.Command("history").description("NCS workload \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").option("--page <page>", "\uC870\uD68C\uD560 page \uBC88\uD638").option("--size <size>", "page \uB2F9 \uD56D\uBAA9 \uC218 (\uAE30\uBCF8: API \uAE30\uBCF8\uAC12 10)").option("--sort <sort>", "\uC815\uB82C \uAE30\uC900 \uD544\uB4DC\uBA85 (\uC5ED\uC21C\uC740 \uD544\uB4DC\uBA85 \uC55E\uC5D0 - \uB97C \uBD99\uC784, \uC608: -id)").action(async (id, _opts, cmd) => {
|
|
7174
|
+
const opts = cmd.optsWithGlobals();
|
|
7175
|
+
requireNonEmpty(id, "id");
|
|
7176
|
+
const { client } = await resolveNcsClient(opts);
|
|
7177
|
+
startSpinner(`NCS workload "${id}" \uD788\uC2A4\uD1A0\uB9AC \uBAA9\uB85D \uC870\uD68C \uC911...`);
|
|
7178
|
+
let totalCount;
|
|
7179
|
+
let history;
|
|
7180
|
+
try {
|
|
7181
|
+
const result = await client.listWorkloadHistory(id, {
|
|
7182
|
+
page: parsePositiveIntegerOption(opts.page, "--page"),
|
|
7183
|
+
size: parsePositiveIntegerOption(opts.size, "--size"),
|
|
7184
|
+
sort: opts.sort
|
|
7185
|
+
});
|
|
7186
|
+
totalCount = result.totalCount;
|
|
7187
|
+
history = result.history;
|
|
7188
|
+
} catch (err) {
|
|
7189
|
+
stopSpinner(false);
|
|
7190
|
+
throw err;
|
|
7191
|
+
}
|
|
7192
|
+
stopSpinner(true);
|
|
7193
|
+
output(opts, {
|
|
7194
|
+
headers: ["id", "status", "templateId", "createdAt", "deletedAt"],
|
|
7195
|
+
rows: history.map((h) => [
|
|
7196
|
+
String(h.id),
|
|
7197
|
+
h.status,
|
|
7198
|
+
h.templateId ?? "",
|
|
7199
|
+
h.createdAt,
|
|
7200
|
+
h.deletedAt ?? ""
|
|
7201
|
+
]),
|
|
7202
|
+
raw: { totalCount, history },
|
|
7203
|
+
ids: history.map((h) => String(h.id))
|
|
7204
|
+
});
|
|
7205
|
+
}).addCommand(historyGetCommand);
|
|
7206
|
+
var scheduleHistoryCommand = new import_commander46.Command("schedule-history").description("NCS workload \uC608\uC57D \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7207
|
+
const opts = cmd.optsWithGlobals();
|
|
7208
|
+
requireNonEmpty(id, "id");
|
|
7209
|
+
const { client } = await resolveNcsClient(opts);
|
|
7210
|
+
startSpinner(`NCS workload "${id}" \uC608\uC57D \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC \uC870\uD68C \uC911...`);
|
|
7211
|
+
let scheduleHistory;
|
|
7212
|
+
try {
|
|
7213
|
+
const result = await client.getWorkloadScheduleHistory(id);
|
|
7214
|
+
scheduleHistory = result.scheduleHistory;
|
|
7215
|
+
} catch (err) {
|
|
7216
|
+
stopSpinner(false);
|
|
7217
|
+
throw err;
|
|
7218
|
+
}
|
|
7219
|
+
stopSpinner(true);
|
|
7220
|
+
output(opts, {
|
|
7221
|
+
headers: ["id", "status", "createdAt", "finishedAt"],
|
|
7222
|
+
rows: scheduleHistory.map((s) => [s.id, s.status, s.createdAt, s.finishedAt ?? ""]),
|
|
7223
|
+
raw: { scheduleHistory },
|
|
7224
|
+
ids: scheduleHistory.map((s) => s.id)
|
|
7225
|
+
});
|
|
7226
|
+
});
|
|
7227
|
+
var createCommand7 = new import_commander46.Command("create").description("NCS workload(\uB7F0\uD0C0\uC784 \uC2E4\uD589) \uB97C \uC0DD\uC131\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC)").requiredOption("--file <path>", "workload \uC0DD\uC131 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C").option("--wait", "workload \uAC00 Running \uC0C1\uD0DC\uAC00 \uB420 \uB54C\uAE4C\uC9C0 \uB300\uAE30").option("--timeout <sec>", "wait \uD0C0\uC784\uC544\uC6C3 (\uCD08, \uAE30\uBCF8 300)", "300").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
7228
|
+
const opts = cmd.optsWithGlobals();
|
|
7229
|
+
const payload = readJsonPayload(opts.file);
|
|
7230
|
+
const timeoutMs = parsePositiveIntegerOption(opts.timeout ?? "300", "--timeout") * 1e3;
|
|
7231
|
+
const { client } = await resolveNcsClient(opts);
|
|
7232
|
+
startSpinner("NCS workload \uC0DD\uC131 \uC911...");
|
|
7233
|
+
let workload;
|
|
7234
|
+
try {
|
|
7235
|
+
workload = await client.createWorkload(payload);
|
|
7236
|
+
} catch (err) {
|
|
7237
|
+
stopSpinner(false);
|
|
7238
|
+
throw err;
|
|
7239
|
+
}
|
|
7240
|
+
stopSpinner(true);
|
|
7241
|
+
if (opts.wait) {
|
|
7242
|
+
startSpinner(`NCS workload "${workload.id}" Running \uB300\uAE30 \uC911...`);
|
|
7243
|
+
try {
|
|
7244
|
+
workload = await client.waitForRunning(workload.id, { timeoutMs });
|
|
7245
|
+
} catch (err) {
|
|
7246
|
+
stopSpinner(false);
|
|
7247
|
+
throw err;
|
|
7248
|
+
}
|
|
7249
|
+
stopSpinner(true, `Running \uD655\uC778 (id: ${workload.id})`);
|
|
7250
|
+
}
|
|
7251
|
+
output(opts, {
|
|
7252
|
+
headers: WORKLOAD_HEADERS,
|
|
7253
|
+
rows: workloadRows(workload),
|
|
7254
|
+
raw: workload,
|
|
7255
|
+
ids: [workload.id]
|
|
7256
|
+
});
|
|
7257
|
+
});
|
|
7258
|
+
var updateCommand = new import_commander46.Command("update").description("NCS workload \uB97C \uC804\uCCB4 \uAD50\uCCB4\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC, PUT)").argument("<id>", "workload ID").requiredOption("--file <path>", "workload \uAD50\uCCB4 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7259
|
+
const opts = cmd.optsWithGlobals();
|
|
7260
|
+
requireNonEmpty(id, "id");
|
|
7261
|
+
const payload = readJsonPayload(opts.file);
|
|
7262
|
+
const { client } = await resolveNcsClient(opts);
|
|
7263
|
+
startSpinner(`NCS workload "${id}" \uAD50\uCCB4 \uC911...`);
|
|
7264
|
+
let workload;
|
|
7265
|
+
try {
|
|
7266
|
+
workload = await client.updateWorkload(id, payload);
|
|
7267
|
+
} catch (err) {
|
|
7268
|
+
stopSpinner(false);
|
|
7269
|
+
throw err;
|
|
7270
|
+
}
|
|
7271
|
+
stopSpinner(true);
|
|
7272
|
+
output(opts, {
|
|
7273
|
+
headers: WORKLOAD_HEADERS,
|
|
7274
|
+
rows: workloadRows(workload),
|
|
7275
|
+
raw: workload,
|
|
7276
|
+
ids: [workload.id]
|
|
7277
|
+
});
|
|
7278
|
+
});
|
|
7279
|
+
var patchCommand = new import_commander46.Command("patch").description("NCS workload \uB97C \uBD80\uBD84 \uBCC0\uACBD\uD55C\uB2E4 (--file \uB85C JSON Patch \uBC30\uC5F4 \uC804\uB2EC, RFC 6902)").argument("<id>", "workload ID").requiredOption("--file <path>", "JSON Patch \uBC30\uC5F4(op/path/value)\uC774 \uB2F4\uAE34 \uD30C\uC77C \uACBD\uB85C").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7280
|
+
const opts = cmd.optsWithGlobals();
|
|
7281
|
+
requireNonEmpty(id, "id");
|
|
7282
|
+
const payload = readJsonPayload(opts.file);
|
|
7283
|
+
const { client } = await resolveNcsClient(opts);
|
|
7284
|
+
startSpinner(`NCS workload "${id}" \uBD80\uBD84 \uBCC0\uACBD \uC911...`);
|
|
7285
|
+
let workload;
|
|
7286
|
+
try {
|
|
7287
|
+
workload = await client.patchWorkload(id, payload);
|
|
7288
|
+
} catch (err) {
|
|
7289
|
+
stopSpinner(false);
|
|
7290
|
+
throw err;
|
|
7291
|
+
}
|
|
7292
|
+
stopSpinner(true);
|
|
7293
|
+
output(opts, {
|
|
7294
|
+
headers: WORKLOAD_HEADERS,
|
|
7295
|
+
rows: workloadRows(workload),
|
|
7296
|
+
raw: workload,
|
|
7297
|
+
ids: [workload.id]
|
|
7298
|
+
});
|
|
7299
|
+
});
|
|
7300
|
+
var pauseCommand = new import_commander46.Command("pause").description("NCS workload \uB97C \uC77C\uC2DC\uC815\uC9C0\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7301
|
+
const opts = cmd.optsWithGlobals();
|
|
7302
|
+
requireNonEmpty(id, "id");
|
|
7303
|
+
const { client } = await resolveNcsClient(opts);
|
|
7304
|
+
startSpinner(`NCS workload "${id}" \uC77C\uC2DC\uC815\uC9C0 \uC911...`);
|
|
7305
|
+
try {
|
|
7306
|
+
await client.pauseWorkload(id);
|
|
7307
|
+
} catch (err) {
|
|
7308
|
+
stopSpinner(false);
|
|
7309
|
+
throw err;
|
|
7310
|
+
}
|
|
7311
|
+
stopSpinner(true);
|
|
7312
|
+
process.stderr.write(import_chalk17.default.green(`\u2713 NCS workload "${id}" \uAC00 \uC77C\uC2DC\uC815\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
7313
|
+
`));
|
|
7314
|
+
});
|
|
7315
|
+
var resumeCommand = new import_commander46.Command("resume").description("NCS workload \uB97C \uC7AC\uAC1C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7316
|
+
const opts = cmd.optsWithGlobals();
|
|
7317
|
+
requireNonEmpty(id, "id");
|
|
7318
|
+
const { client } = await resolveNcsClient(opts);
|
|
7319
|
+
startSpinner(`NCS workload "${id}" \uC7AC\uAC1C \uC911...`);
|
|
7320
|
+
try {
|
|
7321
|
+
await client.resumeWorkload(id);
|
|
7322
|
+
} catch (err) {
|
|
7323
|
+
stopSpinner(false);
|
|
7324
|
+
throw err;
|
|
7325
|
+
}
|
|
7326
|
+
stopSpinner(true);
|
|
7327
|
+
process.stderr.write(import_chalk17.default.green(`\u2713 NCS workload "${id}" \uAC00 \uC7AC\uAC1C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
7328
|
+
`));
|
|
7329
|
+
});
|
|
7330
|
+
var restartCommand = new import_commander46.Command("restart").description("NCS workload task \uB97C \uC7AC\uC2DC\uC791\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").option("--task <taskId>", "task ID (\uD544\uC218)").action(async (id, _opts, cmd) => {
|
|
7331
|
+
const opts = cmd.optsWithGlobals();
|
|
7332
|
+
requireNonEmpty(id, "id");
|
|
7333
|
+
if (!opts.task || !opts.task.trim()) {
|
|
7334
|
+
throw new NhnCloudCliError(
|
|
7335
|
+
"--task \uC635\uC158\uC774 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4. task ID \uB97C \uC9C0\uC815\uD558\uC138\uC694.",
|
|
7336
|
+
EXIT_PARAM_ERROR
|
|
7337
|
+
);
|
|
7338
|
+
}
|
|
7339
|
+
const { client } = await resolveNcsClient(opts);
|
|
7340
|
+
startSpinner(`NCS workload "${id}" task "${opts.task}" \uC7AC\uC2DC\uC791 \uC911...`);
|
|
7341
|
+
try {
|
|
7342
|
+
await client.restartWorkloadTask(id, opts.task);
|
|
7343
|
+
} catch (err) {
|
|
7344
|
+
stopSpinner(false);
|
|
7345
|
+
throw err;
|
|
7346
|
+
}
|
|
7347
|
+
stopSpinner(true);
|
|
7348
|
+
process.stderr.write(
|
|
7349
|
+
import_chalk17.default.green(`\u2713 NCS workload "${id}" task "${opts.task}" \uAC00 \uC7AC\uC2DC\uC791\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
7350
|
+
`)
|
|
7351
|
+
);
|
|
7352
|
+
});
|
|
7353
|
+
var deleteCommand6 = new import_commander46.Command("delete").description("NCS workload \uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "workload ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7354
|
+
const opts = cmd.optsWithGlobals();
|
|
7355
|
+
requireNonEmpty(id, "id");
|
|
7356
|
+
const ok = await confirmDestructive(`NCS workload "${id}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
7357
|
+
if (!ok) {
|
|
7358
|
+
process.stderr.write(import_chalk17.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
7359
|
+
return;
|
|
7360
|
+
}
|
|
7361
|
+
const { client } = await resolveNcsClient(opts);
|
|
7362
|
+
startSpinner(`NCS workload \uC0AD\uC81C \uC911... (id: ${id})`);
|
|
7363
|
+
try {
|
|
7364
|
+
await client.deleteWorkload(id);
|
|
7365
|
+
} catch (err) {
|
|
7366
|
+
stopSpinner(false);
|
|
7367
|
+
throw err;
|
|
7368
|
+
}
|
|
7369
|
+
stopSpinner(true);
|
|
7370
|
+
process.stderr.write(import_chalk17.default.green(`\u2713 NCS workload "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
7371
|
+
`));
|
|
7372
|
+
});
|
|
7373
|
+
var workloadCommand = new import_commander46.Command("workload").description("NCS workload(\uB7F0\uD0C0\uC784 \uC2E4\uD589) \uAD00\uB9AC").addCommand(listCommand9).addCommand(getCommand7).addCommand(logsCommand).addCommand(eventsCommand2).addCommand(historyCommand).addCommand(scheduleHistoryCommand).addCommand(createCommand7).addCommand(updateCommand).addCommand(patchCommand).addCommand(pauseCommand).addCommand(resumeCommand).addCommand(restartCommand).addCommand(deleteCommand6);
|
|
7374
|
+
|
|
7375
|
+
// src/commands/ncs/malware.ts
|
|
7376
|
+
var import_commander47 = require("commander");
|
|
7377
|
+
function parseEnabledOption(value) {
|
|
7378
|
+
if (value === "true") return true;
|
|
7379
|
+
if (value === "false") return false;
|
|
7380
|
+
throw new NhnCloudCliError(
|
|
7381
|
+
`--enabled \uB294 true \uB610\uB294 false \uC5EC\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
7382
|
+
EXIT_PARAM_ERROR
|
|
7383
|
+
);
|
|
7384
|
+
}
|
|
7385
|
+
var configGetCommand = new import_commander47.Command("get").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
7386
|
+
const opts = cmd.optsWithGlobals();
|
|
7387
|
+
const { client } = await resolveNcsClient(opts);
|
|
7388
|
+
startSpinner("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815 \uC870\uD68C \uC911...");
|
|
7389
|
+
let config;
|
|
7390
|
+
try {
|
|
7391
|
+
config = await client.getMalwareConfig();
|
|
7392
|
+
} catch (err) {
|
|
7393
|
+
stopSpinner(false);
|
|
7394
|
+
throw err;
|
|
7395
|
+
}
|
|
7396
|
+
stopSpinner(true);
|
|
7397
|
+
output(opts, {
|
|
7398
|
+
headers: ["enabled"],
|
|
7399
|
+
rows: [[String(config.enabled)]],
|
|
7400
|
+
raw: config,
|
|
7401
|
+
ids: []
|
|
7402
|
+
});
|
|
7403
|
+
});
|
|
7404
|
+
var configSetCommand = new import_commander47.Command("set").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815\uC744 \uBCC0\uACBD\uD55C\uB2E4").requiredOption("--enabled <true|false>", "\uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC0AC\uC6A9 \uC5EC\uBD80").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
7405
|
+
const opts = cmd.optsWithGlobals();
|
|
7406
|
+
const enabled = parseEnabledOption(opts.enabled);
|
|
7407
|
+
const { client } = await resolveNcsClient(opts);
|
|
7408
|
+
startSpinner("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815 \uBCC0\uACBD \uC911...");
|
|
7409
|
+
let config;
|
|
7410
|
+
try {
|
|
7411
|
+
config = await client.setMalwareConfig(enabled);
|
|
7412
|
+
} catch (err) {
|
|
7413
|
+
stopSpinner(false);
|
|
7414
|
+
throw err;
|
|
7415
|
+
}
|
|
7416
|
+
stopSpinner(true);
|
|
7417
|
+
output(opts, {
|
|
7418
|
+
headers: ["enabled"],
|
|
7419
|
+
rows: [[String(config.enabled)]],
|
|
7420
|
+
raw: config,
|
|
7421
|
+
ids: []
|
|
7422
|
+
});
|
|
7423
|
+
});
|
|
7424
|
+
var configCommand = new import_commander47.Command("config").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815 \uAD00\uB9AC").addCommand(configGetCommand).addCommand(configSetCommand);
|
|
7425
|
+
var resultCommand = new import_commander47.Command("result").description("NCS workload \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC\uC758 \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uACB0\uACFC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<workloadId>", "workload ID").argument("<historyId>", "\uD788\uC2A4\uD1A0\uB9AC ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--app-key <key>", "NCS appKey (profile \uC758 ncs.appkey \uBCF4\uB2E4 \uC6B0\uC120)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (workloadId, historyId, _opts, cmd) => {
|
|
7426
|
+
const opts = cmd.optsWithGlobals();
|
|
7427
|
+
requireNonEmpty(workloadId, "workloadId");
|
|
7428
|
+
requireNonEmpty(historyId, "historyId");
|
|
7429
|
+
const { client } = await resolveNcsClient(opts);
|
|
7430
|
+
startSpinner(
|
|
7431
|
+
`NCS workload "${workloadId}" \uD788\uC2A4\uD1A0\uB9AC "${historyId}" \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uACB0\uACFC \uC870\uD68C \uC911...`
|
|
7432
|
+
);
|
|
7433
|
+
let result;
|
|
7434
|
+
try {
|
|
7435
|
+
result = await client.getMalwareResult(workloadId, historyId);
|
|
7436
|
+
} catch (err) {
|
|
7437
|
+
stopSpinner(false);
|
|
7438
|
+
throw err;
|
|
7439
|
+
}
|
|
7440
|
+
stopSpinner(true);
|
|
7441
|
+
output(opts, {
|
|
7442
|
+
headers: ["scannedAt", "infectedFiles", "scannedDirectories", "scannedFiles", "reports"],
|
|
7443
|
+
rows: [
|
|
7444
|
+
[
|
|
7445
|
+
result.scannedAt ?? "",
|
|
7446
|
+
String(result.infectedFiles ?? ""),
|
|
7447
|
+
String(result.scannedDirectories ?? ""),
|
|
7448
|
+
String(result.scannedFiles ?? ""),
|
|
7449
|
+
String(result.reports?.length ?? 0)
|
|
7450
|
+
]
|
|
7451
|
+
],
|
|
7452
|
+
raw: result,
|
|
7453
|
+
ids: []
|
|
7454
|
+
});
|
|
7455
|
+
});
|
|
7456
|
+
var malwareCommand = new import_commander47.Command("malware").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uAD00\uB9AC").addCommand(configCommand).addCommand(resultCommand);
|
|
7457
|
+
|
|
7458
|
+
// src/index.ts
|
|
7459
|
+
var rootAgentHints = `
|
|
7460
|
+
Agent hints:
|
|
7461
|
+
- Prefer --json for structured output.
|
|
7462
|
+
- Use --quiet only when the command documents an identifier output.
|
|
7463
|
+
- Use --profile <name> to avoid relying on default profile.
|
|
7464
|
+
- For IaaS/NKS commands, use --region <region> when region matters.
|
|
7465
|
+
- Run "nhncloud commands --json" to inspect command paths and options.
|
|
7466
|
+
`;
|
|
7467
|
+
var logncrashAgentWorkflow = `
|
|
7468
|
+
Agent workflow:
|
|
7469
|
+
1. nhncloud logncrash search --query '*' --from 1h --to now --json
|
|
7470
|
+
2. nhncloud logncrash export --query '<lucene>' --from 1h --to now --output logs.jsonl
|
|
7471
|
+
`;
|
|
7472
|
+
var deployAgentWorkflow = `
|
|
7473
|
+
Agent workflow:
|
|
7474
|
+
1. nhncloud deploy artifacts <target> --json
|
|
7475
|
+
2. nhncloud deploy server-groups <target> --json
|
|
7476
|
+
3. nhncloud deploy run <target>
|
|
7477
|
+
`;
|
|
7478
|
+
var instanceAgentWorkflow = `
|
|
7479
|
+
Agent workflow:
|
|
7480
|
+
1. nhncloud instance images --json
|
|
7481
|
+
2. nhncloud instance flavors --detail --json
|
|
7482
|
+
3. nhncloud instance list --json
|
|
7483
|
+
`;
|
|
7484
|
+
var networkAgentWorkflow = `
|
|
7485
|
+
Agent workflow:
|
|
7486
|
+
1. nhncloud network list --json
|
|
7487
|
+
2. nhncloud network subnet list --json
|
|
7488
|
+
`;
|
|
7489
|
+
var volumeAgentWorkflow = `
|
|
7490
|
+
Agent workflow:
|
|
7491
|
+
1. nhncloud volume list --json
|
|
7492
|
+
2. nhncloud volume get <volume-id> --json
|
|
7493
|
+
`;
|
|
7494
|
+
var floatingIpAgentWorkflow = `
|
|
7495
|
+
Agent workflow:
|
|
7496
|
+
1. nhncloud floatingip list --json
|
|
7497
|
+
2. nhncloud floatingip create --json
|
|
7498
|
+
`;
|
|
7499
|
+
var ncrAgentWorkflow = `
|
|
7500
|
+
Agent workflow:
|
|
7501
|
+
1. nhncloud ncr list --json
|
|
7502
|
+
2. nhncloud ncr images <registry> --json
|
|
7503
|
+
3. nhncloud ncr tags <registry> <repository> --json
|
|
7504
|
+
`;
|
|
7505
|
+
var nksAgentWorkflow = `
|
|
7506
|
+
Agent workflow:
|
|
7507
|
+
1. nhncloud nks supports --json
|
|
7508
|
+
2. nhncloud nks cluster list --json
|
|
7509
|
+
3. nhncloud nks cluster get <cluster> --json
|
|
7510
|
+
`;
|
|
7511
|
+
var ncsAgentWorkflow = `
|
|
7512
|
+
Agent workflow:
|
|
7513
|
+
1. nhncloud ncs template list --json
|
|
7514
|
+
2. nhncloud ncs workload list --json
|
|
7515
|
+
3. nhncloud ncs workload get <id> --json
|
|
5700
7516
|
`;
|
|
5701
|
-
var program = new
|
|
5702
|
-
program.name("nhncloud").description("NHN Cloud CLI \u2014 AI agent & terminal friendly").version("0.
|
|
7517
|
+
var program = new import_commander48.Command();
|
|
7518
|
+
program.name("nhncloud").description("NHN Cloud CLI \u2014 AI agent & terminal friendly").version("0.9.0").option("--json", "JSON \uD615\uC2DD\uC73C\uB85C \uCD9C\uB825").option("--quiet", "\uCD5C\uC18C \uCD9C\uB825 (\uC790\uB3D9\uD654\uC6A9)").option("--no-color", "\uC0C9\uC0C1 \uBE44\uD65C\uC131\uD654").addHelpText("after", rootAgentHints);
|
|
5703
7519
|
program.hook("preAction", () => {
|
|
5704
7520
|
const opts = program.opts();
|
|
5705
7521
|
if (!opts.color || process.env["NO_COLOR"]) {
|
|
5706
|
-
|
|
7522
|
+
import_chalk18.default.level = 0;
|
|
5707
7523
|
}
|
|
5708
7524
|
if (opts.json || opts.quiet) {
|
|
5709
7525
|
setQuiet(true);
|
|
5710
7526
|
}
|
|
5711
7527
|
});
|
|
5712
7528
|
program.addCommand(configureCommand);
|
|
5713
|
-
var logncrashCommand = new
|
|
7529
|
+
var logncrashCommand = new import_commander48.Command("logncrash").description("Log & Crash \uAD00\uB828 \uBA85\uB839").addHelpText("after", logncrashAgentWorkflow);
|
|
5714
7530
|
logncrashCommand.addCommand(searchCommand);
|
|
5715
7531
|
logncrashCommand.addCommand(sendCommand);
|
|
5716
7532
|
logncrashCommand.addCommand(exportCommand);
|
|
5717
7533
|
program.addCommand(logncrashCommand);
|
|
5718
|
-
var deployCommand = new
|
|
7534
|
+
var deployCommand = new import_commander48.Command("deploy").description("NHN Cloud Deploy \uAD00\uB828 \uBA85\uB839").addHelpText("after", deployAgentWorkflow);
|
|
5719
7535
|
deployCommand.addCommand(runCommand);
|
|
5720
7536
|
deployCommand.addCommand(artifactsCommand);
|
|
5721
7537
|
deployCommand.addCommand(serverGroupsCommand);
|
|
@@ -5725,7 +7541,7 @@ deployCommand.addCommand(binariesCommand);
|
|
|
5725
7541
|
deployCommand.addCommand(uploadCommand);
|
|
5726
7542
|
deployCommand.addCommand(downloadCommand);
|
|
5727
7543
|
program.addCommand(deployCommand);
|
|
5728
|
-
var instanceCommand = new
|
|
7544
|
+
var instanceCommand = new import_commander48.Command("instance").description("Compute \uC778\uC2A4\uD134\uC2A4 \uAD00\uB828 \uBA85\uB839").addHelpText("after", instanceAgentWorkflow);
|
|
5729
7545
|
instanceCommand.addCommand(listCommand);
|
|
5730
7546
|
instanceCommand.addCommand(flavorsCommand);
|
|
5731
7547
|
instanceCommand.addCommand(availabilityZonesCommand);
|
|
@@ -5744,39 +7560,46 @@ instanceCommand.addCommand(keypairCommand);
|
|
|
5744
7560
|
instanceCommand.addCommand(volumeCommand);
|
|
5745
7561
|
instanceCommand.addCommand(volumesCommand);
|
|
5746
7562
|
program.addCommand(instanceCommand);
|
|
5747
|
-
var networkCommand = new
|
|
7563
|
+
var networkCommand = new import_commander48.Command("network").description("VPC\xB7\uC11C\uBE0C\uB137 \uC870\uD68C").addHelpText("after", networkAgentWorkflow);
|
|
5748
7564
|
networkCommand.addCommand(listCommand3);
|
|
5749
7565
|
networkCommand.addCommand(subnetCommand);
|
|
5750
7566
|
program.addCommand(networkCommand);
|
|
5751
|
-
var volumeCommand2 = new
|
|
7567
|
+
var volumeCommand2 = new import_commander48.Command("volume").description("Block Storage \uBCFC\uB968 \uAD00\uB828 \uBA85\uB839").addHelpText("after", volumeAgentWorkflow);
|
|
5752
7568
|
volumeCommand2.addCommand(listCommand2);
|
|
5753
7569
|
volumeCommand2.addCommand(getCommand);
|
|
5754
7570
|
volumeCommand2.addCommand(createCommand);
|
|
5755
7571
|
program.addCommand(volumeCommand2);
|
|
5756
|
-
var floatingipCommand = new
|
|
7572
|
+
var floatingipCommand = new import_commander48.Command("floatingip").description(
|
|
5757
7573
|
"Floating IP(\uC778\uC2A4\uD134\uC2A4 \uACF5\uC778 IP) \uAD00\uB9AC"
|
|
5758
7574
|
).addHelpText("after", floatingIpAgentWorkflow);
|
|
5759
7575
|
floatingipCommand.addCommand(listCommand4);
|
|
5760
7576
|
floatingipCommand.addCommand(createCommand2);
|
|
5761
7577
|
floatingipCommand.addCommand(deleteCommand);
|
|
5762
7578
|
program.addCommand(floatingipCommand);
|
|
5763
|
-
var ncrCommand = new
|
|
7579
|
+
var ncrCommand = new import_commander48.Command("ncr").description("NHN Container Registry \uAD00\uB828 \uBA85\uB839").addHelpText("after", ncrAgentWorkflow);
|
|
5764
7580
|
ncrCommand.addCommand(listCommand5);
|
|
5765
7581
|
ncrCommand.addCommand(getCommand3);
|
|
5766
7582
|
ncrCommand.addCommand(imagesCommand2);
|
|
5767
7583
|
ncrCommand.addCommand(tagsCommand);
|
|
5768
7584
|
program.addCommand(ncrCommand);
|
|
5769
|
-
var nksCommand = new
|
|
7585
|
+
var nksCommand = new import_commander48.Command("nks").description("NHN Kubernetes Service \uAD00\uB828 \uBA85\uB839").addHelpText("after", nksAgentWorkflow);
|
|
5770
7586
|
nksCommand.addCommand(supportsCommand);
|
|
5771
7587
|
nksCommand.addCommand(clusterCommand);
|
|
5772
7588
|
nksCommand.addCommand(nodegroupCommand);
|
|
5773
7589
|
nksCommand.addCommand(addonTypeCommand);
|
|
5774
7590
|
nksCommand.addCommand(addonCommand);
|
|
5775
7591
|
program.addCommand(nksCommand);
|
|
7592
|
+
var ncsCommand = new import_commander48.Command("ncs").description("NHN Container Service \uAD00\uB828 \uBA85\uB839").addHelpText("after", ncsAgentWorkflow);
|
|
7593
|
+
ncsCommand.addCommand(templateCommand);
|
|
7594
|
+
ncsCommand.addCommand(workloadCommand);
|
|
7595
|
+
ncsCommand.addCommand(malwareCommand);
|
|
7596
|
+
program.addCommand(ncsCommand);
|
|
7597
|
+
program.addCommand(skillsCommand);
|
|
7598
|
+
program.addCommand(doctorCommand);
|
|
5776
7599
|
program.addCommand(createCommandsCommand(program));
|
|
5777
7600
|
program.parseAsync().catch((err) => {
|
|
5778
7601
|
const message = err instanceof Error ? err.message : String(err);
|
|
5779
7602
|
const exitCode = err instanceof NhnCloudCliError ? err.exitCode : 1;
|
|
5780
|
-
process.stderr.write(
|
|
7603
|
+
process.stderr.write(import_chalk18.default.red(`\uC624\uB958: ${message}`) + "\n");
|
|
5781
7604
|
process.exit(exitCode);
|
|
5782
7605
|
});
|