@bifos/nhncloud-cli 0.17.0 → 0.19.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 +113 -190
- package/dist/index.js +2454 -363
- package/package.json +25 -4
- package/skills/nhncloud-cli/SKILL.md +5 -6
- package/skills/nhncloud-cli/references/apigateway.md +9 -48
- package/skills/nhncloud-cli/references/common.md +18 -98
- package/skills/nhncloud-cli/references/deploy.md +2 -40
- package/skills/nhncloud-cli/references/iaas.md +56 -9
- package/skills/nhncloud-cli/references/loadbalancer.md +2 -45
- package/skills/nhncloud-cli/references/logncrash.md +9 -57
- package/skills/nhncloud-cli/references/ncr.md +0 -22
- package/skills/nhncloud-cli/references/ncs.md +5 -45
- package/skills/nhncloud-cli/references/nks.md +1 -10
- package/skills/nhncloud-cli/references/skm.md +118 -0
- package/skills/nhncloud-cli/references/troubleshooting.md +23 -47
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
|
|
26
26
|
// src/index.ts
|
|
27
|
-
var
|
|
27
|
+
var import_commander72 = require("commander");
|
|
28
28
|
var import_chalk18 = __toESM(require("chalk"));
|
|
29
29
|
|
|
30
30
|
// src/utils/spinner.ts
|
|
@@ -413,6 +413,17 @@ function configureCommanderExitCodes(root) {
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
+
// src/commands/help.ts
|
|
417
|
+
function configureGlobalOptionsHelp(root) {
|
|
418
|
+
root.configureHelp({ showGlobalOptions: true });
|
|
419
|
+
for (const child of root.commands) {
|
|
420
|
+
configureGlobalOptionsHelp(child);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// src/version.ts
|
|
425
|
+
var CLI_VERSION = true ? "0.19.0" : "0.0.0-dev";
|
|
426
|
+
|
|
416
427
|
// src/commands/configure.ts
|
|
417
428
|
var import_commander2 = require("commander");
|
|
418
429
|
var import_chalk2 = __toESM(require("chalk"));
|
|
@@ -517,6 +528,13 @@ async function writeToken(profile, accessToken, expiresAt, credentialHash) {
|
|
|
517
528
|
|
|
518
529
|
// src/api/httpError.ts
|
|
519
530
|
var import_ky = require("ky");
|
|
531
|
+
async function readHttpErrorBody(err) {
|
|
532
|
+
try {
|
|
533
|
+
return await err.response.clone().json();
|
|
534
|
+
} catch {
|
|
535
|
+
return void 0;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
520
538
|
function toNhnCloudCliError(err) {
|
|
521
539
|
if (err instanceof NhnCloudCliError) {
|
|
522
540
|
return err;
|
|
@@ -592,10 +610,12 @@ var import_ky3 = __toESM(require("ky"));
|
|
|
592
610
|
var ENDPOINTS = {
|
|
593
611
|
logncrash: "https://api-lncs-search.nhncloudservice.com",
|
|
594
612
|
"logncrash-collector": "https://api-logncrash.nhncloudservice.com",
|
|
595
|
-
deploy: "https://api-deploy.nhncloudservice.com"
|
|
613
|
+
deploy: "https://api-deploy.nhncloudservice.com",
|
|
614
|
+
skm: "https://api-keymanager.nhncloudservice.com"
|
|
596
615
|
};
|
|
597
616
|
var GOV_ENDPOINTS = {
|
|
598
|
-
deploy: "https://api-tcd.gov-nhncloudservice.com"
|
|
617
|
+
deploy: "https://api-tcd.gov-nhncloudservice.com",
|
|
618
|
+
skm: "https://api-keymanager.gov-nhncloudservice.com"
|
|
599
619
|
};
|
|
600
620
|
function endpointFor(service, environment = "real") {
|
|
601
621
|
const endpoints = environment === "gov" ? GOV_ENDPOINTS : ENDPOINTS;
|
|
@@ -875,12 +895,9 @@ async function toLogncrashError(err) {
|
|
|
875
895
|
return toNhnCloudCliError(err);
|
|
876
896
|
}
|
|
877
897
|
let requestId = null;
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
requestId = body.requestId;
|
|
882
|
-
}
|
|
883
|
-
} catch {
|
|
898
|
+
const body = await readHttpErrorBody(err);
|
|
899
|
+
if (typeof body === "object" && body !== null && "requestId" in body && typeof body.requestId === "string") {
|
|
900
|
+
requestId = body.requestId;
|
|
884
901
|
}
|
|
885
902
|
return new LogncrashServerError(
|
|
886
903
|
`API \uD638\uCD9C \uC2E4\uD328 (500): ${err.message}`,
|
|
@@ -2009,7 +2026,7 @@ async function verifyLogncrash(uak, appkey) {
|
|
|
2009
2026
|
}
|
|
2010
2027
|
|
|
2011
2028
|
// src/commands/configure.ts
|
|
2012
|
-
async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigateway, deploy, doVerify, logncrashUak = uak) {
|
|
2029
|
+
async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigateway, skm, deploy, doVerify, logncrashUak = uak) {
|
|
2013
2030
|
if (doVerify) {
|
|
2014
2031
|
if (await getProfileEnvironment(profileName, true) === "gov") {
|
|
2015
2032
|
throw new NhnCloudCliError(
|
|
@@ -2115,6 +2132,9 @@ async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigat
|
|
|
2115
2132
|
if (apigateway) {
|
|
2116
2133
|
await setServiceCredential(profileName, "apigateway", apigateway);
|
|
2117
2134
|
}
|
|
2135
|
+
if (skm) {
|
|
2136
|
+
await setServiceCredential(profileName, "skm", skm);
|
|
2137
|
+
}
|
|
2118
2138
|
if (deploy) {
|
|
2119
2139
|
await setServiceCredential(profileName, "deploy", deploy);
|
|
2120
2140
|
}
|
|
@@ -2244,7 +2264,7 @@ async function runInteractive(opts) {
|
|
|
2244
2264
|
}
|
|
2245
2265
|
if (opts.verify) {
|
|
2246
2266
|
try {
|
|
2247
|
-
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, deploy, true, uak);
|
|
2267
|
+
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, void 0, deploy, true, uak);
|
|
2248
2268
|
} catch (err) {
|
|
2249
2269
|
if (err instanceof NhnCloudCliError && err.exitCode === EXIT_AUTH_ERROR) {
|
|
2250
2270
|
process.stderr.write(import_chalk2.default.red(` \u2717 ${sanitizeMultilineForTerminal(err.message)}
|
|
@@ -2257,13 +2277,13 @@ async function runInteractive(opts) {
|
|
|
2257
2277
|
process.stderr.write(import_chalk2.default.yellow("\uC800\uC7A5\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
2258
2278
|
return;
|
|
2259
2279
|
}
|
|
2260
|
-
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, deploy, false, uak);
|
|
2280
|
+
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, void 0, deploy, false, uak);
|
|
2261
2281
|
} else {
|
|
2262
2282
|
throw err;
|
|
2263
2283
|
}
|
|
2264
2284
|
}
|
|
2265
2285
|
} else {
|
|
2266
|
-
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, deploy, false, uak);
|
|
2286
|
+
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, void 0, deploy, false, uak);
|
|
2267
2287
|
}
|
|
2268
2288
|
}
|
|
2269
2289
|
async function runNonInteractive(opts) {
|
|
@@ -2287,6 +2307,9 @@ async function runNonInteractive(opts) {
|
|
|
2287
2307
|
if (opts.apigatewayAppkey !== void 0 && opts.apigatewayAppkey.trim().length === 0) {
|
|
2288
2308
|
throw new NhnCloudCliError("--apigateway-appkey \uAC12\uC740 \uBE44\uC5B4 \uC788\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
2289
2309
|
}
|
|
2310
|
+
if (opts.skmAppkey !== void 0 && opts.skmAppkey.trim().length === 0) {
|
|
2311
|
+
throw new NhnCloudCliError("--skm-appkey \uAC12\uC740 \uBE44\uC5B4 \uC788\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
2312
|
+
}
|
|
2290
2313
|
if (opts.deployAppkey !== void 0 && opts.deployAppkey.trim().length === 0) {
|
|
2291
2314
|
throw new NhnCloudCliError("--deploy-appkey \uAC12\uC740 \uBE44\uC5B4 \uC788\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
2292
2315
|
}
|
|
@@ -2309,10 +2332,11 @@ async function runNonInteractive(opts) {
|
|
|
2309
2332
|
const ncr = opts.ncrAppkey?.trim() ? { appkey: opts.ncrAppkey.trim() } : void 0;
|
|
2310
2333
|
const ncs = opts.ncsAppkey?.trim() ? { appkey: opts.ncsAppkey.trim() } : void 0;
|
|
2311
2334
|
const apigateway = opts.apigatewayAppkey?.trim() ? { appkey: opts.apigatewayAppkey.trim() } : void 0;
|
|
2335
|
+
const skm = opts.skmAppkey?.trim() ? { appkey: opts.skmAppkey.trim() } : void 0;
|
|
2312
2336
|
const deploy = opts.deployAppkey?.trim() ? { appkey: opts.deployAppkey.trim() } : void 0;
|
|
2313
|
-
if (!uak && !logncrash && !iaas && !ncr && !ncs && !apigateway && !deploy) {
|
|
2337
|
+
if (!uak && !logncrash && !iaas && !ncr && !ncs && !apigateway && !skm && !deploy) {
|
|
2314
2338
|
throw new NhnCloudCliError(
|
|
2315
|
-
"\uBE44\uB300\uD654\uD615 \uBAA8\uB4DC: --uak-id + UAK secret, --logncrash-appkey,\n--iaas-tenant-id + --iaas-username + iaas password,\n--ncr-appkey, --ncs-appkey, --apigateway-appkey, \uB610\uB294 --deploy-appkey\n\uC911 \uD558\uB098\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.\nsecret/password \uB294 \uB178\uCD9C \uBC29\uC9C0\uB97C \uC704\uD574 \uD658\uACBD\uBCC0\uC218 \uAD8C\uC7A5:\nNHNCLOUD_UAK_SECRET / NHNCLOUD_IAAS_PASSWORD.",
|
|
2339
|
+
"\uBE44\uB300\uD654\uD615 \uBAA8\uB4DC: --uak-id + UAK secret, --logncrash-appkey,\n--iaas-tenant-id + --iaas-username + iaas password,\n--ncr-appkey, --ncs-appkey, --apigateway-appkey, --skm-appkey, \uB610\uB294 --deploy-appkey\n\uC911 \uD558\uB098\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.\nsecret/password \uB294 \uB178\uCD9C \uBC29\uC9C0\uB97C \uC704\uD574 \uD658\uACBD\uBCC0\uC218 \uAD8C\uC7A5:\nNHNCLOUD_UAK_SECRET / NHNCLOUD_IAAS_PASSWORD.",
|
|
2316
2340
|
EXIT_PARAM_ERROR
|
|
2317
2341
|
);
|
|
2318
2342
|
}
|
|
@@ -2331,6 +2355,7 @@ async function runNonInteractive(opts) {
|
|
|
2331
2355
|
ncr,
|
|
2332
2356
|
ncs,
|
|
2333
2357
|
apigateway,
|
|
2358
|
+
skm,
|
|
2334
2359
|
deploy,
|
|
2335
2360
|
opts.verify,
|
|
2336
2361
|
logncrashUak
|
|
@@ -2339,8 +2364,8 @@ async function runNonInteractive(opts) {
|
|
|
2339
2364
|
var configureCommand = new import_commander2.Command("configure").description("\uC790\uACA9\uC99D\uBA85 \uC124\uC815 \uB9C8\uBC95\uC0AC (\uB300\uD654\uD615 + flag)").option("--profile <name>", "\uB300\uC0C1 profile \uC774\uB984 (\uAE30\uBCF8: default)").option("--uak-id <id>", "\uAC1C\uC778 UAK ID (\uBE44\uB300\uD654\uD615)").option("--uak-secret <secret>", "\uAC1C\uC778 UAK Secret (\uBE44\uB300\uD654\uD615, \uB178\uCD9C \uBC29\uC9C0\uB85C env NHNCLOUD_UAK_SECRET \uAD8C\uC7A5)").option("--logncrash-appkey <key>", "logncrash appkey (\uBE44\uB300\uD654\uD615)").option("--logncrash-secret <secret>", "\uD3D0\uAE30 \uC608\uC815: Search v3\uC5D0\uC11C\uB294 \uC0AC\uC6A9\xB7\uC800\uC7A5\uD558\uC9C0 \uC54A\uC74C").option("--iaas-tenant-id <id>", "iaas tenantId / \uD504\uB85C\uC81D\uD2B8 ID (\uBE44\uB300\uD654\uD615)").option("--iaas-username <user>", "iaas IAM username (\uBE44\uB300\uD654\uD615)").option(
|
|
2340
2365
|
"--iaas-password <pass>",
|
|
2341
2366
|
"iaas API \uBE44\uBC00\uBC88\uD638 (\uBE44\uB300\uD654\uD615, \uB178\uCD9C \uBC29\uC9C0\uB85C env NHNCLOUD_IAAS_PASSWORD \uAD8C\uC7A5)"
|
|
2342
|
-
).option("--iaas-region <region>", "iaas region (\uAE30\uBCF8: kr1)", "kr1").option("--ncr-appkey <key>", "ncr appkey (\uBE44\uB300\uD654\uD615)").option("--ncs-appkey <key>", "ncs appkey (\uBE44\uB300\uD654\uD615)").option("--apigateway-appkey <key>", "API Gateway appkey (\uBE44\uB300\uD654\uD615)").option("--deploy-appkey <key>", "deploy appkey (\uBE44\uB300\uD654\uD615)").option("--no-verify", "\uC5F0\uACB0 \uD14C\uC2A4\uD2B8 \uC0DD\uB7B5").action(async (opts) => {
|
|
2343
|
-
const hasFlag = opts.uakId !== void 0 || opts.uakSecret !== void 0 || opts.logncrashAppkey !== void 0 || opts.logncrashSecret !== void 0 || opts.iaasTenantId !== void 0 || opts.iaasUsername !== void 0 || opts.iaasPassword !== void 0 || opts.ncrAppkey !== void 0 || opts.ncsAppkey !== void 0 || opts.apigatewayAppkey !== void 0 || opts.deployAppkey !== void 0;
|
|
2367
|
+
).option("--iaas-region <region>", "iaas region (\uAE30\uBCF8: kr1)", "kr1").option("--ncr-appkey <key>", "ncr appkey (\uBE44\uB300\uD654\uD615)").option("--ncs-appkey <key>", "ncs appkey (\uBE44\uB300\uD654\uD615)").option("--apigateway-appkey <key>", "API Gateway appkey (\uBE44\uB300\uD654\uD615)").option("--skm-appkey <key>", "Secure Key Manager appkey (\uBE44\uB300\uD654\uD615)").option("--deploy-appkey <key>", "deploy appkey (\uBE44\uB300\uD654\uD615)").option("--no-verify", "\uC5F0\uACB0 \uD14C\uC2A4\uD2B8 \uC0DD\uB7B5").action(async (opts) => {
|
|
2368
|
+
const hasFlag = opts.uakId !== void 0 || opts.uakSecret !== void 0 || opts.logncrashAppkey !== void 0 || opts.logncrashSecret !== void 0 || opts.iaasTenantId !== void 0 || opts.iaasUsername !== void 0 || opts.iaasPassword !== void 0 || opts.ncrAppkey !== void 0 || opts.ncsAppkey !== void 0 || opts.apigatewayAppkey !== void 0 || opts.skmAppkey !== void 0 || opts.deployAppkey !== void 0;
|
|
2344
2369
|
try {
|
|
2345
2370
|
if (hasFlag) {
|
|
2346
2371
|
await runNonInteractive(opts);
|
|
@@ -4828,6 +4853,14 @@ var InstanceClient = class {
|
|
|
4828
4853
|
throw toNhnCloudCliError(err);
|
|
4829
4854
|
}
|
|
4830
4855
|
}
|
|
4856
|
+
/** 인스턴스에 보안그룹을 연결한다 (addSecurityGroup action, 이름 기준). */
|
|
4857
|
+
async addSecurityGroup(id, groupName) {
|
|
4858
|
+
return this.serverAction(id, { addSecurityGroup: { name: groupName } });
|
|
4859
|
+
}
|
|
4860
|
+
/** 인스턴스에서 보안그룹 연결을 해제한다 (removeSecurityGroup action, 이름 기준). */
|
|
4861
|
+
async removeSecurityGroup(id, groupName) {
|
|
4862
|
+
return this.serverAction(id, { removeSecurityGroup: { name: groupName } });
|
|
4863
|
+
}
|
|
4831
4864
|
/** 인스턴스를 시작한다 (SHUTOFF → ACTIVE). */
|
|
4832
4865
|
async start(id) {
|
|
4833
4866
|
return this.serverAction(id, { "os-start": null });
|
|
@@ -5382,8 +5415,34 @@ var createCommand = new import_commander21.Command("create").description("\uBCFC
|
|
|
5382
5415
|
// src/commands/network/list.ts
|
|
5383
5416
|
var import_commander22 = require("commander");
|
|
5384
5417
|
|
|
5418
|
+
// src/commands/network/helpers.ts
|
|
5419
|
+
var import_node_net = require("net");
|
|
5420
|
+
|
|
5421
|
+
// src/services/network/client.ts
|
|
5422
|
+
var import_ky12 = __toESM(require("ky"));
|
|
5423
|
+
|
|
5424
|
+
// src/services/network/errors.ts
|
|
5425
|
+
var import_ky11 = require("ky");
|
|
5426
|
+
var REJECTION_STATUSES = /* @__PURE__ */ new Set([400, 409]);
|
|
5427
|
+
async function toNetworkWriteError(err) {
|
|
5428
|
+
const base = toNhnCloudCliError(err);
|
|
5429
|
+
if (!(err instanceof import_ky11.HTTPError) || !REJECTION_STATUSES.has(err.response.status)) {
|
|
5430
|
+
return base;
|
|
5431
|
+
}
|
|
5432
|
+
let reason = null;
|
|
5433
|
+
const body = await readHttpErrorBody(err);
|
|
5434
|
+
const neutron = typeof body === "object" && body !== null ? body["NeutronError"] : void 0;
|
|
5435
|
+
const message = typeof neutron === "object" && neutron !== null ? neutron["message"] : void 0;
|
|
5436
|
+
if (typeof message === "string") reason = message;
|
|
5437
|
+
if (reason === null) return base;
|
|
5438
|
+
return new NhnCloudCliError(
|
|
5439
|
+
`${base.message}
|
|
5440
|
+
\uC11C\uBC84 \uC751\uB2F5: ${sanitizeForTerminal(reason)}`,
|
|
5441
|
+
base.exitCode
|
|
5442
|
+
);
|
|
5443
|
+
}
|
|
5444
|
+
|
|
5385
5445
|
// src/services/network/client.ts
|
|
5386
|
-
var import_ky11 = __toESM(require("ky"));
|
|
5387
5446
|
function isVpc(val) {
|
|
5388
5447
|
if (typeof val !== "object" || val === null) return false;
|
|
5389
5448
|
const obj = val;
|
|
@@ -5419,6 +5478,28 @@ function isFloatingIpResponse(val) {
|
|
|
5419
5478
|
const obj = val;
|
|
5420
5479
|
return isFloatingIp(obj["floatingip"]);
|
|
5421
5480
|
}
|
|
5481
|
+
function isSecurityGroupRule(val) {
|
|
5482
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5483
|
+
const obj = val;
|
|
5484
|
+
return typeof obj["id"] === "string" && typeof obj["security_group_id"] === "string" && typeof obj["direction"] === "string" && typeof obj["ethertype"] === "string" && (obj["protocol"] === null || typeof obj["protocol"] === "string") && (obj["port_range_min"] === null || typeof obj["port_range_min"] === "number") && (obj["port_range_max"] === null || typeof obj["port_range_max"] === "number") && (obj["remote_ip_prefix"] === null || typeof obj["remote_ip_prefix"] === "string") && (obj["remote_group_id"] === null || typeof obj["remote_group_id"] === "string") && (obj["description"] === null || typeof obj["description"] === "string") && typeof obj["tenant_id"] === "string";
|
|
5485
|
+
}
|
|
5486
|
+
function isSecurityGroup(val) {
|
|
5487
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5488
|
+
const obj = val;
|
|
5489
|
+
return typeof obj["id"] === "string" && typeof obj["name"] === "string" && typeof obj["description"] === "string" && typeof obj["tenant_id"] === "string" && Array.isArray(obj["security_group_rules"]) && obj["security_group_rules"].every(isSecurityGroupRule);
|
|
5490
|
+
}
|
|
5491
|
+
function isSecurityGroupPort(val) {
|
|
5492
|
+
if (typeof val !== "object" || val === null) return false;
|
|
5493
|
+
const obj = val;
|
|
5494
|
+
return typeof obj["id"] === "string" && typeof obj["name"] === "string" && typeof obj["status"] === "string" && typeof obj["device_owner"] === "string" && typeof obj["device_id"] === "string" && typeof obj["network_id"] === "string" && Array.isArray(obj["fixed_ips"]) && obj["fixed_ips"].every((ip) => {
|
|
5495
|
+
if (typeof ip !== "object" || ip === null) return false;
|
|
5496
|
+
const fixedIp = ip;
|
|
5497
|
+
return typeof fixedIp["subnet_id"] === "string" && typeof fixedIp["ip_address"] === "string";
|
|
5498
|
+
}) && Array.isArray(obj["security_groups"]) && obj["security_groups"].every((id) => typeof id === "string");
|
|
5499
|
+
}
|
|
5500
|
+
function omitUndefined(obj) {
|
|
5501
|
+
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
|
|
5502
|
+
}
|
|
5422
5503
|
var NetworkClient = class {
|
|
5423
5504
|
tokenId;
|
|
5424
5505
|
networkEndpoint;
|
|
@@ -5429,6 +5510,184 @@ var NetworkClient = class {
|
|
|
5429
5510
|
authHeaders() {
|
|
5430
5511
|
return { "X-Auth-Token": this.tokenId };
|
|
5431
5512
|
}
|
|
5513
|
+
async listSecurityGroups() {
|
|
5514
|
+
try {
|
|
5515
|
+
const raw = await import_ky12.default.get(`${this.networkEndpoint}/security-groups`, {
|
|
5516
|
+
headers: this.authHeaders(),
|
|
5517
|
+
retry: 0,
|
|
5518
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5519
|
+
}).json();
|
|
5520
|
+
const groups = typeof raw === "object" && raw !== null ? raw["security_groups"] : void 0;
|
|
5521
|
+
if (!Array.isArray(groups) || !groups.every(isSecurityGroup)) {
|
|
5522
|
+
throw new NhnCloudCliError("network security-group list \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 security_groups \uBC30\uC5F4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
5523
|
+
}
|
|
5524
|
+
return groups;
|
|
5525
|
+
} catch (err) {
|
|
5526
|
+
throw toNhnCloudCliError(err);
|
|
5527
|
+
}
|
|
5528
|
+
}
|
|
5529
|
+
async getSecurityGroup(id) {
|
|
5530
|
+
try {
|
|
5531
|
+
const raw = await import_ky12.default.get(`${this.networkEndpoint}/security-groups/${encodeURIComponent(id)}`, {
|
|
5532
|
+
headers: this.authHeaders(),
|
|
5533
|
+
retry: 0,
|
|
5534
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5535
|
+
}).json();
|
|
5536
|
+
const group = typeof raw === "object" && raw !== null ? raw["security_group"] : void 0;
|
|
5537
|
+
if (!isSecurityGroup(group)) {
|
|
5538
|
+
throw new NhnCloudCliError("network security-group get \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 security_group \uAC1D\uCCB4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
5539
|
+
}
|
|
5540
|
+
return group;
|
|
5541
|
+
} catch (err) {
|
|
5542
|
+
throw toNhnCloudCliError(err);
|
|
5543
|
+
}
|
|
5544
|
+
}
|
|
5545
|
+
async listSecurityGroupRules(securityGroupId) {
|
|
5546
|
+
try {
|
|
5547
|
+
const raw = await import_ky12.default.get(`${this.networkEndpoint}/security-group-rules`, {
|
|
5548
|
+
headers: this.authHeaders(),
|
|
5549
|
+
searchParams: { security_group_id: securityGroupId },
|
|
5550
|
+
retry: 0,
|
|
5551
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5552
|
+
}).json();
|
|
5553
|
+
const rules = typeof raw === "object" && raw !== null ? raw["security_group_rules"] : void 0;
|
|
5554
|
+
if (!Array.isArray(rules) || !rules.every(isSecurityGroupRule)) {
|
|
5555
|
+
throw new NhnCloudCliError("network security-group rule list \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 security_group_rules \uBC30\uC5F4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
5556
|
+
}
|
|
5557
|
+
return rules;
|
|
5558
|
+
} catch (err) {
|
|
5559
|
+
throw toNhnCloudCliError(err);
|
|
5560
|
+
}
|
|
5561
|
+
}
|
|
5562
|
+
async getSecurityGroupRule(id) {
|
|
5563
|
+
try {
|
|
5564
|
+
const raw = await import_ky12.default.get(`${this.networkEndpoint}/security-group-rules/${encodeURIComponent(id)}`, {
|
|
5565
|
+
headers: this.authHeaders(),
|
|
5566
|
+
retry: 0,
|
|
5567
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5568
|
+
}).json();
|
|
5569
|
+
const rule = typeof raw === "object" && raw !== null ? raw["security_group_rule"] : void 0;
|
|
5570
|
+
if (!isSecurityGroupRule(rule)) {
|
|
5571
|
+
throw new NhnCloudCliError("network security-group rule get \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 security_group_rule \uAC1D\uCCB4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
5572
|
+
}
|
|
5573
|
+
return rule;
|
|
5574
|
+
} catch (err) {
|
|
5575
|
+
throw toNhnCloudCliError(err);
|
|
5576
|
+
}
|
|
5577
|
+
}
|
|
5578
|
+
async listSecurityGroupPorts(securityGroupId) {
|
|
5579
|
+
try {
|
|
5580
|
+
const raw = await import_ky12.default.get(`${this.networkEndpoint}/security-group-ports`, {
|
|
5581
|
+
headers: this.authHeaders(),
|
|
5582
|
+
searchParams: { security_group_id: securityGroupId },
|
|
5583
|
+
retry: 0,
|
|
5584
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5585
|
+
}).json();
|
|
5586
|
+
const ports = typeof raw === "object" && raw !== null ? raw["security_group_ports"] : void 0;
|
|
5587
|
+
if (!Array.isArray(ports) || !ports.every(isSecurityGroupPort)) {
|
|
5588
|
+
throw new NhnCloudCliError("network security-group ports \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 security_group_ports \uBC30\uC5F4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
5589
|
+
}
|
|
5590
|
+
return ports;
|
|
5591
|
+
} catch (err) {
|
|
5592
|
+
throw toNhnCloudCliError(err);
|
|
5593
|
+
}
|
|
5594
|
+
}
|
|
5595
|
+
/** 보안그룹을 생성한다 (POST /v2.0/security-groups). 송신 규칙 두 개가 자동으로 함께 생성된다. */
|
|
5596
|
+
async createSecurityGroup(params) {
|
|
5597
|
+
try {
|
|
5598
|
+
const raw = await import_ky12.default.post(`${this.networkEndpoint}/security-groups`, {
|
|
5599
|
+
headers: this.authHeaders(),
|
|
5600
|
+
json: { security_group: omitUndefined(params) },
|
|
5601
|
+
retry: 0,
|
|
5602
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5603
|
+
}).json();
|
|
5604
|
+
const group = typeof raw === "object" && raw !== null ? raw["security_group"] : void 0;
|
|
5605
|
+
if (!isSecurityGroup(group)) {
|
|
5606
|
+
throw new NhnCloudCliError("network security-group create \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 security_group \uAC1D\uCCB4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
5607
|
+
}
|
|
5608
|
+
return group;
|
|
5609
|
+
} catch (err) {
|
|
5610
|
+
throw await toNetworkWriteError(err);
|
|
5611
|
+
}
|
|
5612
|
+
}
|
|
5613
|
+
/** 보안그룹 이름·설명을 변경한다 (PUT /v2.0/security-groups/{id}). */
|
|
5614
|
+
async updateSecurityGroup(id, params) {
|
|
5615
|
+
try {
|
|
5616
|
+
const raw = await import_ky12.default.put(`${this.networkEndpoint}/security-groups/${encodeURIComponent(id)}`, {
|
|
5617
|
+
headers: this.authHeaders(),
|
|
5618
|
+
json: { security_group: omitUndefined(params) },
|
|
5619
|
+
retry: 0,
|
|
5620
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5621
|
+
}).json();
|
|
5622
|
+
const group = typeof raw === "object" && raw !== null ? raw["security_group"] : void 0;
|
|
5623
|
+
if (!isSecurityGroup(group)) {
|
|
5624
|
+
throw new NhnCloudCliError("network security-group update \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 security_group \uAC1D\uCCB4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
5625
|
+
}
|
|
5626
|
+
return group;
|
|
5627
|
+
} catch (err) {
|
|
5628
|
+
throw await toNetworkWriteError(err);
|
|
5629
|
+
}
|
|
5630
|
+
}
|
|
5631
|
+
/** 보안그룹을 삭제한다 (DELETE /v2.0/security-groups/{id}, 204 무본문). */
|
|
5632
|
+
async deleteSecurityGroup(id) {
|
|
5633
|
+
try {
|
|
5634
|
+
await import_ky12.default.delete(`${this.networkEndpoint}/security-groups/${encodeURIComponent(id)}`, {
|
|
5635
|
+
headers: this.authHeaders(),
|
|
5636
|
+
retry: 0,
|
|
5637
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5638
|
+
});
|
|
5639
|
+
} catch (err) {
|
|
5640
|
+
throw await toNetworkWriteError(err);
|
|
5641
|
+
}
|
|
5642
|
+
}
|
|
5643
|
+
/** 보안그룹 규칙을 생성한다 (POST /v2.0/security-group-rules). ethertype 은 IPv4 로 고정한다. */
|
|
5644
|
+
async createSecurityGroupRule(params) {
|
|
5645
|
+
try {
|
|
5646
|
+
const raw = await import_ky12.default.post(`${this.networkEndpoint}/security-group-rules`, {
|
|
5647
|
+
headers: this.authHeaders(),
|
|
5648
|
+
json: { security_group_rule: { ...omitUndefined(params), ethertype: "IPv4" } },
|
|
5649
|
+
retry: 0,
|
|
5650
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5651
|
+
}).json();
|
|
5652
|
+
const rule = typeof raw === "object" && raw !== null ? raw["security_group_rule"] : void 0;
|
|
5653
|
+
if (!isSecurityGroupRule(rule)) {
|
|
5654
|
+
throw new NhnCloudCliError("network security-group rule create \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 security_group_rule \uAC1D\uCCB4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
5655
|
+
}
|
|
5656
|
+
return rule;
|
|
5657
|
+
} catch (err) {
|
|
5658
|
+
throw await toNetworkWriteError(err);
|
|
5659
|
+
}
|
|
5660
|
+
}
|
|
5661
|
+
/** 보안그룹 규칙을 삭제한다 (DELETE /v2.0/security-group-rules/{id}, 204 무본문). */
|
|
5662
|
+
async deleteSecurityGroupRule(id) {
|
|
5663
|
+
try {
|
|
5664
|
+
await import_ky12.default.delete(`${this.networkEndpoint}/security-group-rules/${encodeURIComponent(id)}`, {
|
|
5665
|
+
headers: this.authHeaders(),
|
|
5666
|
+
retry: 0,
|
|
5667
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5668
|
+
});
|
|
5669
|
+
} catch (err) {
|
|
5670
|
+
throw await toNetworkWriteError(err);
|
|
5671
|
+
}
|
|
5672
|
+
}
|
|
5673
|
+
/** 다른 보안그룹을 원격 그룹으로 참조하는 규칙을 조회한다 (GET /v2.0/security-group-rules?remote_group_id=). */
|
|
5674
|
+
async listSecurityGroupRulesByRemoteGroup(remoteGroupId) {
|
|
5675
|
+
try {
|
|
5676
|
+
const raw = await import_ky12.default.get(`${this.networkEndpoint}/security-group-rules`, {
|
|
5677
|
+
headers: this.authHeaders(),
|
|
5678
|
+
searchParams: { remote_group_id: remoteGroupId },
|
|
5679
|
+
retry: 0,
|
|
5680
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
5681
|
+
}).json();
|
|
5682
|
+
const rules = typeof raw === "object" && raw !== null ? raw["security_group_rules"] : void 0;
|
|
5683
|
+
if (!Array.isArray(rules) || !rules.every(isSecurityGroupRule)) {
|
|
5684
|
+
throw new NhnCloudCliError("network security-group rule list \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 security_group_rules \uBC30\uC5F4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
5685
|
+
}
|
|
5686
|
+
return rules;
|
|
5687
|
+
} catch (err) {
|
|
5688
|
+
throw toNhnCloudCliError(err);
|
|
5689
|
+
}
|
|
5690
|
+
}
|
|
5432
5691
|
/**
|
|
5433
5692
|
* VPC 목록을 조회한다 (GET /v2.0/vpcs, NHN VPC).
|
|
5434
5693
|
* instance 와 다른 host(networkEndpoint)지만 같은 Keystone 토큰을 쓴다.
|
|
@@ -5436,7 +5695,7 @@ var NetworkClient = class {
|
|
|
5436
5695
|
async listVpcs() {
|
|
5437
5696
|
const url = `${this.networkEndpoint}/vpcs`;
|
|
5438
5697
|
try {
|
|
5439
|
-
const raw = await
|
|
5698
|
+
const raw = await import_ky12.default.get(url, {
|
|
5440
5699
|
headers: this.authHeaders(),
|
|
5441
5700
|
retry: 0,
|
|
5442
5701
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -5458,7 +5717,7 @@ var NetworkClient = class {
|
|
|
5458
5717
|
async listSubnets() {
|
|
5459
5718
|
const url = `${this.networkEndpoint}/vpcsubnets`;
|
|
5460
5719
|
try {
|
|
5461
|
-
const raw = await
|
|
5720
|
+
const raw = await import_ky12.default.get(url, {
|
|
5462
5721
|
headers: this.authHeaders(),
|
|
5463
5722
|
retry: 0,
|
|
5464
5723
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -5478,7 +5737,7 @@ var NetworkClient = class {
|
|
|
5478
5737
|
async listFloatingIps() {
|
|
5479
5738
|
const url = `${this.networkEndpoint}/floatingips`;
|
|
5480
5739
|
try {
|
|
5481
|
-
const raw = await
|
|
5740
|
+
const raw = await import_ky12.default.get(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS }).json();
|
|
5482
5741
|
if (!isFloatingIpsResponse(raw)) {
|
|
5483
5742
|
throw new NhnCloudCliError(
|
|
5484
5743
|
"floatingip list \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 floatingips \uBC30\uC5F4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -5494,7 +5753,7 @@ var NetworkClient = class {
|
|
|
5494
5753
|
async createFloatingIp(params) {
|
|
5495
5754
|
const url = `${this.networkEndpoint}/floatingips`;
|
|
5496
5755
|
try {
|
|
5497
|
-
const raw = await
|
|
5756
|
+
const raw = await import_ky12.default.post(url, {
|
|
5498
5757
|
headers: this.authHeaders(),
|
|
5499
5758
|
json: { floatingip: { floating_network_id: params.floating_network_id } },
|
|
5500
5759
|
retry: 0,
|
|
@@ -5515,7 +5774,7 @@ var NetworkClient = class {
|
|
|
5515
5774
|
async deleteFloatingIp(id) {
|
|
5516
5775
|
const url = `${this.networkEndpoint}/floatingips/${encodeURIComponent(id)}`;
|
|
5517
5776
|
try {
|
|
5518
|
-
await
|
|
5777
|
+
await import_ky12.default.delete(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS });
|
|
5519
5778
|
} catch (err) {
|
|
5520
5779
|
throw toNhnCloudCliError(err);
|
|
5521
5780
|
}
|
|
@@ -5529,7 +5788,7 @@ var NetworkClient = class {
|
|
|
5529
5788
|
async findExternalNetworkId() {
|
|
5530
5789
|
const url = `${this.networkEndpoint}/vpcs`;
|
|
5531
5790
|
try {
|
|
5532
|
-
const raw = await
|
|
5791
|
+
const raw = await import_ky12.default.get(url, {
|
|
5533
5792
|
headers: this.authHeaders(),
|
|
5534
5793
|
searchParams: { "router:external": "true" },
|
|
5535
5794
|
retry: 0,
|
|
@@ -5552,11 +5811,160 @@ var NetworkClient = class {
|
|
|
5552
5811
|
}
|
|
5553
5812
|
};
|
|
5554
5813
|
|
|
5814
|
+
// src/commands/resource-resolver.ts
|
|
5815
|
+
function requireResourceInput(value, label) {
|
|
5816
|
+
const normalized = value.trim();
|
|
5817
|
+
if (!normalized) {
|
|
5818
|
+
throw new NhnCloudCliError(`${label} \uC774\uB984 \uB610\uB294 UUID\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
5819
|
+
}
|
|
5820
|
+
return normalized;
|
|
5821
|
+
}
|
|
5822
|
+
function requireYes(yes, operation) {
|
|
5823
|
+
if (!yes) {
|
|
5824
|
+
throw new NhnCloudCliError(
|
|
5825
|
+
`${operation}\uC5D0\uB294 --yes \uD50C\uB798\uADF8\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.`,
|
|
5826
|
+
EXIT_PARAM_ERROR
|
|
5827
|
+
);
|
|
5828
|
+
}
|
|
5829
|
+
return true;
|
|
5830
|
+
}
|
|
5831
|
+
function resolvedId(resource, label) {
|
|
5832
|
+
const id = resource.id.trim();
|
|
5833
|
+
if (!id) {
|
|
5834
|
+
throw new NhnCloudCliError(`${label} \uC870\uD68C \uACB0\uACFC\uC758 UUID\uAC00 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
5835
|
+
}
|
|
5836
|
+
return id;
|
|
5837
|
+
}
|
|
5838
|
+
function resolveFromList(resources, input, label) {
|
|
5839
|
+
const exactId = resources.find((resource) => resource.id === input);
|
|
5840
|
+
if (exactId) return resolvedId(exactId, label);
|
|
5841
|
+
const nameMatches = resources.filter((resource) => resource.name === input);
|
|
5842
|
+
if (nameMatches.length === 1) return resolvedId(nameMatches[0], label);
|
|
5843
|
+
if (nameMatches.length === 0) {
|
|
5844
|
+
throw new NhnCloudCliError(
|
|
5845
|
+
`${label}\uC744(\uB97C) \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${JSON.stringify(input)}`,
|
|
5846
|
+
EXIT_PARAM_ERROR
|
|
5847
|
+
);
|
|
5848
|
+
}
|
|
5849
|
+
const candidateIds = nameMatches.map((resource) => resolvedId(resource, label)).sort();
|
|
5850
|
+
throw new NhnCloudCliError(
|
|
5851
|
+
`${label} \uC774\uB984\uC774 \uC911\uBCF5\uB429\uB2C8\uB2E4: ${JSON.stringify(input)} (\uD6C4\uBCF4 UUID: ${candidateIds.join(", ")})`,
|
|
5852
|
+
EXIT_PARAM_ERROR
|
|
5853
|
+
);
|
|
5854
|
+
}
|
|
5855
|
+
|
|
5555
5856
|
// src/commands/network/helpers.ts
|
|
5556
5857
|
async function resolveNetworkClient(opts) {
|
|
5557
5858
|
const { profileName, tokenId, networkEndpoint } = await resolveIaasTokenContext(opts);
|
|
5558
5859
|
return { client: new NetworkClient(tokenId, networkEndpoint), profileName };
|
|
5559
5860
|
}
|
|
5861
|
+
async function resolveSecurityGroupClients(opts) {
|
|
5862
|
+
const { profileName, tokenId, networkEndpoint, computeEndpoint, imageEndpoint } = await resolveIaasTokenContext(opts);
|
|
5863
|
+
return {
|
|
5864
|
+
network: new NetworkClient(tokenId, networkEndpoint),
|
|
5865
|
+
instance: new InstanceClient(tokenId, computeEndpoint, imageEndpoint),
|
|
5866
|
+
profileName
|
|
5867
|
+
};
|
|
5868
|
+
}
|
|
5869
|
+
async function resolveSecurityGroupId(client, value) {
|
|
5870
|
+
const input = requireResourceInput(value, "\uBCF4\uC548\uADF8\uB8F9");
|
|
5871
|
+
return resolveFromList(await client.listSecurityGroups(), input, "\uBCF4\uC548\uADF8\uB8F9");
|
|
5872
|
+
}
|
|
5873
|
+
function requireUniqueGroupName(groups, groupId) {
|
|
5874
|
+
const group = groups.find((candidate) => candidate.id === groupId);
|
|
5875
|
+
if (!group) paramError(`\uBCF4\uC548\uADF8\uB8F9\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${JSON.stringify(groupId)}`);
|
|
5876
|
+
const sameName = groups.filter((candidate) => candidate.name === group.name);
|
|
5877
|
+
if (sameName.length > 1) {
|
|
5878
|
+
const candidateIds = sameName.map((candidate) => candidate.id).sort();
|
|
5879
|
+
paramError(
|
|
5880
|
+
`\uC774\uB984\uC774 \uAC19\uC740 \uBCF4\uC548\uADF8\uB8F9\uC774 ${sameName.length}\uAC1C \uC788\uC5B4 \uC778\uC2A4\uD134\uC2A4 \uC5F0\uACB0\uC744 \uBCC0\uACBD\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${group.name} (\uD6C4\uBCF4 UUID: ${candidateIds.join(", ")}). network security-group update\uB85C \uC774\uB984\uC744 \uBA3C\uC800 \uBC14\uAFB8\uC138\uC694.`
|
|
5881
|
+
);
|
|
5882
|
+
}
|
|
5883
|
+
return group;
|
|
5884
|
+
}
|
|
5885
|
+
function formatRulePorts(rule) {
|
|
5886
|
+
if (rule.port_range_min === null && rule.port_range_max === null) return "any";
|
|
5887
|
+
if (rule.port_range_min === rule.port_range_max) return String(rule.port_range_min);
|
|
5888
|
+
return `${rule.port_range_min ?? "any"}-${rule.port_range_max ?? "any"}`;
|
|
5889
|
+
}
|
|
5890
|
+
function formatRuleRemote(rule) {
|
|
5891
|
+
if (rule.remote_ip_prefix !== null) return rule.remote_ip_prefix;
|
|
5892
|
+
if (rule.remote_group_id !== null) return `sg:${rule.remote_group_id}`;
|
|
5893
|
+
return "any";
|
|
5894
|
+
}
|
|
5895
|
+
function withOptions(command) {
|
|
5896
|
+
return command.option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984");
|
|
5897
|
+
}
|
|
5898
|
+
var RULE_PROTOCOLS = ["tcp", "udp", "icmp", "any"];
|
|
5899
|
+
var PORT_RANGE = { min: 1, max: 65535 };
|
|
5900
|
+
var CIDR_PREFIX_PATTERN = /^(\d|[12]\d|3[0-2])$/;
|
|
5901
|
+
function paramError(message) {
|
|
5902
|
+
throw new NhnCloudCliError(message, EXIT_PARAM_ERROR);
|
|
5903
|
+
}
|
|
5904
|
+
function parsePortRange(value) {
|
|
5905
|
+
const formatError = `--port-range\uB294 \uC2DC\uC791-\uB05D \uD615\uC2DD\uC774\uBA70 \uC2DC\uC791\uC774 \uB05D\uBCF4\uB2E4 \uD074 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${JSON.stringify(value)}`;
|
|
5906
|
+
const parts = value.split("-");
|
|
5907
|
+
if (parts.length !== 2 || !parts[0] || !parts[1]) paramError(formatError);
|
|
5908
|
+
const min = parseIntegerOption(parts[0], "--port-range", PORT_RANGE);
|
|
5909
|
+
const max = parseIntegerOption(parts[1], "--port-range", PORT_RANGE);
|
|
5910
|
+
if (min > max) paramError(formatError);
|
|
5911
|
+
return [min, max];
|
|
5912
|
+
}
|
|
5913
|
+
function isIpv4OrCidr(value) {
|
|
5914
|
+
const parts = value.split("/");
|
|
5915
|
+
if (parts.length > 2 || (0, import_node_net.isIP)(parts[0] ?? "") !== 4) return false;
|
|
5916
|
+
return parts.length === 1 || CIDR_PREFIX_PATTERN.test(parts[1] ?? "");
|
|
5917
|
+
}
|
|
5918
|
+
function parseRuleInput(opts) {
|
|
5919
|
+
const { direction, protocol } = opts;
|
|
5920
|
+
if (direction !== "ingress" && direction !== "egress") {
|
|
5921
|
+
paramError(`--direction\uC740 ingress \uB610\uB294 egress\uC5EC\uC57C \uD569\uB2C8\uB2E4: ${JSON.stringify(direction)}`);
|
|
5922
|
+
}
|
|
5923
|
+
if (protocol !== void 0 && !RULE_PROTOCOLS.includes(protocol)) {
|
|
5924
|
+
paramError(`--protocol\uC740 tcp, udp, icmp, any \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4: ${JSON.stringify(protocol)}`);
|
|
5925
|
+
}
|
|
5926
|
+
if (opts.port !== void 0 && opts.portRange !== void 0) {
|
|
5927
|
+
paramError("--port\uC640 --port-range\uB294 \uD568\uAED8 \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
5928
|
+
}
|
|
5929
|
+
let portRangeMin;
|
|
5930
|
+
let portRangeMax;
|
|
5931
|
+
if (opts.port !== void 0 || opts.portRange !== void 0) {
|
|
5932
|
+
if (protocol !== "tcp" && protocol !== "udp") {
|
|
5933
|
+
paramError("\uD3EC\uD2B8\uB294 --protocol tcp \uB610\uB294 udp\uC640 \uD568\uAED8 \uC9C0\uC815\uD569\uB2C8\uB2E4.");
|
|
5934
|
+
}
|
|
5935
|
+
if (opts.port !== void 0) {
|
|
5936
|
+
portRangeMin = parseIntegerOption(opts.port, "--port", PORT_RANGE);
|
|
5937
|
+
portRangeMax = portRangeMin;
|
|
5938
|
+
} else if (opts.portRange !== void 0) {
|
|
5939
|
+
[portRangeMin, portRangeMax] = parsePortRange(opts.portRange);
|
|
5940
|
+
}
|
|
5941
|
+
}
|
|
5942
|
+
if (opts.cidr !== void 0 && opts.remoteGroup !== void 0) {
|
|
5943
|
+
paramError("--cidr\uC640 --remote-group\uC740 \uD568\uAED8 \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
|
|
5944
|
+
}
|
|
5945
|
+
if (opts.cidr !== void 0 && !isIpv4OrCidr(opts.cidr)) {
|
|
5946
|
+
paramError(`--cidr\uB294 IPv4 \uC8FC\uC18C \uB610\uB294 CIDR\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4: ${JSON.stringify(opts.cidr)}`);
|
|
5947
|
+
}
|
|
5948
|
+
return {
|
|
5949
|
+
direction,
|
|
5950
|
+
protocol,
|
|
5951
|
+
portRangeMin,
|
|
5952
|
+
portRangeMax,
|
|
5953
|
+
cidr: opts.cidr,
|
|
5954
|
+
remoteGroup: opts.remoteGroup,
|
|
5955
|
+
description: opts.description
|
|
5956
|
+
};
|
|
5957
|
+
}
|
|
5958
|
+
function toCreateRuleParams(input, securityGroupId, remoteGroupId) {
|
|
5959
|
+
const params = { security_group_id: securityGroupId, direction: input.direction };
|
|
5960
|
+
if (input.protocol !== void 0 && input.protocol !== "any") params.protocol = input.protocol;
|
|
5961
|
+
if (input.portRangeMin !== void 0) params.port_range_min = input.portRangeMin;
|
|
5962
|
+
if (input.portRangeMax !== void 0) params.port_range_max = input.portRangeMax;
|
|
5963
|
+
if (input.cidr !== void 0) params.remote_ip_prefix = input.cidr;
|
|
5964
|
+
if (remoteGroupId !== void 0) params.remote_group_id = remoteGroupId;
|
|
5965
|
+
if (input.description !== void 0) params.description = input.description;
|
|
5966
|
+
return params;
|
|
5967
|
+
}
|
|
5560
5968
|
|
|
5561
5969
|
// src/commands/network/list.ts
|
|
5562
5970
|
var listCommand3 = new import_commander22.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) => {
|
|
@@ -5608,52 +6016,367 @@ var subnetListCommand = new import_commander23.Command("list").description("\uC1
|
|
|
5608
6016
|
});
|
|
5609
6017
|
var subnetCommand = new import_commander23.Command("subnet").description("\uC11C\uBE0C\uB137 \uAD00\uB828 \uBA85\uB839").addCommand(subnetListCommand);
|
|
5610
6018
|
|
|
5611
|
-
// src/commands/
|
|
6019
|
+
// src/commands/network/security-group.ts
|
|
6020
|
+
var import_commander26 = require("commander");
|
|
6021
|
+
|
|
6022
|
+
// src/commands/network/security-group-manage.ts
|
|
5612
6023
|
var import_commander24 = require("commander");
|
|
5613
|
-
|
|
6024
|
+
function parseName(value) {
|
|
6025
|
+
const name = value.trim();
|
|
6026
|
+
if (!name) throw new NhnCloudCliError("--name\uC740 \uBE44\uC5B4 \uC788\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
6027
|
+
return name;
|
|
6028
|
+
}
|
|
6029
|
+
function outputGroup(opts, group) {
|
|
6030
|
+
output(opts, {
|
|
6031
|
+
headers: ["field", "value"],
|
|
6032
|
+
rows: [
|
|
6033
|
+
["id", group.id],
|
|
6034
|
+
["name", group.name],
|
|
6035
|
+
["description", group.description],
|
|
6036
|
+
["rules", String(group.security_group_rules.length)]
|
|
6037
|
+
],
|
|
6038
|
+
raw: group,
|
|
6039
|
+
ids: [group.id]
|
|
6040
|
+
});
|
|
6041
|
+
}
|
|
6042
|
+
var createCommand2 = withOptions(new import_commander24.Command("create").description("\uBCF4\uC548\uADF8\uB8F9\uC744 \uC0DD\uC131\uD55C\uB2E4 (\uC1A1\uC2E0 \uADDC\uCE59 \uB450 \uAC1C\uAC00 \uD568\uAED8 \uC0DD\uC131\uB41C\uB2E4)").requiredOption("--name <name>", "\uBCF4\uC548\uADF8\uB8F9 \uC774\uB984").option("--description <text>", "\uBCF4\uC548\uADF8\uB8F9 \uC124\uBA85")).action(async (_opts, cmd) => {
|
|
5614
6043
|
const opts = cmd.optsWithGlobals();
|
|
5615
|
-
const {
|
|
5616
|
-
|
|
5617
|
-
|
|
6044
|
+
const params = { name: parseName(opts.name ?? ""), description: opts.description };
|
|
6045
|
+
const { network } = await resolveSecurityGroupClients(opts);
|
|
6046
|
+
startSpinner("\uBCF4\uC548\uADF8\uB8F9 \uC0DD\uC131 \uC911...");
|
|
6047
|
+
let group;
|
|
5618
6048
|
try {
|
|
5619
|
-
|
|
6049
|
+
group = await network.createSecurityGroup(params);
|
|
5620
6050
|
} catch (err) {
|
|
5621
6051
|
stopSpinner(false);
|
|
5622
6052
|
throw err;
|
|
5623
6053
|
}
|
|
5624
6054
|
stopSpinner(true);
|
|
5625
|
-
|
|
5626
|
-
headers: ["id", "floating_ip_address", "status", "port_id", "fixed_ip_address"],
|
|
5627
|
-
rows: fips.map((f) => [
|
|
5628
|
-
f.id,
|
|
5629
|
-
f.floating_ip_address,
|
|
5630
|
-
f.status,
|
|
5631
|
-
f.port_id ?? "-",
|
|
5632
|
-
f.fixed_ip_address ?? "-"
|
|
5633
|
-
]),
|
|
5634
|
-
raw: fips,
|
|
5635
|
-
ids: fips.map((f) => f.id)
|
|
5636
|
-
});
|
|
6055
|
+
outputGroup(opts, group);
|
|
5637
6056
|
});
|
|
5638
|
-
|
|
5639
|
-
// src/commands/floatingip/create.ts
|
|
5640
|
-
var import_commander25 = require("commander");
|
|
5641
|
-
var import_chalk6 = __toESM(require("chalk"));
|
|
5642
|
-
var createCommand2 = new import_commander25.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) => {
|
|
6057
|
+
var updateCommand = withOptions(new import_commander24.Command("update").description("\uBCF4\uC548\uADF8\uB8F9 \uC774\uB984\uC774\uB098 \uC124\uBA85\uC744 \uBCC0\uACBD\uD55C\uB2E4").argument("<group>", "\uBCF4\uC548\uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID").option("--name <name>", "\uC0C8 \uC774\uB984").option("--description <text>", "\uC0C8 \uC124\uBA85")).action(async (value, _opts, cmd) => {
|
|
5643
6058
|
const opts = cmd.optsWithGlobals();
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
6059
|
+
if (opts.name === void 0 && opts.description === void 0) {
|
|
6060
|
+
throw new NhnCloudCliError("--name \uB610\uB294 --description \uC911 \uD558\uB098\uB294 \uD544\uC694\uD569\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
6061
|
+
}
|
|
6062
|
+
const params = {
|
|
6063
|
+
name: opts.name === void 0 ? void 0 : parseName(opts.name),
|
|
6064
|
+
description: opts.description
|
|
6065
|
+
};
|
|
6066
|
+
const groupInput = requireResourceInput(value, "\uBCF4\uC548\uADF8\uB8F9");
|
|
6067
|
+
const { network } = await resolveSecurityGroupClients(opts);
|
|
6068
|
+
startSpinner("\uBCF4\uC548\uADF8\uB8F9 \uBCC0\uACBD \uC911...");
|
|
6069
|
+
let group;
|
|
6070
|
+
try {
|
|
6071
|
+
const id = await resolveSecurityGroupId(network, groupInput);
|
|
6072
|
+
group = await network.updateSecurityGroup(id, params);
|
|
6073
|
+
} catch (err) {
|
|
6074
|
+
stopSpinner(false);
|
|
6075
|
+
throw err;
|
|
6076
|
+
}
|
|
6077
|
+
stopSpinner(true);
|
|
6078
|
+
outputGroup(opts, group);
|
|
6079
|
+
});
|
|
6080
|
+
var deleteCommand = withOptions(new import_commander24.Command("delete").description("\uBCF4\uC548\uADF8\uB8F9\uC744 \uC0AD\uC81C\uD55C\uB2E4 (\uD3EC\uD2B8\uC5D0 \uC5F0\uACB0\uB41C \uADF8\uB8F9\uC740 \uAC70\uBD80\uD55C\uB2E4)").argument("<group>", "\uBCF4\uC548\uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID").option("--yes", "\uC0AD\uC81C \uD655\uC778")).action(async (value, _opts, cmd) => {
|
|
6081
|
+
const opts = cmd.optsWithGlobals();
|
|
6082
|
+
requireYes(opts.yes, "\uBCF4\uC548\uADF8\uB8F9 \uC0AD\uC81C");
|
|
6083
|
+
const groupInput = requireResourceInput(value, "\uBCF4\uC548\uADF8\uB8F9");
|
|
6084
|
+
const { network } = await resolveSecurityGroupClients(opts);
|
|
6085
|
+
startSpinner("\uBCF4\uC548\uADF8\uB8F9 \uC0AD\uC81C \uC911...");
|
|
6086
|
+
let groupId;
|
|
6087
|
+
let referencingRules;
|
|
6088
|
+
let referenceCheckFailed = false;
|
|
6089
|
+
try {
|
|
6090
|
+
groupId = await resolveSecurityGroupId(network, groupInput);
|
|
6091
|
+
const ports = await network.listSecurityGroupPorts(groupId);
|
|
6092
|
+
if (ports.length > 0) {
|
|
6093
|
+
const deviceIds = [...new Set(ports.map((port) => port.device_id).filter((deviceId) => deviceId !== ""))];
|
|
6094
|
+
throw new NhnCloudCliError(
|
|
6095
|
+
`\uBCF4\uC548\uADF8\uB8F9\uC774 \uD3EC\uD2B8 ${ports.length}\uAC1C\uC5D0 \uC5F0\uACB0\uB418\uC5B4 \uC788\uC5B4 \uC0AD\uC81C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uBA3C\uC800 instance security-group remove\uB85C \uC5F0\uACB0\uC744 \uD574\uC81C\uD558\uC138\uC694: ${deviceIds.join(", ")}`,
|
|
6096
|
+
EXIT_PARAM_ERROR
|
|
6097
|
+
);
|
|
6098
|
+
}
|
|
6099
|
+
try {
|
|
6100
|
+
referencingRules = (await network.listSecurityGroupRulesByRemoteGroup(groupId)).filter(
|
|
6101
|
+
(rule) => rule.remote_group_id === groupId && rule.security_group_id !== groupId
|
|
6102
|
+
);
|
|
6103
|
+
} catch {
|
|
6104
|
+
referencingRules = [];
|
|
6105
|
+
referenceCheckFailed = true;
|
|
6106
|
+
}
|
|
6107
|
+
await network.deleteSecurityGroup(groupId);
|
|
6108
|
+
} catch (err) {
|
|
6109
|
+
stopSpinner(false);
|
|
6110
|
+
throw err;
|
|
6111
|
+
}
|
|
6112
|
+
stopSpinner(true);
|
|
6113
|
+
if (referenceCheckFailed) {
|
|
6114
|
+
process.stderr.write("\uACBD\uACE0: \uB2E4\uB978 \uBCF4\uC548\uADF8\uB8F9 \uADDC\uCE59\uC758 \uC6D0\uACA9 \uADF8\uB8F9 \uCC38\uC870\uB97C \uD655\uC778\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uC0AD\uC81C\uB294 \uC9C4\uD589\uD588\uC2B5\uB2C8\uB2E4.\n");
|
|
6115
|
+
}
|
|
6116
|
+
if (referencingRules.length > 0) {
|
|
6117
|
+
const refs = referencingRules.map((rule) => sanitizeForTerminal(`${rule.security_group_id}/${rule.id}`));
|
|
6118
|
+
process.stderr.write(
|
|
6119
|
+
`\uACBD\uACE0: \uB2E4\uB978 \uBCF4\uC548\uADF8\uB8F9 \uADDC\uCE59 ${referencingRules.length}\uAC1C\uAC00 \uC774 \uADF8\uB8F9\uC744 \uC6D0\uACA9 \uADF8\uB8F9\uC73C\uB85C \uCC38\uC870\uD588\uC2B5\uB2C8\uB2E4: ${refs.join(", ")}
|
|
6120
|
+
`
|
|
6121
|
+
);
|
|
6122
|
+
}
|
|
6123
|
+
const result = { operation: "security-group-delete", status: "succeeded", security_group_id: groupId };
|
|
6124
|
+
output(opts, {
|
|
6125
|
+
headers: ["field", "value"],
|
|
6126
|
+
rows: Object.entries(result).map(([key, field]) => [key, field]),
|
|
6127
|
+
raw: result,
|
|
6128
|
+
ids: [groupId]
|
|
6129
|
+
});
|
|
6130
|
+
});
|
|
6131
|
+
|
|
6132
|
+
// src/commands/network/security-group-rule.ts
|
|
6133
|
+
var import_commander25 = require("commander");
|
|
6134
|
+
var REPLACE_NOTE = "(\uADDC\uCE59 \uC218\uC815 API\uAC00 \uC5C6\uC5B4 \uAD50\uCCB4\uB294 \uC0DD\uC131 \uD6C4 \uC0AD\uC81C\uB85C \uD55C\uB2E4)";
|
|
6135
|
+
function outputRule(opts, rule) {
|
|
6136
|
+
output(opts, {
|
|
6137
|
+
headers: ["field", "value"],
|
|
6138
|
+
rows: [
|
|
6139
|
+
["id", rule.id],
|
|
6140
|
+
["security_group_id", rule.security_group_id],
|
|
6141
|
+
["direction", rule.direction],
|
|
6142
|
+
["ethertype", rule.ethertype],
|
|
6143
|
+
["protocol", rule.protocol ?? "any"],
|
|
6144
|
+
["ports", formatRulePorts(rule)],
|
|
6145
|
+
["remote", formatRuleRemote(rule)],
|
|
6146
|
+
["description", rule.description ?? ""]
|
|
6147
|
+
],
|
|
6148
|
+
raw: rule,
|
|
6149
|
+
ids: [rule.id]
|
|
6150
|
+
});
|
|
6151
|
+
}
|
|
6152
|
+
var listCommand4 = withOptions(new import_commander25.Command("list").description("\uBCF4\uC548\uADF8\uB8F9 \uADDC\uCE59 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<group>", "\uBCF4\uC548\uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID")).action(async (value, _opts, cmd) => {
|
|
6153
|
+
const groupInput = requireResourceInput(value, "\uBCF4\uC548\uADF8\uB8F9");
|
|
6154
|
+
const opts = cmd.optsWithGlobals();
|
|
6155
|
+
const { network } = await resolveSecurityGroupClients(opts);
|
|
6156
|
+
startSpinner("\uBCF4\uC548\uADF8\uB8F9 \uADDC\uCE59 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
6157
|
+
let rules;
|
|
6158
|
+
try {
|
|
6159
|
+
const id = await resolveSecurityGroupId(network, groupInput);
|
|
6160
|
+
rules = await network.listSecurityGroupRules(id);
|
|
6161
|
+
} catch (err) {
|
|
6162
|
+
stopSpinner(false);
|
|
6163
|
+
throw err;
|
|
6164
|
+
}
|
|
6165
|
+
stopSpinner(true);
|
|
6166
|
+
output(opts, {
|
|
6167
|
+
headers: ["id", "direction", "ethertype", "protocol", "ports", "remote", "description"],
|
|
6168
|
+
rows: rules.map((rule) => [
|
|
6169
|
+
rule.id,
|
|
6170
|
+
rule.direction,
|
|
6171
|
+
rule.ethertype,
|
|
6172
|
+
rule.protocol ?? "any",
|
|
6173
|
+
formatRulePorts(rule),
|
|
6174
|
+
formatRuleRemote(rule),
|
|
6175
|
+
rule.description ?? ""
|
|
6176
|
+
]),
|
|
6177
|
+
raw: rules,
|
|
6178
|
+
ids: rules.map((rule) => rule.id)
|
|
6179
|
+
});
|
|
6180
|
+
});
|
|
6181
|
+
var getCommand2 = withOptions(new import_commander25.Command("get").description("\uBCF4\uC548 \uADDC\uCE59\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<rule-id>", "\uBCF4\uC548 \uADDC\uCE59 UUID")).action(async (value, _opts, cmd) => {
|
|
6182
|
+
const ruleId = requireResourceInput(value, "\uBCF4\uC548 \uADDC\uCE59");
|
|
6183
|
+
const opts = cmd.optsWithGlobals();
|
|
6184
|
+
const { network } = await resolveSecurityGroupClients(opts);
|
|
6185
|
+
startSpinner("\uBCF4\uC548 \uADDC\uCE59 \uC870\uD68C \uC911...");
|
|
6186
|
+
let rule;
|
|
6187
|
+
try {
|
|
6188
|
+
rule = await network.getSecurityGroupRule(ruleId);
|
|
6189
|
+
} catch (err) {
|
|
6190
|
+
stopSpinner(false);
|
|
6191
|
+
throw err;
|
|
6192
|
+
}
|
|
6193
|
+
stopSpinner(true);
|
|
6194
|
+
outputRule(opts, rule);
|
|
6195
|
+
});
|
|
6196
|
+
var createCommand3 = withOptions(new import_commander25.Command("create").description(`\uBCF4\uC548 \uADDC\uCE59\uC744 \uC0DD\uC131\uD55C\uB2E4 ${REPLACE_NOTE}`).argument("<group>", "\uBCF4\uC548\uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID").requiredOption("--direction <direction>", "ingress \uB610\uB294 egress").option("--protocol <protocol>", "tcp, udp, icmp, any (\uAE30\uBCF8: any)").option("--port <port>", "\uB2E8\uC77C \uD3EC\uD2B8 (tcp\xB7udp)").option("--port-range <start-end>", "\uD3EC\uD2B8 \uBC94\uC704 (\uC608: 1000-2000, tcp\xB7udp)").option("--cidr <cidr>", "\uC6D0\uACA9 IPv4 \uC8FC\uC18C \uB610\uB294 CIDR").option("--remote-group <group>", "\uC6D0\uACA9 \uBCF4\uC548\uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID").option("--description <text>", "\uADDC\uCE59 \uC124\uBA85")).action(async (value, _opts, cmd) => {
|
|
6197
|
+
const opts = cmd.optsWithGlobals();
|
|
6198
|
+
const input = parseRuleInput(opts);
|
|
6199
|
+
const groupInput = requireResourceInput(value, "\uBCF4\uC548\uADF8\uB8F9");
|
|
6200
|
+
const remoteGroupInput = input.remoteGroup === void 0 ? void 0 : requireResourceInput(input.remoteGroup, "\uC6D0\uACA9 \uBCF4\uC548\uADF8\uB8F9");
|
|
6201
|
+
const { network } = await resolveSecurityGroupClients(opts);
|
|
6202
|
+
startSpinner("\uBCF4\uC548 \uADDC\uCE59 \uC0DD\uC131 \uC911...");
|
|
6203
|
+
let rule;
|
|
6204
|
+
try {
|
|
6205
|
+
const groups = await network.listSecurityGroups();
|
|
6206
|
+
const groupId = resolveFromList(groups, groupInput, "\uBCF4\uC548\uADF8\uB8F9");
|
|
6207
|
+
const remoteGroupId = remoteGroupInput === void 0 ? void 0 : resolveFromList(groups, remoteGroupInput, "\uC6D0\uACA9 \uBCF4\uC548\uADF8\uB8F9");
|
|
6208
|
+
rule = await network.createSecurityGroupRule(toCreateRuleParams(input, groupId, remoteGroupId));
|
|
6209
|
+
} catch (err) {
|
|
6210
|
+
stopSpinner(false);
|
|
6211
|
+
throw err;
|
|
6212
|
+
}
|
|
6213
|
+
stopSpinner(true);
|
|
6214
|
+
outputRule(opts, rule);
|
|
6215
|
+
});
|
|
6216
|
+
var deleteCommand2 = withOptions(new import_commander25.Command("delete").description(`\uBCF4\uC548 \uADDC\uCE59\uC744 \uC0AD\uC81C\uD55C\uB2E4 ${REPLACE_NOTE}`).argument("<rule-id>", "\uBCF4\uC548 \uADDC\uCE59 UUID").option("--yes", "\uC0AD\uC81C \uD655\uC778")).action(async (value, _opts, cmd) => {
|
|
6217
|
+
const opts = cmd.optsWithGlobals();
|
|
6218
|
+
requireYes(opts.yes, "\uBCF4\uC548 \uADDC\uCE59 \uC0AD\uC81C");
|
|
6219
|
+
const ruleId = requireResourceInput(value, "\uBCF4\uC548 \uADDC\uCE59");
|
|
6220
|
+
const { network } = await resolveSecurityGroupClients(opts);
|
|
6221
|
+
startSpinner("\uBCF4\uC548 \uADDC\uCE59 \uC0AD\uC81C \uC911...");
|
|
6222
|
+
try {
|
|
6223
|
+
await network.deleteSecurityGroupRule(ruleId);
|
|
6224
|
+
} catch (err) {
|
|
6225
|
+
stopSpinner(false);
|
|
6226
|
+
throw err;
|
|
6227
|
+
}
|
|
6228
|
+
stopSpinner(true);
|
|
6229
|
+
const result = { operation: "security-group-rule-delete", status: "succeeded", security_group_rule_id: ruleId };
|
|
6230
|
+
output(opts, {
|
|
6231
|
+
headers: ["field", "value"],
|
|
6232
|
+
rows: Object.entries(result).map(([key, field]) => [key, field]),
|
|
6233
|
+
raw: result,
|
|
6234
|
+
ids: [ruleId]
|
|
6235
|
+
});
|
|
6236
|
+
});
|
|
6237
|
+
var ruleCommand = new import_commander25.Command("rule").description("\uBCF4\uC548 \uADDC\uCE59 \uC870\uD68C\uC640 \uBCC0\uACBD").addCommand(listCommand4).addCommand(getCommand2).addCommand(createCommand3).addCommand(deleteCommand2);
|
|
6238
|
+
|
|
6239
|
+
// src/commands/network/security-group.ts
|
|
6240
|
+
function optsOf(cmd) {
|
|
6241
|
+
return cmd.optsWithGlobals();
|
|
6242
|
+
}
|
|
6243
|
+
var listCommand5 = withOptions(new import_commander26.Command("list").description("\uBCF4\uC548\uADF8\uB8F9 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4")).action(async (_opts, cmd) => {
|
|
6244
|
+
const opts = optsOf(cmd);
|
|
6245
|
+
const { network } = await resolveSecurityGroupClients(opts);
|
|
6246
|
+
startSpinner("\uBCF4\uC548\uADF8\uB8F9 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
6247
|
+
let groups;
|
|
6248
|
+
try {
|
|
6249
|
+
groups = await network.listSecurityGroups();
|
|
6250
|
+
} catch (err) {
|
|
6251
|
+
stopSpinner(false);
|
|
6252
|
+
throw err;
|
|
6253
|
+
}
|
|
6254
|
+
stopSpinner(true);
|
|
6255
|
+
output(opts, {
|
|
6256
|
+
headers: ["id", "name", "description", "rules"],
|
|
6257
|
+
rows: groups.map((group) => [group.id, group.name, group.description, String(group.security_group_rules.length)]),
|
|
6258
|
+
raw: groups,
|
|
6259
|
+
ids: groups.map((group) => group.id)
|
|
6260
|
+
});
|
|
6261
|
+
});
|
|
6262
|
+
var getCommand3 = withOptions(new import_commander26.Command("get").description("\uBCF4\uC548\uADF8\uB8F9\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<group>", "\uBCF4\uC548\uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID")).action(async (value, _opts, cmd) => {
|
|
6263
|
+
const groupInput = requireResourceInput(value, "\uBCF4\uC548\uADF8\uB8F9");
|
|
6264
|
+
const opts = optsOf(cmd);
|
|
6265
|
+
const { network } = await resolveSecurityGroupClients(opts);
|
|
6266
|
+
startSpinner("\uBCF4\uC548\uADF8\uB8F9 \uC870\uD68C \uC911...");
|
|
6267
|
+
let group;
|
|
6268
|
+
try {
|
|
6269
|
+
const id = await resolveSecurityGroupId(network, groupInput);
|
|
6270
|
+
group = await network.getSecurityGroup(id);
|
|
6271
|
+
} catch (err) {
|
|
6272
|
+
stopSpinner(false);
|
|
6273
|
+
throw err;
|
|
6274
|
+
}
|
|
6275
|
+
stopSpinner(true);
|
|
6276
|
+
output(opts, {
|
|
6277
|
+
headers: ["field", "value"],
|
|
6278
|
+
rows: [
|
|
6279
|
+
["id", group.id],
|
|
6280
|
+
["name", group.name],
|
|
6281
|
+
["description", group.description],
|
|
6282
|
+
["tenant_id", group.tenant_id],
|
|
6283
|
+
["rules", String(group.security_group_rules.length)]
|
|
6284
|
+
],
|
|
6285
|
+
raw: group,
|
|
6286
|
+
ids: [group.id]
|
|
6287
|
+
});
|
|
6288
|
+
});
|
|
6289
|
+
var portsCommand = withOptions(new import_commander26.Command("ports").description("\uBCF4\uC548\uADF8\uB8F9\uC5D0 \uC5F0\uACB0\uB41C \uD3EC\uD2B8\uC640 \uC778\uC2A4\uD134\uC2A4\uB97C \uC870\uD68C\uD55C\uB2E4 (--quiet\uB294 \uC778\uC2A4\uD134\uC2A4 UUID)").argument("<group>", "\uBCF4\uC548\uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID")).action(async (value, _opts, cmd) => {
|
|
6290
|
+
const groupInput = requireResourceInput(value, "\uBCF4\uC548\uADF8\uB8F9");
|
|
6291
|
+
const opts = optsOf(cmd);
|
|
6292
|
+
const { network, instance } = await resolveSecurityGroupClients(opts);
|
|
6293
|
+
startSpinner("\uBCF4\uC548\uADF8\uB8F9 \uC5F0\uACB0 \uD3EC\uD2B8 \uC870\uD68C \uC911...");
|
|
6294
|
+
let ports;
|
|
6295
|
+
let warning = null;
|
|
6296
|
+
try {
|
|
6297
|
+
const id = await resolveSecurityGroupId(network, groupInput);
|
|
6298
|
+
const listedPorts = await network.listSecurityGroupPorts(id);
|
|
6299
|
+
let names = /* @__PURE__ */ new Map();
|
|
6300
|
+
if (listedPorts.some((port) => port.device_owner.startsWith("compute:"))) {
|
|
6301
|
+
try {
|
|
6302
|
+
names = new Map((await instance.list()).map((server) => [server.id, server.name]));
|
|
6303
|
+
} catch (err) {
|
|
6304
|
+
warning = err instanceof NhnCloudCliError ? err.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958";
|
|
6305
|
+
}
|
|
6306
|
+
}
|
|
6307
|
+
ports = listedPorts.map((port) => ({
|
|
6308
|
+
...port,
|
|
6309
|
+
instance_name: port.device_owner.startsWith("compute:") ? names.get(port.device_id) ?? null : null
|
|
6310
|
+
}));
|
|
6311
|
+
} catch (err) {
|
|
6312
|
+
stopSpinner(false);
|
|
6313
|
+
throw err;
|
|
6314
|
+
}
|
|
6315
|
+
stopSpinner(true);
|
|
6316
|
+
if (warning !== null) process.stderr.write(`\uACBD\uACE0: \uC778\uC2A4\uD134\uC2A4 \uC774\uB984\uC744 \uC870\uD68C\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${warning}
|
|
6317
|
+
`);
|
|
6318
|
+
output(opts, {
|
|
6319
|
+
headers: ["port_id", "device_id", "instance_name", "device_owner", "fixed_ips", "security_groups"],
|
|
6320
|
+
rows: ports.map((port) => [
|
|
6321
|
+
port.id,
|
|
6322
|
+
port.device_id,
|
|
6323
|
+
port.instance_name ?? "",
|
|
6324
|
+
port.device_owner,
|
|
6325
|
+
port.fixed_ips.map((ip) => ip.ip_address).join(","),
|
|
6326
|
+
port.security_groups.join(",")
|
|
6327
|
+
]),
|
|
6328
|
+
raw: ports,
|
|
6329
|
+
ids: [...new Set(ports.filter((port) => port.device_owner.startsWith("compute:")).map((port) => port.device_id))]
|
|
6330
|
+
});
|
|
6331
|
+
});
|
|
6332
|
+
var securityGroupCommand = new import_commander26.Command("security-group").description("\uBCF4\uC548\uADF8\uB8F9 \uC870\uD68C\uC640 \uBCC0\uACBD").addCommand(listCommand5).addCommand(getCommand3).addCommand(portsCommand).addCommand(createCommand2).addCommand(updateCommand).addCommand(deleteCommand).addCommand(ruleCommand);
|
|
6333
|
+
|
|
6334
|
+
// src/commands/floatingip/list.ts
|
|
6335
|
+
var import_commander27 = require("commander");
|
|
6336
|
+
var listCommand6 = new import_commander27.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) => {
|
|
6337
|
+
const opts = cmd.optsWithGlobals();
|
|
6338
|
+
const { client } = await resolveNetworkClient(opts);
|
|
6339
|
+
startSpinner("Floating IP \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
6340
|
+
let fips;
|
|
6341
|
+
try {
|
|
6342
|
+
fips = await client.listFloatingIps();
|
|
6343
|
+
} catch (err) {
|
|
6344
|
+
stopSpinner(false);
|
|
6345
|
+
throw err;
|
|
6346
|
+
}
|
|
6347
|
+
stopSpinner(true);
|
|
6348
|
+
output(opts, {
|
|
6349
|
+
headers: ["id", "floating_ip_address", "status", "port_id", "fixed_ip_address"],
|
|
6350
|
+
rows: fips.map((f) => [
|
|
6351
|
+
f.id,
|
|
6352
|
+
f.floating_ip_address,
|
|
6353
|
+
f.status,
|
|
6354
|
+
f.port_id ?? "-",
|
|
6355
|
+
f.fixed_ip_address ?? "-"
|
|
6356
|
+
]),
|
|
6357
|
+
raw: fips,
|
|
6358
|
+
ids: fips.map((f) => f.id)
|
|
6359
|
+
});
|
|
6360
|
+
});
|
|
6361
|
+
|
|
6362
|
+
// src/commands/floatingip/create.ts
|
|
6363
|
+
var import_commander28 = require("commander");
|
|
6364
|
+
var import_chalk6 = __toESM(require("chalk"));
|
|
6365
|
+
var createCommand4 = new import_commander28.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) => {
|
|
6366
|
+
const opts = cmd.optsWithGlobals();
|
|
6367
|
+
const { client } = await resolveNetworkClient(opts);
|
|
6368
|
+
let networkId = opts.network;
|
|
6369
|
+
if (networkId === void 0) {
|
|
6370
|
+
startSpinner("\uC678\uBD80 \uB124\uD2B8\uC6CC\uD06C \uC870\uD68C \uC911...");
|
|
6371
|
+
try {
|
|
6372
|
+
const found = await client.findExternalNetworkId();
|
|
6373
|
+
if (found === null) {
|
|
6374
|
+
throw new NhnCloudCliError(
|
|
6375
|
+
"\uC678\uBD80 \uB124\uD2B8\uC6CC\uD06C(router:external=true)\uB97C \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. --network <id> \uB85C \uC9C1\uC811 \uC9C0\uC815\uD558\uC138\uC694.",
|
|
6376
|
+
EXIT_PARAM_ERROR
|
|
6377
|
+
);
|
|
6378
|
+
}
|
|
6379
|
+
networkId = found;
|
|
5657
6380
|
} catch (err) {
|
|
5658
6381
|
stopSpinner(false);
|
|
5659
6382
|
throw err;
|
|
@@ -5682,9 +6405,9 @@ var createCommand2 = new import_commander25.Command("create").description("Float
|
|
|
5682
6405
|
});
|
|
5683
6406
|
|
|
5684
6407
|
// src/commands/floatingip/delete.ts
|
|
5685
|
-
var
|
|
6408
|
+
var import_commander29 = require("commander");
|
|
5686
6409
|
var import_chalk7 = __toESM(require("chalk"));
|
|
5687
|
-
var
|
|
6410
|
+
var deleteCommand3 = new import_commander29.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) => {
|
|
5688
6411
|
const opts = cmd.optsWithGlobals();
|
|
5689
6412
|
const isTTY = process.stdin.isTTY;
|
|
5690
6413
|
if (!isTTY && !opts.yes) {
|
|
@@ -5718,8 +6441,8 @@ var deleteCommand = new import_commander26.Command("delete").description("Floati
|
|
|
5718
6441
|
});
|
|
5719
6442
|
|
|
5720
6443
|
// src/commands/instance/flavors.ts
|
|
5721
|
-
var
|
|
5722
|
-
var flavorsCommand = new
|
|
6444
|
+
var import_commander30 = require("commander");
|
|
6445
|
+
var flavorsCommand = new import_commander30.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) => {
|
|
5723
6446
|
const opts = cmd.optsWithGlobals();
|
|
5724
6447
|
const minDisk = parseNonNegativeIntegerOption(opts.minDisk, "--min-disk");
|
|
5725
6448
|
const minRam = parseNonNegativeIntegerOption(opts.minRam, "--min-ram");
|
|
@@ -5762,8 +6485,8 @@ function isDetailList(flavors) {
|
|
|
5762
6485
|
}
|
|
5763
6486
|
|
|
5764
6487
|
// src/commands/instance/availability-zones.ts
|
|
5765
|
-
var
|
|
5766
|
-
var availabilityZonesCommand = new
|
|
6488
|
+
var import_commander31 = require("commander");
|
|
6489
|
+
var availabilityZonesCommand = new import_commander31.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) => {
|
|
5767
6490
|
const opts = cmd.optsWithGlobals();
|
|
5768
6491
|
const { client } = await resolveInstanceClient(opts);
|
|
5769
6492
|
startSpinner("\uAC00\uC6A9\uC131 \uC601\uC5ED \uC870\uD68C \uC911...");
|
|
@@ -5784,14 +6507,14 @@ var availabilityZonesCommand = new import_commander28.Command("availability-zone
|
|
|
5784
6507
|
});
|
|
5785
6508
|
|
|
5786
6509
|
// src/commands/instance/get.ts
|
|
5787
|
-
var
|
|
6510
|
+
var import_commander32 = require("commander");
|
|
5788
6511
|
function getIps2(server) {
|
|
5789
6512
|
return Object.values(server.addresses).flat().map((a) => a.addr).join(", ");
|
|
5790
6513
|
}
|
|
5791
6514
|
function getImageId(server) {
|
|
5792
6515
|
return typeof server.image === "object" ? server.image.id : "";
|
|
5793
6516
|
}
|
|
5794
|
-
var
|
|
6517
|
+
var getCommand4 = new import_commander32.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) => {
|
|
5795
6518
|
const opts = cmd.optsWithGlobals();
|
|
5796
6519
|
const { client } = await resolveInstanceClient(opts);
|
|
5797
6520
|
startSpinner("\uC778\uC2A4\uD134\uC2A4 \uC870\uD68C \uC911...");
|
|
@@ -5823,7 +6546,7 @@ var getCommand2 = new import_commander29.Command("get").description("\uB2E8\uC77
|
|
|
5823
6546
|
});
|
|
5824
6547
|
|
|
5825
6548
|
// src/commands/instance/create.ts
|
|
5826
|
-
var
|
|
6549
|
+
var import_commander33 = require("commander");
|
|
5827
6550
|
var import_node_fs7 = require("fs");
|
|
5828
6551
|
var import_chalk8 = __toESM(require("chalk"));
|
|
5829
6552
|
function getFirstIp(server) {
|
|
@@ -5840,7 +6563,7 @@ function getIps3(server) {
|
|
|
5840
6563
|
function getImageId2(server) {
|
|
5841
6564
|
return typeof server.image === "object" ? server.image.id : "";
|
|
5842
6565
|
}
|
|
5843
|
-
var
|
|
6566
|
+
var createCommand5 = new import_commander33.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) => {
|
|
5844
6567
|
const opts = cmd.optsWithGlobals();
|
|
5845
6568
|
const networks = opts.network ?? [];
|
|
5846
6569
|
if (networks.length === 0) {
|
|
@@ -5939,9 +6662,9 @@ var createCommand3 = new import_commander30.Command("create").description("\uC77
|
|
|
5939
6662
|
});
|
|
5940
6663
|
|
|
5941
6664
|
// src/commands/instance/delete.ts
|
|
5942
|
-
var
|
|
6665
|
+
var import_commander34 = require("commander");
|
|
5943
6666
|
var import_chalk9 = __toESM(require("chalk"));
|
|
5944
|
-
var
|
|
6667
|
+
var deleteCommand4 = new import_commander34.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) => {
|
|
5945
6668
|
const opts = cmd.optsWithGlobals();
|
|
5946
6669
|
const isTTY = process.stdin.isTTY;
|
|
5947
6670
|
if (!isTTY && !opts.yes) {
|
|
@@ -5975,9 +6698,9 @@ var deleteCommand2 = new import_commander31.Command("delete").description("\uC77
|
|
|
5975
6698
|
});
|
|
5976
6699
|
|
|
5977
6700
|
// src/commands/instance/power.ts
|
|
5978
|
-
var
|
|
6701
|
+
var import_commander35 = require("commander");
|
|
5979
6702
|
var import_chalk10 = __toESM(require("chalk"));
|
|
5980
|
-
var startCommand = new
|
|
6703
|
+
var startCommand = new import_commander35.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) => {
|
|
5981
6704
|
const opts = cmd.optsWithGlobals();
|
|
5982
6705
|
const { client } = await resolveInstanceClient(opts);
|
|
5983
6706
|
startSpinner(`\uC778\uC2A4\uD134\uC2A4 \uC2DC\uC791 \uC911... (id: ${id})`);
|
|
@@ -5991,7 +6714,7 @@ var startCommand = new import_commander32.Command("start").description("\uC778\u
|
|
|
5991
6714
|
process.stderr.write(import_chalk10.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uC2DC\uC791\uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\u2192 ACTIVE).
|
|
5992
6715
|
`));
|
|
5993
6716
|
});
|
|
5994
|
-
var stopCommand = new
|
|
6717
|
+
var stopCommand = new import_commander35.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) => {
|
|
5995
6718
|
const opts = cmd.optsWithGlobals();
|
|
5996
6719
|
const { client } = await resolveInstanceClient(opts);
|
|
5997
6720
|
startSpinner(`\uC778\uC2A4\uD134\uC2A4 \uC815\uC9C0 \uC911... (id: ${id})`);
|
|
@@ -6005,7 +6728,7 @@ var stopCommand = new import_commander32.Command("stop").description("\uC778\uC2
|
|
|
6005
6728
|
process.stderr.write(import_chalk10.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uC815\uC9C0\uB97C \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\u2192 SHUTOFF).
|
|
6006
6729
|
`));
|
|
6007
6730
|
});
|
|
6008
|
-
var rebootCommand = new
|
|
6731
|
+
var rebootCommand = new import_commander35.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) => {
|
|
6009
6732
|
const opts = cmd.optsWithGlobals();
|
|
6010
6733
|
const { client } = await resolveInstanceClient(opts);
|
|
6011
6734
|
const type = opts.hard ? "HARD" : "SOFT";
|
|
@@ -6022,9 +6745,9 @@ var rebootCommand = new import_commander32.Command("reboot").description("\uC778
|
|
|
6022
6745
|
});
|
|
6023
6746
|
|
|
6024
6747
|
// src/commands/instance/resize.ts
|
|
6025
|
-
var
|
|
6748
|
+
var import_commander36 = require("commander");
|
|
6026
6749
|
var import_chalk11 = __toESM(require("chalk"));
|
|
6027
|
-
var resizeCommand = new
|
|
6750
|
+
var resizeCommand = new import_commander36.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) => {
|
|
6028
6751
|
const opts = cmd.optsWithGlobals();
|
|
6029
6752
|
const { client } = await resolveInstanceClient(opts);
|
|
6030
6753
|
startSpinner(`\uC778\uC2A4\uD134\uC2A4 \uD0C0\uC785 \uBCC0\uACBD \uC911... (id: ${id})`);
|
|
@@ -6042,7 +6765,7 @@ var resizeCommand = new import_commander33.Command("resize").description("\uC778
|
|
|
6042
6765
|
)
|
|
6043
6766
|
);
|
|
6044
6767
|
});
|
|
6045
|
-
var resizeConfirmCommand = new
|
|
6768
|
+
var resizeConfirmCommand = new import_commander36.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) => {
|
|
6046
6769
|
const opts = cmd.optsWithGlobals();
|
|
6047
6770
|
const { client } = await resolveInstanceClient(opts);
|
|
6048
6771
|
startSpinner(`resize \uD655\uC815 \uC911... (id: ${id})`);
|
|
@@ -6056,7 +6779,7 @@ var resizeConfirmCommand = new import_commander33.Command("resize-confirm").desc
|
|
|
6056
6779
|
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).
|
|
6057
6780
|
`));
|
|
6058
6781
|
});
|
|
6059
|
-
var resizeRevertCommand = new
|
|
6782
|
+
var resizeRevertCommand = new import_commander36.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) => {
|
|
6060
6783
|
const opts = cmd.optsWithGlobals();
|
|
6061
6784
|
const { client } = await resolveInstanceClient(opts);
|
|
6062
6785
|
startSpinner(`resize \uB864\uBC31 \uC911... (id: ${id})`);
|
|
@@ -6074,9 +6797,9 @@ var resizeRevertCommand = new import_commander33.Command("resize-revert").descri
|
|
|
6074
6797
|
});
|
|
6075
6798
|
|
|
6076
6799
|
// src/commands/instance/images.ts
|
|
6077
|
-
var
|
|
6800
|
+
var import_commander37 = require("commander");
|
|
6078
6801
|
var VISIBILITY_VALUES = ["public", "private", "shared"];
|
|
6079
|
-
var imagesCommand = new
|
|
6802
|
+
var imagesCommand = new import_commander37.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) => {
|
|
6080
6803
|
const opts = cmd.optsWithGlobals();
|
|
6081
6804
|
const limit = parsePositiveIntegerOption(opts.limit, "--limit");
|
|
6082
6805
|
if (opts.visibility !== void 0 && !VISIBILITY_VALUES.includes(opts.visibility)) {
|
|
@@ -6124,8 +6847,8 @@ var imagesCommand = new import_commander34.Command("images").description("\uC774
|
|
|
6124
6847
|
});
|
|
6125
6848
|
|
|
6126
6849
|
// src/commands/instance/keypairs.ts
|
|
6127
|
-
var
|
|
6128
|
-
var keypairsCommand = new
|
|
6850
|
+
var import_commander38 = require("commander");
|
|
6851
|
+
var keypairsCommand = new import_commander38.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) => {
|
|
6129
6852
|
const opts = cmd.optsWithGlobals();
|
|
6130
6853
|
const { client } = await resolveInstanceClient(opts);
|
|
6131
6854
|
startSpinner("\uD0A4\uD398\uC5B4 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -6146,7 +6869,7 @@ var keypairsCommand = new import_commander35.Command("keypairs").description("\u
|
|
|
6146
6869
|
});
|
|
6147
6870
|
|
|
6148
6871
|
// src/commands/instance/keypair.ts
|
|
6149
|
-
var
|
|
6872
|
+
var import_commander39 = require("commander");
|
|
6150
6873
|
var import_node_fs8 = require("fs");
|
|
6151
6874
|
var import_node_crypto5 = require("crypto");
|
|
6152
6875
|
var import_chalk12 = __toESM(require("chalk"));
|
|
@@ -6189,7 +6912,7 @@ function savePrivateKey(filePath, privateKey) {
|
|
|
6189
6912
|
);
|
|
6190
6913
|
}
|
|
6191
6914
|
}
|
|
6192
|
-
var getKeypairCmd = new
|
|
6915
|
+
var getKeypairCmd = new import_commander39.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) => {
|
|
6193
6916
|
const opts = cmd.optsWithGlobals();
|
|
6194
6917
|
const { client } = await resolveInstanceClient(opts);
|
|
6195
6918
|
startSpinner("\uD0A4\uD398\uC5B4 \uC870\uD68C \uC911...");
|
|
@@ -6214,7 +6937,7 @@ var getKeypairCmd = new import_commander36.Command("get").description("\uB2E8\uC
|
|
|
6214
6937
|
ids: [kp.name]
|
|
6215
6938
|
});
|
|
6216
6939
|
});
|
|
6217
|
-
var createKeypairCmd = new
|
|
6940
|
+
var createKeypairCmd = new import_commander39.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) => {
|
|
6218
6941
|
const opts = cmd.optsWithGlobals();
|
|
6219
6942
|
const publicKey = opts.publicKey !== void 0 ? resolvePublicKey(opts.publicKey) : void 0;
|
|
6220
6943
|
if (opts.output !== void 0 && publicKey !== void 0) {
|
|
@@ -6273,7 +6996,7 @@ var createKeypairCmd = new import_commander36.Command("create").description("\uD
|
|
|
6273
6996
|
ids: [meta.name]
|
|
6274
6997
|
});
|
|
6275
6998
|
});
|
|
6276
|
-
var deleteKeypairCmd = new
|
|
6999
|
+
var deleteKeypairCmd = new import_commander39.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) => {
|
|
6277
7000
|
const opts = cmd.optsWithGlobals();
|
|
6278
7001
|
const { client } = await resolveInstanceClient(opts);
|
|
6279
7002
|
startSpinner("\uD0A4\uD398\uC5B4 \uC0AD\uC81C \uC911...");
|
|
@@ -6287,12 +7010,12 @@ var deleteKeypairCmd = new import_commander36.Command("delete").description("\uD
|
|
|
6287
7010
|
process.stderr.write(import_chalk12.default.green(`\u2713 \uD0A4\uD398\uC5B4 "${name}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
6288
7011
|
`));
|
|
6289
7012
|
});
|
|
6290
|
-
var keypairCommand = new
|
|
7013
|
+
var keypairCommand = new import_commander39.Command("keypair").description("\uD0A4\uD398\uC5B4 \uB2E8\uAC74 \uAD00\uB9AC (get / create / delete)").addCommand(getKeypairCmd).addCommand(createKeypairCmd).addCommand(deleteKeypairCmd);
|
|
6291
7014
|
|
|
6292
7015
|
// src/commands/instance/volume.ts
|
|
6293
|
-
var
|
|
7016
|
+
var import_commander40 = require("commander");
|
|
6294
7017
|
var import_chalk13 = __toESM(require("chalk"));
|
|
6295
|
-
var attachCommand = new
|
|
7018
|
+
var attachCommand = new import_commander40.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) => {
|
|
6296
7019
|
const opts = cmd.optsWithGlobals();
|
|
6297
7020
|
const { client } = await resolveInstanceClient(opts);
|
|
6298
7021
|
startSpinner("\uBCFC\uB968 \uC5F0\uACB0 \uC911...");
|
|
@@ -6320,7 +7043,7 @@ var attachCommand = new import_commander37.Command("attach").description("\uBCFC
|
|
|
6320
7043
|
ids: [att.id]
|
|
6321
7044
|
});
|
|
6322
7045
|
});
|
|
6323
|
-
var detachCommand = new
|
|
7046
|
+
var detachCommand = new import_commander40.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) => {
|
|
6324
7047
|
const opts = cmd.optsWithGlobals();
|
|
6325
7048
|
const { client } = await resolveInstanceClient(opts);
|
|
6326
7049
|
startSpinner("\uBCFC\uB968 \uC5F0\uACB0 \uD574\uC81C \uC911...");
|
|
@@ -6336,15 +7059,15 @@ var detachCommand = new import_commander37.Command("detach").description("\uBCFC
|
|
|
6336
7059
|
`)
|
|
6337
7060
|
);
|
|
6338
7061
|
});
|
|
6339
|
-
var volumeCommand = new
|
|
7062
|
+
var volumeCommand = new import_commander40.Command("volume").description(
|
|
6340
7063
|
"\uC778\uC2A4\uD134\uC2A4 \uBCFC\uB968 \uC5F0\uACB0/\uD574\uC81C"
|
|
6341
7064
|
);
|
|
6342
7065
|
volumeCommand.addCommand(attachCommand);
|
|
6343
7066
|
volumeCommand.addCommand(detachCommand);
|
|
6344
7067
|
|
|
6345
7068
|
// src/commands/instance/volumes.ts
|
|
6346
|
-
var
|
|
6347
|
-
var volumesCommand = new
|
|
7069
|
+
var import_commander41 = require("commander");
|
|
7070
|
+
var volumesCommand = new import_commander41.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) => {
|
|
6348
7071
|
const opts = cmd.optsWithGlobals();
|
|
6349
7072
|
const { client } = await resolveInstanceClient(opts);
|
|
6350
7073
|
startSpinner("\uBCFC\uB968 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -6364,11 +7087,91 @@ var volumesCommand = new import_commander38.Command("volumes").description("\uC7
|
|
|
6364
7087
|
});
|
|
6365
7088
|
});
|
|
6366
7089
|
|
|
7090
|
+
// src/commands/instance/security-group.ts
|
|
7091
|
+
var import_commander42 = require("commander");
|
|
7092
|
+
var ACTIONS = {
|
|
7093
|
+
add: { operation: "instance-security-group-add", label: "\uBCF4\uC548\uADF8\uB8F9 \uC5F0\uACB0 \uCD94\uAC00", spinner: "\uBCF4\uC548\uADF8\uB8F9 \uC5F0\uACB0 \uCD94\uAC00 \uC911..." },
|
|
7094
|
+
remove: { operation: "instance-security-group-remove", label: "\uBCF4\uC548\uADF8\uB8F9 \uC5F0\uACB0 \uD574\uC81C", spinner: "\uBCF4\uC548\uADF8\uB8F9 \uC5F0\uACB0 \uD574\uC81C \uC911..." }
|
|
7095
|
+
};
|
|
7096
|
+
async function isAttached(network, groupId, instanceId) {
|
|
7097
|
+
const ports = await network.listSecurityGroupPorts(groupId);
|
|
7098
|
+
return ports.some((port) => port.device_id === instanceId);
|
|
7099
|
+
}
|
|
7100
|
+
async function requestChange(instance, action, instanceId, groupName) {
|
|
7101
|
+
if (action === "add") await instance.addSecurityGroup(instanceId, groupName);
|
|
7102
|
+
else await instance.removeSecurityGroup(instanceId, groupName);
|
|
7103
|
+
}
|
|
7104
|
+
async function runAction(action, instanceArg, groupArg, opts) {
|
|
7105
|
+
const { operation, label, spinner } = ACTIONS[action];
|
|
7106
|
+
requireYes(opts.yes, label);
|
|
7107
|
+
const instanceId = requireResourceInput(instanceArg, "\uC778\uC2A4\uD134\uC2A4");
|
|
7108
|
+
const groupInput = requireResourceInput(groupArg, "\uBCF4\uC548\uADF8\uB8F9");
|
|
7109
|
+
const { network, instance } = await resolveSecurityGroupClients(opts);
|
|
7110
|
+
startSpinner(spinner);
|
|
7111
|
+
let groupId;
|
|
7112
|
+
let groupName;
|
|
7113
|
+
let requested = false;
|
|
7114
|
+
try {
|
|
7115
|
+
const groups = await network.listSecurityGroups();
|
|
7116
|
+
groupId = resolveFromList(groups, groupInput, "\uBCF4\uC548\uADF8\uB8F9");
|
|
7117
|
+
groupName = requireUniqueGroupName(groups, groupId).name;
|
|
7118
|
+
const attached = await isAttached(network, groupId, instanceId);
|
|
7119
|
+
if (action === "remove" && !attached) {
|
|
7120
|
+
throw new NhnCloudCliError(
|
|
7121
|
+
`\uC778\uC2A4\uD134\uC2A4 ${instanceId}\uC5D0 \uBCF4\uC548\uADF8\uB8F9 ${groupName}\uC774 \uC5F0\uACB0\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.`,
|
|
7122
|
+
EXIT_PARAM_ERROR
|
|
7123
|
+
);
|
|
7124
|
+
}
|
|
7125
|
+
if (action === "remove" || !attached) {
|
|
7126
|
+
await requestChange(instance, action, instanceId, groupName);
|
|
7127
|
+
requested = true;
|
|
7128
|
+
}
|
|
7129
|
+
} catch (err) {
|
|
7130
|
+
stopSpinner(false);
|
|
7131
|
+
throw err;
|
|
7132
|
+
}
|
|
7133
|
+
let warning;
|
|
7134
|
+
if (requested) {
|
|
7135
|
+
const safeGroupId = sanitizeForTerminal(groupId);
|
|
7136
|
+
try {
|
|
7137
|
+
const attachedAfter = await isAttached(network, groupId, instanceId);
|
|
7138
|
+
if (attachedAfter !== (action === "add")) {
|
|
7139
|
+
warning = `\uACBD\uACE0: \uC694\uCCAD\uC740 \uC811\uC218\uB410\uC9C0\uB9CC \uC5F0\uACB0 \uC870\uD68C\uC5D0 \uC544\uC9C1 \uBC18\uC601\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. network security-group ports ${safeGroupId}\uB85C \uB2E4\uC2DC \uD655\uC778\uD558\uC138\uC694.
|
|
7140
|
+
`;
|
|
7141
|
+
}
|
|
7142
|
+
} catch {
|
|
7143
|
+
warning = `\uACBD\uACE0: \uC694\uCCAD\uC740 \uC811\uC218\uB410\uC9C0\uB9CC \uC5F0\uACB0 \uC0C1\uD0DC\uB97C \uD655\uC778\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. network security-group ports ${safeGroupId}\uB85C \uB2E4\uC2DC \uD655\uC778\uD558\uC138\uC694.
|
|
7144
|
+
`;
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
7147
|
+
stopSpinner(true);
|
|
7148
|
+
if (warning) process.stderr.write(warning);
|
|
7149
|
+
const result = {
|
|
7150
|
+
operation,
|
|
7151
|
+
status: requested ? "succeeded" : "unchanged",
|
|
7152
|
+
instance_id: instanceId,
|
|
7153
|
+
security_group_id: groupId,
|
|
7154
|
+
security_group_name: groupName
|
|
7155
|
+
};
|
|
7156
|
+
output(opts, {
|
|
7157
|
+
headers: ["field", "value"],
|
|
7158
|
+
rows: Object.entries(result).map(([key, value]) => [key, value]),
|
|
7159
|
+
raw: result,
|
|
7160
|
+
ids: [instanceId]
|
|
7161
|
+
});
|
|
7162
|
+
}
|
|
7163
|
+
function actionCommand(action, description) {
|
|
7164
|
+
return withOptions(new import_commander42.Command(action).description(description).argument("<instance-id>", "\uC778\uC2A4\uD134\uC2A4 UUID").argument("<group>", "\uBCF4\uC548\uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID").option("--yes", `${ACTIONS[action].label} \uD655\uC778`)).action(async (instanceArg, groupArg, _opts, cmd) => {
|
|
7165
|
+
await runAction(action, instanceArg, groupArg, cmd.optsWithGlobals());
|
|
7166
|
+
});
|
|
7167
|
+
}
|
|
7168
|
+
var securityGroupCommand2 = new import_commander42.Command("security-group").description("\uC778\uC2A4\uD134\uC2A4\uC758 \uBCF4\uC548\uADF8\uB8F9 \uC5F0\uACB0 \uBCC0\uACBD").addCommand(actionCommand("add", "\uC778\uC2A4\uD134\uC2A4\uC5D0 \uBCF4\uC548\uADF8\uB8F9\uC744 \uC5F0\uACB0\uD55C\uB2E4 (\uB2E4\uB978 \uC5F0\uACB0\uC740 \uC720\uC9C0\uD55C\uB2E4)")).addCommand(actionCommand("remove", "\uC778\uC2A4\uD134\uC2A4\uC5D0\uC11C \uBCF4\uC548\uADF8\uB8F9 \uC5F0\uACB0\uC744 \uD574\uC81C\uD55C\uB2E4 (\uB2E4\uB978 \uC5F0\uACB0\uC740 \uC720\uC9C0\uD55C\uB2E4)"));
|
|
7169
|
+
|
|
6367
7170
|
// src/commands/ncr/list.ts
|
|
6368
|
-
var
|
|
7171
|
+
var import_commander43 = require("commander");
|
|
6369
7172
|
|
|
6370
7173
|
// src/services/ncr/harbor-client.ts
|
|
6371
|
-
var
|
|
7174
|
+
var import_ky13 = __toESM(require("ky"));
|
|
6372
7175
|
var PAGE_SIZE = 100;
|
|
6373
7176
|
var MAX_PAGES = 1e3;
|
|
6374
7177
|
var HarborClient = class {
|
|
@@ -6397,7 +7200,7 @@ var HarborClient = class {
|
|
|
6397
7200
|
try {
|
|
6398
7201
|
for (; ; ) {
|
|
6399
7202
|
const url = `https://${this.host}${path5}?page=${page}&page_size=${PAGE_SIZE}`;
|
|
6400
|
-
const res = await
|
|
7203
|
+
const res = await import_ky13.default.get(url, {
|
|
6401
7204
|
headers: this.basicAuthHeaders(),
|
|
6402
7205
|
retry: 0,
|
|
6403
7206
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -6493,7 +7296,7 @@ function parseHarborHost(uri) {
|
|
|
6493
7296
|
}
|
|
6494
7297
|
|
|
6495
7298
|
// src/commands/ncr/list.ts
|
|
6496
|
-
var
|
|
7299
|
+
var listCommand7 = new import_commander43.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
6497
7300
|
const opts = cmd.optsWithGlobals();
|
|
6498
7301
|
const { client, profileName } = await createNcrClient(opts);
|
|
6499
7302
|
const appKey = await resolveAppKey(profileName);
|
|
@@ -6519,8 +7322,8 @@ var listCommand5 = new import_commander39.Command("list").description("NCR \uB80
|
|
|
6519
7322
|
});
|
|
6520
7323
|
|
|
6521
7324
|
// src/commands/ncr/get.ts
|
|
6522
|
-
var
|
|
6523
|
-
var
|
|
7325
|
+
var import_commander44 = require("commander");
|
|
7326
|
+
var getCommand5 = new import_commander44.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (registry, _opts, cmd) => {
|
|
6524
7327
|
const opts = cmd.optsWithGlobals();
|
|
6525
7328
|
if (!registry.trim()) {
|
|
6526
7329
|
throw new NhnCloudCliError(
|
|
@@ -6548,8 +7351,8 @@ var getCommand3 = new import_commander40.Command("get").description("\uB2E8\uC77
|
|
|
6548
7351
|
});
|
|
6549
7352
|
|
|
6550
7353
|
// src/commands/ncr/images.ts
|
|
6551
|
-
var
|
|
6552
|
-
var imagesCommand2 = new
|
|
7354
|
+
var import_commander45 = require("commander");
|
|
7355
|
+
var imagesCommand2 = new import_commander45.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (registry, _opts, cmd) => {
|
|
6553
7356
|
const opts = cmd.optsWithGlobals();
|
|
6554
7357
|
if (!registry.trim()) {
|
|
6555
7358
|
throw new NhnCloudCliError(
|
|
@@ -6583,8 +7386,8 @@ var imagesCommand2 = new import_commander41.Command("images").description("\uB80
|
|
|
6583
7386
|
});
|
|
6584
7387
|
|
|
6585
7388
|
// src/commands/ncr/tags.ts
|
|
6586
|
-
var
|
|
6587
|
-
var tagsCommand = new
|
|
7389
|
+
var import_commander46 = require("commander");
|
|
7390
|
+
var tagsCommand = new import_commander46.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (registry, repository, _opts, cmd) => {
|
|
6588
7391
|
const opts = cmd.optsWithGlobals();
|
|
6589
7392
|
if (!registry.trim()) {
|
|
6590
7393
|
throw new NhnCloudCliError(
|
|
@@ -6625,7 +7428,7 @@ var tagsCommand = new import_commander42.Command("tags").description("\uD2B9\uC8
|
|
|
6625
7428
|
});
|
|
6626
7429
|
|
|
6627
7430
|
// src/commands/commands.ts
|
|
6628
|
-
var
|
|
7431
|
+
var import_commander47 = require("commander");
|
|
6629
7432
|
function commandPath(command) {
|
|
6630
7433
|
const names = [];
|
|
6631
7434
|
let current2 = command;
|
|
@@ -6663,7 +7466,7 @@ function collectCommandCatalog(program2) {
|
|
|
6663
7466
|
return { commands };
|
|
6664
7467
|
}
|
|
6665
7468
|
function createCommandsCommand(program2) {
|
|
6666
|
-
return new
|
|
7469
|
+
return new import_commander47.Command("commands").description("\uBA85\uB839 \uACBD\uB85C\uC640 \uC635\uC158 catalog\uB97C \uCD9C\uB825\uD55C\uB2E4").action((_opts, cmd) => {
|
|
6667
7470
|
const opts = cmd.optsWithGlobals();
|
|
6668
7471
|
const catalog = collectCommandCatalog(program2);
|
|
6669
7472
|
output(opts, {
|
|
@@ -6680,13 +7483,13 @@ function createCommandsCommand(program2) {
|
|
|
6680
7483
|
}
|
|
6681
7484
|
|
|
6682
7485
|
// src/commands/nks/supports.ts
|
|
6683
|
-
var
|
|
7486
|
+
var import_commander48 = require("commander");
|
|
6684
7487
|
|
|
6685
7488
|
// src/commands/nks/helpers.ts
|
|
6686
7489
|
var import_promises6 = require("fs/promises");
|
|
6687
7490
|
|
|
6688
7491
|
// src/services/nks/client.ts
|
|
6689
|
-
var
|
|
7492
|
+
var import_ky14 = __toESM(require("ky"));
|
|
6690
7493
|
|
|
6691
7494
|
// src/services/nks/types.ts
|
|
6692
7495
|
function isNksClusterSummary(val) {
|
|
@@ -6793,7 +7596,7 @@ var NksClient = class {
|
|
|
6793
7596
|
async supports() {
|
|
6794
7597
|
const url = `${this.nksEndpoint}/supports`;
|
|
6795
7598
|
try {
|
|
6796
|
-
const raw = await
|
|
7599
|
+
const raw = await import_ky14.default.get(url, {
|
|
6797
7600
|
headers: this.authHeaders(),
|
|
6798
7601
|
retry: 0,
|
|
6799
7602
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -6813,7 +7616,7 @@ var NksClient = class {
|
|
|
6813
7616
|
async listClusters() {
|
|
6814
7617
|
const url = `${this.nksEndpoint}/clusters`;
|
|
6815
7618
|
try {
|
|
6816
|
-
const raw = await
|
|
7619
|
+
const raw = await import_ky14.default.get(url, {
|
|
6817
7620
|
headers: this.authHeaders(),
|
|
6818
7621
|
retry: 0,
|
|
6819
7622
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -7121,7 +7924,7 @@ var NksClient = class {
|
|
|
7121
7924
|
async removeClusterAddon(cluster, addon) {
|
|
7122
7925
|
const url = `${this.nksEndpoint}/clusters/${encodeURIComponent(cluster)}/addons/${encodeURIComponent(addon)}`;
|
|
7123
7926
|
try {
|
|
7124
|
-
const raw = await
|
|
7927
|
+
const raw = await import_ky14.default.delete(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS }).json();
|
|
7125
7928
|
if (!isNksUuidResponse(raw)) {
|
|
7126
7929
|
throw new NhnCloudCliError(
|
|
7127
7930
|
"nks cluster addon remove \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 uuid \uD544\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -7143,7 +7946,7 @@ var NksClient = class {
|
|
|
7143
7946
|
async getJson(path5, searchParams) {
|
|
7144
7947
|
const url = `${this.nksEndpoint}${path5}`;
|
|
7145
7948
|
try {
|
|
7146
|
-
return await
|
|
7949
|
+
return await import_ky14.default.get(url, {
|
|
7147
7950
|
headers: this.authHeaders(),
|
|
7148
7951
|
searchParams,
|
|
7149
7952
|
retry: 0,
|
|
@@ -7164,10 +7967,10 @@ var NksClient = class {
|
|
|
7164
7967
|
const url = `${this.nksEndpoint}${path5}`;
|
|
7165
7968
|
try {
|
|
7166
7969
|
if (method === "delete") {
|
|
7167
|
-
await
|
|
7970
|
+
await import_ky14.default.delete(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS });
|
|
7168
7971
|
return;
|
|
7169
7972
|
}
|
|
7170
|
-
await
|
|
7973
|
+
await import_ky14.default.post(url, { headers: this.authHeaders(), json: payload, retry: 0, timeout: DEFAULT_TIMEOUT_MS });
|
|
7171
7974
|
} catch (err) {
|
|
7172
7975
|
throw toNhnCloudCliError(err);
|
|
7173
7976
|
}
|
|
@@ -7176,7 +7979,7 @@ var NksClient = class {
|
|
|
7176
7979
|
const url = `${this.nksEndpoint}${path5}`;
|
|
7177
7980
|
try {
|
|
7178
7981
|
const options = { headers: this.authHeaders(), json: payload, retry: 0, timeout: DEFAULT_TIMEOUT_MS };
|
|
7179
|
-
return method === "post" ? await
|
|
7982
|
+
return method === "post" ? await import_ky14.default.post(url, options).json() : await import_ky14.default.patch(url, options).json();
|
|
7180
7983
|
} catch (err) {
|
|
7181
7984
|
throw toNhnCloudCliError(err);
|
|
7182
7985
|
}
|
|
@@ -7253,7 +8056,7 @@ function parseNonNegativeInteger(value, optionName) {
|
|
|
7253
8056
|
}
|
|
7254
8057
|
|
|
7255
8058
|
// src/commands/nks/supports.ts
|
|
7256
|
-
var supportsCommand = new
|
|
8059
|
+
var supportsCommand = new import_commander48.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) => {
|
|
7257
8060
|
const opts = cmd.optsWithGlobals();
|
|
7258
8061
|
const { client } = await resolveNksClient(opts);
|
|
7259
8062
|
startSpinner("NKS \uC9C0\uC6D0 \uC815\uBCF4 \uC870\uD68C \uC911...");
|
|
@@ -7278,9 +8081,9 @@ var supportsCommand = new import_commander44.Command("supports").description("NK
|
|
|
7278
8081
|
|
|
7279
8082
|
// src/commands/nks/cluster.ts
|
|
7280
8083
|
var import_promises7 = require("fs/promises");
|
|
7281
|
-
var
|
|
8084
|
+
var import_commander49 = require("commander");
|
|
7282
8085
|
var import_chalk14 = __toESM(require("chalk"));
|
|
7283
|
-
var
|
|
8086
|
+
var listCommand8 = new import_commander49.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) => {
|
|
7284
8087
|
const opts = cmd.optsWithGlobals();
|
|
7285
8088
|
const { client } = await resolveNksClient(opts);
|
|
7286
8089
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -7386,7 +8189,7 @@ async function writeKubeconfigFile(path5, contents, force) {
|
|
|
7386
8189
|
throw err;
|
|
7387
8190
|
}
|
|
7388
8191
|
}
|
|
7389
|
-
var
|
|
8192
|
+
var createCommand6 = new import_commander49.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) => {
|
|
7390
8193
|
const opts = cmd.optsWithGlobals();
|
|
7391
8194
|
const payload = await readJsonFile(opts.file);
|
|
7392
8195
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7401,7 +8204,7 @@ var createCommand4 = new import_commander45.Command("create").description("NKS \
|
|
|
7401
8204
|
stopSpinner(true);
|
|
7402
8205
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 \uC0DD\uC131");
|
|
7403
8206
|
});
|
|
7404
|
-
var
|
|
8207
|
+
var deleteCommand5 = new import_commander49.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) => {
|
|
7405
8208
|
const opts = cmd.optsWithGlobals();
|
|
7406
8209
|
const ok = await confirmDangerousAction(`NKS \uD074\uB7EC\uC2A4\uD130 "${cluster}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
7407
8210
|
if (!ok) return;
|
|
@@ -7417,7 +8220,7 @@ var deleteCommand3 = new import_commander45.Command("delete").description("NKS \
|
|
|
7417
8220
|
process.stderr.write(import_chalk14.default.green(`\u2713 NKS \uD074\uB7EC\uC2A4\uD130 "${cluster}" \uC0AD\uC81C \uC694\uCCAD \uC644\uB8CC
|
|
7418
8221
|
`));
|
|
7419
8222
|
});
|
|
7420
|
-
var resizeCommand2 = new
|
|
8223
|
+
var resizeCommand2 = new import_commander49.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) => {
|
|
7421
8224
|
const opts = cmd.optsWithGlobals();
|
|
7422
8225
|
const nodeCount = parsePositiveInteger(opts.nodeCount, "--node-count");
|
|
7423
8226
|
const nodesToRemove = opts.nodesToRemove?.split(",").map((node) => node.trim()).filter(Boolean);
|
|
@@ -7441,7 +8244,7 @@ var resizeCommand2 = new import_commander45.Command("resize").description("NKS \
|
|
|
7441
8244
|
stopSpinner(true);
|
|
7442
8245
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 resize");
|
|
7443
8246
|
});
|
|
7444
|
-
var setIpAclCommand = new
|
|
8247
|
+
var setIpAclCommand = new import_commander49.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) => {
|
|
7445
8248
|
const opts = cmd.optsWithGlobals();
|
|
7446
8249
|
const payload = await readJsonFile(opts.file);
|
|
7447
8250
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7456,7 +8259,7 @@ var setIpAclCommand = new import_commander45.Command("set-ipacl").description("N
|
|
|
7456
8259
|
stopSpinner(true);
|
|
7457
8260
|
uuidOutput(opts, result, "IP ACL \uC124\uC815");
|
|
7458
8261
|
});
|
|
7459
|
-
var renewCertificateCommand = new
|
|
8262
|
+
var renewCertificateCommand = new import_commander49.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) => {
|
|
7460
8263
|
const opts = cmd.optsWithGlobals();
|
|
7461
8264
|
const term = parsePositiveInteger(opts.termOfValidity, "--term-of-validity");
|
|
7462
8265
|
if (term < 1 || term > 5) {
|
|
@@ -7474,7 +8277,7 @@ var renewCertificateCommand = new import_commander45.Command("renew-certificate"
|
|
|
7474
8277
|
stopSpinner(true);
|
|
7475
8278
|
uuidOutput(opts, result, "\uC778\uC99D\uC11C \uAC31\uC2E0");
|
|
7476
8279
|
});
|
|
7477
|
-
var updateSgwCommand = new
|
|
8280
|
+
var updateSgwCommand = new import_commander49.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) => {
|
|
7478
8281
|
const opts = cmd.optsWithGlobals();
|
|
7479
8282
|
const { client } = await resolveNksClient(opts);
|
|
7480
8283
|
startSpinner("NKS \uC11C\uBE44\uC2A4 \uAC8C\uC774\uD2B8\uC6E8\uC774 \uBCC0\uACBD \uC694\uCCAD \uC911...");
|
|
@@ -7488,7 +8291,7 @@ var updateSgwCommand = new import_commander45.Command("update-sgw").description(
|
|
|
7488
8291
|
stopSpinner(true);
|
|
7489
8292
|
uuidOutput(opts, result, "\uC11C\uBE44\uC2A4 \uAC8C\uC774\uD2B8\uC6E8\uC774 \uBCC0\uACBD");
|
|
7490
8293
|
});
|
|
7491
|
-
var setControlPlaneLogCommand = new
|
|
8294
|
+
var setControlPlaneLogCommand = new import_commander49.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) => {
|
|
7492
8295
|
const opts = cmd.optsWithGlobals();
|
|
7493
8296
|
const controlPlaneLog = await readJsonFile(opts.file);
|
|
7494
8297
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7503,7 +8306,7 @@ var setControlPlaneLogCommand = new import_commander45.Command("set-control-plan
|
|
|
7503
8306
|
stopSpinner(true);
|
|
7504
8307
|
uuidOutput(opts, result, "control plane log \uC124\uC815");
|
|
7505
8308
|
});
|
|
7506
|
-
var
|
|
8309
|
+
var getCommand6 = new import_commander49.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) => {
|
|
7507
8310
|
const opts = cmd.optsWithGlobals();
|
|
7508
8311
|
const { client } = await resolveNksClient(opts);
|
|
7509
8312
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC870\uD68C \uC911...");
|
|
@@ -7522,7 +8325,7 @@ var getCommand4 = new import_commander45.Command("get").description("NKS \uD074\
|
|
|
7522
8325
|
ids: [resourceId(result)]
|
|
7523
8326
|
});
|
|
7524
8327
|
});
|
|
7525
|
-
var eventsCommand = new
|
|
8328
|
+
var eventsCommand = new import_commander49.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) => {
|
|
7526
8329
|
const opts = cmd.optsWithGlobals();
|
|
7527
8330
|
const { client } = await resolveNksClient(opts);
|
|
7528
8331
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC791\uC5C5 \uC774\uB825 \uC870\uD68C \uC911...");
|
|
@@ -7543,7 +8346,7 @@ var eventsCommand = new import_commander45.Command("events").description("NKS \u
|
|
|
7543
8346
|
ids: events.map((event) => event.uuid)
|
|
7544
8347
|
});
|
|
7545
8348
|
});
|
|
7546
|
-
var eventCommand = new
|
|
8349
|
+
var eventCommand = new import_commander49.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 (\uC815\uC218 id \uAC00 \uC544\uB2C8\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 (cluster, event, _opts, cmd) => {
|
|
7547
8350
|
const opts = cmd.optsWithGlobals();
|
|
7548
8351
|
if (!isUuid(event)) {
|
|
7549
8352
|
throw new NhnCloudCliError(
|
|
@@ -7572,7 +8375,7 @@ var eventCommand = new import_commander45.Command("event").description("NKS \uD0
|
|
|
7572
8375
|
ids: [result.uuid]
|
|
7573
8376
|
});
|
|
7574
8377
|
});
|
|
7575
|
-
var kubeconfigCommand = new
|
|
8378
|
+
var kubeconfigCommand = new import_commander49.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) => {
|
|
7576
8379
|
const opts = cmd.optsWithGlobals();
|
|
7577
8380
|
const { client } = await resolveNksClient(opts);
|
|
7578
8381
|
startSpinner("NKS kubeconfig \uC870\uD68C \uC911...");
|
|
@@ -7592,7 +8395,7 @@ var kubeconfigCommand = new import_commander45.Command("kubeconfig").description
|
|
|
7592
8395
|
}
|
|
7593
8396
|
process.stdout.write(kubeconfig.endsWith("\n") ? kubeconfig : kubeconfig + "\n");
|
|
7594
8397
|
});
|
|
7595
|
-
var ipAclCommand = new
|
|
8398
|
+
var ipAclCommand = new import_commander49.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) => {
|
|
7596
8399
|
const opts = cmd.optsWithGlobals();
|
|
7597
8400
|
const { client } = await resolveNksClient(opts);
|
|
7598
8401
|
startSpinner("NKS IP ACL \uC870\uD68C \uC911...");
|
|
@@ -7611,7 +8414,7 @@ var ipAclCommand = new import_commander45.Command("ipacl").description("NKS \uD0
|
|
|
7611
8414
|
ids: [result.cluster_uuid]
|
|
7612
8415
|
});
|
|
7613
8416
|
});
|
|
7614
|
-
var clusterAddonListCommand = new
|
|
8417
|
+
var clusterAddonListCommand = new import_commander49.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) => {
|
|
7615
8418
|
const opts = cmd.optsWithGlobals();
|
|
7616
8419
|
const { client } = await resolveNksClient(opts);
|
|
7617
8420
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -7630,7 +8433,7 @@ var clusterAddonListCommand = new import_commander45.Command("list").description
|
|
|
7630
8433
|
ids: addons.map((addon) => addon.uuid ?? addon.id ?? addon.name)
|
|
7631
8434
|
});
|
|
7632
8435
|
});
|
|
7633
|
-
var clusterAddonGetCommand = new
|
|
8436
|
+
var clusterAddonGetCommand = new import_commander49.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) => {
|
|
7634
8437
|
const opts = cmd.optsWithGlobals();
|
|
7635
8438
|
const { client } = await resolveNksClient(opts);
|
|
7636
8439
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uC870\uD68C \uC911...");
|
|
@@ -7658,7 +8461,7 @@ function parseResolveConflicts(value) {
|
|
|
7658
8461
|
EXIT_PARAM_ERROR
|
|
7659
8462
|
);
|
|
7660
8463
|
}
|
|
7661
|
-
var clusterAddonInstallCommand = new
|
|
8464
|
+
var clusterAddonInstallCommand = new import_commander49.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("--addon-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) => {
|
|
7662
8465
|
const opts = cmd.optsWithGlobals();
|
|
7663
8466
|
const resolveConflicts = parseResolveConflicts(opts.resolveConflicts);
|
|
7664
8467
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7677,7 +8480,7 @@ var clusterAddonInstallCommand = new import_commander45.Command("install").descr
|
|
|
7677
8480
|
stopSpinner(true);
|
|
7678
8481
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uC124\uCE58");
|
|
7679
8482
|
});
|
|
7680
|
-
var clusterAddonUpdateCommand = new
|
|
8483
|
+
var clusterAddonUpdateCommand = new import_commander49.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("--addon-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) => {
|
|
7681
8484
|
const opts = cmd.optsWithGlobals();
|
|
7682
8485
|
const resolveConflicts = parseResolveConflicts(opts.resolveConflicts);
|
|
7683
8486
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7695,7 +8498,7 @@ var clusterAddonUpdateCommand = new import_commander45.Command("update").descrip
|
|
|
7695
8498
|
stopSpinner(true);
|
|
7696
8499
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uC5C5\uB370\uC774\uD2B8");
|
|
7697
8500
|
});
|
|
7698
|
-
var clusterAddonRemoveCommand = new
|
|
8501
|
+
var clusterAddonRemoveCommand = new import_commander49.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) => {
|
|
7699
8502
|
const opts = cmd.optsWithGlobals();
|
|
7700
8503
|
const ok = await confirmDangerousAction(`NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 "${addon}" \uC744 \uC81C\uAC70\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
7701
8504
|
if (!ok) return;
|
|
@@ -7711,11 +8514,11 @@ var clusterAddonRemoveCommand = new import_commander45.Command("remove").descrip
|
|
|
7711
8514
|
stopSpinner(true);
|
|
7712
8515
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uC81C\uAC70");
|
|
7713
8516
|
});
|
|
7714
|
-
var clusterAddonCommand = new
|
|
7715
|
-
var clusterCommand = new
|
|
8517
|
+
var clusterAddonCommand = new import_commander49.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);
|
|
8518
|
+
var clusterCommand = new import_commander49.Command("cluster").description("NKS \uD074\uB7EC\uC2A4\uD130 \uAD00\uB828 \uBA85\uB839").addCommand(listCommand8).addCommand(getCommand6).addCommand(createCommand6).addCommand(deleteCommand5).addCommand(resizeCommand2).addCommand(eventsCommand).addCommand(eventCommand).addCommand(kubeconfigCommand).addCommand(ipAclCommand).addCommand(setIpAclCommand).addCommand(renewCertificateCommand).addCommand(updateSgwCommand).addCommand(setControlPlaneLogCommand).addCommand(clusterAddonCommand);
|
|
7716
8519
|
|
|
7717
8520
|
// src/commands/nks/nodegroup.ts
|
|
7718
|
-
var
|
|
8521
|
+
var import_commander50 = require("commander");
|
|
7719
8522
|
var import_chalk15 = __toESM(require("chalk"));
|
|
7720
8523
|
function nodeGroupRow(nodegroup) {
|
|
7721
8524
|
return [
|
|
@@ -7769,7 +8572,7 @@ async function confirmDangerousAction2(message, yes) {
|
|
|
7769
8572
|
if (!ok) process.stderr.write(import_chalk15.default.yellow("\uC791\uC5C5\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
7770
8573
|
return ok;
|
|
7771
8574
|
}
|
|
7772
|
-
var
|
|
8575
|
+
var listCommand9 = new import_commander50.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) => {
|
|
7773
8576
|
const opts = cmd.optsWithGlobals();
|
|
7774
8577
|
const { client } = await resolveNksClient(opts);
|
|
7775
8578
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -7788,7 +8591,7 @@ var listCommand7 = new import_commander46.Command("list").description("NKS \uB17
|
|
|
7788
8591
|
ids: nodegroups.map((nodegroup) => nodegroup.uuid)
|
|
7789
8592
|
});
|
|
7790
8593
|
});
|
|
7791
|
-
var
|
|
8594
|
+
var getCommand7 = new import_commander50.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) => {
|
|
7792
8595
|
const opts = cmd.optsWithGlobals();
|
|
7793
8596
|
const { client } = await resolveNksClient(opts);
|
|
7794
8597
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 \uC870\uD68C \uC911...");
|
|
@@ -7807,7 +8610,7 @@ var getCommand5 = new import_commander46.Command("get").description("NKS \uB178\
|
|
|
7807
8610
|
ids: [result.uuid]
|
|
7808
8611
|
});
|
|
7809
8612
|
});
|
|
7810
|
-
var
|
|
8613
|
+
var createCommand7 = new import_commander50.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) => {
|
|
7811
8614
|
const opts = cmd.optsWithGlobals();
|
|
7812
8615
|
const payload = await readJsonFile(opts.file);
|
|
7813
8616
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7822,7 +8625,7 @@ var createCommand5 = new import_commander46.Command("create").description("NKS \
|
|
|
7822
8625
|
stopSpinner(true);
|
|
7823
8626
|
uuidOutput2(opts, result, "\uB178\uB4DC \uADF8\uB8F9 \uC0DD\uC131");
|
|
7824
8627
|
});
|
|
7825
|
-
var
|
|
8628
|
+
var deleteCommand6 = new import_commander50.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) => {
|
|
7826
8629
|
const opts = cmd.optsWithGlobals();
|
|
7827
8630
|
const ok = await confirmDangerousAction2(`NKS \uB178\uB4DC \uADF8\uB8F9 "${nodegroup}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
7828
8631
|
if (!ok) return;
|
|
@@ -7839,7 +8642,7 @@ var deleteCommand4 = new import_commander46.Command("delete").description("NKS \
|
|
|
7839
8642
|
`));
|
|
7840
8643
|
});
|
|
7841
8644
|
function nodeActionCommand(name) {
|
|
7842
|
-
return new
|
|
8645
|
+
return new import_commander50.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) => {
|
|
7843
8646
|
const opts = cmd.optsWithGlobals();
|
|
7844
8647
|
const nodes = parseCsv(opts.nodes, "--nodes");
|
|
7845
8648
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7855,7 +8658,7 @@ function nodeActionCommand(name) {
|
|
|
7855
8658
|
uuidOutput2(opts, result, `\uB178\uB4DC ${name === "stop-node" ? "\uC911\uC9C0" : "\uC2DC\uC791"}`);
|
|
7856
8659
|
});
|
|
7857
8660
|
}
|
|
7858
|
-
var autoscaleCommand = new
|
|
8661
|
+
var autoscaleCommand = new import_commander50.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) => {
|
|
7859
8662
|
const opts = cmd.optsWithGlobals();
|
|
7860
8663
|
const { client } = await resolveNksClient(opts);
|
|
7861
8664
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 autoscale \uC870\uD68C \uC911...");
|
|
@@ -7874,7 +8677,7 @@ var autoscaleCommand = new import_commander46.Command("autoscale").description("
|
|
|
7874
8677
|
ids: []
|
|
7875
8678
|
});
|
|
7876
8679
|
});
|
|
7877
|
-
var setAutoscaleCommand = new
|
|
8680
|
+
var setAutoscaleCommand = new import_commander50.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) => {
|
|
7878
8681
|
const opts = cmd.optsWithGlobals();
|
|
7879
8682
|
const payload = await readJsonFile(opts.file);
|
|
7880
8683
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7889,7 +8692,7 @@ var setAutoscaleCommand = new import_commander46.Command("set-autoscale").descri
|
|
|
7889
8692
|
stopSpinner(true);
|
|
7890
8693
|
uuidOutput2(opts, result, "autoscale \uBCC0\uACBD");
|
|
7891
8694
|
});
|
|
7892
|
-
var setMetricAutoscaleCommand = new
|
|
8695
|
+
var setMetricAutoscaleCommand = new import_commander50.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) => {
|
|
7893
8696
|
const opts = cmd.optsWithGlobals();
|
|
7894
8697
|
const payload = await readJsonFile(opts.file);
|
|
7895
8698
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7904,7 +8707,7 @@ var setMetricAutoscaleCommand = new import_commander46.Command("set-metric-autos
|
|
|
7904
8707
|
stopSpinner(true);
|
|
7905
8708
|
uuidOutput2(opts, result, "metric autoscale \uBCC0\uACBD");
|
|
7906
8709
|
});
|
|
7907
|
-
var upgradeCommand = new
|
|
8710
|
+
var upgradeCommand = new import_commander50.Command("upgrade").description("NKS \uB178\uB4DC \uADF8\uB8F9 Kubernetes version \uC744 \uC5C5\uADF8\uB808\uC774\uB4DC\uD55C\uB2E4 (default-master \uB85C control plane \uC5C5\uADF8\uB808\uC774\uB4DC)").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984. control plane \uC740 default-master \uB85C \uC9C0\uC815\uD55C\uB2E4").requiredOption("--kube-version <v>", "\uB300\uC0C1 Kubernetes version").option("--num-buffer-nodes <n>", "\uCD95\uCD9C\uB41C \uD30C\uB4DC\uB97C \uBC1B\uC744 \uC5EC\uC720 \uB178\uB4DC \uC218 (\uAE30\uBCF8 1, \uC791\uC5C5 \uD6C4 \uC790\uB3D9 \uC0AD\uC81C, \uC778\uC2A4\uD134\uC2A4 \uC694\uAE08 \uBC1C\uC0DD)").option("--num-max-unavailable-nodes <n>", "\uD55C \uBC88\uC5D0 \uC11C\uBE44\uC2A4 \uBD88\uAC00 \uC0C1\uD0DC\uB85C \uB458 \uB178\uB4DC \uC218 (\uAE30\uBCF8 1, \uD06C\uBA74 \uBE60\uB974\uACE0 \uAC00\uC6A9\uC131 \uB0AE\uC74C)").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) => {
|
|
7908
8711
|
const opts = cmd.optsWithGlobals();
|
|
7909
8712
|
const { client } = await resolveNksClient(opts);
|
|
7910
8713
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 upgrade \uC694\uCCAD \uC911...");
|
|
@@ -7922,7 +8725,7 @@ var upgradeCommand = new import_commander46.Command("upgrade").description("NKS
|
|
|
7922
8725
|
stopSpinner(true);
|
|
7923
8726
|
uuidOutput2(opts, result, "\uB178\uB4DC \uADF8\uB8F9 upgrade");
|
|
7924
8727
|
});
|
|
7925
|
-
var setUserscriptCommand = new
|
|
8728
|
+
var setUserscriptCommand = new import_commander50.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) => {
|
|
7926
8729
|
const opts = cmd.optsWithGlobals();
|
|
7927
8730
|
const contents = await readTextFile(opts.file);
|
|
7928
8731
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7937,7 +8740,7 @@ var setUserscriptCommand = new import_commander46.Command("set-userscript").desc
|
|
|
7937
8740
|
stopSpinner(true);
|
|
7938
8741
|
uuidOutput2(opts, result, "user script \uBCC0\uACBD");
|
|
7939
8742
|
});
|
|
7940
|
-
var updateFlavorCommand = new
|
|
8743
|
+
var updateFlavorCommand = new import_commander50.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>", "\uCD95\uCD9C\uB41C \uD30C\uB4DC\uB97C \uBC1B\uC744 \uC5EC\uC720 \uB178\uB4DC \uC218 (\uAE30\uBCF8 1, \uC791\uC5C5 \uD6C4 \uC790\uB3D9 \uC0AD\uC81C, \uC778\uC2A4\uD134\uC2A4 \uC694\uAE08 \uBC1C\uC0DD)").option("--num-max-unavailable-nodes <n>", "\uD55C \uBC88\uC5D0 \uC11C\uBE44\uC2A4 \uBD88\uAC00 \uC0C1\uD0DC\uB85C \uB458 \uB178\uB4DC \uC218 (\uAE30\uBCF8 1, \uD06C\uBA74 \uBE60\uB974\uACE0 \uAC00\uC6A9\uC131 \uB0AE\uC74C)").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) => {
|
|
7941
8744
|
const opts = cmd.optsWithGlobals();
|
|
7942
8745
|
const { client } = await resolveNksClient(opts);
|
|
7943
8746
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 flavor \uBCC0\uACBD \uC694\uCCAD \uC911...");
|
|
@@ -7956,7 +8759,7 @@ var updateFlavorCommand = new import_commander46.Command("update-flavor").descri
|
|
|
7956
8759
|
uuidOutput2(opts, result, "flavor \uBCC0\uACBD");
|
|
7957
8760
|
});
|
|
7958
8761
|
function patchPayloadCommand(name) {
|
|
7959
|
-
return new
|
|
8762
|
+
return new import_commander50.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) => {
|
|
7960
8763
|
const opts = cmd.optsWithGlobals();
|
|
7961
8764
|
const payload = await readJsonFile(opts.file);
|
|
7962
8765
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7972,10 +8775,10 @@ function patchPayloadCommand(name) {
|
|
|
7972
8775
|
uuidOutput2(opts, result, name);
|
|
7973
8776
|
});
|
|
7974
8777
|
}
|
|
7975
|
-
var nodegroupCommand = new
|
|
8778
|
+
var nodegroupCommand = new import_commander50.Command("nodegroup").description("NKS \uB178\uB4DC \uADF8\uB8F9 \uAD00\uB828 \uBA85\uB839").addCommand(listCommand9).addCommand(getCommand7).addCommand(createCommand7).addCommand(deleteCommand6).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"));
|
|
7976
8779
|
|
|
7977
8780
|
// src/commands/nks/addon.ts
|
|
7978
|
-
var
|
|
8781
|
+
var import_commander51 = require("commander");
|
|
7979
8782
|
function addonTypeRow(addonType) {
|
|
7980
8783
|
return [
|
|
7981
8784
|
addonType.uuid ?? addonType.id ?? addonType.name,
|
|
@@ -7991,7 +8794,7 @@ function addonRow2(addon) {
|
|
|
7991
8794
|
addon.status ?? ""
|
|
7992
8795
|
];
|
|
7993
8796
|
}
|
|
7994
|
-
var addonTypeListCommand = new
|
|
8797
|
+
var addonTypeListCommand = new import_commander51.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) => {
|
|
7995
8798
|
const opts = cmd.optsWithGlobals();
|
|
7996
8799
|
const { client } = await resolveNksClient(opts);
|
|
7997
8800
|
startSpinner("NKS \uC560\uB4DC\uC628 \uD0C0\uC785 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -8010,7 +8813,7 @@ var addonTypeListCommand = new import_commander47.Command("list").description("N
|
|
|
8010
8813
|
ids: addonTypes.map((addonType) => addonType.uuid ?? addonType.id ?? addonType.name)
|
|
8011
8814
|
});
|
|
8012
8815
|
});
|
|
8013
|
-
var addonTypeGetCommand = new
|
|
8816
|
+
var addonTypeGetCommand = new import_commander51.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) => {
|
|
8014
8817
|
const opts = cmd.optsWithGlobals();
|
|
8015
8818
|
const { client } = await resolveNksClient(opts);
|
|
8016
8819
|
startSpinner("NKS \uC560\uB4DC\uC628 \uD0C0\uC785 \uC870\uD68C \uC911...");
|
|
@@ -8029,8 +8832,8 @@ var addonTypeGetCommand = new import_commander47.Command("get").description("NKS
|
|
|
8029
8832
|
ids: [result.uuid ?? result.id ?? result.name]
|
|
8030
8833
|
});
|
|
8031
8834
|
});
|
|
8032
|
-
var addonTypeCommand = new
|
|
8033
|
-
var addonListCommand = new
|
|
8835
|
+
var addonTypeCommand = new import_commander51.Command("addon-type").description("NKS \uC560\uB4DC\uC628 \uD0C0\uC785 \uAD00\uB828 \uBA85\uB839").addCommand(addonTypeListCommand).addCommand(addonTypeGetCommand);
|
|
8836
|
+
var addonListCommand = new import_commander51.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) => {
|
|
8034
8837
|
const opts = cmd.optsWithGlobals();
|
|
8035
8838
|
const { client } = await resolveNksClient(opts);
|
|
8036
8839
|
startSpinner("NKS \uC560\uB4DC\uC628 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -8053,7 +8856,7 @@ var addonListCommand = new import_commander47.Command("list").description("NKS \
|
|
|
8053
8856
|
ids: addons.map((addon) => addon.uuid ?? addon.id ?? addon.name)
|
|
8054
8857
|
});
|
|
8055
8858
|
});
|
|
8056
|
-
var addonGetCommand = new
|
|
8859
|
+
var addonGetCommand = new import_commander51.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) => {
|
|
8057
8860
|
const opts = cmd.optsWithGlobals();
|
|
8058
8861
|
const { client } = await resolveNksClient(opts);
|
|
8059
8862
|
startSpinner("NKS \uC560\uB4DC\uC628 \uC870\uD68C \uC911...");
|
|
@@ -8072,10 +8875,10 @@ var addonGetCommand = new import_commander47.Command("get").description("NKS \uC
|
|
|
8072
8875
|
ids: [result.uuid ?? result.id ?? result.name]
|
|
8073
8876
|
});
|
|
8074
8877
|
});
|
|
8075
|
-
var addonCommand = new
|
|
8878
|
+
var addonCommand = new import_commander51.Command("addon").description("NKS \uC560\uB4DC\uC628 \uAD00\uB828 \uBA85\uB839").addCommand(addonListCommand).addCommand(addonGetCommand);
|
|
8076
8879
|
|
|
8077
8880
|
// src/commands/ncs/template.ts
|
|
8078
|
-
var
|
|
8881
|
+
var import_commander52 = require("commander");
|
|
8079
8882
|
var import_chalk16 = __toESM(require("chalk"));
|
|
8080
8883
|
|
|
8081
8884
|
// src/commands/ncs/helpers.ts
|
|
@@ -8249,7 +9052,7 @@ async function confirmDestructive(message, yes) {
|
|
|
8249
9052
|
}
|
|
8250
9053
|
|
|
8251
9054
|
// src/commands/ncs/template.ts
|
|
8252
|
-
var
|
|
9055
|
+
var listCommand10 = new import_commander52.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("--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) => {
|
|
8253
9056
|
const opts = cmd.optsWithGlobals();
|
|
8254
9057
|
const { client } = await resolveNcsClient(opts);
|
|
8255
9058
|
startSpinner("NCS \uC124\uACC4\uB3C4 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -8280,7 +9083,7 @@ var listCommand8 = new import_commander48.Command("list").description("NCS \uC12
|
|
|
8280
9083
|
ids: templates.map((t) => t.id)
|
|
8281
9084
|
});
|
|
8282
9085
|
});
|
|
8283
|
-
var
|
|
9086
|
+
var getCommand8 = new import_commander52.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8284
9087
|
const opts = cmd.optsWithGlobals();
|
|
8285
9088
|
requireNonEmpty(id, "id");
|
|
8286
9089
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8308,7 +9111,7 @@ var getCommand6 = new import_commander48.Command("get").description("NCS \uC124\
|
|
|
8308
9111
|
ids: [template.id]
|
|
8309
9112
|
});
|
|
8310
9113
|
});
|
|
8311
|
-
var
|
|
9114
|
+
var createCommand8 = new import_commander52.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
8312
9115
|
const opts = cmd.optsWithGlobals();
|
|
8313
9116
|
const payload = readJsonPayload(opts.file);
|
|
8314
9117
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8336,7 +9139,7 @@ var createCommand6 = new import_commander48.Command("create").description("NCS \
|
|
|
8336
9139
|
ids: [template.id]
|
|
8337
9140
|
});
|
|
8338
9141
|
});
|
|
8339
|
-
var
|
|
9142
|
+
var deleteCommand7 = new import_commander52.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8340
9143
|
const opts = cmd.optsWithGlobals();
|
|
8341
9144
|
requireNonEmpty(id, "id");
|
|
8342
9145
|
const ok = await confirmDestructive(`NCS \uC124\uACC4\uB3C4 "${id}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
@@ -8356,7 +9159,7 @@ var deleteCommand5 = new import_commander48.Command("delete").description("NCS \
|
|
|
8356
9159
|
process.stderr.write(import_chalk16.default.green(`\u2713 NCS \uC124\uACC4\uB3C4 "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
8357
9160
|
`));
|
|
8358
9161
|
});
|
|
8359
|
-
var versionListCommand = new
|
|
9162
|
+
var versionListCommand = new import_commander52.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("--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) => {
|
|
8360
9163
|
const opts = cmd.optsWithGlobals();
|
|
8361
9164
|
requireNonEmpty(id, "id");
|
|
8362
9165
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8389,7 +9192,7 @@ var versionListCommand = new import_commander48.Command("list").description("NCS
|
|
|
8389
9192
|
ids: versions.map((v) => v.id)
|
|
8390
9193
|
});
|
|
8391
9194
|
});
|
|
8392
|
-
var versionGetCommand = new
|
|
9195
|
+
var versionGetCommand = new import_commander52.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, version, _opts, cmd) => {
|
|
8393
9196
|
const opts = cmd.optsWithGlobals();
|
|
8394
9197
|
requireNonEmpty(id, "id");
|
|
8395
9198
|
requireNonEmpty(version, "version");
|
|
@@ -8410,7 +9213,7 @@ var versionGetCommand = new import_commander48.Command("get").description("NCS \
|
|
|
8410
9213
|
ids: [detail.id]
|
|
8411
9214
|
});
|
|
8412
9215
|
});
|
|
8413
|
-
var versionCreateCommand = new
|
|
9216
|
+
var versionCreateCommand = new import_commander52.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8414
9217
|
const opts = cmd.optsWithGlobals();
|
|
8415
9218
|
requireNonEmpty(id, "id");
|
|
8416
9219
|
const payload = readJsonPayload(opts.file);
|
|
@@ -8431,7 +9234,7 @@ var versionCreateCommand = new import_commander48.Command("create").description(
|
|
|
8431
9234
|
ids: [version.id]
|
|
8432
9235
|
});
|
|
8433
9236
|
});
|
|
8434
|
-
var versionDeleteCommand = new
|
|
9237
|
+
var versionDeleteCommand = new import_commander52.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, version, _opts, cmd) => {
|
|
8435
9238
|
const opts = cmd.optsWithGlobals();
|
|
8436
9239
|
requireNonEmpty(id, "id");
|
|
8437
9240
|
requireNonEmpty(version, "version");
|
|
@@ -8457,11 +9260,11 @@ var versionDeleteCommand = new import_commander48.Command("delete").description(
|
|
|
8457
9260
|
`)
|
|
8458
9261
|
);
|
|
8459
9262
|
});
|
|
8460
|
-
var versionCommand = new
|
|
8461
|
-
var templateCommand = new
|
|
9263
|
+
var versionCommand = new import_commander52.Command("version").description("NCS \uC124\uACC4\uB3C4(template) \uBC84\uC804 \uAD00\uB9AC").addCommand(versionListCommand).addCommand(versionGetCommand).addCommand(versionCreateCommand).addCommand(versionDeleteCommand);
|
|
9264
|
+
var templateCommand = new import_commander52.Command("template").description("NCS \uC124\uACC4\uB3C4(template) \uAD00\uB9AC").addCommand(listCommand10).addCommand(getCommand8).addCommand(createCommand8).addCommand(deleteCommand7).addCommand(versionCommand);
|
|
8462
9265
|
|
|
8463
9266
|
// src/commands/ncs/workload.ts
|
|
8464
|
-
var
|
|
9267
|
+
var import_commander53 = require("commander");
|
|
8465
9268
|
var import_chalk17 = __toESM(require("chalk"));
|
|
8466
9269
|
function workloadRows(w) {
|
|
8467
9270
|
return [
|
|
@@ -8476,7 +9279,7 @@ function workloadRows(w) {
|
|
|
8476
9279
|
];
|
|
8477
9280
|
}
|
|
8478
9281
|
var WORKLOAD_HEADERS = ["id", "name", "type", "status", "desired", "available"];
|
|
8479
|
-
var
|
|
9282
|
+
var listCommand11 = new import_commander53.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("--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) => {
|
|
8480
9283
|
const opts = cmd.optsWithGlobals();
|
|
8481
9284
|
const { client } = await resolveNcsClient(opts);
|
|
8482
9285
|
startSpinner("NCS workload \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -8509,7 +9312,7 @@ var listCommand9 = new import_commander49.Command("list").description("NCS workl
|
|
|
8509
9312
|
ids: workloads.map((w) => w.id)
|
|
8510
9313
|
});
|
|
8511
9314
|
});
|
|
8512
|
-
var
|
|
9315
|
+
var getCommand9 = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8513
9316
|
const opts = cmd.optsWithGlobals();
|
|
8514
9317
|
requireNonEmpty(id, "id");
|
|
8515
9318
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8539,7 +9342,7 @@ var getCommand7 = new import_commander49.Command("get").description("NCS workloa
|
|
|
8539
9342
|
ids: [workload.id]
|
|
8540
9343
|
});
|
|
8541
9344
|
});
|
|
8542
|
-
var logsCommand = new
|
|
9345
|
+
var logsCommand = new import_commander53.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("--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(
|
|
8543
9346
|
"--from <time>",
|
|
8544
9347
|
"\uB85C\uADF8 \uC2DC\uC791: \uC2DC\uAC04\uB300 \uD3EC\uD568 RFC3339, now \uB610\uB294 0 \uC774\uC0C1\uC758 \uC815\uC218\uC640 m/h/d \uB2E8\uC704 (\uC608: 30m, 1h, 2d). UTC Z\uB85C \uC815\uADDC\uD654\uD558\uBA70 \uC0DD\uB7B5 \uC2DC API \uAE30\uBCF8 \uBC94\uC704"
|
|
8545
9348
|
).option(
|
|
@@ -8584,7 +9387,7 @@ var logsCommand = new import_commander49.Command("logs").description("NCS worklo
|
|
|
8584
9387
|
ids: []
|
|
8585
9388
|
});
|
|
8586
9389
|
});
|
|
8587
|
-
var eventsCommand2 = new
|
|
9390
|
+
var eventsCommand2 = new import_commander53.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("--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(
|
|
8588
9391
|
"--from <time>",
|
|
8589
9392
|
"\uC774\uBCA4\uD2B8 \uC2DC\uC791: \uC2DC\uAC04\uB300 \uD3EC\uD568 RFC3339, now \uB610\uB294 0 \uC774\uC0C1\uC758 \uC815\uC218\uC640 m/h/d \uB2E8\uC704 (\uC608: 30m, 1h, 2d). UTC Z\uB85C \uC815\uADDC\uD654\uD558\uBA70 \uC0DD\uB7B5 \uC2DC API \uAE30\uBCF8 \uBC94\uC704"
|
|
8590
9393
|
).option(
|
|
@@ -8626,7 +9429,7 @@ var eventsCommand2 = new import_commander49.Command("events").description("NCS w
|
|
|
8626
9429
|
ids: []
|
|
8627
9430
|
});
|
|
8628
9431
|
});
|
|
8629
|
-
var historyGetCommand = new
|
|
9432
|
+
var historyGetCommand = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, historyId, _opts, cmd) => {
|
|
8630
9433
|
const opts = cmd.optsWithGlobals();
|
|
8631
9434
|
requireNonEmpty(id, "id");
|
|
8632
9435
|
requireNonEmpty(historyId, "historyId");
|
|
@@ -8655,7 +9458,7 @@ var historyGetCommand = new import_commander49.Command("get").description("NCS w
|
|
|
8655
9458
|
ids: [String(detail.id)]
|
|
8656
9459
|
});
|
|
8657
9460
|
});
|
|
8658
|
-
var historyCommand = new
|
|
9461
|
+
var historyCommand = new import_commander53.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("--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) => {
|
|
8659
9462
|
const opts = cmd.optsWithGlobals();
|
|
8660
9463
|
requireNonEmpty(id, "id");
|
|
8661
9464
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8688,7 +9491,7 @@ var historyCommand = new import_commander49.Command("history").description("NCS
|
|
|
8688
9491
|
ids: history.map((h) => String(h.id))
|
|
8689
9492
|
});
|
|
8690
9493
|
}).addCommand(historyGetCommand);
|
|
8691
|
-
var scheduleHistoryCommand = new
|
|
9494
|
+
var scheduleHistoryCommand = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8692
9495
|
const opts = cmd.optsWithGlobals();
|
|
8693
9496
|
requireNonEmpty(id, "id");
|
|
8694
9497
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8709,7 +9512,7 @@ var scheduleHistoryCommand = new import_commander49.Command("schedule-history").
|
|
|
8709
9512
|
ids: scheduleHistory.map((s) => s.id)
|
|
8710
9513
|
});
|
|
8711
9514
|
});
|
|
8712
|
-
var
|
|
9515
|
+
var createCommand9 = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
8713
9516
|
const opts = cmd.optsWithGlobals();
|
|
8714
9517
|
const payload = readJsonPayload(opts.file);
|
|
8715
9518
|
const timeoutMs = parsePositiveIntegerOption(opts.timeout ?? "300", "--timeout") * 1e3;
|
|
@@ -8740,7 +9543,7 @@ var createCommand7 = new import_commander49.Command("create").description("NCS w
|
|
|
8740
9543
|
ids: [workload.id]
|
|
8741
9544
|
});
|
|
8742
9545
|
});
|
|
8743
|
-
var
|
|
9546
|
+
var updateCommand2 = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8744
9547
|
const opts = cmd.optsWithGlobals();
|
|
8745
9548
|
requireNonEmpty(id, "id");
|
|
8746
9549
|
const payload = readJsonPayload(opts.file);
|
|
@@ -8761,7 +9564,7 @@ var updateCommand = new import_commander49.Command("update").description("NCS wo
|
|
|
8761
9564
|
ids: [workload.id]
|
|
8762
9565
|
});
|
|
8763
9566
|
});
|
|
8764
|
-
var patchCommand = new
|
|
9567
|
+
var patchCommand = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8765
9568
|
const opts = cmd.optsWithGlobals();
|
|
8766
9569
|
requireNonEmpty(id, "id");
|
|
8767
9570
|
const payload = readJsonPayload(opts.file);
|
|
@@ -8782,7 +9585,7 @@ var patchCommand = new import_commander49.Command("patch").description("NCS work
|
|
|
8782
9585
|
ids: [workload.id]
|
|
8783
9586
|
});
|
|
8784
9587
|
});
|
|
8785
|
-
var pauseCommand = new
|
|
9588
|
+
var pauseCommand = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8786
9589
|
const opts = cmd.optsWithGlobals();
|
|
8787
9590
|
requireNonEmpty(id, "id");
|
|
8788
9591
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8797,7 +9600,7 @@ var pauseCommand = new import_commander49.Command("pause").description("NCS work
|
|
|
8797
9600
|
process.stderr.write(import_chalk17.default.green(`\u2713 NCS workload "${id}" \uAC00 \uC77C\uC2DC\uC815\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
8798
9601
|
`));
|
|
8799
9602
|
});
|
|
8800
|
-
var resumeCommand = new
|
|
9603
|
+
var resumeCommand = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8801
9604
|
const opts = cmd.optsWithGlobals();
|
|
8802
9605
|
requireNonEmpty(id, "id");
|
|
8803
9606
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8812,7 +9615,7 @@ var resumeCommand = new import_commander49.Command("resume").description("NCS wo
|
|
|
8812
9615
|
process.stderr.write(import_chalk17.default.green(`\u2713 NCS workload "${id}" \uAC00 \uC7AC\uAC1C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
8813
9616
|
`));
|
|
8814
9617
|
});
|
|
8815
|
-
var restartCommand = new
|
|
9618
|
+
var restartCommand = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").option("--task <taskId>", "task ID (\uD544\uC218)").action(async (id, _opts, cmd) => {
|
|
8816
9619
|
const opts = cmd.optsWithGlobals();
|
|
8817
9620
|
requireNonEmpty(id, "id");
|
|
8818
9621
|
if (!opts.task || !opts.task.trim()) {
|
|
@@ -8835,7 +9638,7 @@ var restartCommand = new import_commander49.Command("restart").description("NCS
|
|
|
8835
9638
|
`)
|
|
8836
9639
|
);
|
|
8837
9640
|
});
|
|
8838
|
-
var
|
|
9641
|
+
var deleteCommand8 = new import_commander53.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8839
9642
|
const opts = cmd.optsWithGlobals();
|
|
8840
9643
|
requireNonEmpty(id, "id");
|
|
8841
9644
|
const ok = await confirmDestructive(`NCS workload "${id}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
@@ -8855,10 +9658,10 @@ var deleteCommand6 = new import_commander49.Command("delete").description("NCS w
|
|
|
8855
9658
|
process.stderr.write(import_chalk17.default.green(`\u2713 NCS workload "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
8856
9659
|
`));
|
|
8857
9660
|
});
|
|
8858
|
-
var workloadCommand = new
|
|
9661
|
+
var workloadCommand = new import_commander53.Command("workload").description("NCS workload(\uB7F0\uD0C0\uC784 \uC2E4\uD589) \uAD00\uB9AC").addCommand(listCommand11).addCommand(getCommand9).addCommand(logsCommand).addCommand(eventsCommand2).addCommand(historyCommand).addCommand(scheduleHistoryCommand).addCommand(createCommand9).addCommand(updateCommand2).addCommand(patchCommand).addCommand(pauseCommand).addCommand(resumeCommand).addCommand(restartCommand).addCommand(deleteCommand8);
|
|
8859
9662
|
|
|
8860
9663
|
// src/commands/ncs/malware.ts
|
|
8861
|
-
var
|
|
9664
|
+
var import_commander54 = require("commander");
|
|
8862
9665
|
function parseEnabledOption(value) {
|
|
8863
9666
|
if (value === "true") return true;
|
|
8864
9667
|
if (value === "false") return false;
|
|
@@ -8867,7 +9670,7 @@ function parseEnabledOption(value) {
|
|
|
8867
9670
|
EXIT_PARAM_ERROR
|
|
8868
9671
|
);
|
|
8869
9672
|
}
|
|
8870
|
-
var configGetCommand = new
|
|
9673
|
+
var configGetCommand = new import_commander54.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
8871
9674
|
const opts = cmd.optsWithGlobals();
|
|
8872
9675
|
const { client } = await resolveNcsClient(opts);
|
|
8873
9676
|
startSpinner("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815 \uC870\uD68C \uC911...");
|
|
@@ -8886,7 +9689,7 @@ var configGetCommand = new import_commander50.Command("get").description("NCS \u
|
|
|
8886
9689
|
ids: []
|
|
8887
9690
|
});
|
|
8888
9691
|
});
|
|
8889
|
-
var configSetCommand = new
|
|
9692
|
+
var configSetCommand = new import_commander54.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
8890
9693
|
const opts = cmd.optsWithGlobals();
|
|
8891
9694
|
const enabled = parseEnabledOption(opts.enabled);
|
|
8892
9695
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8906,8 +9709,8 @@ var configSetCommand = new import_commander50.Command("set").description("NCS \u
|
|
|
8906
9709
|
ids: []
|
|
8907
9710
|
});
|
|
8908
9711
|
});
|
|
8909
|
-
var configCommand = new
|
|
8910
|
-
var resultCommand = new
|
|
9712
|
+
var configCommand = new import_commander54.Command("config").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815 \uAD00\uB9AC").addCommand(configGetCommand).addCommand(configSetCommand);
|
|
9713
|
+
var resultCommand = new import_commander54.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("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (workloadId, historyId, _opts, cmd) => {
|
|
8911
9714
|
const opts = cmd.optsWithGlobals();
|
|
8912
9715
|
requireNonEmpty(workloadId, "workloadId");
|
|
8913
9716
|
requireNonEmpty(historyId, "historyId");
|
|
@@ -8938,16 +9741,16 @@ var resultCommand = new import_commander50.Command("result").description("NCS wo
|
|
|
8938
9741
|
ids: []
|
|
8939
9742
|
});
|
|
8940
9743
|
});
|
|
8941
|
-
var malwareCommand = new
|
|
9744
|
+
var malwareCommand = new import_commander54.Command("malware").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uAD00\uB9AC").addCommand(configCommand).addCommand(resultCommand);
|
|
8942
9745
|
|
|
8943
9746
|
// src/commands/apigateway/service.ts
|
|
8944
|
-
var
|
|
9747
|
+
var import_commander55 = require("commander");
|
|
8945
9748
|
|
|
8946
9749
|
// src/commands/apigateway/helpers.ts
|
|
8947
9750
|
var import_promises8 = require("fs/promises");
|
|
8948
9751
|
|
|
8949
9752
|
// src/services/apigateway/client.ts
|
|
8950
|
-
var
|
|
9753
|
+
var import_ky15 = __toESM(require("ky"));
|
|
8951
9754
|
|
|
8952
9755
|
// src/services/apigateway/types.ts
|
|
8953
9756
|
function isApiGatewayService(value) {
|
|
@@ -9064,7 +9867,7 @@ var ApiGatewayClient = class {
|
|
|
9064
9867
|
let page = params.page ?? 1;
|
|
9065
9868
|
try {
|
|
9066
9869
|
while (true) {
|
|
9067
|
-
const response = await
|
|
9870
|
+
const response = await import_ky15.default.get(`${this.baseUrl}/services`, {
|
|
9068
9871
|
headers: this.authHeaders(),
|
|
9069
9872
|
searchParams: { page, limit },
|
|
9070
9873
|
retry: 0,
|
|
@@ -9104,7 +9907,7 @@ var ApiGatewayClient = class {
|
|
|
9104
9907
|
/** API Gateway service 한 건을 조회한다. */
|
|
9105
9908
|
async getService(apigwServiceId) {
|
|
9106
9909
|
try {
|
|
9107
|
-
const response = await
|
|
9910
|
+
const response = await import_ky15.default.get(`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}`, {
|
|
9108
9911
|
headers: this.authHeaders(),
|
|
9109
9912
|
retry: 0,
|
|
9110
9913
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -9125,7 +9928,7 @@ var ApiGatewayClient = class {
|
|
|
9125
9928
|
/** paging 없이 API Gateway resource 전체를 한 번에 조회한다. */
|
|
9126
9929
|
async listResources(apigwServiceId) {
|
|
9127
9930
|
try {
|
|
9128
|
-
const response = await
|
|
9931
|
+
const response = await import_ky15.default.get(
|
|
9129
9932
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resources`,
|
|
9130
9933
|
{
|
|
9131
9934
|
headers: this.authHeaders(),
|
|
@@ -9149,7 +9952,7 @@ var ApiGatewayClient = class {
|
|
|
9149
9952
|
/** API Gateway resource 경로 플러그인을 upsert한다. */
|
|
9150
9953
|
async setPathPlugins(apigwServiceId, resourceId2, pathPluginList) {
|
|
9151
9954
|
try {
|
|
9152
|
-
const response = await
|
|
9955
|
+
const response = await import_ky15.default.put(
|
|
9153
9956
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resource-paths/${encodeURIComponent(resourceId2)}`,
|
|
9154
9957
|
{
|
|
9155
9958
|
headers: this.authHeaders(),
|
|
@@ -9174,7 +9977,7 @@ var ApiGatewayClient = class {
|
|
|
9174
9977
|
/** API Gateway resource 메서드 플러그인을 upsert한다. */
|
|
9175
9978
|
async setMethodPlugins(apigwServiceId, resourceId2, body) {
|
|
9176
9979
|
try {
|
|
9177
|
-
const response = await
|
|
9980
|
+
const response = await import_ky15.default.put(
|
|
9178
9981
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resource-methods/${encodeURIComponent(resourceId2)}`,
|
|
9179
9982
|
{
|
|
9180
9983
|
headers: this.authHeaders(),
|
|
@@ -9199,7 +10002,7 @@ var ApiGatewayClient = class {
|
|
|
9199
10002
|
/** API Gateway resource 요청 parameter를 조회한다. */
|
|
9200
10003
|
async getResourceParameters(apigwServiceId, resourceId2) {
|
|
9201
10004
|
try {
|
|
9202
|
-
const response = await
|
|
10005
|
+
const response = await import_ky15.default.get(
|
|
9203
10006
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resources/${encodeURIComponent(resourceId2)}/parameters`,
|
|
9204
10007
|
{
|
|
9205
10008
|
headers: this.authHeaders(),
|
|
@@ -9229,7 +10032,7 @@ var ApiGatewayClient = class {
|
|
|
9229
10032
|
/** API Gateway resource 응답 정의를 조회한다. */
|
|
9230
10033
|
async getResourceResponses(apigwServiceId, resourceId2) {
|
|
9231
10034
|
try {
|
|
9232
|
-
const response = await
|
|
10035
|
+
const response = await import_ky15.default.get(
|
|
9233
10036
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resources/${encodeURIComponent(resourceId2)}/responses`,
|
|
9234
10037
|
{
|
|
9235
10038
|
headers: this.authHeaders(),
|
|
@@ -9260,7 +10063,7 @@ var ApiGatewayClient = class {
|
|
|
9260
10063
|
let page = 1;
|
|
9261
10064
|
try {
|
|
9262
10065
|
while (true) {
|
|
9263
|
-
const response = await
|
|
10066
|
+
const response = await import_ky15.default.get(
|
|
9264
10067
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages`,
|
|
9265
10068
|
{
|
|
9266
10069
|
headers: this.authHeaders(),
|
|
@@ -9303,7 +10106,7 @@ var ApiGatewayClient = class {
|
|
|
9303
10106
|
/** API Gateway stage의 backend endpoint와 설명을 수정한다. */
|
|
9304
10107
|
async updateStage(apigwServiceId, stageId, body) {
|
|
9305
10108
|
try {
|
|
9306
|
-
const response = await
|
|
10109
|
+
const response = await import_ky15.default.put(
|
|
9307
10110
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}`,
|
|
9308
10111
|
{
|
|
9309
10112
|
headers: this.authHeaders(),
|
|
@@ -9328,7 +10131,7 @@ var ApiGatewayClient = class {
|
|
|
9328
10131
|
/** 사용자 정의 Swagger 객체를 내부 해석 없이 반환한다. */
|
|
9329
10132
|
async getStageSwagger(apigwServiceId, stageId) {
|
|
9330
10133
|
try {
|
|
9331
|
-
const response = await
|
|
10134
|
+
const response = await import_ky15.default.get(
|
|
9332
10135
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/swagger`,
|
|
9333
10136
|
{
|
|
9334
10137
|
headers: this.authHeaders(),
|
|
@@ -9352,7 +10155,7 @@ var ApiGatewayClient = class {
|
|
|
9352
10155
|
/** paging 없이 배포된 API Gateway stage resource 전체를 한 번에 조회한다. */
|
|
9353
10156
|
async listStageResources(apigwServiceId, stageId) {
|
|
9354
10157
|
try {
|
|
9355
|
-
const response = await
|
|
10158
|
+
const response = await import_ky15.default.get(
|
|
9356
10159
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/resources`,
|
|
9357
10160
|
{
|
|
9358
10161
|
headers: this.authHeaders(),
|
|
@@ -9376,7 +10179,7 @@ var ApiGatewayClient = class {
|
|
|
9376
10179
|
/** API Gateway service resource를 stage에 반영한다. */
|
|
9377
10180
|
async importStageResources(apigwServiceId, stageId) {
|
|
9378
10181
|
try {
|
|
9379
|
-
const response = await
|
|
10182
|
+
const response = await import_ky15.default.put(
|
|
9380
10183
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/resources`,
|
|
9381
10184
|
{
|
|
9382
10185
|
headers: this.authHeaders(),
|
|
@@ -9401,7 +10204,7 @@ var ApiGatewayClient = class {
|
|
|
9401
10204
|
async createDeploy(apigwServiceId, stageId, body) {
|
|
9402
10205
|
const json = body.deployDescription === void 0 ? {} : { deployDescription: body.deployDescription };
|
|
9403
10206
|
try {
|
|
9404
|
-
const response = await
|
|
10207
|
+
const response = await import_ky15.default.post(
|
|
9405
10208
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/deploys`,
|
|
9406
10209
|
{
|
|
9407
10210
|
headers: this.authHeaders(),
|
|
@@ -9419,7 +10222,7 @@ var ApiGatewayClient = class {
|
|
|
9419
10222
|
/** 배포 이력의 설정으로 API Gateway stage를 롤백한다. */
|
|
9420
10223
|
async rollbackDeploy(apigwServiceId, stageId, deployId) {
|
|
9421
10224
|
try {
|
|
9422
|
-
const response = await
|
|
10225
|
+
const response = await import_ky15.default.post(
|
|
9423
10226
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/deploys/${encodeURIComponent(deployId)}/rollback`,
|
|
9424
10227
|
{
|
|
9425
10228
|
headers: this.authHeaders(),
|
|
@@ -9447,7 +10250,7 @@ var ApiGatewayClient = class {
|
|
|
9447
10250
|
let page = 1;
|
|
9448
10251
|
try {
|
|
9449
10252
|
while (true) {
|
|
9450
|
-
const response = await
|
|
10253
|
+
const response = await import_ky15.default.get(
|
|
9451
10254
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/deploys`,
|
|
9452
10255
|
{
|
|
9453
10256
|
headers: this.authHeaders(),
|
|
@@ -9490,7 +10293,7 @@ var ApiGatewayClient = class {
|
|
|
9490
10293
|
/** API Gateway stage 최신 배포 결과를 조회한다. */
|
|
9491
10294
|
async getLatestDeploy(apigwServiceId, stageId) {
|
|
9492
10295
|
try {
|
|
9493
|
-
const response = await
|
|
10296
|
+
const response = await import_ky15.default.get(
|
|
9494
10297
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/deploys/latest`,
|
|
9495
10298
|
{
|
|
9496
10299
|
headers: this.authHeaders(),
|
|
@@ -9546,7 +10349,7 @@ function fileErrorReason(error) {
|
|
|
9546
10349
|
}
|
|
9547
10350
|
return error instanceof Error ? error.message : String(error);
|
|
9548
10351
|
}
|
|
9549
|
-
function
|
|
10352
|
+
function requireYes2(yes, operation) {
|
|
9550
10353
|
if (!yes) {
|
|
9551
10354
|
throw new NhnCloudCliError(
|
|
9552
10355
|
`${operation}\uC5D0\uB294 --yes \uD50C\uB798\uADF8\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.`,
|
|
@@ -9642,7 +10445,7 @@ async function resolveApiGatewayClient(opts) {
|
|
|
9642
10445
|
}
|
|
9643
10446
|
|
|
9644
10447
|
// src/commands/apigateway/service.ts
|
|
9645
|
-
var
|
|
10448
|
+
var listCommand12 = new import_commander55.Command("list").description("API Gateway service \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, command) => {
|
|
9646
10449
|
const opts = command.optsWithGlobals();
|
|
9647
10450
|
const { client } = await resolveApiGatewayClient(opts);
|
|
9648
10451
|
startSpinner("API Gateway service \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -9673,7 +10476,7 @@ var listCommand10 = new import_commander51.Command("list").description("API Gate
|
|
|
9673
10476
|
ids: services.map((service) => sanitizeForTerminal(service.apigwServiceId))
|
|
9674
10477
|
});
|
|
9675
10478
|
});
|
|
9676
|
-
var
|
|
10479
|
+
var getCommand10 = new import_commander55.Command("get").description("API Gateway service \uD55C \uAC74\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").argument("<service-id>", "API Gateway service ID").option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (serviceId, _opts, command) => {
|
|
9677
10480
|
const opts = command.optsWithGlobals();
|
|
9678
10481
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
9679
10482
|
const displayServiceId = sanitizeForTerminal(parsedServiceId);
|
|
@@ -9706,10 +10509,10 @@ var getCommand8 = new import_commander51.Command("get").description("API Gateway
|
|
|
9706
10509
|
ids: [sanitizeForTerminal(service.apigwServiceId)]
|
|
9707
10510
|
});
|
|
9708
10511
|
});
|
|
9709
|
-
var serviceCommand = new
|
|
10512
|
+
var serviceCommand = new import_commander55.Command("service").description("API Gateway service \uC870\uD68C \uBA85\uB839").addCommand(listCommand12).addCommand(getCommand10);
|
|
9710
10513
|
|
|
9711
10514
|
// src/commands/apigateway/resource.ts
|
|
9712
|
-
var
|
|
10515
|
+
var import_commander56 = require("commander");
|
|
9713
10516
|
function addApiGatewayOptions(command) {
|
|
9714
10517
|
return command.option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984");
|
|
9715
10518
|
}
|
|
@@ -9790,8 +10593,8 @@ function updatedResourceOutput(opts, resources) {
|
|
|
9790
10593
|
ids: resources.map((resource) => sanitizeForTerminal(resource.resourceId))
|
|
9791
10594
|
});
|
|
9792
10595
|
}
|
|
9793
|
-
var
|
|
9794
|
-
new
|
|
10596
|
+
var listCommand13 = addApiGatewayOptions(
|
|
10597
|
+
new import_commander56.Command("list").description("API Gateway resource \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").argument("<service-id>", "API Gateway service ID")
|
|
9795
10598
|
).action(async (serviceId, _opts, command) => {
|
|
9796
10599
|
const opts = command.optsWithGlobals();
|
|
9797
10600
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -9820,7 +10623,7 @@ var listCommand11 = addApiGatewayOptions(
|
|
|
9820
10623
|
});
|
|
9821
10624
|
});
|
|
9822
10625
|
var parametersCommand = addApiGatewayOptions(
|
|
9823
|
-
new
|
|
10626
|
+
new import_commander56.Command("parameters").description("API Gateway resource \uC694\uCCAD parameter\uB97C \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").argument("<service-id>", "API Gateway service ID").argument("<resource-id>", "API Gateway resource ID")
|
|
9824
10627
|
).action(async (serviceId, resourceId2, _opts, command) => {
|
|
9825
10628
|
const opts = command.optsWithGlobals();
|
|
9826
10629
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -9849,7 +10652,7 @@ var parametersCommand = addApiGatewayOptions(
|
|
|
9849
10652
|
});
|
|
9850
10653
|
});
|
|
9851
10654
|
var responsesCommand = addApiGatewayOptions(
|
|
9852
|
-
new
|
|
10655
|
+
new import_commander56.Command("responses").description("API Gateway resource \uC751\uB2F5 \uC815\uC758\uB97C \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").argument("<service-id>", "API Gateway service ID").argument("<resource-id>", "API Gateway resource ID")
|
|
9853
10656
|
).action(async (serviceId, resourceId2, _opts, command) => {
|
|
9854
10657
|
const opts = command.optsWithGlobals();
|
|
9855
10658
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -9875,7 +10678,7 @@ var responsesCommand = addApiGatewayOptions(
|
|
|
9875
10678
|
});
|
|
9876
10679
|
});
|
|
9877
10680
|
var setPathPluginCommand = addApiGatewayOptions(
|
|
9878
|
-
new
|
|
10681
|
+
new import_commander56.Command("set-path-plugin").description("API Gateway resource \uACBD\uB85C \uD50C\uB7EC\uADF8\uC778\uC744 \uC124\uC815\uD55C\uB2E4").argument("<service-id>", "API Gateway service ID").argument("<resource-id>", "API Gateway resource ID").requiredOption("--config-file <path>", "\uD50C\uB7EC\uADF8\uC778 \uC124\uC815 JSON \uD30C\uC77C").option("--dry-run", "\uC4F0\uAE30 \uC5C6\uC774 \uC608\uC0C1 \uC601\uD5A5 \uBC94\uC704\uB97C \uCD9C\uB825\uD55C\uB2E4").option("--yes", "\uB9AC\uC18C\uC2A4 \uACBD\uB85C \uD50C\uB7EC\uADF8\uC778 \uC124\uC815\uC744 \uD655\uC778\uD55C\uB2E4")
|
|
9879
10682
|
).action(async (serviceId, resourceId2, _opts, command) => {
|
|
9880
10683
|
const opts = command.optsWithGlobals();
|
|
9881
10684
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -9891,7 +10694,7 @@ var setPathPluginCommand = addApiGatewayOptions(
|
|
|
9891
10694
|
"\uACBD\uACE0: applyChildPath\uC640 delete\uAC00 \uD568\uAED8 true\uC774\uBA74 \uD558\uC704 \uC804\uCCB4\uC5D0\uC11C \uD574\uB2F9 \uD50C\uB7EC\uADF8\uC778\uC774 \uC0AD\uC81C\uB429\uB2C8\uB2E4.\n"
|
|
9892
10695
|
);
|
|
9893
10696
|
}
|
|
9894
|
-
if (!opts.dryRun)
|
|
10697
|
+
if (!opts.dryRun) requireYes2(opts.yes, "\uB9AC\uC18C\uC2A4 \uACBD\uB85C \uD50C\uB7EC\uADF8\uC778 \uC124\uC815");
|
|
9895
10698
|
const { client } = await resolveApiGatewayClient(opts);
|
|
9896
10699
|
const displayResourceId = sanitizeForTerminal(parsedResourceId);
|
|
9897
10700
|
const spinnerAction = opts.dryRun ? "\uACBD\uB85C \uD50C\uB7EC\uADF8\uC778 \uC601\uD5A5 \uBC94\uC704 \uD655\uC778" : "\uACBD\uB85C \uD50C\uB7EC\uADF8\uC778 \uC124\uC815";
|
|
@@ -9949,13 +10752,13 @@ var setPathPluginCommand = addApiGatewayOptions(
|
|
|
9949
10752
|
updatedResourceOutput(opts, updatedResources);
|
|
9950
10753
|
});
|
|
9951
10754
|
var setMethodPluginCommand = addApiGatewayOptions(
|
|
9952
|
-
new
|
|
10755
|
+
new import_commander56.Command("set-method-plugin").description("API Gateway resource \uBA54\uC11C\uB4DC \uD50C\uB7EC\uADF8\uC778\uC744 \uC124\uC815\uD55C\uB2E4").argument("<service-id>", "API Gateway service ID").argument("<resource-id>", "API Gateway resource ID").requiredOption("--config-file <path>", "\uD50C\uB7EC\uADF8\uC778 \uC124\uC815 JSON \uD30C\uC77C").option("--dry-run", "\uC4F0\uAE30 \uC5C6\uC774 \uC608\uC0C1 \uBCC0\uACBD \uB0B4\uC6A9\uC744 \uCD9C\uB825\uD55C\uB2E4").option("--yes", "\uB9AC\uC18C\uC2A4 \uBA54\uC11C\uB4DC \uD50C\uB7EC\uADF8\uC778 \uC124\uC815\uC744 \uD655\uC778\uD55C\uB2E4")
|
|
9953
10756
|
).action(async (serviceId, resourceId2, _opts, command) => {
|
|
9954
10757
|
const opts = command.optsWithGlobals();
|
|
9955
10758
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
9956
10759
|
const parsedResourceId = parseRequiredArgument(resourceId2, "resource-id");
|
|
9957
10760
|
const config = parseMethodPluginConfig(await readPluginConfigFile(opts.configFile));
|
|
9958
|
-
if (!opts.dryRun)
|
|
10761
|
+
if (!opts.dryRun) requireYes2(opts.yes, "\uB9AC\uC18C\uC2A4 \uBA54\uC11C\uB4DC \uD50C\uB7EC\uADF8\uC778 \uC124\uC815");
|
|
9959
10762
|
const { client } = await resolveApiGatewayClient(opts);
|
|
9960
10763
|
const displayResourceId = sanitizeForTerminal(parsedResourceId);
|
|
9961
10764
|
const spinnerAction = opts.dryRun ? "\uBA54\uC11C\uB4DC \uD50C\uB7EC\uADF8\uC778 \uC601\uD5A5 \uBC94\uC704 \uD655\uC778" : "\uBA54\uC11C\uB4DC \uD50C\uB7EC\uADF8\uC778 \uC124\uC815";
|
|
@@ -10037,19 +10840,19 @@ var setMethodPluginCommand = addApiGatewayOptions(
|
|
|
10037
10840
|
}
|
|
10038
10841
|
updatedResourceOutput(opts, updatedResources);
|
|
10039
10842
|
});
|
|
10040
|
-
var resourceCommand = new
|
|
10843
|
+
var resourceCommand = new import_commander56.Command("resource").description("API Gateway resource \uC870\uD68C \uBC0F \uBCC0\uACBD \uBA85\uB839").addCommand(listCommand13).addCommand(parametersCommand).addCommand(responsesCommand).addCommand(setPathPluginCommand).addCommand(setMethodPluginCommand);
|
|
10041
10844
|
|
|
10042
10845
|
// src/commands/apigateway/stage.ts
|
|
10043
10846
|
var import_promises9 = require("fs/promises");
|
|
10044
|
-
var
|
|
10847
|
+
var import_commander58 = require("commander");
|
|
10045
10848
|
|
|
10046
10849
|
// src/commands/apigateway/deploy.ts
|
|
10047
|
-
var
|
|
10850
|
+
var import_commander57 = require("commander");
|
|
10048
10851
|
function addApiGatewayOptions2(command) {
|
|
10049
10852
|
return command.option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984");
|
|
10050
10853
|
}
|
|
10051
|
-
var
|
|
10052
|
-
new
|
|
10854
|
+
var listCommand14 = addApiGatewayOptions2(
|
|
10855
|
+
new import_commander57.Command("list").description("API Gateway stage \uBC30\uD3EC \uC774\uB825 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").argument("<service-id>", "API Gateway service ID").argument("<stage-id>", "API Gateway stage ID")
|
|
10053
10856
|
).action(async (serviceId, stageId, _opts, command) => {
|
|
10054
10857
|
const opts = command.optsWithGlobals();
|
|
10055
10858
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -10078,7 +10881,7 @@ var listCommand12 = addApiGatewayOptions2(
|
|
|
10078
10881
|
});
|
|
10079
10882
|
});
|
|
10080
10883
|
var latestCommand = addApiGatewayOptions2(
|
|
10081
|
-
new
|
|
10884
|
+
new import_commander57.Command("latest").description("API Gateway stage \uCD5C\uC2E0 \uBC30\uD3EC \uACB0\uACFC\uB97C \uC870\uD68C\uD55C\uB2E4 (resource \uC804\uCCB4\uB294 --json)").argument("<service-id>", "API Gateway service ID").argument("<stage-id>", "API Gateway stage ID")
|
|
10082
10885
|
).action(async (serviceId, stageId, _opts, command) => {
|
|
10083
10886
|
const opts = command.optsWithGlobals();
|
|
10084
10887
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -10107,8 +10910,8 @@ var latestCommand = addApiGatewayOptions2(
|
|
|
10107
10910
|
ids: [sanitizeForTerminal(deploy.deployId)]
|
|
10108
10911
|
});
|
|
10109
10912
|
});
|
|
10110
|
-
var
|
|
10111
|
-
new
|
|
10913
|
+
var createCommand10 = addApiGatewayOptions2(
|
|
10914
|
+
new import_commander57.Command("create").description("stage \uC124\uC815\uC744 API Gateway service \uC5D0 \uBC30\uD3EC\uD55C\uB2E4").argument("<service-id>", "API Gateway service ID").argument("<stage-id>", "API Gateway stage ID").option("--description <text>", "\uBC30\uD3EC \uC124\uBA85 (\uCD5C\uB300 200\uC790)").option("--no-wait", "\uBC30\uD3EC \uACB0\uACFC\uB97C \uAE30\uB2E4\uB9AC\uC9C0 \uC54A\uACE0 \uC694\uCCAD\uB9CC \uD55C\uB2E4").option("--timeout <sec>", "\uBC30\uD3EC \uB300\uAE30 \uC0C1\uD55C (\uCD08, \uAE30\uBCF8 300)", "300").option("--yes", "\uBC30\uD3EC\uB97C \uD655\uC778\uD55C\uB2E4")
|
|
10112
10915
|
).action(async (serviceId, stageId, _opts, command) => {
|
|
10113
10916
|
const opts = command.optsWithGlobals();
|
|
10114
10917
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -10126,7 +10929,7 @@ var createCommand8 = addApiGatewayOptions2(
|
|
|
10126
10929
|
);
|
|
10127
10930
|
}
|
|
10128
10931
|
const timeoutMs = parsePositiveIntegerOption(opts.timeout ?? "300", "--timeout") * 1e3;
|
|
10129
|
-
|
|
10932
|
+
requireYes2(opts.yes, "\uC2A4\uD14C\uC774\uC9C0 \uBC30\uD3EC");
|
|
10130
10933
|
const displayStageId = sanitizeForTerminal(parsedStageId);
|
|
10131
10934
|
const { client } = await resolveApiGatewayClient(opts);
|
|
10132
10935
|
let baselineDeployId = null;
|
|
@@ -10206,13 +11009,13 @@ var createCommand8 = addApiGatewayOptions2(
|
|
|
10206
11009
|
});
|
|
10207
11010
|
});
|
|
10208
11011
|
var rollbackCommand = addApiGatewayOptions2(
|
|
10209
|
-
new
|
|
11012
|
+
new import_commander57.Command("rollback").description("\uBC30\uD3EC \uC774\uB825\uC73C\uB85C stage \uC124\uC815\uC744 \uB418\uB3CC\uB9B0\uB2E4").argument("<service-id>", "API Gateway service ID").argument("<stage-id>", "API Gateway stage ID").argument("<deploy-id>", "\uB418\uB3CC\uB9B4 \uBC30\uD3EC ID").option("--yes", "\uB418\uB3CC\uB9AC\uAE30\uB97C \uD655\uC778\uD55C\uB2E4")
|
|
10210
11013
|
).action(async (serviceId, stageId, deployId, _opts, command) => {
|
|
10211
11014
|
const opts = command.optsWithGlobals();
|
|
10212
11015
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
10213
11016
|
const parsedStageId = parseRequiredArgument(stageId, "stage-id");
|
|
10214
11017
|
const parsedDeployId = parseRequiredArgument(deployId, "deploy-id");
|
|
10215
|
-
|
|
11018
|
+
requireYes2(opts.yes, "\uC2A4\uD14C\uC774\uC9C0 \uB418\uB3CC\uB9AC\uAE30");
|
|
10216
11019
|
const displayStageId = sanitizeForTerminal(parsedStageId);
|
|
10217
11020
|
const { client } = await resolveApiGatewayClient(opts);
|
|
10218
11021
|
startSpinner(`API Gateway stage "${displayStageId}" \uB418\uB3CC\uB9AC\uB294 \uC911...`);
|
|
@@ -10234,7 +11037,7 @@ var rollbackCommand = addApiGatewayOptions2(
|
|
|
10234
11037
|
);
|
|
10235
11038
|
process.stderr.write("\uC644\uB8CC: \uC9C1\uC804\uAE4C\uC9C0\uC758 \uC2A4\uD14C\uC774\uC9C0 \uC124\uC815\uC740 \uC774 \uBC30\uD3EC \uC774\uB825\uC758 \uB0B4\uC6A9\uC73C\uB85C \uB300\uCCB4\uB410\uC2B5\uB2C8\uB2E4.\n");
|
|
10236
11039
|
});
|
|
10237
|
-
var deployCommand = new
|
|
11040
|
+
var deployCommand = new import_commander57.Command("deploy").description("API Gateway stage \uBC30\uD3EC \uC870\uD68C\uC640 \uC2E4\uD589 \uBA85\uB839").addCommand(listCommand14).addCommand(latestCommand).addCommand(createCommand10).addCommand(rollbackCommand);
|
|
10238
11041
|
|
|
10239
11042
|
// src/commands/apigateway/stage.ts
|
|
10240
11043
|
function addApiGatewayOptions3(command) {
|
|
@@ -10262,8 +11065,8 @@ async function writeStageSwaggerFile(path5, swagger, force) {
|
|
|
10262
11065
|
);
|
|
10263
11066
|
}
|
|
10264
11067
|
}
|
|
10265
|
-
var
|
|
10266
|
-
new
|
|
11068
|
+
var listCommand15 = addApiGatewayOptions3(
|
|
11069
|
+
new import_commander58.Command("list").description("API Gateway stage \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (resourceUpdatedAt\uC740 \uB9AC\uC18C\uC2A4 \uBC18\uC601 \uC2DC\uAC01)").argument("<service-id>", "API Gateway service ID")
|
|
10267
11070
|
).action(async (serviceId, _opts, command) => {
|
|
10268
11071
|
const opts = command.optsWithGlobals();
|
|
10269
11072
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -10292,7 +11095,7 @@ var listCommand13 = addApiGatewayOptions3(
|
|
|
10292
11095
|
});
|
|
10293
11096
|
});
|
|
10294
11097
|
var swaggerCommand = addApiGatewayOptions3(
|
|
10295
|
-
new
|
|
11098
|
+
new import_commander58.Command("swagger").description("API Gateway stage Swagger\uB97C \uCD9C\uB825\uD558\uAC70\uB098 \uC800\uC7A5\uD55C\uB2E4").argument("<service-id>", "API Gateway service ID").argument("<stage-id>", "API Gateway stage ID").option("--output <file>", "Swagger JSON \uC800\uC7A5 \uACBD\uB85C").option("--force", "\uAE30\uC874 \uD30C\uC77C \uB36E\uC5B4\uC4F0\uAE30")
|
|
10296
11099
|
).action(async (serviceId, stageId, _opts, command) => {
|
|
10297
11100
|
const opts = command.optsWithGlobals();
|
|
10298
11101
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -10316,7 +11119,7 @@ var swaggerCommand = addApiGatewayOptions3(
|
|
|
10316
11119
|
printJson(swagger);
|
|
10317
11120
|
});
|
|
10318
11121
|
var resourcesCommand = addApiGatewayOptions3(
|
|
10319
|
-
new
|
|
11122
|
+
new import_commander58.Command("resources").description("\uBC30\uD3EC\uB41C API Gateway stage resource \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").argument("<service-id>", "API Gateway service ID").argument("<stage-id>", "API Gateway stage ID")
|
|
10320
11123
|
).action(async (serviceId, stageId, _opts, command) => {
|
|
10321
11124
|
const opts = command.optsWithGlobals();
|
|
10322
11125
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -10345,8 +11148,8 @@ var resourcesCommand = addApiGatewayOptions3(
|
|
|
10345
11148
|
ids: resources.map((resource) => sanitizeForTerminal(resource.stageResourceId))
|
|
10346
11149
|
});
|
|
10347
11150
|
});
|
|
10348
|
-
var
|
|
10349
|
-
new
|
|
11151
|
+
var updateCommand3 = addApiGatewayOptions3(
|
|
11152
|
+
new import_commander58.Command("update").description("API Gateway stage\uC758 backend endpoint URL\uACFC \uC124\uBA85\uC744 \uC218\uC815\uD55C\uB2E4").argument("<service-id>", "API Gateway service ID").argument("<stage-id>", "API Gateway stage ID").option("--backend-endpoint-url <url>", "\uBCC0\uACBD\uD560 backend endpoint URL").option("--description <text>", "\uBCC0\uACBD\uD560 stage \uC124\uBA85").option("--yes", "\uC2A4\uD14C\uC774\uC9C0 \uC218\uC815\uC744 \uD655\uC778\uD55C\uB2E4")
|
|
10350
11153
|
).action(async (serviceId, stageId, _opts, command) => {
|
|
10351
11154
|
const opts = command.optsWithGlobals();
|
|
10352
11155
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
@@ -10357,7 +11160,7 @@ var updateCommand2 = addApiGatewayOptions3(
|
|
|
10357
11160
|
EXIT_PARAM_ERROR
|
|
10358
11161
|
);
|
|
10359
11162
|
}
|
|
10360
|
-
|
|
11163
|
+
requireYes2(opts.yes, "\uC2A4\uD14C\uC774\uC9C0 \uC218\uC815");
|
|
10361
11164
|
const displayStageId = sanitizeForTerminal(parsedStageId);
|
|
10362
11165
|
const { client } = await resolveApiGatewayClient(opts);
|
|
10363
11166
|
startSpinner(`API Gateway stage "${displayStageId}" \uC218\uC815 \uC911...`);
|
|
@@ -10395,12 +11198,12 @@ var updateCommand2 = addApiGatewayOptions3(
|
|
|
10395
11198
|
process.stderr.write("\uC548\uB0B4: \uC2A4\uD14C\uC774\uC9C0 \uBCC0\uACBD \uD6C4 \uC2E4\uC81C \uD2B8\uB798\uD53D \uBC18\uC601 \uC0C1\uD0DC\uB97C \uD655\uC778\uD558\uC138\uC694.\n");
|
|
10396
11199
|
});
|
|
10397
11200
|
var importResourcesCommand = addApiGatewayOptions3(
|
|
10398
|
-
new
|
|
11201
|
+
new import_commander58.Command("import-resources").description("API Gateway service \uC758 \uB9AC\uC18C\uC2A4\uB97C stage \uB85C \uAC00\uC838\uC628\uB2E4").argument("<service-id>", "API Gateway service ID").argument("<stage-id>", "API Gateway stage ID").option("--yes", "\uC2A4\uD14C\uC774\uC9C0 \uBC18\uC601\uC744 \uD655\uC778\uD55C\uB2E4")
|
|
10399
11202
|
).action(async (serviceId, stageId, _opts, command) => {
|
|
10400
11203
|
const opts = command.optsWithGlobals();
|
|
10401
11204
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
10402
11205
|
const parsedStageId = parseRequiredArgument(stageId, "stage-id");
|
|
10403
|
-
|
|
11206
|
+
requireYes2(opts.yes, "\uC2A4\uD14C\uC774\uC9C0 \uBC18\uC601");
|
|
10404
11207
|
const displayStageId = sanitizeForTerminal(parsedStageId);
|
|
10405
11208
|
const { client } = await resolveApiGatewayClient(opts);
|
|
10406
11209
|
startSpinner(`API Gateway stage "${displayStageId}" \uB9AC\uC18C\uC2A4 \uBC18\uC601 \uC911...`);
|
|
@@ -10417,19 +11220,1343 @@ var importResourcesCommand = addApiGatewayOptions3(
|
|
|
10417
11220
|
"\uC548\uB0B4: \uBC18\uC601\uC740 \uC2A4\uD14C\uC774\uC9C0 \uC124\uC815\uB9CC \uBC14\uAFC9\uB2C8\uB2E4. \uC11C\uBE44\uC2A4\uC5D0 \uC801\uC6A9\uD558\uB824\uBA74 apigateway stage deploy create \uB97C \uC2E4\uD589\uD558\uC138\uC694.\n"
|
|
10418
11221
|
);
|
|
10419
11222
|
});
|
|
10420
|
-
var stageCommand = new
|
|
11223
|
+
var stageCommand = new import_commander58.Command("stage").description("API Gateway stage \uC870\uD68C \uBC0F \uBCC0\uACBD \uBA85\uB839").addCommand(listCommand15).addCommand(swaggerCommand).addCommand(resourcesCommand).addCommand(updateCommand3).addCommand(importResourcesCommand).addCommand(deployCommand);
|
|
11224
|
+
|
|
11225
|
+
// src/commands/skm/confirm.ts
|
|
11226
|
+
var import_commander59 = require("commander");
|
|
11227
|
+
|
|
11228
|
+
// src/commands/skm/helpers.ts
|
|
11229
|
+
var import_node_net2 = require("net");
|
|
11230
|
+
|
|
11231
|
+
// src/services/skm/client.ts
|
|
11232
|
+
var import_ky16 = __toESM(require("ky"));
|
|
11233
|
+
|
|
11234
|
+
// src/services/skm/types.ts
|
|
11235
|
+
function isRecord3(value) {
|
|
11236
|
+
return typeof value === "object" && value !== null;
|
|
11237
|
+
}
|
|
11238
|
+
function hasStrings(obj, keys) {
|
|
11239
|
+
return keys.every((key) => typeof obj[key] === "string");
|
|
11240
|
+
}
|
|
11241
|
+
function hasNumbers(obj, keys) {
|
|
11242
|
+
return keys.every((key) => typeof obj[key] === "number");
|
|
11243
|
+
}
|
|
11244
|
+
function hasOptional(obj, keys, type) {
|
|
11245
|
+
return keys.every((key) => obj[key] === void 0 || obj[key] === null || typeof obj[key] === type);
|
|
11246
|
+
}
|
|
11247
|
+
var AUDIT_FIELDS = ["creationUser", "creationDatetime", "lastChangeUser", "lastChangeDatetime"];
|
|
11248
|
+
function isSkmClientInfo(value) {
|
|
11249
|
+
if (!isRecord3(value)) return false;
|
|
11250
|
+
return typeof value["clientIp"] === "string" && typeof value["clientSentCertificate"] === "boolean" && hasOptional(value, ["clientMacHeader"], "string");
|
|
11251
|
+
}
|
|
11252
|
+
function isSkmKeyStore(value) {
|
|
11253
|
+
if (!isRecord3(value)) return false;
|
|
11254
|
+
return typeof value["keyStoreId"] === "number" && hasStrings(value, ["name", "ip4AuthUse", "macAuthUse", "certificateAuthUse"]) && hasOptional(value, ["description", ...AUDIT_FIELDS], "string");
|
|
11255
|
+
}
|
|
11256
|
+
function isSkmKey(value) {
|
|
11257
|
+
if (!isRecord3(value)) return false;
|
|
11258
|
+
return hasStrings(value, ["keyId", "name", "keyType"]) && typeof value["currentKeyValueVersion"] === "number" && hasOptional(value, ["autoRotationPeriod"], "number") && hasOptional(
|
|
11259
|
+
value,
|
|
11260
|
+
["description", "nextAutoRotationDate", "lastAccessDatetime", "deletionDatetime", ...AUDIT_FIELDS],
|
|
11261
|
+
"string"
|
|
11262
|
+
);
|
|
11263
|
+
}
|
|
11264
|
+
function isSkmAuthDetail(value) {
|
|
11265
|
+
if (!isRecord3(value)) return false;
|
|
11266
|
+
return (typeof value["value"] === "string" || typeof value["name"] === "string") && hasOptional(
|
|
11267
|
+
value,
|
|
11268
|
+
[
|
|
11269
|
+
"value",
|
|
11270
|
+
"name",
|
|
11271
|
+
"password",
|
|
11272
|
+
"description",
|
|
11273
|
+
"expirationDate",
|
|
11274
|
+
"lastAccessDatetime",
|
|
11275
|
+
"deletionDatetime",
|
|
11276
|
+
...AUDIT_FIELDS
|
|
11277
|
+
],
|
|
11278
|
+
"string"
|
|
11279
|
+
);
|
|
11280
|
+
}
|
|
11281
|
+
function isSkmEncryptResult(value) {
|
|
11282
|
+
return isRecord3(value) && hasStrings(value, ["ciphertext"]) && hasNumbers(value, ["keyVersion"]);
|
|
11283
|
+
}
|
|
11284
|
+
function isSkmDecryptResult(value) {
|
|
11285
|
+
return isRecord3(value) && hasStrings(value, ["plaintext"]) && hasNumbers(value, ["keyVersion"]);
|
|
11286
|
+
}
|
|
11287
|
+
function isSkmLocalKey(value) {
|
|
11288
|
+
return isRecord3(value) && hasStrings(value, ["localKeyPlaintext", "localKeyCiphertext"]) && hasNumbers(value, ["keyVersion"]);
|
|
11289
|
+
}
|
|
11290
|
+
function isSkmSymmetricKey(value) {
|
|
11291
|
+
return isRecord3(value) && hasStrings(value, ["symmetricKey"]) && hasNumbers(value, ["keyVersion"]);
|
|
11292
|
+
}
|
|
11293
|
+
function isSkmSignResult(value) {
|
|
11294
|
+
return isRecord3(value) && hasStrings(value, ["signature"]) && hasNumbers(value, ["keyVersion"]);
|
|
11295
|
+
}
|
|
11296
|
+
function isSkmStandardSignResult(value) {
|
|
11297
|
+
return isRecord3(value) && hasStrings(value, ["signature", "algorithm", "hashAlgorithm", "mgfAlgorithm"]) && hasNumbers(value, ["keyVersion", "saltLength"]);
|
|
11298
|
+
}
|
|
11299
|
+
function isSkmVerifyResult(value) {
|
|
11300
|
+
return isRecord3(value) && typeof value["result"] === "boolean" && hasNumbers(value, ["keyVersion"]);
|
|
11301
|
+
}
|
|
11302
|
+
function isSkmAsymmetricKeyMaterial(value) {
|
|
11303
|
+
return isRecord3(value) && hasStrings(value, ["keyType", "key", "encodedKey"]) && hasOptional(value, ["standardEncodedKey"], "string") && hasNumbers(value, ["keyVersion"]);
|
|
11304
|
+
}
|
|
11305
|
+
function isSkmCreatedKey(value) {
|
|
11306
|
+
return isRecord3(value) && hasStrings(value, ["keyId", "keyStatus"]);
|
|
11307
|
+
}
|
|
11308
|
+
function isSkmCreatedKeyStore(value) {
|
|
11309
|
+
if (!isRecord3(value)) return false;
|
|
11310
|
+
return typeof value["keyStoreId"] === "number" && hasStrings(value, ["name", "ip4AuthUse", "macAuthUse", "certificateAuthUse"]) && hasOptional(value, ["description", "authMode"], "string");
|
|
11311
|
+
}
|
|
11312
|
+
function isSkmUpdatedSecret(value) {
|
|
11313
|
+
if (!isRecord3(value)) return false;
|
|
11314
|
+
return hasStrings(value, ["keyId", "name"]) && hasOptional(value, ["description", "secretValue", ...AUDIT_FIELDS], "string");
|
|
11315
|
+
}
|
|
11316
|
+
function isSkmDeletion(value) {
|
|
11317
|
+
return isRecord3(value) && hasStrings(value, ["keyId", "deletionDateTime"]);
|
|
11318
|
+
}
|
|
11319
|
+
function hasAuthIdentifier(obj) {
|
|
11320
|
+
return (typeof obj["value"] === "string" || typeof obj["name"] === "string") && hasOptional(obj, ["value", "name"], "string");
|
|
11321
|
+
}
|
|
11322
|
+
function isSkmAuthAdded(value) {
|
|
11323
|
+
return isRecord3(value) && hasAuthIdentifier(value) && hasOptional(value, ["description"], "string");
|
|
11324
|
+
}
|
|
11325
|
+
function isSkmAuthDeletion(value) {
|
|
11326
|
+
return isRecord3(value) && hasAuthIdentifier(value) && hasStrings(value, ["deletionDateTime"]);
|
|
11327
|
+
}
|
|
11328
|
+
|
|
11329
|
+
// src/services/skm/client.ts
|
|
11330
|
+
var KEY_PAGE_SIZE = 100;
|
|
11331
|
+
var STANDARD_SIGN_ALGORITHM = "RSASSA-PSS";
|
|
11332
|
+
var AUTH_PATHS = {
|
|
11333
|
+
ipv4: { path: "ips", field: "ipv4List" },
|
|
11334
|
+
mac: { path: "macs", field: "macList" },
|
|
11335
|
+
certificate: { path: "certificates", field: "certificateList" }
|
|
11336
|
+
};
|
|
11337
|
+
var AUTH_WRITE_PATH = {
|
|
11338
|
+
ipv4: "ipv4s",
|
|
11339
|
+
mac: "macs",
|
|
11340
|
+
certificate: "certificates"
|
|
11341
|
+
};
|
|
11342
|
+
function isRecord4(value) {
|
|
11343
|
+
return typeof value === "object" && value !== null;
|
|
11344
|
+
}
|
|
11345
|
+
function isEnvelope(value) {
|
|
11346
|
+
if (!isRecord4(value)) return false;
|
|
11347
|
+
const header = value["header"];
|
|
11348
|
+
return isRecord4(header) && typeof header["isSuccessful"] === "boolean";
|
|
11349
|
+
}
|
|
11350
|
+
function arrayOf(guard) {
|
|
11351
|
+
return (value) => Array.isArray(value) && value.every(guard);
|
|
11352
|
+
}
|
|
11353
|
+
function isString(value) {
|
|
11354
|
+
return typeof value === "string";
|
|
11355
|
+
}
|
|
11356
|
+
function withDescription(body, description) {
|
|
11357
|
+
return description === void 0 ? body : { ...body, description };
|
|
11358
|
+
}
|
|
11359
|
+
function authDeletionBody(type, keyStoreName, value) {
|
|
11360
|
+
return type === "certificate" ? { keyStoreName, name: value } : { keyStoreName, value };
|
|
11361
|
+
}
|
|
11362
|
+
function keyStoreBody(input) {
|
|
11363
|
+
const { name, description, ip4AuthUse, macAuthUse, certificateAuthUse, authMode } = input;
|
|
11364
|
+
return withDescription({ name, ip4AuthUse, macAuthUse, certificateAuthUse, authMode }, description);
|
|
11365
|
+
}
|
|
11366
|
+
function keyVersionParams(keyVersion) {
|
|
11367
|
+
return keyVersion === void 0 ? {} : { searchParams: { keyVersion } };
|
|
11368
|
+
}
|
|
11369
|
+
async function toSkmError(err) {
|
|
11370
|
+
if (!(err instanceof import_ky16.HTTPError)) return toNhnCloudCliError(err);
|
|
11371
|
+
let resultMessage = null;
|
|
11372
|
+
const body = await readHttpErrorBody(err);
|
|
11373
|
+
const header = isRecord4(body) ? body["header"] : void 0;
|
|
11374
|
+
const message = isRecord4(header) ? header["resultMessage"] : void 0;
|
|
11375
|
+
if (typeof message === "string") resultMessage = message;
|
|
11376
|
+
if (resultMessage === null) return toNhnCloudCliError(err);
|
|
11377
|
+
const status = err.response.status;
|
|
11378
|
+
return new NhnCloudCliError(
|
|
11379
|
+
`API \uD638\uCD9C \uC2E4\uD328 (${status}): ${sanitizeForTerminal(resultMessage)}`,
|
|
11380
|
+
status === 401 || status === 403 ? EXIT_AUTH_ERROR : EXIT_API_ERROR
|
|
11381
|
+
);
|
|
11382
|
+
}
|
|
11383
|
+
var SkmClient = class {
|
|
11384
|
+
baseUrl;
|
|
11385
|
+
headers;
|
|
11386
|
+
constructor(accessToken, environment, appKey, macAddress) {
|
|
11387
|
+
this.baseUrl = `${endpointFor("skm", environment)}/keymanager/v1.3/appkey/${encodeURIComponent(appKey)}`;
|
|
11388
|
+
this.headers = { "X-NHN-Authorization": `Bearer ${accessToken}` };
|
|
11389
|
+
if (macAddress !== void 0) {
|
|
11390
|
+
this.headers["X-TOAST-CLIENT-MAC-ADDR"] = macAddress;
|
|
11391
|
+
}
|
|
11392
|
+
}
|
|
11393
|
+
/**
|
|
11394
|
+
* 요청을 보내고 봉투 형태인지만 확인해 반환한다. 성공 판정은 호출부가 한다.
|
|
11395
|
+
* 쓰기 요청도 중복 실행을 막으려고 재시도하지 않는다.
|
|
11396
|
+
*/
|
|
11397
|
+
async send(method, path5, options) {
|
|
11398
|
+
let response;
|
|
11399
|
+
try {
|
|
11400
|
+
response = await import_ky16.default[method](`${this.baseUrl}${path5}`, {
|
|
11401
|
+
headers: this.headers,
|
|
11402
|
+
...options,
|
|
11403
|
+
retry: 0,
|
|
11404
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
11405
|
+
}).json();
|
|
11406
|
+
} catch (err) {
|
|
11407
|
+
throw await toSkmError(err);
|
|
11408
|
+
}
|
|
11409
|
+
if (!isEnvelope(response)) {
|
|
11410
|
+
throw new NhnCloudCliError("Secure Key Manager \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: header", EXIT_API_ERROR);
|
|
11411
|
+
}
|
|
11412
|
+
return response;
|
|
11413
|
+
}
|
|
11414
|
+
/**
|
|
11415
|
+
* 요청을 보내고 봉투를 벗긴 뒤 body 또는 body[field] 를 가드로 검사해 반환한다.
|
|
11416
|
+
* field 가 null 이면 body 전체를 검사한다.
|
|
11417
|
+
*/
|
|
11418
|
+
async request(method, path5, field, guard, options = {}) {
|
|
11419
|
+
const body = unwrap(await this.send(method, path5, options));
|
|
11420
|
+
const value = field === null ? body : isRecord4(body) ? body[field] : void 0;
|
|
11421
|
+
if (!guard(value)) {
|
|
11422
|
+
throw new NhnCloudCliError(`Secure Key Manager \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: ${field ?? "body"}`, EXIT_API_ERROR);
|
|
11423
|
+
}
|
|
11424
|
+
return value;
|
|
11425
|
+
}
|
|
11426
|
+
/**
|
|
11427
|
+
* body 가 null 이거나 없는 응답(키 저장소 수정·삭제)은 검사할 필드가 없어 헤더만 본다 (ADR-040).
|
|
11428
|
+
* isSuccessful 이 false 면 unwrapHeader 가 NhnEnvelopeError 를 던진다.
|
|
11429
|
+
*/
|
|
11430
|
+
async requestHeaderOnly(method, path5, options = {}) {
|
|
11431
|
+
unwrapHeader(await this.send(method, path5, options));
|
|
11432
|
+
}
|
|
11433
|
+
keyPath(prefix, keyId, action) {
|
|
11434
|
+
return `/${prefix}/${encodeURIComponent(keyId)}/${action}`;
|
|
11435
|
+
}
|
|
11436
|
+
/** 호출 클라이언트의 IP·MAC·인증서 전송 여부를 확인한다. */
|
|
11437
|
+
confirm() {
|
|
11438
|
+
return this.request("get", "/confirm", null, isSkmClientInfo);
|
|
11439
|
+
}
|
|
11440
|
+
listKeyStores() {
|
|
11441
|
+
return this.request("get", "/keystores", "keyStoreList", arrayOf(isSkmKeyStore), {
|
|
11442
|
+
searchParams: { detail: "true" }
|
|
11443
|
+
});
|
|
11444
|
+
}
|
|
11445
|
+
getKeyStore(keyStoreId) {
|
|
11446
|
+
return this.request("get", `/keystores/${keyStoreId}`, null, isSkmKeyStore);
|
|
11447
|
+
}
|
|
11448
|
+
/**
|
|
11449
|
+
* 모든 페이지의 키를 모은다.
|
|
11450
|
+
* 서버가 pageNumber 를 무시하면 같은 페이지가 반복되므로, 첫 keyId 가 직전 페이지와 같으면 중단한다.
|
|
11451
|
+
*/
|
|
11452
|
+
async listKeys(keyStoreId, filter = {}) {
|
|
11453
|
+
const keys = [];
|
|
11454
|
+
let previousFirstKeyId;
|
|
11455
|
+
for (let pageNumber = 1; ; pageNumber++) {
|
|
11456
|
+
const searchParams = { detail: "true", pageNumber, pageSize: KEY_PAGE_SIZE };
|
|
11457
|
+
if (filter.type) searchParams["type"] = filter.type;
|
|
11458
|
+
if (filter.name) searchParams["name"] = filter.name;
|
|
11459
|
+
if (filter.status) searchParams["status"] = filter.status;
|
|
11460
|
+
const page = await this.request("get", `/keystores/${keyStoreId}/keys`, "keyList", arrayOf(isSkmKey), {
|
|
11461
|
+
searchParams
|
|
11462
|
+
});
|
|
11463
|
+
const firstKeyId = page[0]?.keyId;
|
|
11464
|
+
if (firstKeyId !== void 0 && firstKeyId === previousFirstKeyId) {
|
|
11465
|
+
throw new NhnCloudCliError(
|
|
11466
|
+
`Secure Key Manager \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: ${pageNumber} \uD398\uC774\uC9C0\uAC00 \uC9C1\uC804 \uD398\uC774\uC9C0\uC640 \uAC19\uC740 \uD0A4\uB85C \uC2DC\uC791\uD569\uB2C8\uB2E4.`,
|
|
11467
|
+
EXIT_API_ERROR
|
|
11468
|
+
);
|
|
11469
|
+
}
|
|
11470
|
+
keys.push(...page);
|
|
11471
|
+
if (page.length < KEY_PAGE_SIZE) return keys;
|
|
11472
|
+
previousFirstKeyId = firstKeyId;
|
|
11473
|
+
}
|
|
11474
|
+
}
|
|
11475
|
+
getKey(keyStoreId, keyId) {
|
|
11476
|
+
return this.request("get", `/keystores/${keyStoreId}/keys/${encodeURIComponent(keyId)}`, null, isSkmKey);
|
|
11477
|
+
}
|
|
11478
|
+
listAuths(keyStoreId, type) {
|
|
11479
|
+
const { path: path5, field } = AUTH_PATHS[type];
|
|
11480
|
+
return this.request("get", `/keystores/${keyStoreId}/${path5}`, field, arrayOf(isString));
|
|
11481
|
+
}
|
|
11482
|
+
getAuth(keyStoreId, type, value) {
|
|
11483
|
+
const { path: path5, field } = AUTH_PATHS[type];
|
|
11484
|
+
return this.request("get", `/keystores/${keyStoreId}/${path5}`, field, arrayOf(isSkmAuthDetail), {
|
|
11485
|
+
searchParams: { value }
|
|
11486
|
+
});
|
|
11487
|
+
}
|
|
11488
|
+
getSecret(keyId) {
|
|
11489
|
+
return this.request("get", `/secrets/${encodeURIComponent(keyId)}`, "secret", isString);
|
|
11490
|
+
}
|
|
11491
|
+
encrypt(keyId, plaintext) {
|
|
11492
|
+
return this.request("post", this.keyPath("symmetric-keys", keyId, "encrypt"), null, isSkmEncryptResult, {
|
|
11493
|
+
json: { plaintext }
|
|
11494
|
+
});
|
|
11495
|
+
}
|
|
11496
|
+
decrypt(keyId, ciphertext) {
|
|
11497
|
+
return this.request("post", this.keyPath("symmetric-keys", keyId, "decrypt"), null, isSkmDecryptResult, {
|
|
11498
|
+
json: { ciphertext }
|
|
11499
|
+
});
|
|
11500
|
+
}
|
|
11501
|
+
createLocalKey(keyId) {
|
|
11502
|
+
return this.request("post", this.keyPath("symmetric-keys", keyId, "create-local-key"), null, isSkmLocalKey);
|
|
11503
|
+
}
|
|
11504
|
+
getSymmetricKey(keyId, keyVersion) {
|
|
11505
|
+
return this.request(
|
|
11506
|
+
"get",
|
|
11507
|
+
this.keyPath("symmetric-keys", keyId, "symmetric-key"),
|
|
11508
|
+
null,
|
|
11509
|
+
isSkmSymmetricKey,
|
|
11510
|
+
keyVersionParams(keyVersion)
|
|
11511
|
+
);
|
|
11512
|
+
}
|
|
11513
|
+
sign(keyId, plaintext) {
|
|
11514
|
+
return this.request("post", this.keyPath("asymmetric-keys", keyId, "sign"), null, isSkmSignResult, {
|
|
11515
|
+
json: { plaintext }
|
|
11516
|
+
});
|
|
11517
|
+
}
|
|
11518
|
+
verify(keyId, plaintext, signature) {
|
|
11519
|
+
return this.request("post", this.keyPath("asymmetric-keys", keyId, "verify"), null, isSkmVerifyResult, {
|
|
11520
|
+
json: { plaintext, signature }
|
|
11521
|
+
});
|
|
11522
|
+
}
|
|
11523
|
+
signStandard(keyId, plaintextBase64) {
|
|
11524
|
+
return this.request(
|
|
11525
|
+
"post",
|
|
11526
|
+
this.keyPath("asymmetric-keys", keyId, "sign-standard"),
|
|
11527
|
+
null,
|
|
11528
|
+
isSkmStandardSignResult,
|
|
11529
|
+
{ json: { plaintext: plaintextBase64, algorithm: STANDARD_SIGN_ALGORITHM } }
|
|
11530
|
+
);
|
|
11531
|
+
}
|
|
11532
|
+
verifyStandard(keyId, plaintextBase64, signature, keyVersion) {
|
|
11533
|
+
return this.request("post", this.keyPath("asymmetric-keys", keyId, "verify-standard"), null, isSkmVerifyResult, {
|
|
11534
|
+
json: { plaintext: plaintextBase64, signature, algorithm: STANDARD_SIGN_ALGORITHM, keyVersion }
|
|
11535
|
+
});
|
|
11536
|
+
}
|
|
11537
|
+
getPrivateKey(keyId, keyVersion) {
|
|
11538
|
+
return this.request(
|
|
11539
|
+
"get",
|
|
11540
|
+
this.keyPath("asymmetric-keys", keyId, "privateKey"),
|
|
11541
|
+
null,
|
|
11542
|
+
isSkmAsymmetricKeyMaterial,
|
|
11543
|
+
keyVersionParams(keyVersion)
|
|
11544
|
+
);
|
|
11545
|
+
}
|
|
11546
|
+
getPublicKey(keyId, keyVersion) {
|
|
11547
|
+
return this.request(
|
|
11548
|
+
"get",
|
|
11549
|
+
this.keyPath("asymmetric-keys", keyId, "publicKey"),
|
|
11550
|
+
null,
|
|
11551
|
+
isSkmAsymmetricKeyMaterial,
|
|
11552
|
+
keyVersionParams(keyVersion)
|
|
11553
|
+
);
|
|
11554
|
+
}
|
|
11555
|
+
createSecret(keyStoreName, name, description, secretValue) {
|
|
11556
|
+
return this.request("post", "/keys/secrets/create", null, isSkmCreatedKey, {
|
|
11557
|
+
json: withDescription({ keyStoreName, name, secretValue }, description)
|
|
11558
|
+
});
|
|
11559
|
+
}
|
|
11560
|
+
/** 자동 회전 주기의 단위가 문서에 없어 항상 0(자동 회전 안 함)을 보낸다 (ADR-040). */
|
|
11561
|
+
createSymmetricKey(keyStoreName, name, description) {
|
|
11562
|
+
return this.request("post", "/keys/symmetric-keys/create", null, isSkmCreatedKey, {
|
|
11563
|
+
json: withDescription({ keyStoreName, name, autoRotationPeriod: 0 }, description)
|
|
11564
|
+
});
|
|
11565
|
+
}
|
|
11566
|
+
/** 자동 회전 주기의 단위가 문서에 없어 항상 0(자동 회전 안 함)을 보낸다 (ADR-040). */
|
|
11567
|
+
createAsymmetricKey(keyStoreName, name, description) {
|
|
11568
|
+
return this.request("post", "/keys/asymmetric-keys/create", null, isSkmCreatedKey, {
|
|
11569
|
+
json: withDescription({ keyStoreName, name, autoRotationPeriod: 0 }, description)
|
|
11570
|
+
});
|
|
11571
|
+
}
|
|
11572
|
+
updateSecret(keyId, secretValue) {
|
|
11573
|
+
return this.request("put", `/secrets/${encodeURIComponent(keyId)}`, null, isSkmUpdatedSecret, {
|
|
11574
|
+
json: { secretValue }
|
|
11575
|
+
});
|
|
11576
|
+
}
|
|
11577
|
+
/** 7일 뒤 삭제를 예약한다. */
|
|
11578
|
+
scheduleKeyDeletion(keyId) {
|
|
11579
|
+
return this.request("put", this.keyPath("keys", keyId, "delete"), null, isSkmDeletion);
|
|
11580
|
+
}
|
|
11581
|
+
/** 삭제 예약된 키를 즉시 삭제한다. 되돌릴 수 없다. */
|
|
11582
|
+
deleteKeyNow(keyId) {
|
|
11583
|
+
return this.request("delete", `/keys/${encodeURIComponent(keyId)}`, null, isSkmDeletion);
|
|
11584
|
+
}
|
|
11585
|
+
createKeyStore(input) {
|
|
11586
|
+
return this.request("post", "/keystores", null, isSkmCreatedKeyStore, { json: keyStoreBody(input) });
|
|
11587
|
+
}
|
|
11588
|
+
/** 전체 교체 API 라 주지 않은 값은 호출부가 현재 값으로 채워 넘긴다 (ADR-040). */
|
|
11589
|
+
updateKeyStore(keyStoreId, input) {
|
|
11590
|
+
return this.requestHeaderOnly("put", `/keystores/${keyStoreId}`, { json: keyStoreBody(input) });
|
|
11591
|
+
}
|
|
11592
|
+
deleteKeyStore(keyStoreId) {
|
|
11593
|
+
return this.requestHeaderOnly("delete", `/keystores/${keyStoreId}`);
|
|
11594
|
+
}
|
|
11595
|
+
addAuth(type, keyStoreName, value, description) {
|
|
11596
|
+
return this.request("post", `/auths/${AUTH_WRITE_PATH[type]}`, null, isSkmAuthAdded, {
|
|
11597
|
+
json: withDescription({ keyStoreName, value }, description)
|
|
11598
|
+
});
|
|
11599
|
+
}
|
|
11600
|
+
addCertificate(keyStoreName, name, password, lifeTime, description) {
|
|
11601
|
+
return this.request("post", `/auths/${AUTH_WRITE_PATH.certificate}`, null, isSkmAuthAdded, {
|
|
11602
|
+
json: withDescription({ keyStoreName, name, password, lifeTime }, description)
|
|
11603
|
+
});
|
|
11604
|
+
}
|
|
11605
|
+
/** 7일 뒤 삭제를 예약한다. */
|
|
11606
|
+
scheduleAuthDeletion(type, keyStoreName, value) {
|
|
11607
|
+
return this.request("put", `/auths/${AUTH_WRITE_PATH[type]}/delete`, null, isSkmAuthDeletion, {
|
|
11608
|
+
json: authDeletionBody(type, keyStoreName, value)
|
|
11609
|
+
});
|
|
11610
|
+
}
|
|
11611
|
+
/** 삭제 예약된 인증 정보를 즉시 삭제한다. 되돌릴 수 없다. */
|
|
11612
|
+
deleteAuthNow(type, keyStoreName, value) {
|
|
11613
|
+
return this.request("post", `/auths/${AUTH_WRITE_PATH[type]}/delete`, null, isSkmAuthDeletion, {
|
|
11614
|
+
json: authDeletionBody(type, keyStoreName, value)
|
|
11615
|
+
});
|
|
11616
|
+
}
|
|
11617
|
+
};
|
|
11618
|
+
|
|
11619
|
+
// src/commands/skm/helpers.ts
|
|
11620
|
+
var MAC_ADDRESS_PATTERN = /^[0-9A-Fa-f]{2}(:[0-9A-Fa-f]{2}){5}$/;
|
|
11621
|
+
var KEY_NAME_MAX_LENGTH = 100;
|
|
11622
|
+
var KEY_TYPES = {
|
|
11623
|
+
secret: "SECRET",
|
|
11624
|
+
"symmetric-key": "SYMMETRIC_KEY",
|
|
11625
|
+
"asymmetric-key": "ASYMMETRIC_KEY"
|
|
11626
|
+
};
|
|
11627
|
+
var AUTH_TYPES = ["ipv4", "mac", "certificate"];
|
|
11628
|
+
function withSkmOptions(command) {
|
|
11629
|
+
return command.option("--mac-address <mac>", "\uD0A4 \uC800\uC7A5\uC18C MAC \uC778\uC99D\uC5D0 \uC4F8 \uD074\uB77C\uC774\uC5B8\uD2B8 MAC \uC8FC\uC18C (X-TOAST-CLIENT-MAC-ADDR)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984");
|
|
11630
|
+
}
|
|
11631
|
+
function withTypeOption(command) {
|
|
11632
|
+
return command.requiredOption("--type <type>", "\uC778\uC99D \uC815\uBCF4 \uC885\uB958 (ipv4|mac|certificate)");
|
|
11633
|
+
}
|
|
11634
|
+
function parseMacAddressOption(value) {
|
|
11635
|
+
if (value === void 0) return void 0;
|
|
11636
|
+
if (!MAC_ADDRESS_PATTERN.test(value)) {
|
|
11637
|
+
throw new NhnCloudCliError(
|
|
11638
|
+
`--mac-address\uB294 aa:bb:cc:dd:ee:ff \uD615\uC2DD\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
11639
|
+
EXIT_PARAM_ERROR
|
|
11640
|
+
);
|
|
11641
|
+
}
|
|
11642
|
+
return value.toLowerCase();
|
|
11643
|
+
}
|
|
11644
|
+
function parseKeyStoreId(value) {
|
|
11645
|
+
return parseNonNegativeIntegerOption(parseRequiredArgument(value, "keystore-id"), "<keystore-id>");
|
|
11646
|
+
}
|
|
11647
|
+
function parseAuthTypeOption(value) {
|
|
11648
|
+
const found = AUTH_TYPES.find((type) => type === value);
|
|
11649
|
+
if (!found) {
|
|
11650
|
+
throw new NhnCloudCliError(
|
|
11651
|
+
`--type\uC740 ipv4, mac, certificate \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
11652
|
+
EXIT_PARAM_ERROR
|
|
11653
|
+
);
|
|
11654
|
+
}
|
|
11655
|
+
return found;
|
|
11656
|
+
}
|
|
11657
|
+
function parseAuthListOption(value) {
|
|
11658
|
+
const items = value.split(",").map((item) => item.trim());
|
|
11659
|
+
if (items.some((item) => !AUTH_TYPES.some((type) => type === item))) {
|
|
11660
|
+
throw new NhnCloudCliError(
|
|
11661
|
+
`--auth\uB294 ipv4, mac, certificate\uB97C \uC27C\uD45C\uB85C \uB098\uC5F4\uD574\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
11662
|
+
EXIT_PARAM_ERROR
|
|
11663
|
+
);
|
|
11664
|
+
}
|
|
11665
|
+
const flag = (type) => items.includes(type) ? "Y" : "N";
|
|
11666
|
+
return { ip4AuthUse: flag("ipv4"), macAuthUse: flag("mac"), certificateAuthUse: flag("certificate") };
|
|
11667
|
+
}
|
|
11668
|
+
function parseAuthModeOption(value) {
|
|
11669
|
+
const upper = value.toUpperCase();
|
|
11670
|
+
if (upper !== "AND" && upper !== "OR") {
|
|
11671
|
+
throw new NhnCloudCliError(
|
|
11672
|
+
`--auth-mode\uB294 and \uB610\uB294 or\uC5EC\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
11673
|
+
EXIT_PARAM_ERROR
|
|
11674
|
+
);
|
|
11675
|
+
}
|
|
11676
|
+
return upper;
|
|
11677
|
+
}
|
|
11678
|
+
function parseDescriptionOption(value, maxLength) {
|
|
11679
|
+
const trimmed = value?.trim();
|
|
11680
|
+
if (!trimmed) return void 0;
|
|
11681
|
+
if (trimmed.length > maxLength) {
|
|
11682
|
+
throw new NhnCloudCliError(`--description\uC740 ${maxLength}\uC790 \uC774\uD558\uC5EC\uC57C \uD569\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
11683
|
+
}
|
|
11684
|
+
return trimmed;
|
|
11685
|
+
}
|
|
11686
|
+
function isIpv4OrCidr2(value) {
|
|
11687
|
+
const [address, prefix, ...rest] = value.split("/");
|
|
11688
|
+
if (rest.length > 0 || address === void 0 || (0, import_node_net2.isIP)(address) !== 4) return false;
|
|
11689
|
+
return prefix === void 0 || /^(\d|[12]\d|3[0-2])$/.test(prefix);
|
|
11690
|
+
}
|
|
11691
|
+
function parseAuthValue(type, value) {
|
|
11692
|
+
if (type === "ipv4") {
|
|
11693
|
+
if (!isIpv4OrCidr2(value)) {
|
|
11694
|
+
throw new NhnCloudCliError(
|
|
11695
|
+
`IPv4 \uC8FC\uC18C\uB098 CIDR \uB300\uC5ED \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
11696
|
+
EXIT_PARAM_ERROR
|
|
11697
|
+
);
|
|
11698
|
+
}
|
|
11699
|
+
return value;
|
|
11700
|
+
}
|
|
11701
|
+
if (type === "mac") {
|
|
11702
|
+
if (!MAC_ADDRESS_PATTERN.test(value)) {
|
|
11703
|
+
throw new NhnCloudCliError(
|
|
11704
|
+
`MAC \uC8FC\uC18C\uB294 aa:bb:cc:dd:ee:ff \uD615\uC2DD\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
11705
|
+
EXIT_PARAM_ERROR
|
|
11706
|
+
);
|
|
11707
|
+
}
|
|
11708
|
+
return value.toLowerCase();
|
|
11709
|
+
}
|
|
11710
|
+
const name = value.trim();
|
|
11711
|
+
if (!name) {
|
|
11712
|
+
throw new NhnCloudCliError("\uC778\uC99D\uC11C \uC774\uB984\uC774 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
11713
|
+
}
|
|
11714
|
+
return name;
|
|
11715
|
+
}
|
|
11716
|
+
function parseKeyTypeOption(value) {
|
|
11717
|
+
if (value === void 0) return void 0;
|
|
11718
|
+
const found = Object.hasOwn(KEY_TYPES, value) ? KEY_TYPES[value] : void 0;
|
|
11719
|
+
if (!found) {
|
|
11720
|
+
throw new NhnCloudCliError(
|
|
11721
|
+
`--type\uC740 secret, symmetric-key, asymmetric-key \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
11722
|
+
EXIT_PARAM_ERROR
|
|
11723
|
+
);
|
|
11724
|
+
}
|
|
11725
|
+
return found;
|
|
11726
|
+
}
|
|
11727
|
+
function parseKeyStatusOption(value) {
|
|
11728
|
+
if (value === void 0) return void 0;
|
|
11729
|
+
if (value !== "active" && value !== "inactive") {
|
|
11730
|
+
throw new NhnCloudCliError(
|
|
11731
|
+
`--status\uB294 active \uB610\uB294 inactive\uC5EC\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
11732
|
+
EXIT_PARAM_ERROR
|
|
11733
|
+
);
|
|
11734
|
+
}
|
|
11735
|
+
return value;
|
|
11736
|
+
}
|
|
11737
|
+
function parseKeyNameOption(value) {
|
|
11738
|
+
if (value === void 0) return void 0;
|
|
11739
|
+
const trimmed = value.trim();
|
|
11740
|
+
if (!trimmed) {
|
|
11741
|
+
throw new NhnCloudCliError("--name\uC740 \uBE44\uC5B4 \uC788\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
11742
|
+
}
|
|
11743
|
+
if (trimmed.length > KEY_NAME_MAX_LENGTH) {
|
|
11744
|
+
throw new NhnCloudCliError(`--name\uC740 ${KEY_NAME_MAX_LENGTH}\uC790 \uC774\uD558\uC5EC\uC57C \uD569\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
11745
|
+
}
|
|
11746
|
+
return trimmed;
|
|
11747
|
+
}
|
|
11748
|
+
async function resolveSkmClient(opts) {
|
|
11749
|
+
const profileName = await resolveProfileName(opts.profile);
|
|
11750
|
+
const appKey = await resolveServiceAppKey(
|
|
11751
|
+
"skm",
|
|
11752
|
+
profileName,
|
|
11753
|
+
"Secure Key Manager appkey\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. nhncloud configure --skm-appkey <key>\uB85C \uC124\uC815\uD558\uC138\uC694."
|
|
11754
|
+
);
|
|
11755
|
+
const uak = await getUserAccessKey(profileName);
|
|
11756
|
+
const environment = await getProfileEnvironment(profileName);
|
|
11757
|
+
const accessToken = await getAccessToken(profileName, uak.id, uak.secret, false, environment);
|
|
11758
|
+
return { client: new SkmClient(accessToken, environment, appKey, opts.macAddress), profileName };
|
|
11759
|
+
}
|
|
11760
|
+
function maskAuthDetail(detail) {
|
|
11761
|
+
if (typeof detail.password !== "string") return detail;
|
|
11762
|
+
return { ...detail, password: "***" };
|
|
11763
|
+
}
|
|
11764
|
+
function formatCell(value) {
|
|
11765
|
+
if (value === null || value === void 0) return "-";
|
|
11766
|
+
return sanitizeForTerminal(String(value));
|
|
11767
|
+
}
|
|
11768
|
+
function printSkmValue(opts, value, raw) {
|
|
11769
|
+
if (opts.json) {
|
|
11770
|
+
printJson(raw);
|
|
11771
|
+
} else if (opts.quiet) {
|
|
11772
|
+
process.stdout.write(value + "\n");
|
|
11773
|
+
} else {
|
|
11774
|
+
process.stdout.write(sanitizeMultilineForTerminal(value) + "\n");
|
|
11775
|
+
}
|
|
11776
|
+
}
|
|
11777
|
+
async function resolveKeyStoreName(client, keyStoreId) {
|
|
11778
|
+
const keyStore = await client.getKeyStore(keyStoreId);
|
|
11779
|
+
return keyStore.name;
|
|
11780
|
+
}
|
|
11781
|
+
function outputSkmWriteResult(opts, result, ids) {
|
|
11782
|
+
output(opts, {
|
|
11783
|
+
headers: ["field", "value"],
|
|
11784
|
+
rows: Object.entries(result).map(([key, value]) => [key, formatCell(value)]),
|
|
11785
|
+
raw: result,
|
|
11786
|
+
ids
|
|
11787
|
+
});
|
|
11788
|
+
}
|
|
11789
|
+
function parseKeyVersionOption(value) {
|
|
11790
|
+
return parseNonNegativeIntegerOption(value, "--key-version");
|
|
11791
|
+
}
|
|
11792
|
+
async function withSkmSpinner(text, call) {
|
|
11793
|
+
startSpinner(text);
|
|
11794
|
+
let result;
|
|
11795
|
+
try {
|
|
11796
|
+
result = await call();
|
|
11797
|
+
} catch (err) {
|
|
11798
|
+
stopSpinner(false);
|
|
11799
|
+
throw err;
|
|
11800
|
+
}
|
|
11801
|
+
stopSpinner(true);
|
|
11802
|
+
return result;
|
|
11803
|
+
}
|
|
11804
|
+
|
|
11805
|
+
// src/commands/skm/confirm.ts
|
|
11806
|
+
var confirmCommand = withSkmOptions(
|
|
11807
|
+
new import_commander59.Command("confirm").description("SKM \uC11C\uBC84\uAC00 \uBCF8 \uD074\uB77C\uC774\uC5B8\uD2B8 IP, MAC \uD5E4\uB354\uC640 \uC778\uC99D\uC11C \uC0AC\uC6A9 \uC5EC\uBD80\uB97C \uC870\uD68C\uD55C\uB2E4")
|
|
11808
|
+
).action(async (_opts, command) => {
|
|
11809
|
+
const opts = command.optsWithGlobals();
|
|
11810
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
11811
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
11812
|
+
const info = await withSkmSpinner("SKM \uD074\uB77C\uC774\uC5B8\uD2B8 \uC815\uBCF4 \uC870\uD68C \uC911...", () => client.confirm());
|
|
11813
|
+
output(opts, {
|
|
11814
|
+
headers: ["field", "value"],
|
|
11815
|
+
rows: [
|
|
11816
|
+
["clientIp", formatCell(info.clientIp)],
|
|
11817
|
+
["clientMacHeader", formatCell(info.clientMacHeader)],
|
|
11818
|
+
["clientSentCertificate", formatCell(info.clientSentCertificate)]
|
|
11819
|
+
],
|
|
11820
|
+
raw: info,
|
|
11821
|
+
ids: [formatCell(info.clientIp)]
|
|
11822
|
+
});
|
|
11823
|
+
});
|
|
11824
|
+
|
|
11825
|
+
// src/commands/skm/keystore.ts
|
|
11826
|
+
var import_commander61 = require("commander");
|
|
11827
|
+
|
|
11828
|
+
// src/commands/skm/keystore-manage.ts
|
|
11829
|
+
var import_commander60 = require("commander");
|
|
11830
|
+
|
|
11831
|
+
// src/commands/skm/input.ts
|
|
11832
|
+
var import_node_fs10 = require("fs");
|
|
11833
|
+
var processStdin = {
|
|
11834
|
+
get isTTY() {
|
|
11835
|
+
return process.stdin.isTTY;
|
|
11836
|
+
},
|
|
11837
|
+
read: () => (0, import_node_fs10.readFileSync)(0)
|
|
11838
|
+
};
|
|
11839
|
+
function assertWithinLimit(size, spec) {
|
|
11840
|
+
if (size > spec.maxBytes) {
|
|
11841
|
+
throw new NhnCloudCliError(
|
|
11842
|
+
`${spec.label}\uAC00 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${size}\uBC14\uC774\uD2B8 (\uD55C\uB3C4 ${spec.maxBytes}\uBC14\uC774\uD2B8).`,
|
|
11843
|
+
EXIT_PARAM_ERROR
|
|
11844
|
+
);
|
|
11845
|
+
}
|
|
11846
|
+
}
|
|
11847
|
+
function readInputFile(file, spec) {
|
|
11848
|
+
let stat3;
|
|
11849
|
+
try {
|
|
11850
|
+
stat3 = (0, import_node_fs10.statSync)(file);
|
|
11851
|
+
} catch (e) {
|
|
11852
|
+
const reason = e.code ?? (e instanceof Error ? e.message : String(e));
|
|
11853
|
+
throw new NhnCloudCliError(`${spec.label} \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${file} (${reason})`, EXIT_PARAM_ERROR);
|
|
11854
|
+
}
|
|
11855
|
+
if (!stat3.isFile()) {
|
|
11856
|
+
throw new NhnCloudCliError(`${spec.label} \uD30C\uC77C\uC774 \uC77C\uBC18 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${file}`, EXIT_PARAM_ERROR);
|
|
11857
|
+
}
|
|
11858
|
+
assertWithinLimit(stat3.size, spec);
|
|
11859
|
+
return (0, import_node_fs10.readFileSync)(file);
|
|
11860
|
+
}
|
|
11861
|
+
function readStdin(stdin, spec) {
|
|
11862
|
+
try {
|
|
11863
|
+
return stdin.read();
|
|
11864
|
+
} catch (e) {
|
|
11865
|
+
const reason = e.code ?? (e instanceof Error ? e.message : String(e));
|
|
11866
|
+
throw new NhnCloudCliError(`${spec.label}\uB97C \uD45C\uC900 \uC785\uB825\uC5D0\uC11C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 (${reason}).`, EXIT_PARAM_ERROR);
|
|
11867
|
+
}
|
|
11868
|
+
}
|
|
11869
|
+
function readSkmInput(source, spec, stdin = processStdin) {
|
|
11870
|
+
const fileFlag = spec.fileFlag ?? "--file";
|
|
11871
|
+
if (source.text !== void 0 && source.file !== void 0) {
|
|
11872
|
+
throw new NhnCloudCliError(`${spec.textFlag}\uC640 ${fileFlag}\uC740 \uD568\uAED8 \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
11873
|
+
}
|
|
11874
|
+
let input;
|
|
11875
|
+
if (source.text !== void 0) {
|
|
11876
|
+
input = Buffer.from(source.text, "utf-8");
|
|
11877
|
+
} else if (source.file !== void 0) {
|
|
11878
|
+
input = readInputFile(source.file, spec);
|
|
11879
|
+
} else if (!stdin.isTTY) {
|
|
11880
|
+
input = readStdin(stdin, spec);
|
|
11881
|
+
} else {
|
|
11882
|
+
throw new NhnCloudCliError(
|
|
11883
|
+
`${spec.label}\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. ${spec.textFlag} <\uAC12>, ${fileFlag} <\uACBD\uB85C>, \uD45C\uC900 \uC785\uB825(\uD30C\uC774\uD504) \uC911 \uD558\uB098\uB85C \uC804\uB2EC\uD558\uC138\uC694.`,
|
|
11884
|
+
EXIT_PARAM_ERROR
|
|
11885
|
+
);
|
|
11886
|
+
}
|
|
11887
|
+
assertWithinLimit(input.length, spec);
|
|
11888
|
+
if (input.length === 0) {
|
|
11889
|
+
throw new NhnCloudCliError(`${spec.label}\uAC00 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
11890
|
+
}
|
|
11891
|
+
return input;
|
|
11892
|
+
}
|
|
11893
|
+
function decodeUtf8Input(input, label, hint) {
|
|
11894
|
+
try {
|
|
11895
|
+
return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(input);
|
|
11896
|
+
} catch {
|
|
11897
|
+
throw new NhnCloudCliError(`${label}\uB294 UTF-8 \uD14D\uC2A4\uD2B8\uC5EC\uC57C \uD569\uB2C8\uB2E4. ${hint}`, EXIT_PARAM_ERROR);
|
|
11898
|
+
}
|
|
11899
|
+
}
|
|
11900
|
+
|
|
11901
|
+
// src/commands/skm/keystore-manage.ts
|
|
11902
|
+
var DESCRIPTION_MAX_LENGTH = 1e3;
|
|
11903
|
+
var PASSWORD_MAX_BYTES = 1024;
|
|
11904
|
+
var LOCKOUT_WARNING = "(\uC2E4\uD589 \uC704\uCE58\uAC00 \uD0A4\uB97C \uC4F0\uC9C0 \uBABB\uD558\uAC8C \uB420 \uC218 \uC788\uC74C, \uBA3C\uC800 skm confirm\uC73C\uB85C \uD655\uC778)";
|
|
11905
|
+
var createCommand11 = withSkmOptions(
|
|
11906
|
+
new import_commander60.Command("create").description("\uD0A4 \uC800\uC7A5\uC18C\uB97C \uB9CC\uB4E0\uB2E4").requiredOption("--name <name>", "\uD0A4 \uC800\uC7A5\uC18C \uC774\uB984 (100\uC790 \uC774\uD558)").requiredOption("--auth <list>", "\uC0AC\uC6A9\uD560 \uC778\uC99D (ipv4,mac,certificate \uC911 \uD558\uB098 \uC774\uC0C1\uC744 \uC27C\uD45C\uB85C)").option("--auth-mode <mode>", "\uC778\uC99D \uACB0\uD569 \uBC29\uC2DD (and|or)", "and").option("--description <text>", "\uD0A4 \uC800\uC7A5\uC18C \uC124\uBA85 (1000\uC790 \uC774\uD558)")
|
|
11907
|
+
).action(async (_opts, command) => {
|
|
11908
|
+
const opts = command.optsWithGlobals();
|
|
11909
|
+
const name = parseKeyNameOption(opts.name);
|
|
11910
|
+
const auths = parseAuthListOption(opts.auth);
|
|
11911
|
+
const authMode = parseAuthModeOption(opts.authMode);
|
|
11912
|
+
const description = parseDescriptionOption(opts.description, DESCRIPTION_MAX_LENGTH);
|
|
11913
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
11914
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
11915
|
+
const input = { name, ...auths, authMode };
|
|
11916
|
+
if (description !== void 0) input.description = description;
|
|
11917
|
+
const created = await withSkmSpinner(
|
|
11918
|
+
`SKM \uD0A4 \uC800\uC7A5\uC18C ${formatCell(name)} \uC0DD\uC131 \uC911...`,
|
|
11919
|
+
() => client.createKeyStore(input)
|
|
11920
|
+
);
|
|
11921
|
+
outputSkmWriteResult(opts, { ...created }, [String(created.keyStoreId)]);
|
|
11922
|
+
});
|
|
11923
|
+
var updateCommand4 = withSkmOptions(
|
|
11924
|
+
new import_commander60.Command("update").description(`\uD0A4 \uC800\uC7A5\uC18C\uB97C \uC218\uC815\uD55C\uB2E4. \uC8FC\uC9C0 \uC54A\uC740 \uD56D\uBAA9\uC740 \uD604\uC7AC \uAC12\uC744 \uC720\uC9C0\uD55C\uB2E4 ${LOCKOUT_WARNING}`).argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID").requiredOption("--auth-mode <mode>", "\uC778\uC99D \uACB0\uD569 \uBC29\uC2DD (and|or). \uC870\uD68C \uC751\uB2F5\uC5D0 \uC5C6\uC5B4 \uB9E4\uBC88 \uC9C0\uC815\uD55C\uB2E4").option("--name <name>", "\uD0A4 \uC800\uC7A5\uC18C \uC774\uB984 (100\uC790 \uC774\uD558)").option("--description <text>", "\uD0A4 \uC800\uC7A5\uC18C \uC124\uBA85 (1000\uC790 \uC774\uD558)").option("--auth <list>", "\uC0AC\uC6A9\uD560 \uC778\uC99D (ipv4,mac,certificate \uC911 \uD558\uB098 \uC774\uC0C1\uC744 \uC27C\uD45C\uB85C)")
|
|
11925
|
+
).action(async (keyStoreId, _opts, command) => {
|
|
11926
|
+
const opts = command.optsWithGlobals();
|
|
11927
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
11928
|
+
const authMode = parseAuthModeOption(opts.authMode);
|
|
11929
|
+
const name = parseKeyNameOption(opts.name);
|
|
11930
|
+
const description = parseDescriptionOption(opts.description, DESCRIPTION_MAX_LENGTH);
|
|
11931
|
+
const auths = opts.auth === void 0 ? void 0 : parseAuthListOption(opts.auth);
|
|
11932
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
11933
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
11934
|
+
const current2 = await withSkmSpinner(`SKM \uD0A4 \uC800\uC7A5\uC18C ${parsedId} \uC870\uD68C \uC911...`, () => client.getKeyStore(parsedId));
|
|
11935
|
+
const currentDescription = typeof current2.description === "string" ? current2.description : void 0;
|
|
11936
|
+
const yesNo = (value) => value === "Y" ? "Y" : "N";
|
|
11937
|
+
const input = {
|
|
11938
|
+
name: name ?? current2.name,
|
|
11939
|
+
...auths ?? {
|
|
11940
|
+
ip4AuthUse: yesNo(current2.ip4AuthUse),
|
|
11941
|
+
macAuthUse: yesNo(current2.macAuthUse),
|
|
11942
|
+
certificateAuthUse: yesNo(current2.certificateAuthUse)
|
|
11943
|
+
},
|
|
11944
|
+
authMode
|
|
11945
|
+
};
|
|
11946
|
+
const nextDescription = description ?? currentDescription;
|
|
11947
|
+
if (nextDescription !== void 0) input.description = nextDescription;
|
|
11948
|
+
if (input.ip4AuthUse === "N" && input.macAuthUse === "N" && input.certificateAuthUse === "N") {
|
|
11949
|
+
throw new NhnCloudCliError("\uD0A4 \uC800\uC7A5\uC18C \uC778\uC99D\uC740 \uD558\uB098 \uC774\uC0C1 \uCF1C\uC57C \uD569\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
11950
|
+
}
|
|
11951
|
+
await withSkmSpinner(`SKM \uD0A4 \uC800\uC7A5\uC18C ${parsedId} \uC218\uC815 \uC911...`, () => client.updateKeyStore(parsedId, input));
|
|
11952
|
+
outputSkmWriteResult(
|
|
11953
|
+
opts,
|
|
11954
|
+
{ operation: "keystore-update", status: "succeeded", keyStoreId: parsedId, ...input },
|
|
11955
|
+
[String(parsedId)]
|
|
11956
|
+
);
|
|
11957
|
+
});
|
|
11958
|
+
var deleteCommand9 = withSkmOptions(
|
|
11959
|
+
new import_commander60.Command("delete").description("\uD0A4 \uC800\uC7A5\uC18C\uB97C \uC0AD\uC81C(\uBE44\uD65C\uC131\uD654)\uD55C\uB2E4").argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID").option("--yes", "\uC0AD\uC81C \uD655\uC778")
|
|
11960
|
+
).action(async (keyStoreId, _opts, command) => {
|
|
11961
|
+
const opts = command.optsWithGlobals();
|
|
11962
|
+
requireYes(opts.yes, "\uD0A4 \uC800\uC7A5\uC18C \uC0AD\uC81C");
|
|
11963
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
11964
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
11965
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
11966
|
+
await withSkmSpinner(`SKM \uD0A4 \uC800\uC7A5\uC18C ${parsedId} \uC0AD\uC81C \uC911...`, () => client.deleteKeyStore(parsedId));
|
|
11967
|
+
outputSkmWriteResult(
|
|
11968
|
+
opts,
|
|
11969
|
+
{ operation: "keystore-delete", status: "succeeded", keyStoreId: parsedId },
|
|
11970
|
+
[String(parsedId)]
|
|
11971
|
+
);
|
|
11972
|
+
});
|
|
11973
|
+
function readCertificateOptions(opts) {
|
|
11974
|
+
if (opts.lifeTime === void 0) {
|
|
11975
|
+
throw new NhnCloudCliError("\uC778\uC99D\uC11C \uCD94\uAC00\uC5D0\uB294 --life-time\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
11976
|
+
}
|
|
11977
|
+
const lifeTime = parsePositiveIntegerOption(opts.lifeTime, "--life-time");
|
|
11978
|
+
const input = readSkmInput(
|
|
11979
|
+
{ text: opts.password, file: opts.passwordFile },
|
|
11980
|
+
{ textFlag: "--password", fileFlag: "--password-file", label: "\uC778\uC99D\uC11C \uBE44\uBC00\uBC88\uD638", maxBytes: PASSWORD_MAX_BYTES }
|
|
11981
|
+
);
|
|
11982
|
+
const password = decodeUtf8Input(input, "\uC778\uC99D\uC11C \uBE44\uBC00\uBC88\uD638", "\uD30C\uC77C \uC778\uCF54\uB529\uC744 \uD655\uC778\uD558\uC138\uC694.").replace(/\r?\n$/, "");
|
|
11983
|
+
if (!password) {
|
|
11984
|
+
throw new NhnCloudCliError("\uC778\uC99D\uC11C \uBE44\uBC00\uBC88\uD638\uAC00 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
11985
|
+
}
|
|
11986
|
+
return { lifeTime, password };
|
|
11987
|
+
}
|
|
11988
|
+
function rejectCertificateOptions(opts) {
|
|
11989
|
+
if (opts.lifeTime !== void 0 || opts.password !== void 0 || opts.passwordFile !== void 0) {
|
|
11990
|
+
throw new NhnCloudCliError("--life-time\uACFC --password\uB294 --type certificate\uC5D0\uC11C\uB9CC \uC501\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
11991
|
+
}
|
|
11992
|
+
}
|
|
11993
|
+
function authAddedFields(added) {
|
|
11994
|
+
return { value: added.value, name: added.name, description: added.description };
|
|
11995
|
+
}
|
|
11996
|
+
var authAddCommand = withTypeOption(
|
|
11997
|
+
withSkmOptions(
|
|
11998
|
+
new import_commander60.Command("add").description("\uD0A4 \uC800\uC7A5\uC18C\uC5D0 \uC778\uC99D \uC815\uBCF4\uB97C \uCD94\uAC00\uD55C\uB2E4 (\uC778\uC99D\uC11C \uBE44\uBC00\uBC88\uD638\uB294 --password, --password-file, \uD45C\uC900 \uC785\uB825 \uC911 \uD558\uB098)").argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID").argument("<value>", "IPv4\xB7MAC \uAC12 \uB610\uB294 \uC778\uC99D\uC11C \uC774\uB984").option("--description <text>", "\uC778\uC99D \uC815\uBCF4 \uC124\uBA85 (1000\uC790 \uC774\uD558)").option("--life-time <days>", "\uC778\uC99D\uC11C \uC720\uD6A8 \uAE30\uAC04(\uC77C) (--type certificate \uC804\uC6A9, \uD544\uC218)").option("--password <pw>", "\uC778\uC99D\uC11C \uBE44\uBC00\uBC88\uD638 (--type certificate \uC804\uC6A9)").option("--password-file <path>", "\uC778\uC99D\uC11C \uBE44\uBC00\uBC88\uD638\uB97C \uC77D\uC744 \uD30C\uC77C (--type certificate \uC804\uC6A9)")
|
|
11999
|
+
)
|
|
12000
|
+
).action(async (keyStoreId, value, _opts, command) => {
|
|
12001
|
+
const opts = command.optsWithGlobals();
|
|
12002
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
12003
|
+
const type = parseAuthTypeOption(opts.type);
|
|
12004
|
+
const parsedValue = parseAuthValue(type, value);
|
|
12005
|
+
const description = parseDescriptionOption(opts.description, DESCRIPTION_MAX_LENGTH);
|
|
12006
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12007
|
+
if (type !== "certificate") rejectCertificateOptions(opts);
|
|
12008
|
+
const target = type === "certificate" ? { type, ...readCertificateOptions(opts) } : { type };
|
|
12009
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12010
|
+
const added = await withSkmSpinner(`SKM ${type} \uC778\uC99D \uC815\uBCF4 ${formatCell(parsedValue)} \uCD94\uAC00 \uC911...`, async () => {
|
|
12011
|
+
const keyStoreName = await resolveKeyStoreName(client, parsedId);
|
|
12012
|
+
if (target.type === "certificate") {
|
|
12013
|
+
return client.addCertificate(keyStoreName, parsedValue, target.password, target.lifeTime, description);
|
|
12014
|
+
}
|
|
12015
|
+
return client.addAuth(target.type, keyStoreName, parsedValue, description);
|
|
12016
|
+
});
|
|
12017
|
+
outputSkmWriteResult(
|
|
12018
|
+
opts,
|
|
12019
|
+
{ operation: "auth-add", type, keyStoreId: parsedId, ...authAddedFields(added) },
|
|
12020
|
+
[formatCell(parsedValue)]
|
|
12021
|
+
);
|
|
12022
|
+
});
|
|
12023
|
+
var authDeleteCommand = withTypeOption(
|
|
12024
|
+
withSkmOptions(
|
|
12025
|
+
new import_commander60.Command("delete").description(`\uC778\uC99D \uC815\uBCF4 \uC0AD\uC81C\uB97C \uC608\uC57D\uD55C\uB2E4 (7\uC77C \uB4A4 \uC0AD\uC81C) ${LOCKOUT_WARNING}`).argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID").argument("<value>", "IPv4\xB7MAC \uAC12 \uB610\uB294 \uC778\uC99D\uC11C \uC774\uB984").option("--yes", "\uC0AD\uC81C \uC608\uC57D \uD655\uC778")
|
|
12026
|
+
)
|
|
12027
|
+
).action(async (keyStoreId, value, _opts, command) => {
|
|
12028
|
+
const opts = command.optsWithGlobals();
|
|
12029
|
+
requireYes(opts.yes, "\uC778\uC99D \uC815\uBCF4 \uC0AD\uC81C \uC608\uC57D");
|
|
12030
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
12031
|
+
const type = parseAuthTypeOption(opts.type);
|
|
12032
|
+
const parsedValue = parseAuthValue(type, value);
|
|
12033
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12034
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12035
|
+
const deletion = await withSkmSpinner(`SKM ${type} \uC778\uC99D \uC815\uBCF4 ${formatCell(parsedValue)} \uC0AD\uC81C \uC608\uC57D \uC911...`, async () => {
|
|
12036
|
+
const keyStoreName = await resolveKeyStoreName(client, parsedId);
|
|
12037
|
+
return client.scheduleAuthDeletion(type, keyStoreName, parsedValue);
|
|
12038
|
+
});
|
|
12039
|
+
outputSkmWriteResult(
|
|
12040
|
+
opts,
|
|
12041
|
+
{
|
|
12042
|
+
operation: "auth-delete-scheduled",
|
|
12043
|
+
type,
|
|
12044
|
+
keyStoreId: parsedId,
|
|
12045
|
+
value: deletion.value,
|
|
12046
|
+
name: deletion.name,
|
|
12047
|
+
deletionDateTime: deletion.deletionDateTime
|
|
12048
|
+
},
|
|
12049
|
+
[formatCell(parsedValue)]
|
|
12050
|
+
);
|
|
12051
|
+
});
|
|
12052
|
+
var authPurgeCommand = withTypeOption(
|
|
12053
|
+
withSkmOptions(
|
|
12054
|
+
new import_commander60.Command("purge").description(`\uC778\uC99D \uC815\uBCF4\uB97C \uC989\uC2DC \uC0AD\uC81C\uD55C\uB2E4 (\uC0AD\uC81C \uC608\uC57D\uB41C \uAC83\uB9CC, \uB418\uB3CC\uB9B4 \uC218 \uC5C6\uC74C) ${LOCKOUT_WARNING}`).argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID").argument("<value>", "IPv4\xB7MAC \uAC12 \uB610\uB294 \uC778\uC99D\uC11C \uC774\uB984").option("--yes", "\uC989\uC2DC \uC0AD\uC81C \uD655\uC778")
|
|
12055
|
+
)
|
|
12056
|
+
).action(async (keyStoreId, value, _opts, command) => {
|
|
12057
|
+
const opts = command.optsWithGlobals();
|
|
12058
|
+
requireYes(opts.yes, "\uC778\uC99D \uC815\uBCF4 \uC989\uC2DC \uC0AD\uC81C");
|
|
12059
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
12060
|
+
const type = parseAuthTypeOption(opts.type);
|
|
12061
|
+
const parsedValue = parseAuthValue(type, value);
|
|
12062
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12063
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12064
|
+
const deletion = await withSkmSpinner(`SKM ${type} \uC778\uC99D \uC815\uBCF4 ${formatCell(parsedValue)} \uC989\uC2DC \uC0AD\uC81C \uC911...`, async () => {
|
|
12065
|
+
const keyStoreName = await resolveKeyStoreName(client, parsedId);
|
|
12066
|
+
return client.deleteAuthNow(type, keyStoreName, parsedValue);
|
|
12067
|
+
});
|
|
12068
|
+
outputSkmWriteResult(
|
|
12069
|
+
opts,
|
|
12070
|
+
{
|
|
12071
|
+
operation: "auth-purge",
|
|
12072
|
+
type,
|
|
12073
|
+
keyStoreId: parsedId,
|
|
12074
|
+
value: deletion.value,
|
|
12075
|
+
name: deletion.name,
|
|
12076
|
+
deletionDateTime: deletion.deletionDateTime
|
|
12077
|
+
},
|
|
12078
|
+
[formatCell(parsedValue)]
|
|
12079
|
+
);
|
|
12080
|
+
});
|
|
12081
|
+
|
|
12082
|
+
// src/commands/skm/keystore.ts
|
|
12083
|
+
var KEYSTORE_FIELDS = [
|
|
12084
|
+
"keyStoreId",
|
|
12085
|
+
"name",
|
|
12086
|
+
"description",
|
|
12087
|
+
"ip4AuthUse",
|
|
12088
|
+
"macAuthUse",
|
|
12089
|
+
"certificateAuthUse",
|
|
12090
|
+
"creationUser",
|
|
12091
|
+
"creationDatetime",
|
|
12092
|
+
"lastChangeUser",
|
|
12093
|
+
"lastChangeDatetime"
|
|
12094
|
+
];
|
|
12095
|
+
var listCommand16 = withSkmOptions(new import_commander61.Command("list").description("\uD0A4 \uC800\uC7A5\uC18C \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)")).action(async (_opts, command) => {
|
|
12096
|
+
const opts = command.optsWithGlobals();
|
|
12097
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12098
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12099
|
+
const stores = await withSkmSpinner("SKM \uD0A4 \uC800\uC7A5\uC18C \uBAA9\uB85D \uC870\uD68C \uC911...", () => client.listKeyStores());
|
|
12100
|
+
output(opts, {
|
|
12101
|
+
headers: ["keyStoreId", "name", "ip4AuthUse", "macAuthUse", "certificateAuthUse", "lastChangeDatetime"],
|
|
12102
|
+
rows: stores.map((s) => [
|
|
12103
|
+
formatCell(s.keyStoreId),
|
|
12104
|
+
formatCell(s.name),
|
|
12105
|
+
formatCell(s.ip4AuthUse),
|
|
12106
|
+
formatCell(s.macAuthUse),
|
|
12107
|
+
formatCell(s.certificateAuthUse),
|
|
12108
|
+
formatCell(s.lastChangeDatetime)
|
|
12109
|
+
]),
|
|
12110
|
+
raw: stores,
|
|
12111
|
+
ids: stores.map((s) => String(s.keyStoreId))
|
|
12112
|
+
});
|
|
12113
|
+
});
|
|
12114
|
+
var getCommand11 = withSkmOptions(
|
|
12115
|
+
new import_commander61.Command("get").description("\uD0A4 \uC800\uC7A5\uC18C \uD55C \uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID")
|
|
12116
|
+
).action(async (keyStoreId, _opts, command) => {
|
|
12117
|
+
const opts = command.optsWithGlobals();
|
|
12118
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
12119
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12120
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12121
|
+
const store = await withSkmSpinner(`SKM \uD0A4 \uC800\uC7A5\uC18C ${parsedId} \uC870\uD68C \uC911...`, () => client.getKeyStore(parsedId));
|
|
12122
|
+
output(opts, {
|
|
12123
|
+
headers: ["field", "value"],
|
|
12124
|
+
rows: KEYSTORE_FIELDS.map((field) => [field, formatCell(store[field])]),
|
|
12125
|
+
raw: store,
|
|
12126
|
+
ids: [String(store.keyStoreId)]
|
|
12127
|
+
});
|
|
12128
|
+
});
|
|
12129
|
+
var authListCommand = withTypeOption(
|
|
12130
|
+
withSkmOptions(
|
|
12131
|
+
new import_commander61.Command("list").description("\uD0A4 \uC800\uC7A5\uC18C \uC778\uC99D \uC815\uBCF4 \uAC12 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID")
|
|
12132
|
+
)
|
|
12133
|
+
).action(async (keyStoreId, _opts, command) => {
|
|
12134
|
+
const opts = command.optsWithGlobals();
|
|
12135
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
12136
|
+
const type = parseAuthTypeOption(opts.type);
|
|
12137
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12138
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12139
|
+
const values = await withSkmSpinner(`SKM ${type} \uC778\uC99D \uC815\uBCF4 \uBAA9\uB85D \uC870\uD68C \uC911...`, () => client.listAuths(parsedId, type));
|
|
12140
|
+
output(opts, {
|
|
12141
|
+
headers: ["value"],
|
|
12142
|
+
rows: values.map((v) => [formatCell(v)]),
|
|
12143
|
+
raw: values,
|
|
12144
|
+
ids: values.map((v) => formatCell(v))
|
|
12145
|
+
});
|
|
12146
|
+
});
|
|
12147
|
+
var authGetCommand = withTypeOption(
|
|
12148
|
+
withSkmOptions(
|
|
12149
|
+
new import_commander61.Command("get").description("\uD0A4 \uC800\uC7A5\uC18C \uC778\uC99D \uC815\uBCF4 \uC0C1\uC138\uB97C \uC870\uD68C\uD55C\uB2E4 (\uC778\uC99D\uC11C \uBE44\uBC00\uBC88\uD638\uB294 \uAC00\uB9B0\uB2E4)").argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID").argument("<value>", "IPv4\xB7MAC \uAC12 \uB610\uB294 \uC778\uC99D\uC11C \uC774\uB984")
|
|
12150
|
+
)
|
|
12151
|
+
).action(async (keyStoreId, value, _opts, command) => {
|
|
12152
|
+
const opts = command.optsWithGlobals();
|
|
12153
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
12154
|
+
const parsedValue = parseRequiredArgument(value, "value");
|
|
12155
|
+
const type = parseAuthTypeOption(opts.type);
|
|
12156
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12157
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12158
|
+
const details = await withSkmSpinner(
|
|
12159
|
+
`SKM ${type} \uC778\uC99D \uC815\uBCF4 \uC870\uD68C \uC911...`,
|
|
12160
|
+
() => client.getAuth(parsedId, type, parsedValue)
|
|
12161
|
+
);
|
|
12162
|
+
const masked = details.map(maskAuthDetail);
|
|
12163
|
+
const keys = masked.map((d) => formatCell(d.value ?? d.name));
|
|
12164
|
+
output(opts, {
|
|
12165
|
+
headers: ["value", "description", "expirationDate", "lastAccessDatetime", "deletionDatetime", "lastChangeDatetime"],
|
|
12166
|
+
rows: masked.map((d, i) => [
|
|
12167
|
+
keys[i] ?? "-",
|
|
12168
|
+
formatCell(d.description),
|
|
12169
|
+
formatCell(d.expirationDate),
|
|
12170
|
+
formatCell(d.lastAccessDatetime),
|
|
12171
|
+
formatCell(d.deletionDatetime),
|
|
12172
|
+
formatCell(d.lastChangeDatetime)
|
|
12173
|
+
]),
|
|
12174
|
+
raw: masked,
|
|
12175
|
+
ids: keys
|
|
12176
|
+
});
|
|
12177
|
+
});
|
|
12178
|
+
var authCommand = new import_commander61.Command("auth").description("\uD0A4 \uC800\uC7A5\uC18C IPv4\xB7MAC\xB7\uC778\uC99D\uC11C \uC778\uC99D \uC815\uBCF4 \uC870\uD68C\xB7\uAD00\uB9AC").addCommand(authListCommand).addCommand(authGetCommand).addCommand(authAddCommand).addCommand(authDeleteCommand).addCommand(authPurgeCommand);
|
|
12179
|
+
var keystoreCommand = new import_commander61.Command("keystore").description("SKM \uD0A4 \uC800\uC7A5\uC18C\uC640 \uC778\uC99D \uC815\uBCF4 \uC870\uD68C\xB7\uAD00\uB9AC").addCommand(listCommand16).addCommand(getCommand11).addCommand(createCommand11).addCommand(updateCommand4).addCommand(deleteCommand9).addCommand(authCommand);
|
|
12180
|
+
|
|
12181
|
+
// src/commands/skm/key.ts
|
|
12182
|
+
var import_commander63 = require("commander");
|
|
12183
|
+
|
|
12184
|
+
// src/commands/skm/key-manage.ts
|
|
12185
|
+
var import_commander62 = require("commander");
|
|
12186
|
+
var createCommand12 = withSkmOptions(
|
|
12187
|
+
new import_commander62.Command("create").description("\uD0A4 \uC800\uC7A5\uC18C\uC5D0 \uD0A4\uB97C \uB9CC\uB4E0\uB2E4 (\uAE30\uBC00 \uB370\uC774\uD130 \uAC12\uC740 --value, --file, \uD45C\uC900 \uC785\uB825 \uC911 \uD558\uB098)").argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID").requiredOption("--type <type>", "\uD0A4 \uC885\uB958 (secret|symmetric-key|asymmetric-key)").requiredOption("--name <name>", "\uD0A4 \uC774\uB984 (100\uC790 \uC774\uD558)").option("--description <text>", "\uD0A4 \uC124\uBA85").option("--value <value>", "\uAE30\uBC00 \uB370\uC774\uD130 \uAC12 (--type secret \uC804\uC6A9)").option("--file <path>", "\uAE30\uBC00 \uB370\uC774\uD130 \uAC12\uC744 \uC77D\uC744 \uD30C\uC77C (--type secret \uC804\uC6A9)")
|
|
12188
|
+
).action(async (keyStoreId, _opts, command) => {
|
|
12189
|
+
const opts = command.optsWithGlobals();
|
|
12190
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
12191
|
+
const type = parseKeyTypeOption(opts.type);
|
|
12192
|
+
const name = parseKeyNameOption(opts.name);
|
|
12193
|
+
const description = opts.description?.trim() || void 0;
|
|
12194
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12195
|
+
let secretValue;
|
|
12196
|
+
if (type === "SECRET") {
|
|
12197
|
+
const input = readSkmInput(
|
|
12198
|
+
{ text: opts.value, file: opts.file },
|
|
12199
|
+
{ textFlag: "--value", label: "\uAE30\uBC00 \uB370\uC774\uD130", maxBytes: MAX_JSON_INPUT_BYTES }
|
|
12200
|
+
);
|
|
12201
|
+
secretValue = decodeUtf8Input(input, "\uAE30\uBC00 \uB370\uC774\uD130", "\uBC14\uC774\uB108\uB9AC\uB294 base64\uB85C \uC778\uCF54\uB529\uD574 \uC804\uB2EC\uD558\uC138\uC694.");
|
|
12202
|
+
} else if (opts.value !== void 0 || opts.file !== void 0) {
|
|
12203
|
+
throw new NhnCloudCliError("--value\uC640 --file\uC740 --type secret\uC5D0\uC11C\uB9CC \uC501\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
12204
|
+
}
|
|
12205
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12206
|
+
const created = await withSkmSpinner(`SKM \uD0A4 ${formatCell(name)} \uC0DD\uC131 \uC911...`, async () => {
|
|
12207
|
+
const keyStoreName = await resolveKeyStoreName(client, parsedId);
|
|
12208
|
+
if (secretValue !== void 0) {
|
|
12209
|
+
return client.createSecret(keyStoreName, name, description, secretValue);
|
|
12210
|
+
}
|
|
12211
|
+
if (type === "SYMMETRIC_KEY") {
|
|
12212
|
+
return client.createSymmetricKey(keyStoreName, name, description);
|
|
12213
|
+
}
|
|
12214
|
+
return client.createAsymmetricKey(keyStoreName, name, description);
|
|
12215
|
+
});
|
|
12216
|
+
outputSkmWriteResult(
|
|
12217
|
+
opts,
|
|
12218
|
+
{ keyId: created.keyId, keyStatus: created.keyStatus, keyStoreId: parsedId, name },
|
|
12219
|
+
[formatCell(created.keyId)]
|
|
12220
|
+
);
|
|
12221
|
+
});
|
|
12222
|
+
var deleteCommand10 = withSkmOptions(
|
|
12223
|
+
new import_commander62.Command("delete").description("\uD0A4 \uC0AD\uC81C\uB97C \uC608\uC57D\uD55C\uB2E4 (7\uC77C \uB4A4 \uC0AD\uC81C, \uADF8 \uC804\uC5D0\uB294 \uCF58\uC194\uC5D0\uC11C \uCDE8\uC18C \uAC00\uB2A5)").argument("<key-id>", "\uD0A4 ID").option("--yes", "\uC0AD\uC81C \uC608\uC57D \uD655\uC778")
|
|
12224
|
+
).action(async (keyId, _opts, command) => {
|
|
12225
|
+
const opts = command.optsWithGlobals();
|
|
12226
|
+
requireYes(opts.yes, "\uD0A4 \uC0AD\uC81C \uC608\uC57D");
|
|
12227
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12228
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12229
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12230
|
+
const deletion = await withSkmSpinner(
|
|
12231
|
+
`SKM \uD0A4 ${formatCell(parsedKeyId)} \uC0AD\uC81C \uC608\uC57D \uC911...`,
|
|
12232
|
+
() => client.scheduleKeyDeletion(parsedKeyId)
|
|
12233
|
+
);
|
|
12234
|
+
outputSkmWriteResult(
|
|
12235
|
+
opts,
|
|
12236
|
+
{
|
|
12237
|
+
operation: "key-delete-scheduled",
|
|
12238
|
+
status: "succeeded",
|
|
12239
|
+
keyId: deletion.keyId,
|
|
12240
|
+
deletionDateTime: deletion.deletionDateTime
|
|
12241
|
+
},
|
|
12242
|
+
[formatCell(deletion.keyId)]
|
|
12243
|
+
);
|
|
12244
|
+
});
|
|
12245
|
+
var purgeCommand = withSkmOptions(
|
|
12246
|
+
new import_commander62.Command("purge").description("\uD0A4\uB97C \uC989\uC2DC \uC0AD\uC81C\uD55C\uB2E4 (\uC0AD\uC81C \uC608\uC57D\uB41C \uD0A4\uB9CC, \uB418\uB3CC\uB9B4 \uC218 \uC5C6\uC74C)").argument("<key-id>", "\uD0A4 ID").option("--yes", "\uC989\uC2DC \uC0AD\uC81C \uD655\uC778")
|
|
12247
|
+
).action(async (keyId, _opts, command) => {
|
|
12248
|
+
const opts = command.optsWithGlobals();
|
|
12249
|
+
requireYes(opts.yes, "\uD0A4 \uC989\uC2DC \uC0AD\uC81C");
|
|
12250
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12251
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12252
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12253
|
+
const deletion = await withSkmSpinner(
|
|
12254
|
+
`SKM \uD0A4 ${formatCell(parsedKeyId)} \uC989\uC2DC \uC0AD\uC81C \uC911...`,
|
|
12255
|
+
() => client.deleteKeyNow(parsedKeyId)
|
|
12256
|
+
);
|
|
12257
|
+
outputSkmWriteResult(
|
|
12258
|
+
opts,
|
|
12259
|
+
{ operation: "key-purge", status: "succeeded", keyId: deletion.keyId, deletionDateTime: deletion.deletionDateTime },
|
|
12260
|
+
[formatCell(deletion.keyId)]
|
|
12261
|
+
);
|
|
12262
|
+
});
|
|
12263
|
+
|
|
12264
|
+
// src/commands/skm/key.ts
|
|
12265
|
+
var KEY_FIELDS = [
|
|
12266
|
+
"keyId",
|
|
12267
|
+
"name",
|
|
12268
|
+
"description",
|
|
12269
|
+
"keyType",
|
|
12270
|
+
"currentKeyValueVersion",
|
|
12271
|
+
"autoRotationPeriod",
|
|
12272
|
+
"nextAutoRotationDate",
|
|
12273
|
+
"lastAccessDatetime",
|
|
12274
|
+
"deletionDatetime",
|
|
12275
|
+
"creationUser",
|
|
12276
|
+
"creationDatetime",
|
|
12277
|
+
"lastChangeUser",
|
|
12278
|
+
"lastChangeDatetime"
|
|
12279
|
+
];
|
|
12280
|
+
var listCommand17 = withSkmOptions(
|
|
12281
|
+
new import_commander63.Command("list").description("\uD0A4 \uC800\uC7A5\uC18C\uC758 \uD0A4 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC804\uCCB4 \uD544\uB4DC\uB294 --json)").argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID").option("--type <type>", "\uD0A4 \uC885\uB958 (secret|symmetric-key|asymmetric-key)").option("--name <name>", "\uD0A4 \uC774\uB984 \uD544\uD130 (100\uC790 \uC774\uD558)").option("--status <status>", "\uD0A4 \uC0C1\uD0DC \uD544\uD130 (active|inactive)")
|
|
12282
|
+
).action(async (keyStoreId, _opts, command) => {
|
|
12283
|
+
const opts = command.optsWithGlobals();
|
|
12284
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
12285
|
+
const type = parseKeyTypeOption(opts.type);
|
|
12286
|
+
const name = parseKeyNameOption(opts.name);
|
|
12287
|
+
const status = parseKeyStatusOption(opts.status);
|
|
12288
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12289
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12290
|
+
const filter = {
|
|
12291
|
+
...type !== void 0 && { type },
|
|
12292
|
+
...name !== void 0 && { name },
|
|
12293
|
+
...status !== void 0 && { status }
|
|
12294
|
+
};
|
|
12295
|
+
const keys = await withSkmSpinner(
|
|
12296
|
+
`SKM \uD0A4 \uC800\uC7A5\uC18C ${parsedId} \uD0A4 \uBAA9\uB85D \uC870\uD68C \uC911...`,
|
|
12297
|
+
() => client.listKeys(parsedId, filter)
|
|
12298
|
+
);
|
|
12299
|
+
output(opts, {
|
|
12300
|
+
headers: ["keyId", "name", "keyType", "currentKeyValueVersion", "lastAccessDatetime", "deletionDatetime"],
|
|
12301
|
+
rows: keys.map((k) => [
|
|
12302
|
+
formatCell(k.keyId),
|
|
12303
|
+
formatCell(k.name),
|
|
12304
|
+
formatCell(k.keyType),
|
|
12305
|
+
formatCell(k.currentKeyValueVersion),
|
|
12306
|
+
formatCell(k.lastAccessDatetime),
|
|
12307
|
+
formatCell(k.deletionDatetime)
|
|
12308
|
+
]),
|
|
12309
|
+
raw: keys,
|
|
12310
|
+
ids: keys.map((k) => formatCell(k.keyId))
|
|
12311
|
+
});
|
|
12312
|
+
});
|
|
12313
|
+
var getCommand12 = withSkmOptions(
|
|
12314
|
+
new import_commander63.Command("get").description("\uD0A4 \uD55C \uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<keystore-id>", "\uD0A4 \uC800\uC7A5\uC18C ID").argument("<key-id>", "\uD0A4 ID")
|
|
12315
|
+
).action(async (keyStoreId, keyId, _opts, command) => {
|
|
12316
|
+
const opts = command.optsWithGlobals();
|
|
12317
|
+
const parsedId = parseKeyStoreId(keyStoreId);
|
|
12318
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12319
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12320
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12321
|
+
const key = await withSkmSpinner(
|
|
12322
|
+
`SKM \uD0A4 ${formatCell(parsedKeyId)} \uC870\uD68C \uC911...`,
|
|
12323
|
+
() => client.getKey(parsedId, parsedKeyId)
|
|
12324
|
+
);
|
|
12325
|
+
output(opts, {
|
|
12326
|
+
headers: ["field", "value"],
|
|
12327
|
+
rows: KEY_FIELDS.map((field) => [field, formatCell(key[field])]),
|
|
12328
|
+
raw: key,
|
|
12329
|
+
ids: [formatCell(key.keyId)]
|
|
12330
|
+
});
|
|
12331
|
+
});
|
|
12332
|
+
var keyCommand = new import_commander63.Command("key").description("SKM \uD0A4 \uC870\uD68C\uC640 \uAD00\uB9AC").addCommand(listCommand17).addCommand(getCommand12).addCommand(createCommand12).addCommand(deleteCommand10).addCommand(purgeCommand);
|
|
12333
|
+
|
|
12334
|
+
// src/commands/skm/secret.ts
|
|
12335
|
+
var import_commander64 = require("commander");
|
|
12336
|
+
var getCommand13 = withSkmOptions(
|
|
12337
|
+
new import_commander64.Command("get").description("\uAE30\uBC00 \uB370\uC774\uD130\uB97C \uC870\uD68C\uD55C\uB2E4 (\uC6D0\uBB38\uC744 stdout\uC5D0 \uCD9C\uB825)").argument("<key-id>", "\uD0A4 ID")
|
|
12338
|
+
).action(async (keyId, _opts, command) => {
|
|
12339
|
+
const opts = command.optsWithGlobals();
|
|
12340
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12341
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12342
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12343
|
+
const secret = await withSkmSpinner(
|
|
12344
|
+
`SKM \uAE30\uBC00 \uB370\uC774\uD130 ${formatCell(parsedKeyId)} \uC870\uD68C \uC911...`,
|
|
12345
|
+
() => client.getSecret(parsedKeyId)
|
|
12346
|
+
);
|
|
12347
|
+
printSkmValue(opts, secret, { secret });
|
|
12348
|
+
});
|
|
12349
|
+
var updateCommand5 = withSkmOptions(
|
|
12350
|
+
new import_commander64.Command("update").description("\uAE30\uBC00 \uB370\uC774\uD130 \uAC12\uC744 \uBC14\uAFBC\uB2E4 (\uAC12\uC740 --value, --file, \uD45C\uC900 \uC785\uB825 \uC911 \uD558\uB098)").argument("<key-id>", "\uD0A4 ID").option("--value <value>", "\uC0C8 \uAE30\uBC00 \uB370\uC774\uD130 \uAC12").option("--file <path>", "\uC0C8 \uAE30\uBC00 \uB370\uC774\uD130 \uAC12\uC744 \uC77D\uC744 \uD30C\uC77C")
|
|
12351
|
+
).action(async (keyId, _opts, command) => {
|
|
12352
|
+
const opts = command.optsWithGlobals();
|
|
12353
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12354
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12355
|
+
const input = readSkmInput(
|
|
12356
|
+
{ text: opts.value, file: opts.file },
|
|
12357
|
+
{ textFlag: "--value", label: "\uAE30\uBC00 \uB370\uC774\uD130", maxBytes: MAX_JSON_INPUT_BYTES }
|
|
12358
|
+
);
|
|
12359
|
+
const secretValue = decodeUtf8Input(input, "\uAE30\uBC00 \uB370\uC774\uD130", "\uBC14\uC774\uB108\uB9AC\uB294 base64\uB85C \uC778\uCF54\uB529\uD574 \uC804\uB2EC\uD558\uC138\uC694.");
|
|
12360
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12361
|
+
const updated = await withSkmSpinner(
|
|
12362
|
+
`SKM \uAE30\uBC00 \uB370\uC774\uD130 ${formatCell(parsedKeyId)} \uC218\uC815 \uC911...`,
|
|
12363
|
+
() => client.updateSecret(parsedKeyId, secretValue)
|
|
12364
|
+
);
|
|
12365
|
+
const { secretValue: _omitted, ...result } = updated;
|
|
12366
|
+
outputSkmWriteResult(opts, result, [formatCell(updated.keyId)]);
|
|
12367
|
+
});
|
|
12368
|
+
var secretCommand = new import_commander64.Command("secret").description("SKM \uAE30\uBC00 \uB370\uC774\uD130 \uC870\uD68C\uC640 \uC218\uC815").addCommand(getCommand13).addCommand(updateCommand5);
|
|
12369
|
+
|
|
12370
|
+
// src/commands/skm/symmetric-key.ts
|
|
12371
|
+
var import_commander65 = require("commander");
|
|
12372
|
+
var MAX_ENCRYPT_BYTES = 32768;
|
|
12373
|
+
var encryptCommand = withSkmOptions(
|
|
12374
|
+
new import_commander65.Command("encrypt").description("\uB300\uCE6D\uD0A4\uB85C \uB370\uC774\uD130\uB97C \uC554\uD638\uD654\uD55C\uB2E4 (--plaintext / --file / stdin, UTF-8 \uD14D\uC2A4\uD2B8 32KB \uC774\uD558)").argument("<key-id>", "\uD0A4 ID").option("--plaintext <text>", "\uC554\uD638\uD654\uD560 \uB370\uC774\uD130").option("--file <path>", "\uC554\uD638\uD654\uD560 \uB370\uC774\uD130\uB97C \uC77D\uC744 \uD30C\uC77C \uACBD\uB85C")
|
|
12375
|
+
).action(async (keyId, _opts, command) => {
|
|
12376
|
+
const opts = command.optsWithGlobals();
|
|
12377
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12378
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12379
|
+
const label = "\uC554\uD638\uD654\uD560 \uB370\uC774\uD130";
|
|
12380
|
+
const input = readSkmInput(
|
|
12381
|
+
{ text: opts.plaintext, file: opts.file },
|
|
12382
|
+
{ textFlag: "--plaintext", label, maxBytes: MAX_ENCRYPT_BYTES }
|
|
12383
|
+
);
|
|
12384
|
+
const plaintext = decodeUtf8Input(input, label, "\uBC14\uC774\uB108\uB9AC\uB294 base64\uB85C \uC778\uCF54\uB529\uD574 \uC804\uB2EC\uD558\uC138\uC694.");
|
|
12385
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12386
|
+
const body = await withSkmSpinner(
|
|
12387
|
+
`SKM \uB300\uCE6D\uD0A4 ${formatCell(parsedKeyId)}\uB85C \uC554\uD638\uD654 \uC911...`,
|
|
12388
|
+
() => client.encrypt(parsedKeyId, plaintext)
|
|
12389
|
+
);
|
|
12390
|
+
printSkmValue(opts, body.ciphertext, body);
|
|
12391
|
+
});
|
|
12392
|
+
var decryptCommand = withSkmOptions(
|
|
12393
|
+
new import_commander65.Command("decrypt").description("\uB300\uCE6D\uD0A4\uB85C \uC554\uD638\uBB38\uC744 \uBCF5\uD638\uD654\uD55C\uB2E4 (--ciphertext / --file / stdin, \uD3C9\uBB38\uC744 stdout\uC5D0 \uCD9C\uB825)").argument("<key-id>", "\uD0A4 ID").option("--ciphertext <text>", "\uBCF5\uD638\uD654\uD560 \uC554\uD638\uBB38 (base64)").option("--file <path>", "\uBCF5\uD638\uD654\uD560 \uC554\uD638\uBB38\uC744 \uC77D\uC744 \uD30C\uC77C \uACBD\uB85C")
|
|
12394
|
+
).action(async (keyId, _opts, command) => {
|
|
12395
|
+
const opts = command.optsWithGlobals();
|
|
12396
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12397
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12398
|
+
const label = "\uBCF5\uD638\uD654\uD560 \uC554\uD638\uBB38";
|
|
12399
|
+
const input = readSkmInput(
|
|
12400
|
+
{ text: opts.ciphertext, file: opts.file },
|
|
12401
|
+
{ textFlag: "--ciphertext", label, maxBytes: MAX_JSON_INPUT_BYTES }
|
|
12402
|
+
);
|
|
12403
|
+
const ciphertext = decodeUtf8Input(input, label, "\uC554\uD638\uBB38\uC740 base64 \uBB38\uC790\uC5F4\uC785\uB2C8\uB2E4.").trim();
|
|
12404
|
+
if (!ciphertext) {
|
|
12405
|
+
throw new NhnCloudCliError(`${label}\uC774 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
12406
|
+
}
|
|
12407
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12408
|
+
const body = await withSkmSpinner(
|
|
12409
|
+
`SKM \uB300\uCE6D\uD0A4 ${formatCell(parsedKeyId)}\uB85C \uBCF5\uD638\uD654 \uC911...`,
|
|
12410
|
+
() => client.decrypt(parsedKeyId, ciphertext)
|
|
12411
|
+
);
|
|
12412
|
+
printSkmValue(opts, body.plaintext, body);
|
|
12413
|
+
});
|
|
12414
|
+
var getCommand14 = withSkmOptions(
|
|
12415
|
+
new import_commander65.Command("get").description("\uB300\uCE6D\uD0A4 \uC6D0\uBB38\uC744 \uC870\uD68C\uD55C\uB2E4 (\uC6D0\uBB38\uC744 stdout\uC5D0 \uCD9C\uB825)").argument("<key-id>", "\uD0A4 ID").option("--key-version <n>", "\uC870\uD68C\uD560 \uD0A4 \uBC84\uC804 (0 \uC774\uC0C1, \uC0DD\uB7B5\uD558\uBA74 \uBC84\uC804\uC744 \uC9C0\uC815\uD558\uC9C0 \uC54A\uACE0 \uC694\uCCAD)")
|
|
12416
|
+
).action(async (keyId, _opts, command) => {
|
|
12417
|
+
const opts = command.optsWithGlobals();
|
|
12418
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12419
|
+
const keyVersion = parseKeyVersionOption(opts.keyVersion);
|
|
12420
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12421
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12422
|
+
const body = await withSkmSpinner(
|
|
12423
|
+
`SKM \uB300\uCE6D\uD0A4 ${formatCell(parsedKeyId)} \uC870\uD68C \uC911...`,
|
|
12424
|
+
() => client.getSymmetricKey(parsedKeyId, keyVersion)
|
|
12425
|
+
);
|
|
12426
|
+
printSkmValue(opts, body.symmetricKey, body);
|
|
12427
|
+
});
|
|
12428
|
+
var createLocalKeyCommand = withSkmOptions(
|
|
12429
|
+
new import_commander65.Command("create-local-key").description("\uB85C\uCEEC \uC554\uD638\uD654\uC5D0 \uC4F8 \uB370\uC774\uD130 \uD0A4\uB97C \uB9CC\uB4E0\uB2E4 (\uD3C9\uBB38 \uD0A4\uB294 \uC774 \uC751\uB2F5\uC5D0\uC11C\uB9CC \uBC1B\uC744 \uC218 \uC788\uB2E4)").argument("<key-id>", "\uD0A4 ID")
|
|
12430
|
+
).action(async (keyId, _opts, command) => {
|
|
12431
|
+
const opts = command.optsWithGlobals();
|
|
12432
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12433
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12434
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12435
|
+
const body = await withSkmSpinner(
|
|
12436
|
+
`SKM \uB300\uCE6D\uD0A4 ${formatCell(parsedKeyId)}\uB85C \uB85C\uCEEC \uD0A4 \uC0DD\uC131 \uC911...`,
|
|
12437
|
+
() => client.createLocalKey(parsedKeyId)
|
|
12438
|
+
);
|
|
12439
|
+
output(opts, {
|
|
12440
|
+
headers: ["field", "value"],
|
|
12441
|
+
rows: [
|
|
12442
|
+
["localKeyPlaintext", formatCell(body.localKeyPlaintext)],
|
|
12443
|
+
["localKeyCiphertext", formatCell(body.localKeyCiphertext)],
|
|
12444
|
+
["keyVersion", formatCell(body.keyVersion)]
|
|
12445
|
+
],
|
|
12446
|
+
raw: body,
|
|
12447
|
+
ids: [body.localKeyPlaintext, body.localKeyCiphertext]
|
|
12448
|
+
});
|
|
12449
|
+
});
|
|
12450
|
+
var symmetricKeyCommand = new import_commander65.Command("symmetric-key").description("SKM \uB300\uCE6D\uD0A4 \uC554\uBCF5\uD638\uD654\uC640 \uD0A4 \uC870\uD68C").addCommand(encryptCommand).addCommand(decryptCommand).addCommand(getCommand14).addCommand(createLocalKeyCommand);
|
|
12451
|
+
|
|
12452
|
+
// src/commands/skm/asymmetric-key.ts
|
|
12453
|
+
var import_commander66 = require("commander");
|
|
12454
|
+
var MAX_SIGN_BYTES = 245;
|
|
12455
|
+
var MAX_STANDARD_SIGN_BYTES = 65536;
|
|
12456
|
+
function readSignPayload(opts, label) {
|
|
12457
|
+
const input = readSkmInput(
|
|
12458
|
+
{ text: opts.plaintext, file: opts.file },
|
|
12459
|
+
{ textFlag: "--plaintext", label, maxBytes: opts.standard ? MAX_STANDARD_SIGN_BYTES : MAX_SIGN_BYTES }
|
|
12460
|
+
);
|
|
12461
|
+
if (opts.standard) return input.toString("base64");
|
|
12462
|
+
return decodeUtf8Input(input, label, "\uBC14\uC774\uB108\uB9AC\uB294 --standard\uB85C \uC11C\uBA85\uD558\uC138\uC694.");
|
|
12463
|
+
}
|
|
12464
|
+
function withSignInputOptions(command) {
|
|
12465
|
+
return command.argument("<key-id>", "\uD0A4 ID").option("--plaintext <text>", "\uB370\uC774\uD130 (\uBBF8\uC9C0\uC815 \uC2DC --file \uB610\uB294 stdin)").option("--file <path>", "\uB370\uC774\uD130\uB97C \uC77D\uC744 \uD30C\uC77C \uACBD\uB85C").option("--standard", "\uD45C\uC900 \uC2A4\uD0B4(RSASSA-PSS)\uC73C\uB85C \uCC98\uB9AC\uD55C\uB2E4 (\uBC14\uC774\uB108\uB9AC \uAC00\uB2A5, 64KB \uC774\uD558)");
|
|
12466
|
+
}
|
|
12467
|
+
var signCommand = withSkmOptions(
|
|
12468
|
+
withSignInputOptions(
|
|
12469
|
+
new import_commander66.Command("sign").description("\uBE44\uB300\uCE6D\uD0A4\uB85C \uB370\uC774\uD130\uC5D0 \uC11C\uBA85\uD55C\uB2E4 (\uC77C\uBC18 \uC11C\uBA85\uC740 UTF-8 \uD14D\uC2A4\uD2B8 245\uBC14\uC774\uD2B8 \uC774\uD558)")
|
|
12470
|
+
)
|
|
12471
|
+
).action(async (keyId, _opts, command) => {
|
|
12472
|
+
const opts = command.optsWithGlobals();
|
|
12473
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12474
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12475
|
+
const payload = readSignPayload(opts, "\uC11C\uBA85\uD560 \uB370\uC774\uD130");
|
|
12476
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12477
|
+
const body = await withSkmSpinner(
|
|
12478
|
+
`SKM \uBE44\uB300\uCE6D\uD0A4 ${formatCell(parsedKeyId)}\uB85C \uC11C\uBA85 \uC911...`,
|
|
12479
|
+
() => opts.standard ? client.signStandard(parsedKeyId, payload) : client.sign(parsedKeyId, payload)
|
|
12480
|
+
);
|
|
12481
|
+
printSkmValue(opts, body.signature, body);
|
|
12482
|
+
});
|
|
12483
|
+
var verifyCommand = withSkmOptions(
|
|
12484
|
+
withSignInputOptions(
|
|
12485
|
+
new import_commander66.Command("verify").description("\uBE44\uB300\uCE6D\uD0A4\uB85C \uC11C\uBA85\uC744 \uAC80\uC99D\uD55C\uB2E4 (\uAC80\uC99D \uC2E4\uD328\uB294 \uC885\uB8CC \uCF54\uB4DC 1)")
|
|
12486
|
+
).requiredOption("--signature <sig>", "\uAC80\uC99D\uD560 \uC11C\uBA85\uAC12 (base64)").option("--key-version <n>", "\uC11C\uBA85\uD55C \uD0A4 \uBC84\uC804 (--standard \uAC80\uC99D\uC5D0 \uD544\uC218)")
|
|
12487
|
+
).action(async (keyId, _opts, command) => {
|
|
12488
|
+
const opts = command.optsWithGlobals();
|
|
12489
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12490
|
+
const signature = opts.signature.trim();
|
|
12491
|
+
if (!signature) {
|
|
12492
|
+
throw new NhnCloudCliError("--signature\uAC00 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
12493
|
+
}
|
|
12494
|
+
const keyVersion = parseKeyVersionOption(opts.keyVersion);
|
|
12495
|
+
if (opts.standard && keyVersion === void 0) {
|
|
12496
|
+
throw new NhnCloudCliError("--standard \uAC80\uC99D\uC5D0\uB294 --key-version\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
12497
|
+
}
|
|
12498
|
+
if (!opts.standard && keyVersion !== void 0) {
|
|
12499
|
+
throw new NhnCloudCliError("--key-version\uC740 --standard\uC640 \uD568\uAED8 \uC9C0\uC815\uD569\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
12500
|
+
}
|
|
12501
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12502
|
+
const payload = readSignPayload(opts, "\uAC80\uC99D\uD560 \uB370\uC774\uD130");
|
|
12503
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12504
|
+
const body = await withSkmSpinner(
|
|
12505
|
+
`SKM \uBE44\uB300\uCE6D\uD0A4 ${formatCell(parsedKeyId)}\uB85C \uC11C\uBA85 \uAC80\uC99D \uC911...`,
|
|
12506
|
+
() => keyVersion !== void 0 ? client.verifyStandard(parsedKeyId, payload, signature, keyVersion) : client.verify(parsedKeyId, payload, signature)
|
|
12507
|
+
);
|
|
12508
|
+
if (opts.json) {
|
|
12509
|
+
printJson(body);
|
|
12510
|
+
} else if (!opts.quiet) {
|
|
12511
|
+
const verdict = body.result ? "\uAC80\uC99D \uC131\uACF5" : "\uAC80\uC99D \uC2E4\uD328";
|
|
12512
|
+
process.stdout.write(`${verdict} (keyVersion ${body.keyVersion})
|
|
12513
|
+
`);
|
|
12514
|
+
}
|
|
12515
|
+
if (!body.result) {
|
|
12516
|
+
throw new NhnCloudCliError("\uC11C\uBA85 \uAC80\uC99D\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.", EXIT_API_ERROR);
|
|
12517
|
+
}
|
|
12518
|
+
});
|
|
12519
|
+
function keyMaterialCommand(name, description, fetch, spinnerLabel) {
|
|
12520
|
+
return withSkmOptions(
|
|
12521
|
+
new import_commander66.Command(name).description(description).argument("<key-id>", "\uD0A4 ID").option("--key-version <n>", "\uC870\uD68C\uD560 \uD0A4 \uBC84\uC804 (0 \uC774\uC0C1, \uC0DD\uB7B5\uD558\uBA74 \uBC84\uC804\uC744 \uC9C0\uC815\uD558\uC9C0 \uC54A\uACE0 \uC694\uCCAD)")
|
|
12522
|
+
).action(async (keyId, _opts, command) => {
|
|
12523
|
+
const opts = command.optsWithGlobals();
|
|
12524
|
+
const parsedKeyId = parseRequiredArgument(keyId, "key-id");
|
|
12525
|
+
const keyVersion = parseKeyVersionOption(opts.keyVersion);
|
|
12526
|
+
const macAddress = parseMacAddressOption(opts.macAddress);
|
|
12527
|
+
const { client } = await resolveSkmClient({ profile: opts.profile, macAddress });
|
|
12528
|
+
const body = await withSkmSpinner(
|
|
12529
|
+
`SKM \uBE44\uB300\uCE6D\uD0A4 ${formatCell(parsedKeyId)} ${spinnerLabel} \uC870\uD68C \uC911...`,
|
|
12530
|
+
() => fetch(client, parsedKeyId, keyVersion)
|
|
12531
|
+
);
|
|
12532
|
+
printSkmValue(opts, body.standardEncodedKey ?? body.encodedKey, body);
|
|
12533
|
+
});
|
|
12534
|
+
}
|
|
12535
|
+
var publicKeyCommand = keyMaterialCommand(
|
|
12536
|
+
"public-key",
|
|
12537
|
+
"\uACF5\uAC1C\uD0A4\uB97C \uC870\uD68C\uD55C\uB2E4 (standardEncodedKey\uB97C, \uC5C6\uC73C\uBA74 encodedKey\uB97C stdout\uC5D0 \uCD9C\uB825)",
|
|
12538
|
+
(client, keyId, keyVersion) => client.getPublicKey(keyId, keyVersion),
|
|
12539
|
+
"\uACF5\uAC1C\uD0A4"
|
|
12540
|
+
);
|
|
12541
|
+
var privateKeyCommand = keyMaterialCommand(
|
|
12542
|
+
"private-key",
|
|
12543
|
+
"\uAC1C\uC778\uD0A4 \uC6D0\uBB38\uC744 \uC870\uD68C\uD55C\uB2E4 (standardEncodedKey\uB97C, \uC5C6\uC73C\uBA74 encodedKey\uB97C stdout\uC5D0 \uCD9C\uB825)",
|
|
12544
|
+
(client, keyId, keyVersion) => client.getPrivateKey(keyId, keyVersion),
|
|
12545
|
+
"\uAC1C\uC778\uD0A4"
|
|
12546
|
+
);
|
|
12547
|
+
var asymmetricKeyCommand = new import_commander66.Command("asymmetric-key").description("SKM \uBE44\uB300\uCE6D\uD0A4 \uC11C\uBA85\xB7\uAC80\uC99D\uACFC \uD0A4 \uC870\uD68C").addCommand(signCommand).addCommand(verifyCommand).addCommand(publicKeyCommand).addCommand(privateKeyCommand);
|
|
10421
12548
|
|
|
10422
12549
|
// src/commands/loadbalancer/list.ts
|
|
10423
|
-
var
|
|
12550
|
+
var import_commander67 = require("commander");
|
|
10424
12551
|
|
|
10425
12552
|
// src/commands/loadbalancer/helpers.ts
|
|
10426
|
-
var
|
|
12553
|
+
var import_node_net3 = require("net");
|
|
10427
12554
|
|
|
10428
12555
|
// src/services/loadbalancer/client.ts
|
|
10429
|
-
var
|
|
12556
|
+
var import_ky17 = __toESM(require("ky"));
|
|
10430
12557
|
|
|
10431
12558
|
// src/services/loadbalancer/types.ts
|
|
10432
|
-
function
|
|
12559
|
+
function isRecord5(value) {
|
|
10433
12560
|
return typeof value === "object" && value !== null;
|
|
10434
12561
|
}
|
|
10435
12562
|
function isNonEmptyString(value) {
|
|
@@ -10439,29 +12566,29 @@ function isIpAclAction(value) {
|
|
|
10439
12566
|
return value === "ALLOW" || value === "DENY";
|
|
10440
12567
|
}
|
|
10441
12568
|
function isLoadBalancerIpAclGroup(value) {
|
|
10442
|
-
return
|
|
12569
|
+
return isRecord5(value) && isNonEmptyString(value["ipacl_group_id"]);
|
|
10443
12570
|
}
|
|
10444
12571
|
function isIpAclGroupLoadBalancer(value) {
|
|
10445
|
-
return
|
|
12572
|
+
return isRecord5(value) && isNonEmptyString(value["loadbalancer_id"]);
|
|
10446
12573
|
}
|
|
10447
12574
|
function isLoadBalancer(value) {
|
|
10448
|
-
if (!
|
|
12575
|
+
if (!isRecord5(value)) return false;
|
|
10449
12576
|
return isNonEmptyString(value["id"]) && typeof value["name"] === "string" && typeof value["vip_address"] === "string" && typeof value["provisioning_status"] === "string" && typeof value["operating_status"] === "string" && (value["ipacl_group_action"] === null || isIpAclAction(value["ipacl_group_action"])) && Array.isArray(value["ipacl_groups"]) && value["ipacl_groups"].every(isLoadBalancerIpAclGroup);
|
|
10450
12577
|
}
|
|
10451
12578
|
function isIpAclGroup(value) {
|
|
10452
|
-
if (!
|
|
12579
|
+
if (!isRecord5(value)) return false;
|
|
10453
12580
|
return isNonEmptyString(value["id"]) && typeof value["name"] === "string" && isIpAclAction(value["action"]) && typeof value["ipacl_target_count"] === "string" && Array.isArray(value["loadbalancers"]) && value["loadbalancers"].every(isIpAclGroupLoadBalancer);
|
|
10454
12581
|
}
|
|
10455
12582
|
function isIpAclTarget(value) {
|
|
10456
|
-
if (!
|
|
12583
|
+
if (!isRecord5(value)) return false;
|
|
10457
12584
|
return isNonEmptyString(value["id"]) && typeof value["cidr_address"] === "string" && typeof value["description"] === "string" && isNonEmptyString(value["ipacl_group_id"]);
|
|
10458
12585
|
}
|
|
10459
12586
|
function isIpAclBinding(value) {
|
|
10460
|
-
return
|
|
12587
|
+
return isRecord5(value) && isNonEmptyString(value["loadbalancer_id"]) && isNonEmptyString(value["ipacl_group_id"]);
|
|
10461
12588
|
}
|
|
10462
12589
|
|
|
10463
12590
|
// src/services/loadbalancer/client.ts
|
|
10464
|
-
function
|
|
12591
|
+
function isRecord6(value) {
|
|
10465
12592
|
return typeof value === "object" && value !== null;
|
|
10466
12593
|
}
|
|
10467
12594
|
function requireNonEmptyId(id, label) {
|
|
@@ -10472,7 +12599,7 @@ function requireNonEmptyId(id, label) {
|
|
|
10472
12599
|
return normalized;
|
|
10473
12600
|
}
|
|
10474
12601
|
function readArrayField(response, key, itemGuard, missingKeyMessage, invalidItemMessage) {
|
|
10475
|
-
if (!
|
|
12602
|
+
if (!isRecord6(response) || !Array.isArray(response[key])) {
|
|
10476
12603
|
throw new NhnCloudCliError(missingKeyMessage, EXIT_API_ERROR);
|
|
10477
12604
|
}
|
|
10478
12605
|
const items = response[key];
|
|
@@ -10482,7 +12609,7 @@ function readArrayField(response, key, itemGuard, missingKeyMessage, invalidItem
|
|
|
10482
12609
|
return items;
|
|
10483
12610
|
}
|
|
10484
12611
|
function readObjectField(response, key, itemGuard, missingKeyMessage, invalidItemMessage) {
|
|
10485
|
-
if (!
|
|
12612
|
+
if (!isRecord6(response) || !(key in response)) {
|
|
10486
12613
|
throw new NhnCloudCliError(missingKeyMessage, EXIT_API_ERROR);
|
|
10487
12614
|
}
|
|
10488
12615
|
const item = response[key];
|
|
@@ -10623,7 +12750,7 @@ var LoadBalancerClient = class {
|
|
|
10623
12750
|
async getJson(path5, searchParams) {
|
|
10624
12751
|
const url = `${this.endpoint}${path5}`;
|
|
10625
12752
|
try {
|
|
10626
|
-
return await
|
|
12753
|
+
return await import_ky17.default.get(url, {
|
|
10627
12754
|
headers: this.authHeaders(),
|
|
10628
12755
|
searchParams,
|
|
10629
12756
|
retry: 0,
|
|
@@ -10636,7 +12763,7 @@ var LoadBalancerClient = class {
|
|
|
10636
12763
|
async postJson(path5, json) {
|
|
10637
12764
|
const url = `${this.endpoint}${path5}`;
|
|
10638
12765
|
try {
|
|
10639
|
-
return await
|
|
12766
|
+
return await import_ky17.default.post(url, {
|
|
10640
12767
|
headers: this.authHeaders(),
|
|
10641
12768
|
json,
|
|
10642
12769
|
retry: 0,
|
|
@@ -10649,7 +12776,7 @@ var LoadBalancerClient = class {
|
|
|
10649
12776
|
async putJson(path5, json) {
|
|
10650
12777
|
const url = `${this.endpoint}${path5}`;
|
|
10651
12778
|
try {
|
|
10652
|
-
return await
|
|
12779
|
+
return await import_ky17.default.put(url, {
|
|
10653
12780
|
headers: this.authHeaders(),
|
|
10654
12781
|
json,
|
|
10655
12782
|
retry: 0,
|
|
@@ -10662,7 +12789,7 @@ var LoadBalancerClient = class {
|
|
|
10662
12789
|
async deleteNoContent(path5) {
|
|
10663
12790
|
const url = `${this.endpoint}${path5}`;
|
|
10664
12791
|
try {
|
|
10665
|
-
await
|
|
12792
|
+
await import_ky17.default.delete(url, {
|
|
10666
12793
|
headers: this.authHeaders(),
|
|
10667
12794
|
retry: 0,
|
|
10668
12795
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -10674,26 +12801,10 @@ var LoadBalancerClient = class {
|
|
|
10674
12801
|
};
|
|
10675
12802
|
|
|
10676
12803
|
// src/commands/loadbalancer/helpers.ts
|
|
10677
|
-
function requireResourceInput(value, label) {
|
|
10678
|
-
const normalized = value.trim();
|
|
10679
|
-
if (!normalized) {
|
|
10680
|
-
throw new NhnCloudCliError(`${label} \uC774\uB984 \uB610\uB294 UUID\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
10681
|
-
}
|
|
10682
|
-
return normalized;
|
|
10683
|
-
}
|
|
10684
12804
|
function optionalTrimmed(value) {
|
|
10685
12805
|
if (value === void 0) return void 0;
|
|
10686
12806
|
return value.trim();
|
|
10687
12807
|
}
|
|
10688
|
-
function requireYes2(yes, operation) {
|
|
10689
|
-
if (!yes) {
|
|
10690
|
-
throw new NhnCloudCliError(
|
|
10691
|
-
`${operation}\uC5D0\uB294 --yes \uD50C\uB798\uADF8\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.`,
|
|
10692
|
-
EXIT_PARAM_ERROR
|
|
10693
|
-
);
|
|
10694
|
-
}
|
|
10695
|
-
return true;
|
|
10696
|
-
}
|
|
10697
12808
|
function parseIpAclAction(value) {
|
|
10698
12809
|
if (value !== "ALLOW" && value !== "DENY") {
|
|
10699
12810
|
throw new NhnCloudCliError(
|
|
@@ -10716,7 +12827,7 @@ function parseIpOrCidr(value) {
|
|
|
10716
12827
|
const normalized = value.trim();
|
|
10717
12828
|
const parts = normalized.split("/");
|
|
10718
12829
|
const address = parts[0] ?? "";
|
|
10719
|
-
const version = (0,
|
|
12830
|
+
const version = (0, import_node_net3.isIP)(address);
|
|
10720
12831
|
if (version === 0 || parts.length > 2) {
|
|
10721
12832
|
throw new NhnCloudCliError(
|
|
10722
12833
|
`--cidr\uC740 IP \uC8FC\uC18C \uB610\uB294 CIDR\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4: ${JSON.stringify(value)}`,
|
|
@@ -10735,30 +12846,6 @@ function parseIpOrCidr(value) {
|
|
|
10735
12846
|
}
|
|
10736
12847
|
return normalized;
|
|
10737
12848
|
}
|
|
10738
|
-
function resolvedId(resource, label) {
|
|
10739
|
-
const id = resource.id.trim();
|
|
10740
|
-
if (!id) {
|
|
10741
|
-
throw new NhnCloudCliError(`${label} \uC870\uD68C \uACB0\uACFC\uC758 UUID\uAC00 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
10742
|
-
}
|
|
10743
|
-
return id;
|
|
10744
|
-
}
|
|
10745
|
-
function resolveFromList(resources, input, label) {
|
|
10746
|
-
const exactId = resources.find((resource) => resource.id === input);
|
|
10747
|
-
if (exactId) return resolvedId(exactId, label);
|
|
10748
|
-
const nameMatches = resources.filter((resource) => resource.name === input);
|
|
10749
|
-
if (nameMatches.length === 1) return resolvedId(nameMatches[0], label);
|
|
10750
|
-
if (nameMatches.length === 0) {
|
|
10751
|
-
throw new NhnCloudCliError(
|
|
10752
|
-
`${label}\uC744(\uB97C) \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${JSON.stringify(input)}`,
|
|
10753
|
-
EXIT_PARAM_ERROR
|
|
10754
|
-
);
|
|
10755
|
-
}
|
|
10756
|
-
const candidateIds = nameMatches.map((resource) => resolvedId(resource, label)).sort();
|
|
10757
|
-
throw new NhnCloudCliError(
|
|
10758
|
-
`${label} \uC774\uB984\uC774 \uC911\uBCF5\uB429\uB2C8\uB2E4: ${JSON.stringify(input)} (\uD6C4\uBCF4 UUID: ${candidateIds.join(", ")})`,
|
|
10759
|
-
EXIT_PARAM_ERROR
|
|
10760
|
-
);
|
|
10761
|
-
}
|
|
10762
12849
|
async function resolveLoadBalancerId(client, value) {
|
|
10763
12850
|
const input = requireResourceInput(value, "Load Balancer");
|
|
10764
12851
|
const resources = await client.listLoadBalancers();
|
|
@@ -10793,7 +12880,7 @@ async function resolveLoadBalancerClient(opts) {
|
|
|
10793
12880
|
}
|
|
10794
12881
|
|
|
10795
12882
|
// src/commands/loadbalancer/list.ts
|
|
10796
|
-
var
|
|
12883
|
+
var listCommand18 = new import_commander67.Command("list").description("Load Balancer \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) => {
|
|
10797
12884
|
const opts = cmd.optsWithGlobals();
|
|
10798
12885
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
10799
12886
|
startSpinner("Load Balancer \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -10831,8 +12918,8 @@ var listCommand14 = new import_commander55.Command("list").description("Load Bal
|
|
|
10831
12918
|
});
|
|
10832
12919
|
|
|
10833
12920
|
// src/commands/loadbalancer/get.ts
|
|
10834
|
-
var
|
|
10835
|
-
var
|
|
12921
|
+
var import_commander68 = require("commander");
|
|
12922
|
+
var getCommand15 = new import_commander68.Command("get").description("Load Balancer\uB97C \uC774\uB984 \uB610\uB294 UUID\uB85C \uC870\uD68C\uD55C\uB2E4").argument("<loadbalancer>", "Load Balancer \uC774\uB984 \uB610\uB294 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 (loadBalancerInput, _opts, cmd) => {
|
|
10836
12923
|
const opts = cmd.optsWithGlobals();
|
|
10837
12924
|
const input = requireResourceInput(loadBalancerInput, "Load Balancer");
|
|
10838
12925
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
@@ -10869,10 +12956,10 @@ var getCommand9 = new import_commander56.Command("get").description("Load Balanc
|
|
|
10869
12956
|
});
|
|
10870
12957
|
|
|
10871
12958
|
// src/commands/loadbalancer/ipacl.ts
|
|
10872
|
-
var
|
|
12959
|
+
var import_commander70 = require("commander");
|
|
10873
12960
|
|
|
10874
12961
|
// src/commands/loadbalancer/target.ts
|
|
10875
|
-
var
|
|
12962
|
+
var import_commander69 = require("commander");
|
|
10876
12963
|
|
|
10877
12964
|
// src/commands/loadbalancer/rebind.ts
|
|
10878
12965
|
function shellQuote(value) {
|
|
@@ -11003,7 +13090,7 @@ function targetWriteResult(operation, target, rebind) {
|
|
|
11003
13090
|
rebind
|
|
11004
13091
|
};
|
|
11005
13092
|
}
|
|
11006
|
-
var
|
|
13093
|
+
var listCommand19 = new import_commander69.Command("list").description("IP ACL \uB300\uC0C1 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<group>", "IP ACL \uADF8\uB8F9 \uC774\uB984 \uB610\uB294 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 (groupInput, _opts, cmd) => {
|
|
11007
13094
|
const opts = cmd.optsWithGlobals();
|
|
11008
13095
|
const input = requireResourceInput(groupInput, "IP ACL \uADF8\uB8F9");
|
|
11009
13096
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
@@ -11032,9 +13119,9 @@ var listCommand15 = new import_commander57.Command("list").description("IP ACL \
|
|
|
11032
13119
|
ids: targets.map((target) => target.id)
|
|
11033
13120
|
});
|
|
11034
13121
|
});
|
|
11035
|
-
var addCommand = new
|
|
13122
|
+
var addCommand = new import_commander69.Command("add").description("IP ACL \uB300\uC0C1\uC744 \uCD94\uAC00\uD558\uACE0 \uC5F0\uACB0\uB41C Load Balancer\uB97C \uC7AC\uBC14\uC778\uB529\uD55C\uB2E4").argument("<group>", "IP ACL \uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID").requiredOption("--cidr <ip-or-cidr>", "\uCD94\uAC00\uD560 IP \uC8FC\uC18C \uB610\uB294 CIDR").option("--description <text>", "IP ACL \uB300\uC0C1 \uC124\uBA85").option("--no-rebind", "\uB300\uC0C1 \uCD94\uAC00 \uD6C4 Load Balancer \uC7AC\uBC14\uC778\uB529 \uC0DD\uB7B5").option("--yes", "\uB300\uC0C1 \uCD94\uAC00 \uD655\uC778").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 (groupInput, _opts, cmd) => {
|
|
11036
13123
|
const opts = cmd.optsWithGlobals();
|
|
11037
|
-
|
|
13124
|
+
requireYes(opts.yes, "IP ACL \uB300\uC0C1 \uCD94\uAC00");
|
|
11038
13125
|
const parsedGroup = requireResourceInput(groupInput, "IP ACL \uADF8\uB8F9");
|
|
11039
13126
|
const parsedCidr = parseIpOrCidr(opts.cidr ?? "");
|
|
11040
13127
|
const parsedDescription = optionalTrimmed(opts.description);
|
|
@@ -11069,9 +13156,9 @@ var addCommand = new import_commander57.Command("add").description("IP ACL \uB30
|
|
|
11069
13156
|
writeTargetWarnings(group, result);
|
|
11070
13157
|
if (result.status === "partial") process.exitCode = EXIT_API_ERROR;
|
|
11071
13158
|
});
|
|
11072
|
-
var removeCommand = new
|
|
13159
|
+
var removeCommand = new import_commander69.Command("remove").description("IP ACL \uB300\uC0C1\uC744 \uC0AD\uC81C\uD558\uACE0 \uC5F0\uACB0\uB41C Load Balancer\uB97C \uC7AC\uBC14\uC778\uB529\uD55C\uB2E4").argument("<target-id>", "\uC0AD\uC81C\uD560 IP ACL \uB300\uC0C1 UUID").option("--no-rebind", "\uB300\uC0C1 \uC0AD\uC81C \uD6C4 Load Balancer \uC7AC\uBC14\uC778\uB529 \uC0DD\uB7B5").option("--yes", "\uB300\uC0C1 \uC0AD\uC81C \uD655\uC778").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 (targetInput, _opts, cmd) => {
|
|
11073
13160
|
const opts = cmd.optsWithGlobals();
|
|
11074
|
-
|
|
13161
|
+
requireYes(opts.yes, "IP ACL \uB300\uC0C1 \uC0AD\uC81C");
|
|
11075
13162
|
const parsedTargetId = requireResourceInput(targetInput, "IP ACL \uB300\uC0C1");
|
|
11076
13163
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
11077
13164
|
startSpinner("IP ACL \uB300\uC0C1 \uC0AD\uC81C\uC640 Load Balancer \uC7AC\uBC14\uC778\uB529 \uC911...");
|
|
@@ -11100,13 +13187,13 @@ var removeCommand = new import_commander57.Command("remove").description("IP ACL
|
|
|
11100
13187
|
writeTargetWarnings(group, result);
|
|
11101
13188
|
if (result.status === "partial") process.exitCode = EXIT_API_ERROR;
|
|
11102
13189
|
});
|
|
11103
|
-
var targetCommand = new
|
|
11104
|
-
targetCommand.addCommand(
|
|
13190
|
+
var targetCommand = new import_commander69.Command("target").description("IP ACL \uB300\uC0C1 \uC870\uD68C\xB7\uAD00\uB9AC");
|
|
13191
|
+
targetCommand.addCommand(listCommand19);
|
|
11105
13192
|
targetCommand.addCommand(addCommand);
|
|
11106
13193
|
targetCommand.addCommand(removeCommand);
|
|
11107
13194
|
|
|
11108
13195
|
// src/commands/loadbalancer/ipacl.ts
|
|
11109
|
-
var
|
|
13196
|
+
var listCommand20 = new import_commander70.Command("list").description("IP ACL \uADF8\uB8F9 \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) => {
|
|
11110
13197
|
const opts = cmd.optsWithGlobals();
|
|
11111
13198
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
11112
13199
|
startSpinner("IP ACL \uADF8\uB8F9 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -11134,7 +13221,7 @@ var listCommand16 = new import_commander58.Command("list").description("IP ACL \
|
|
|
11134
13221
|
ids: groups.map((group) => group.id)
|
|
11135
13222
|
});
|
|
11136
13223
|
});
|
|
11137
|
-
var
|
|
13224
|
+
var getCommand16 = new import_commander70.Command("get").description("IP ACL \uADF8\uB8F9\uC744 \uC774\uB984 \uB610\uB294 UUID\uB85C \uC870\uD68C\uD55C\uB2E4").argument("<group>", "IP ACL \uADF8\uB8F9 \uC774\uB984 \uB610\uB294 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 (groupInput, _opts, cmd) => {
|
|
11138
13225
|
const opts = cmd.optsWithGlobals();
|
|
11139
13226
|
const input = requireResourceInput(groupInput, "IP ACL \uADF8\uB8F9");
|
|
11140
13227
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
@@ -11167,7 +13254,7 @@ var getCommand10 = new import_commander58.Command("get").description("IP ACL \uA
|
|
|
11167
13254
|
ids: [group.id]
|
|
11168
13255
|
});
|
|
11169
13256
|
});
|
|
11170
|
-
var
|
|
13257
|
+
var createCommand13 = new import_commander70.Command("create").description("IP ACL \uADF8\uB8F9\uC744 \uC0DD\uC131\uD55C\uB2E4").requiredOption("--name <name>", "IP ACL \uADF8\uB8F9 \uC774\uB984").requiredOption("--action <ALLOW|DENY>", "IP \uC811\uADFC \uC81C\uC5B4 \uB3D9\uC791").option("--description <text>", "IP ACL \uADF8\uB8F9 \uC124\uBA85").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) => {
|
|
11171
13258
|
const opts = cmd.optsWithGlobals();
|
|
11172
13259
|
const parsedName = requireResourceInput(opts.name ?? "", "IP ACL \uADF8\uB8F9");
|
|
11173
13260
|
const parsedAction = parseIpAclAction(opts.action ?? "");
|
|
@@ -11198,9 +13285,9 @@ var createCommand9 = new import_commander58.Command("create").description("IP AC
|
|
|
11198
13285
|
ids: [group.id]
|
|
11199
13286
|
});
|
|
11200
13287
|
});
|
|
11201
|
-
var
|
|
13288
|
+
var deleteCommand11 = new import_commander70.Command("delete").description("IP ACL \uADF8\uB8F9\uACFC \uD558\uC704 \uB300\uC0C1\uC744 \uC0AD\uC81C\uD55C\uB2E4").argument("<group>", "IP ACL \uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID").option("--yes", "\uC0AD\uC81C\uC640 \uC5F0\uACB0 \uADDC\uCE59 \uC81C\uAC70 \uD655\uC778").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 (groupInput, _opts, cmd) => {
|
|
11202
13289
|
const opts = cmd.optsWithGlobals();
|
|
11203
|
-
const confirmedYes =
|
|
13290
|
+
const confirmedYes = requireYes(opts.yes, "IP ACL \uADF8\uB8F9 \uC0AD\uC81C");
|
|
11204
13291
|
const parsedGroup = requireResourceInput(groupInput, "IP ACL \uADF8\uB8F9");
|
|
11205
13292
|
if (confirmedYes) {
|
|
11206
13293
|
process.stderr.write(
|
|
@@ -11230,23 +13317,15 @@ var deleteCommand7 = new import_commander58.Command("delete").description("IP AC
|
|
|
11230
13317
|
ids: [groupId]
|
|
11231
13318
|
});
|
|
11232
13319
|
});
|
|
11233
|
-
var ipaclCommand = new
|
|
11234
|
-
ipaclCommand.addCommand(
|
|
11235
|
-
ipaclCommand.addCommand(
|
|
11236
|
-
ipaclCommand.addCommand(
|
|
11237
|
-
ipaclCommand.addCommand(
|
|
13320
|
+
var ipaclCommand = new import_commander70.Command("ipacl").description("IP ACL \uADF8\uB8F9\xB7\uB300\uC0C1 \uC870\uD68C");
|
|
13321
|
+
ipaclCommand.addCommand(listCommand20);
|
|
13322
|
+
ipaclCommand.addCommand(getCommand16);
|
|
13323
|
+
ipaclCommand.addCommand(createCommand13);
|
|
13324
|
+
ipaclCommand.addCommand(deleteCommand11);
|
|
11238
13325
|
ipaclCommand.addCommand(targetCommand);
|
|
11239
13326
|
|
|
11240
|
-
// src/commands/loadbalancer/help.ts
|
|
11241
|
-
function configureLoadBalancerHelp(command) {
|
|
11242
|
-
command.configureHelp({ showGlobalOptions: true });
|
|
11243
|
-
for (const child of command.commands) {
|
|
11244
|
-
configureLoadBalancerHelp(child);
|
|
11245
|
-
}
|
|
11246
|
-
}
|
|
11247
|
-
|
|
11248
13327
|
// src/commands/loadbalancer/binding.ts
|
|
11249
|
-
var
|
|
13328
|
+
var import_commander71 = require("commander");
|
|
11250
13329
|
function bindingResult(operation, loadBalancerId, groupIds) {
|
|
11251
13330
|
return {
|
|
11252
13331
|
operation,
|
|
@@ -11268,13 +13347,13 @@ function outputBindingResult(opts, result) {
|
|
|
11268
13347
|
ids: [result.loadbalancer_id]
|
|
11269
13348
|
});
|
|
11270
13349
|
}
|
|
11271
|
-
var setIpAclCommand2 = new
|
|
13350
|
+
var setIpAclCommand2 = new import_commander71.Command("set-ipacl").description("Load Balancer\uC758 IP ACL \uADF8\uB8F9 \uC5F0\uACB0\uC744 \uC804\uCCB4 \uAD50\uCCB4\uD55C\uB2E4").argument("<loadbalancer>", "Load Balancer \uC774\uB984 \uB610\uB294 UUID").requiredOption(
|
|
11272
13351
|
"--group <group>",
|
|
11273
13352
|
"\uC801\uC6A9\uD560 IP ACL \uADF8\uB8F9 \uC774\uB984 \uB610\uB294 UUID (\uBC18\uBCF5 \uAC00\uB2A5)",
|
|
11274
13353
|
collectOption
|
|
11275
13354
|
).option("--yes", "\uAE30\uC874 \uC5F0\uACB0 \uC804\uCCB4 \uAD50\uCCB4 \uD655\uC778").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 (loadBalancerInput, _opts, cmd) => {
|
|
11276
13355
|
const opts = cmd.optsWithGlobals();
|
|
11277
|
-
const confirmedYes =
|
|
13356
|
+
const confirmedYes = requireYes(opts.yes, "Load Balancer IP ACL \uC5F0\uACB0 \uAD50\uCCB4");
|
|
11278
13357
|
const parsedLoadBalancer = requireResourceInput(loadBalancerInput, "Load Balancer");
|
|
11279
13358
|
const parsedGroups = requireResourceInputs(opts.group ?? [], "IP ACL \uADF8\uB8F9");
|
|
11280
13359
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
@@ -11308,9 +13387,9 @@ var setIpAclCommand2 = new import_commander59.Command("set-ipacl").description("
|
|
|
11308
13387
|
bindingResult("loadbalancer-set-ipacl", loadBalancerId, groupIds)
|
|
11309
13388
|
);
|
|
11310
13389
|
});
|
|
11311
|
-
var clearIpAclCommand = new
|
|
13390
|
+
var clearIpAclCommand = new import_commander71.Command("clear-ipacl").description("Load Balancer\uC758 \uBAA8\uB4E0 IP ACL \uADF8\uB8F9 \uC5F0\uACB0\uC744 \uD574\uC81C\uD55C\uB2E4").argument("<loadbalancer>", "Load Balancer \uC774\uB984 \uB610\uB294 UUID").option("--yes", "\uBAA8\uB4E0 IP ACL \uC5F0\uACB0 \uD574\uC81C \uD655\uC778").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 (loadBalancerInput, _opts, cmd) => {
|
|
11312
13391
|
const opts = cmd.optsWithGlobals();
|
|
11313
|
-
const confirmedYes =
|
|
13392
|
+
const confirmedYes = requireYes(opts.yes, "Load Balancer IP ACL \uC5F0\uACB0 \uD574\uC81C");
|
|
11314
13393
|
const parsedLoadBalancer = requireResourceInput(loadBalancerInput, "Load Balancer");
|
|
11315
13394
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
11316
13395
|
startSpinner("Load Balancer IP ACL \uC5F0\uACB0 \uD574\uC81C \uC911...");
|
|
@@ -11360,6 +13439,8 @@ var networkAgentWorkflow = `
|
|
|
11360
13439
|
Agent workflow:
|
|
11361
13440
|
1. nhncloud network list --json
|
|
11362
13441
|
2. nhncloud network subnet list --json
|
|
13442
|
+
3. nhncloud network security-group list --json
|
|
13443
|
+
4. nhncloud network security-group ports <group> --json
|
|
11363
13444
|
`;
|
|
11364
13445
|
var volumeAgentWorkflow = `
|
|
11365
13446
|
Agent workflow:
|
|
@@ -11397,8 +13478,8 @@ Agent workflow:
|
|
|
11397
13478
|
2. nhncloud ncs workload list --json
|
|
11398
13479
|
3. nhncloud ncs workload get <id> --json
|
|
11399
13480
|
`;
|
|
11400
|
-
var program = new
|
|
11401
|
-
program.name("nhncloud").description("NHN Cloud CLI \u2014 AI agent & terminal friendly").version(
|
|
13481
|
+
var program = new import_commander72.Command();
|
|
13482
|
+
program.name("nhncloud").description("NHN Cloud CLI \u2014 AI agent & terminal friendly").version(CLI_VERSION).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").option("--request-timeout <sec>", "HTTP \uC694\uCCAD \uD0C0\uC784\uC544\uC6C3 (\uCD08, \uAE30\uBCF8 30, \uBC94\uC704 1~3600). NHNCLOUD_REQUEST_TIMEOUT \uB85C\uB3C4 \uC9C0\uC815").addHelpText("after", rootAgentHints);
|
|
11402
13483
|
program.hook("preAction", () => {
|
|
11403
13484
|
const opts = program.opts();
|
|
11404
13485
|
const rawTimeout = opts.requestTimeout ?? process.env["NHNCLOUD_REQUEST_TIMEOUT"];
|
|
@@ -11419,13 +13500,13 @@ program.hook("preAction", () => {
|
|
|
11419
13500
|
}
|
|
11420
13501
|
});
|
|
11421
13502
|
program.addCommand(configureCommand);
|
|
11422
|
-
var logncrashCommand = new
|
|
13503
|
+
var logncrashCommand = new import_commander72.Command("logncrash").description("Log & Crash \uAD00\uB828 \uBA85\uB839").addHelpText("after", logncrashAgentWorkflow);
|
|
11423
13504
|
logncrashCommand.addCommand(availableTokenCommand);
|
|
11424
13505
|
logncrashCommand.addCommand(searchCommand);
|
|
11425
13506
|
logncrashCommand.addCommand(sendCommand);
|
|
11426
13507
|
logncrashCommand.addCommand(exportCommand);
|
|
11427
13508
|
program.addCommand(logncrashCommand);
|
|
11428
|
-
var deployCommand2 = new
|
|
13509
|
+
var deployCommand2 = new import_commander72.Command("deploy").description("NHN Cloud Deploy \uAD00\uB828 \uBA85\uB839").addHelpText("after", deployAgentWorkflow);
|
|
11429
13510
|
deployCommand2.hook("preSubcommand", async () => {
|
|
11430
13511
|
await warnLegacyDeployTargets();
|
|
11431
13512
|
});
|
|
@@ -11439,13 +13520,13 @@ deployCommand2.addCommand(binariesCommand);
|
|
|
11439
13520
|
deployCommand2.addCommand(uploadCommand);
|
|
11440
13521
|
deployCommand2.addCommand(downloadCommand);
|
|
11441
13522
|
program.addCommand(deployCommand2);
|
|
11442
|
-
var instanceCommand = new
|
|
13523
|
+
var instanceCommand = new import_commander72.Command("instance").description("Compute \uC778\uC2A4\uD134\uC2A4 \uAD00\uB828 \uBA85\uB839").addHelpText("after", instanceAgentWorkflow);
|
|
11443
13524
|
instanceCommand.addCommand(listCommand);
|
|
11444
13525
|
instanceCommand.addCommand(flavorsCommand);
|
|
11445
13526
|
instanceCommand.addCommand(availabilityZonesCommand);
|
|
11446
|
-
instanceCommand.addCommand(
|
|
11447
|
-
instanceCommand.addCommand(
|
|
11448
|
-
instanceCommand.addCommand(
|
|
13527
|
+
instanceCommand.addCommand(getCommand4);
|
|
13528
|
+
instanceCommand.addCommand(createCommand5);
|
|
13529
|
+
instanceCommand.addCommand(deleteCommand4);
|
|
11449
13530
|
instanceCommand.addCommand(startCommand);
|
|
11450
13531
|
instanceCommand.addCommand(stopCommand);
|
|
11451
13532
|
instanceCommand.addCommand(rebootCommand);
|
|
@@ -11457,60 +13538,70 @@ instanceCommand.addCommand(keypairsCommand);
|
|
|
11457
13538
|
instanceCommand.addCommand(keypairCommand);
|
|
11458
13539
|
instanceCommand.addCommand(volumeCommand);
|
|
11459
13540
|
instanceCommand.addCommand(volumesCommand);
|
|
13541
|
+
instanceCommand.addCommand(securityGroupCommand2);
|
|
11460
13542
|
program.addCommand(instanceCommand);
|
|
11461
|
-
var networkCommand = new
|
|
13543
|
+
var networkCommand = new import_commander72.Command("network").description("VPC\xB7\uC11C\uBE0C\uB137 \uC870\uD68C\uC640 \uBCF4\uC548\uADF8\uB8F9 \uAD00\uB9AC").addHelpText("after", networkAgentWorkflow);
|
|
11462
13544
|
networkCommand.addCommand(listCommand3);
|
|
11463
13545
|
networkCommand.addCommand(subnetCommand);
|
|
13546
|
+
networkCommand.addCommand(securityGroupCommand);
|
|
11464
13547
|
program.addCommand(networkCommand);
|
|
11465
|
-
var volumeCommand2 = new
|
|
13548
|
+
var volumeCommand2 = new import_commander72.Command("volume").description("Block Storage \uBCFC\uB968 \uAD00\uB828 \uBA85\uB839").addHelpText("after", volumeAgentWorkflow);
|
|
11466
13549
|
volumeCommand2.addCommand(listCommand2);
|
|
11467
13550
|
volumeCommand2.addCommand(getCommand);
|
|
11468
13551
|
volumeCommand2.addCommand(createCommand);
|
|
11469
13552
|
program.addCommand(volumeCommand2);
|
|
11470
|
-
var floatingipCommand = new
|
|
13553
|
+
var floatingipCommand = new import_commander72.Command("floatingip").description(
|
|
11471
13554
|
"Floating IP(\uC778\uC2A4\uD134\uC2A4 \uACF5\uC778 IP) \uAD00\uB9AC"
|
|
11472
13555
|
).addHelpText("after", floatingIpAgentWorkflow);
|
|
11473
|
-
floatingipCommand.addCommand(
|
|
11474
|
-
floatingipCommand.addCommand(
|
|
11475
|
-
floatingipCommand.addCommand(
|
|
13556
|
+
floatingipCommand.addCommand(listCommand6);
|
|
13557
|
+
floatingipCommand.addCommand(createCommand4);
|
|
13558
|
+
floatingipCommand.addCommand(deleteCommand3);
|
|
11476
13559
|
program.addCommand(floatingipCommand);
|
|
11477
|
-
var loadbalancerCommand = new
|
|
11478
|
-
loadbalancerCommand.addCommand(
|
|
11479
|
-
loadbalancerCommand.addCommand(
|
|
13560
|
+
var loadbalancerCommand = new import_commander72.Command("loadbalancer").description("Load Balancer\xB7IP ACL \uC870\uD68C\xB7\uAD00\uB9AC").addHelpText("after", loadbalancerAgentWorkflow);
|
|
13561
|
+
loadbalancerCommand.addCommand(listCommand18);
|
|
13562
|
+
loadbalancerCommand.addCommand(getCommand15);
|
|
11480
13563
|
loadbalancerCommand.addCommand(ipaclCommand);
|
|
11481
13564
|
loadbalancerCommand.addCommand(setIpAclCommand2);
|
|
11482
13565
|
loadbalancerCommand.addCommand(clearIpAclCommand);
|
|
11483
|
-
configureLoadBalancerHelp(loadbalancerCommand);
|
|
11484
13566
|
program.addCommand(loadbalancerCommand);
|
|
11485
|
-
var ncrCommand = new
|
|
11486
|
-
ncrCommand.addCommand(
|
|
11487
|
-
ncrCommand.addCommand(
|
|
13567
|
+
var ncrCommand = new import_commander72.Command("ncr").description("NHN Container Registry \uAD00\uB828 \uBA85\uB839").addHelpText("after", ncrAgentWorkflow);
|
|
13568
|
+
ncrCommand.addCommand(listCommand7);
|
|
13569
|
+
ncrCommand.addCommand(getCommand5);
|
|
11488
13570
|
ncrCommand.addCommand(imagesCommand2);
|
|
11489
13571
|
ncrCommand.addCommand(tagsCommand);
|
|
11490
13572
|
program.addCommand(ncrCommand);
|
|
11491
|
-
var nksCommand = new
|
|
13573
|
+
var nksCommand = new import_commander72.Command("nks").description("NHN Kubernetes Service \uAD00\uB828 \uBA85\uB839").addHelpText("after", nksAgentWorkflow);
|
|
11492
13574
|
nksCommand.addCommand(supportsCommand);
|
|
11493
13575
|
nksCommand.addCommand(clusterCommand);
|
|
11494
13576
|
nksCommand.addCommand(nodegroupCommand);
|
|
11495
13577
|
nksCommand.addCommand(addonTypeCommand);
|
|
11496
13578
|
nksCommand.addCommand(addonCommand);
|
|
11497
13579
|
program.addCommand(nksCommand);
|
|
11498
|
-
var ncsCommand = new
|
|
13580
|
+
var ncsCommand = new import_commander72.Command("ncs").description("NHN Container Service \uAD00\uB828 \uBA85\uB839").addHelpText("after", ncsAgentWorkflow);
|
|
11499
13581
|
ncsCommand.addCommand(templateCommand);
|
|
11500
13582
|
ncsCommand.addCommand(workloadCommand);
|
|
11501
13583
|
ncsCommand.addCommand(malwareCommand);
|
|
11502
13584
|
program.addCommand(ncsCommand);
|
|
11503
|
-
var apiGatewayCommand = new
|
|
13585
|
+
var apiGatewayCommand = new import_commander72.Command("apigateway").description("NHN API Gateway \uC870\uD68C \uBA85\uB839");
|
|
11504
13586
|
apiGatewayCommand.addCommand(serviceCommand);
|
|
11505
13587
|
apiGatewayCommand.addCommand(resourceCommand);
|
|
11506
13588
|
apiGatewayCommand.addCommand(stageCommand);
|
|
11507
13589
|
program.addCommand(apiGatewayCommand);
|
|
13590
|
+
var skmCommand = new import_commander72.Command("skm").description("NHN Secure Key Manager \uD0A4 \uC800\uC7A5\uC18C\xB7\uD0A4 \uAD00\uB9AC\uC640 \uAE30\uBC00 \uB370\uC774\uD130\xB7\uC554\uBCF5\uD638\uD654\xB7\uC11C\uBA85 \uBA85\uB839");
|
|
13591
|
+
skmCommand.addCommand(confirmCommand);
|
|
13592
|
+
skmCommand.addCommand(keystoreCommand);
|
|
13593
|
+
skmCommand.addCommand(keyCommand);
|
|
13594
|
+
skmCommand.addCommand(secretCommand);
|
|
13595
|
+
skmCommand.addCommand(symmetricKeyCommand);
|
|
13596
|
+
skmCommand.addCommand(asymmetricKeyCommand);
|
|
13597
|
+
program.addCommand(skmCommand);
|
|
11508
13598
|
program.addCommand(skillsCommand);
|
|
11509
13599
|
program.addCommand(doctorCommand);
|
|
11510
13600
|
program.addCommand(createCommandsCommand(program));
|
|
11511
13601
|
configureCommanderExitCodes(program);
|
|
13602
|
+
configureGlobalOptionsHelp(program);
|
|
11512
13603
|
program.parseAsync().catch((err) => {
|
|
11513
|
-
if (err instanceof
|
|
13604
|
+
if (err instanceof import_commander72.CommanderError) {
|
|
11514
13605
|
process.exit(err.exitCode);
|
|
11515
13606
|
}
|
|
11516
13607
|
const message = sanitizeMultilineForTerminal(
|