@bifos/nhncloud-cli 0.13.0 → 0.15.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 +11 -5
- package/dist/index.js +1556 -555
- package/package.json +1 -1
- package/skills/nhncloud-cli/SKILL.md +2 -1
- package/skills/nhncloud-cli/references/apigateway.md +117 -6
- package/skills/nhncloud-cli/references/deploy.md +42 -43
- package/skills/nhncloud-cli/references/logncrash.md +93 -6
- package/skills/nhncloud-cli/references/ncr.md +5 -7
- package/skills/nhncloud-cli/references/ncs.md +37 -39
- package/skills/nhncloud-cli/references/nks.md +63 -4
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
|
|
26
26
|
// src/index.ts
|
|
27
27
|
var import_commander57 = require("commander");
|
|
28
|
-
var
|
|
28
|
+
var import_chalk18 = __toESM(require("chalk"));
|
|
29
29
|
|
|
30
30
|
// src/utils/spinner.ts
|
|
31
31
|
var import_ora = __toESM(require("ora"));
|
|
@@ -56,6 +56,12 @@ function stopSpinner(success, text) {
|
|
|
56
56
|
current = null;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
// src/config/credentials.ts
|
|
60
|
+
var import_promises = require("fs/promises");
|
|
61
|
+
var import_node_os = require("os");
|
|
62
|
+
var import_node_path = require("path");
|
|
63
|
+
var import_chalk = __toESM(require("chalk"));
|
|
64
|
+
|
|
59
65
|
// src/utils/errors.ts
|
|
60
66
|
var NhnCloudCliError = class extends Error {
|
|
61
67
|
constructor(message, exitCode) {
|
|
@@ -66,77 +72,13 @@ var NhnCloudCliError = class extends Error {
|
|
|
66
72
|
exitCode;
|
|
67
73
|
};
|
|
68
74
|
|
|
69
|
-
// src/api/timeout.ts
|
|
70
|
-
var SYNC_FLOOR_MS = 6e5;
|
|
71
|
-
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
72
|
-
var SYNC_TIMEOUT_MS = SYNC_FLOOR_MS;
|
|
73
|
-
function setRequestTimeoutMs(ms) {
|
|
74
|
-
if (!Number.isInteger(ms) || ms < 1) {
|
|
75
|
-
throw new Error(`setRequestTimeoutMs: 1 \uC774\uC0C1\uC758 \uC815\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${String(ms)}).`);
|
|
76
|
-
}
|
|
77
|
-
DEFAULT_TIMEOUT_MS = ms;
|
|
78
|
-
SYNC_TIMEOUT_MS = Math.max(ms, SYNC_FLOOR_MS);
|
|
79
|
-
}
|
|
80
|
-
function getRequestTimeoutMs() {
|
|
81
|
-
return DEFAULT_TIMEOUT_MS;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
75
|
// src/utils/exit-codes.ts
|
|
85
76
|
var EXIT_API_ERROR = 1;
|
|
86
77
|
var EXIT_AUTH_ERROR = 2;
|
|
87
78
|
var EXIT_PARAM_ERROR = 3;
|
|
88
79
|
var EXIT_CONFIG_ERROR = 4;
|
|
89
80
|
|
|
90
|
-
// src/commands/parse-options.ts
|
|
91
|
-
var POSITIVE_INTEGER_PATTERN = /^[1-9]\d*$/;
|
|
92
|
-
var NON_NEGATIVE_INTEGER_PATTERN = /^(0|[1-9]\d*)$/;
|
|
93
|
-
function parseRequiredArgument(value, label) {
|
|
94
|
-
const trimmed = value.trim();
|
|
95
|
-
if (!trimmed) {
|
|
96
|
-
throw new NhnCloudCliError(`${label} \uC778\uC218\uAC00 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
97
|
-
}
|
|
98
|
-
return trimmed;
|
|
99
|
-
}
|
|
100
|
-
function describeRange({ min, max }) {
|
|
101
|
-
if (min !== void 0 && max !== void 0) return `${min} \uC774\uC0C1 ${max} \uC774\uD558\uC758 \uC815\uC218`;
|
|
102
|
-
if (min !== void 0) return `${min} \uC774\uC0C1\uC758 \uC815\uC218`;
|
|
103
|
-
if (max !== void 0) return `${max} \uC774\uD558\uC758 \uC815\uC218`;
|
|
104
|
-
return "0 \uC774\uC0C1\uC758 \uC815\uC218";
|
|
105
|
-
}
|
|
106
|
-
function throwIntegerOptionError(value, flag, range) {
|
|
107
|
-
throw new NhnCloudCliError(
|
|
108
|
-
`${flag} \uB294 ${describeRange(range)}\uC5EC\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
109
|
-
EXIT_PARAM_ERROR
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
function parseIntegerOption(value, flag, range) {
|
|
113
|
-
if (value === void 0) return void 0;
|
|
114
|
-
const pattern = range.min !== void 0 && range.min > 0 ? POSITIVE_INTEGER_PATTERN : NON_NEGATIVE_INTEGER_PATTERN;
|
|
115
|
-
if (!pattern.test(value)) {
|
|
116
|
-
throwIntegerOptionError(value, flag, range);
|
|
117
|
-
}
|
|
118
|
-
const parsed = Number(value);
|
|
119
|
-
if (!Number.isInteger(parsed) || range.min !== void 0 && parsed < range.min || range.max !== void 0 && parsed > range.max) {
|
|
120
|
-
throwIntegerOptionError(value, flag, range);
|
|
121
|
-
}
|
|
122
|
-
return parsed;
|
|
123
|
-
}
|
|
124
|
-
function parsePositiveIntegerOption(value, flag) {
|
|
125
|
-
return parseIntegerOption(value, flag, { min: 1 });
|
|
126
|
-
}
|
|
127
|
-
function parseNonNegativeIntegerOption(value, flag) {
|
|
128
|
-
return parseIntegerOption(value, flag, { min: 0 });
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/commands/configure.ts
|
|
132
|
-
var import_commander = require("commander");
|
|
133
|
-
var import_chalk = __toESM(require("chalk"));
|
|
134
|
-
var import_core = require("@inquirer/core");
|
|
135
|
-
|
|
136
81
|
// src/config/credentials.ts
|
|
137
|
-
var import_promises = require("fs/promises");
|
|
138
|
-
var import_node_os = require("os");
|
|
139
|
-
var import_node_path = require("path");
|
|
140
82
|
var CREDENTIALS_PATH = (0, import_node_path.join)((0, import_node_os.homedir)(), ".nhncloud", "credentials.json");
|
|
141
83
|
var CONFIG_PATH = (0, import_node_path.join)((0, import_node_os.homedir)(), ".nhncloud", "config.json");
|
|
142
84
|
function isCredentials(value) {
|
|
@@ -195,22 +137,24 @@ nhncloud configure \uB97C \uC2E4\uD589\uD574 \uC790\uACA9\uC99D\uBA85\uC744 \uC1
|
|
|
195
137
|
}
|
|
196
138
|
return parsed;
|
|
197
139
|
}
|
|
198
|
-
async function
|
|
140
|
+
async function readConfigJson() {
|
|
199
141
|
let raw;
|
|
200
142
|
try {
|
|
201
143
|
raw = await (0, import_promises.readFile)(CONFIG_PATH, "utf-8");
|
|
202
144
|
} catch {
|
|
203
145
|
return null;
|
|
204
146
|
}
|
|
205
|
-
let parsed;
|
|
206
147
|
try {
|
|
207
|
-
|
|
148
|
+
return JSON.parse(raw);
|
|
208
149
|
} catch {
|
|
209
150
|
throw new NhnCloudCliError(
|
|
210
151
|
`\uC124\uC815 \uD30C\uC77C \uD30C\uC2F1 \uC624\uB958: ${CONFIG_PATH} \u2014 \uC62C\uBC14\uB978 JSON \uD615\uC2DD\uC778\uC9C0 \uD655\uC778\uD558\uC138\uC694.`,
|
|
211
152
|
EXIT_CONFIG_ERROR
|
|
212
153
|
);
|
|
213
154
|
}
|
|
155
|
+
}
|
|
156
|
+
async function loadConfig() {
|
|
157
|
+
const parsed = await readConfigJson();
|
|
214
158
|
if (!isConfig(parsed)) {
|
|
215
159
|
return null;
|
|
216
160
|
}
|
|
@@ -345,20 +289,98 @@ async function setIaasCredential(profileName, iaas) {
|
|
|
345
289
|
creds.profiles[profileName] = { ...profile, iaas };
|
|
346
290
|
await saveCredentials(creds);
|
|
347
291
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
const targets =
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
);
|
|
292
|
+
function isLegacyDeployConfig(value) {
|
|
293
|
+
if (typeof value !== "object" || value === null) return false;
|
|
294
|
+
const targets = value["targets"];
|
|
295
|
+
return targets === void 0 || typeof targets === "object" && targets !== null;
|
|
296
|
+
}
|
|
297
|
+
async function warnLegacyDeployTargets() {
|
|
298
|
+
let parsed;
|
|
299
|
+
try {
|
|
300
|
+
parsed = await readConfigJson();
|
|
301
|
+
} catch (err) {
|
|
302
|
+
if (err instanceof NhnCloudCliError && err.exitCode === EXIT_CONFIG_ERROR) return;
|
|
303
|
+
throw err;
|
|
304
|
+
}
|
|
305
|
+
if (typeof parsed !== "object" || parsed === null) return;
|
|
306
|
+
const deploy = parsed["deploy"];
|
|
307
|
+
if (!isLegacyDeployConfig(deploy)) return;
|
|
308
|
+
if (!deploy.targets || Object.keys(deploy.targets).length === 0) return;
|
|
309
|
+
process.stderr.write(
|
|
310
|
+
import_chalk.default.yellow(
|
|
311
|
+
"\uACBD\uACE0: config.json \uC758 deploy.targets \uB294 \uB354 \uC774\uC0C1 \uC0AC\uC6A9\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. appkey \uB294 nhncloud configure --deploy-appkey \uB85C \uC62E\uAE30\uACE0, \uB098\uBA38\uC9C0 \uC88C\uD45C\uB294 --artifact-id \uB4F1 \uC635\uC158\uC73C\uB85C \uB118\uAE30\uC138\uC694.\n"
|
|
312
|
+
)
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// src/utils/terminal.ts
|
|
317
|
+
function sanitizeForTerminal(value) {
|
|
318
|
+
return value.replace(/[\x00-\x1F\x7F]/g, "?");
|
|
319
|
+
}
|
|
320
|
+
function sanitizeMultilineForTerminal(value) {
|
|
321
|
+
return value.replace(/[\x00-\x09\x0B-\x1F\x7F]/g, "?");
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// src/api/timeout.ts
|
|
325
|
+
var SYNC_FLOOR_MS = 6e5;
|
|
326
|
+
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
327
|
+
var SYNC_TIMEOUT_MS = SYNC_FLOOR_MS;
|
|
328
|
+
function setRequestTimeoutMs(ms) {
|
|
329
|
+
if (!Number.isInteger(ms) || ms < 1) {
|
|
330
|
+
throw new Error(`setRequestTimeoutMs: 1 \uC774\uC0C1\uC758 \uC815\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${String(ms)}).`);
|
|
331
|
+
}
|
|
332
|
+
DEFAULT_TIMEOUT_MS = ms;
|
|
333
|
+
SYNC_TIMEOUT_MS = Math.max(ms, SYNC_FLOOR_MS);
|
|
334
|
+
}
|
|
335
|
+
function getRequestTimeoutMs() {
|
|
336
|
+
return DEFAULT_TIMEOUT_MS;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// src/commands/parse-options.ts
|
|
340
|
+
var POSITIVE_INTEGER_PATTERN = /^[1-9]\d*$/;
|
|
341
|
+
var NON_NEGATIVE_INTEGER_PATTERN = /^(0|[1-9]\d*)$/;
|
|
342
|
+
function parseRequiredArgument(value, label) {
|
|
343
|
+
const trimmed = value.trim();
|
|
344
|
+
if (!trimmed) {
|
|
345
|
+
throw new NhnCloudCliError(`${label} \uC778\uC218\uAC00 \uBE44\uC5B4\uC788\uC2B5\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
346
|
+
}
|
|
347
|
+
return trimmed;
|
|
348
|
+
}
|
|
349
|
+
function describeRange({ min, max }) {
|
|
350
|
+
if (min !== void 0 && max !== void 0) return `${min} \uC774\uC0C1 ${max} \uC774\uD558\uC758 \uC815\uC218`;
|
|
351
|
+
if (min !== void 0) return `${min} \uC774\uC0C1\uC758 \uC815\uC218`;
|
|
352
|
+
if (max !== void 0) return `${max} \uC774\uD558\uC758 \uC815\uC218`;
|
|
353
|
+
return "0 \uC774\uC0C1\uC758 \uC815\uC218";
|
|
354
|
+
}
|
|
355
|
+
function throwIntegerOptionError(value, flag, range) {
|
|
356
|
+
throw new NhnCloudCliError(
|
|
357
|
+
`${flag} \uB294 ${describeRange(range)}\uC5EC\uC57C \uD569\uB2C8\uB2E4 (\uC785\uB825: ${JSON.stringify(value)}).`,
|
|
358
|
+
EXIT_PARAM_ERROR
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
function parseIntegerOption(value, flag, range) {
|
|
362
|
+
if (value === void 0) return void 0;
|
|
363
|
+
const pattern = range.min !== void 0 && range.min > 0 ? POSITIVE_INTEGER_PATTERN : NON_NEGATIVE_INTEGER_PATTERN;
|
|
364
|
+
if (!pattern.test(value)) {
|
|
365
|
+
throwIntegerOptionError(value, flag, range);
|
|
366
|
+
}
|
|
367
|
+
const parsed = Number(value);
|
|
368
|
+
if (!Number.isInteger(parsed) || range.min !== void 0 && parsed < range.min || range.max !== void 0 && parsed > range.max) {
|
|
369
|
+
throwIntegerOptionError(value, flag, range);
|
|
359
370
|
}
|
|
360
|
-
return
|
|
371
|
+
return parsed;
|
|
372
|
+
}
|
|
373
|
+
function parsePositiveIntegerOption(value, flag) {
|
|
374
|
+
return parseIntegerOption(value, flag, { min: 1 });
|
|
361
375
|
}
|
|
376
|
+
function parseNonNegativeIntegerOption(value, flag) {
|
|
377
|
+
return parseIntegerOption(value, flag, { min: 0 });
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// src/commands/configure.ts
|
|
381
|
+
var import_commander = require("commander");
|
|
382
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
383
|
+
var import_core = require("@inquirer/core");
|
|
362
384
|
|
|
363
385
|
// src/api/oauth.ts
|
|
364
386
|
var import_ky2 = __toESM(require("ky"));
|
|
@@ -737,15 +759,20 @@ async function getIaasToken(profile, iaas, forceRefresh = false) {
|
|
|
737
759
|
}
|
|
738
760
|
|
|
739
761
|
// src/services/logncrash/client.ts
|
|
740
|
-
var
|
|
762
|
+
var import_ky5 = __toESM(require("ky"));
|
|
741
763
|
|
|
742
764
|
// src/api/envelope.ts
|
|
765
|
+
var NhnEnvelopeError = class extends NhnCloudCliError {
|
|
766
|
+
resultCode;
|
|
767
|
+
constructor(resultCode, resultMessage) {
|
|
768
|
+
super(`API \uC624\uB958: ${resultMessage}`, EXIT_API_ERROR);
|
|
769
|
+
this.name = "NhnEnvelopeError";
|
|
770
|
+
this.resultCode = resultCode;
|
|
771
|
+
}
|
|
772
|
+
};
|
|
743
773
|
function unwrapHeader(res) {
|
|
744
774
|
if (!res.header.isSuccessful) {
|
|
745
|
-
throw new
|
|
746
|
-
`API \uC624\uB958: ${res.header.resultMessage}`,
|
|
747
|
-
EXIT_API_ERROR
|
|
748
|
-
);
|
|
775
|
+
throw new NhnEnvelopeError(res.header.resultCode, res.header.resultMessage);
|
|
749
776
|
}
|
|
750
777
|
}
|
|
751
778
|
function unwrap(res) {
|
|
@@ -756,6 +783,45 @@ function unwrap(res) {
|
|
|
756
783
|
return res.body;
|
|
757
784
|
}
|
|
758
785
|
|
|
786
|
+
// src/services/logncrash/errors.ts
|
|
787
|
+
var import_ky4 = require("ky");
|
|
788
|
+
var RATE_LIMIT_RESULT_CODE = 429;
|
|
789
|
+
function isRateLimitError(err) {
|
|
790
|
+
return err instanceof NhnEnvelopeError && Number(err.resultCode) === RATE_LIMIT_RESULT_CODE;
|
|
791
|
+
}
|
|
792
|
+
function withRateLimitHint(err) {
|
|
793
|
+
return new NhnCloudCliError(
|
|
794
|
+
`${err.message}
|
|
795
|
+
\uC870\uD68C \uD69F\uC218 \uC81C\uD55C\uC5D0 \uAC78\uB838\uC2B5\uB2C8\uB2E4. \uC2DC\uAC04\uC744 \uB450\uACE0 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694. \uAC80\uC0C9 \uAE30\uAC04\uC744 \uC881\uD600\uB3C4 \uD480\uB9AC\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.`,
|
|
796
|
+
err.exitCode
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
var LogncrashServerError = class extends NhnCloudCliError {
|
|
800
|
+
requestId;
|
|
801
|
+
constructor(message, requestId) {
|
|
802
|
+
super(message, EXIT_API_ERROR);
|
|
803
|
+
this.name = "LogncrashServerError";
|
|
804
|
+
this.requestId = requestId === null ? null : sanitizeForTerminal(requestId);
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
async function toLogncrashError(err) {
|
|
808
|
+
if (!(err instanceof import_ky4.HTTPError) || err.response.status !== 500) {
|
|
809
|
+
return toNhnCloudCliError(err);
|
|
810
|
+
}
|
|
811
|
+
let requestId = null;
|
|
812
|
+
try {
|
|
813
|
+
const body = await err.response.json();
|
|
814
|
+
if (typeof body === "object" && body !== null && "requestId" in body && typeof body.requestId === "string") {
|
|
815
|
+
requestId = body.requestId;
|
|
816
|
+
}
|
|
817
|
+
} catch {
|
|
818
|
+
}
|
|
819
|
+
return new LogncrashServerError(
|
|
820
|
+
`API \uD638\uCD9C \uC2E4\uD328 (500): ${err.message}`,
|
|
821
|
+
requestId
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
|
|
759
825
|
// src/services/logncrash/client.ts
|
|
760
826
|
var LogncrashClient = class {
|
|
761
827
|
appkey;
|
|
@@ -770,7 +836,7 @@ var LogncrashClient = class {
|
|
|
770
836
|
const endpoint = endpointFor("logncrash");
|
|
771
837
|
const url = `${endpoint}/v3/${encodeURIComponent(this.appkey)}/logs/cursor`;
|
|
772
838
|
try {
|
|
773
|
-
const res = await
|
|
839
|
+
const res = await import_ky5.default.post(url, {
|
|
774
840
|
headers,
|
|
775
841
|
json: {
|
|
776
842
|
query: params.query,
|
|
@@ -785,7 +851,7 @@ var LogncrashClient = class {
|
|
|
785
851
|
}).json();
|
|
786
852
|
return unwrap(res);
|
|
787
853
|
} catch (err) {
|
|
788
|
-
throw
|
|
854
|
+
throw await toLogncrashError(err);
|
|
789
855
|
}
|
|
790
856
|
}
|
|
791
857
|
/**
|
|
@@ -796,7 +862,7 @@ var LogncrashClient = class {
|
|
|
796
862
|
const endpoint = endpointFor("logncrash");
|
|
797
863
|
const url = `${endpoint}/v3/${encodeURIComponent(this.appkey)}/logs/scroll`;
|
|
798
864
|
try {
|
|
799
|
-
const res = await
|
|
865
|
+
const res = await import_ky5.default.post(url, {
|
|
800
866
|
headers,
|
|
801
867
|
json: {
|
|
802
868
|
query: params.query,
|
|
@@ -808,7 +874,7 @@ var LogncrashClient = class {
|
|
|
808
874
|
}).json();
|
|
809
875
|
return unwrap(res);
|
|
810
876
|
} catch (err) {
|
|
811
|
-
throw
|
|
877
|
+
throw await toLogncrashError(err);
|
|
812
878
|
}
|
|
813
879
|
}
|
|
814
880
|
/**
|
|
@@ -819,14 +885,14 @@ var LogncrashClient = class {
|
|
|
819
885
|
const endpoint = endpointFor("logncrash");
|
|
820
886
|
const url = `${endpoint}/v3/${encodeURIComponent(this.appkey)}/logs/scroll/${encodeURIComponent(scrollKey)}`;
|
|
821
887
|
try {
|
|
822
|
-
const res = await
|
|
888
|
+
const res = await import_ky5.default.post(url, {
|
|
823
889
|
headers,
|
|
824
890
|
retry: 0,
|
|
825
891
|
timeout: DEFAULT_TIMEOUT_MS
|
|
826
892
|
}).json();
|
|
827
893
|
return unwrap(res);
|
|
828
894
|
} catch (err) {
|
|
829
|
-
throw
|
|
895
|
+
throw await toLogncrashError(err);
|
|
830
896
|
}
|
|
831
897
|
}
|
|
832
898
|
readHeaders() {
|
|
@@ -858,7 +924,7 @@ var LogncrashClient = class {
|
|
|
858
924
|
if (params.logType !== void 0) payload["logType"] = params.logType;
|
|
859
925
|
if (params.host !== void 0) payload["host"] = params.host;
|
|
860
926
|
try {
|
|
861
|
-
const res = await
|
|
927
|
+
const res = await import_ky5.default.post(url, {
|
|
862
928
|
headers: { "Content-Type": "application/json" },
|
|
863
929
|
json: payload,
|
|
864
930
|
retry: 0,
|
|
@@ -872,7 +938,7 @@ var LogncrashClient = class {
|
|
|
872
938
|
};
|
|
873
939
|
|
|
874
940
|
// src/services/ncr/client.ts
|
|
875
|
-
var
|
|
941
|
+
var import_ky6 = __toESM(require("ky"));
|
|
876
942
|
|
|
877
943
|
// src/services/ncr/types.ts
|
|
878
944
|
function isRegistry(val) {
|
|
@@ -913,7 +979,7 @@ var NcrClient = class {
|
|
|
913
979
|
async listRegistries(appKey) {
|
|
914
980
|
const url = `${this.baseUrl}/ncr/v2.0/appkeys/${encodeURIComponent(appKey)}/registries`;
|
|
915
981
|
try {
|
|
916
|
-
const res = await
|
|
982
|
+
const res = await import_ky6.default.get(url, {
|
|
917
983
|
headers: this.authHeaders(),
|
|
918
984
|
retry: 0,
|
|
919
985
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -940,7 +1006,7 @@ var NcrClient = class {
|
|
|
940
1006
|
async getRegistry(appKey, registry) {
|
|
941
1007
|
const url = `${this.baseUrl}/ncr/v2.0/appkeys/${encodeURIComponent(appKey)}/registries/${encodeURIComponent(registry)}`;
|
|
942
1008
|
try {
|
|
943
|
-
const res = await
|
|
1009
|
+
const res = await import_ky6.default.get(url, {
|
|
944
1010
|
headers: this.authHeaders(),
|
|
945
1011
|
retry: 0,
|
|
946
1012
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -961,7 +1027,7 @@ var NcrClient = class {
|
|
|
961
1027
|
};
|
|
962
1028
|
|
|
963
1029
|
// src/services/ncs/client.ts
|
|
964
|
-
var
|
|
1030
|
+
var import_ky7 = __toESM(require("ky"));
|
|
965
1031
|
|
|
966
1032
|
// src/services/ncs/types.ts
|
|
967
1033
|
function isNcsTemplateSummary(val) {
|
|
@@ -1053,7 +1119,7 @@ var NcsClient = class {
|
|
|
1053
1119
|
searchParams["disable_containers"] = query.disableContainers;
|
|
1054
1120
|
}
|
|
1055
1121
|
try {
|
|
1056
|
-
const res = await
|
|
1122
|
+
const res = await import_ky7.default.get(url, {
|
|
1057
1123
|
headers: this.authHeaders(),
|
|
1058
1124
|
searchParams,
|
|
1059
1125
|
retry: 0,
|
|
@@ -1085,7 +1151,7 @@ var NcsClient = class {
|
|
|
1085
1151
|
async getTemplate(id) {
|
|
1086
1152
|
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}`;
|
|
1087
1153
|
try {
|
|
1088
|
-
const res = await
|
|
1154
|
+
const res = await import_ky7.default.get(url, {
|
|
1089
1155
|
headers: this.authHeaders(),
|
|
1090
1156
|
retry: 0,
|
|
1091
1157
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1118,7 +1184,7 @@ var NcsClient = class {
|
|
|
1118
1184
|
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
1119
1185
|
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
1120
1186
|
try {
|
|
1121
|
-
const res = await
|
|
1187
|
+
const res = await import_ky7.default.get(url, {
|
|
1122
1188
|
headers: this.authHeaders(),
|
|
1123
1189
|
searchParams,
|
|
1124
1190
|
retry: 0,
|
|
@@ -1150,7 +1216,7 @@ var NcsClient = class {
|
|
|
1150
1216
|
async getTemplateVersion(id, version) {
|
|
1151
1217
|
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`;
|
|
1152
1218
|
try {
|
|
1153
|
-
const res = await
|
|
1219
|
+
const res = await import_ky7.default.get(url, {
|
|
1154
1220
|
headers: this.authHeaders(),
|
|
1155
1221
|
retry: 0,
|
|
1156
1222
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1182,7 +1248,7 @@ var NcsClient = class {
|
|
|
1182
1248
|
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
1183
1249
|
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
1184
1250
|
try {
|
|
1185
|
-
const res = await
|
|
1251
|
+
const res = await import_ky7.default.get(url, {
|
|
1186
1252
|
headers: this.authHeaders(),
|
|
1187
1253
|
searchParams,
|
|
1188
1254
|
retry: 0,
|
|
@@ -1214,7 +1280,7 @@ var NcsClient = class {
|
|
|
1214
1280
|
async getWorkload(id) {
|
|
1215
1281
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}`;
|
|
1216
1282
|
try {
|
|
1217
|
-
const res = await
|
|
1283
|
+
const res = await import_ky7.default.get(url, {
|
|
1218
1284
|
headers: this.authHeaders(),
|
|
1219
1285
|
retry: 0,
|
|
1220
1286
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1254,7 +1320,7 @@ var NcsClient = class {
|
|
|
1254
1320
|
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
1255
1321
|
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
1256
1322
|
try {
|
|
1257
|
-
const res = await
|
|
1323
|
+
const res = await import_ky7.default.get(url, {
|
|
1258
1324
|
headers: this.authHeaders(),
|
|
1259
1325
|
searchParams,
|
|
1260
1326
|
retry: 0,
|
|
@@ -1292,7 +1358,7 @@ var NcsClient = class {
|
|
|
1292
1358
|
if (query.page !== void 0) searchParams["page"] = query.page;
|
|
1293
1359
|
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
1294
1360
|
try {
|
|
1295
|
-
const res = await
|
|
1361
|
+
const res = await import_ky7.default.get(url, {
|
|
1296
1362
|
headers: this.authHeaders(),
|
|
1297
1363
|
searchParams,
|
|
1298
1364
|
retry: 0,
|
|
@@ -1329,7 +1395,7 @@ var NcsClient = class {
|
|
|
1329
1395
|
if (query.size !== void 0) searchParams["size"] = query.size;
|
|
1330
1396
|
if (query.sort !== void 0) searchParams["sort"] = query.sort;
|
|
1331
1397
|
try {
|
|
1332
|
-
const res = await
|
|
1398
|
+
const res = await import_ky7.default.get(url, {
|
|
1333
1399
|
headers: this.authHeaders(),
|
|
1334
1400
|
searchParams,
|
|
1335
1401
|
retry: 0,
|
|
@@ -1361,7 +1427,7 @@ var NcsClient = class {
|
|
|
1361
1427
|
async getWorkloadHistory(id, historyId) {
|
|
1362
1428
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/history/${encodeURIComponent(historyId)}`;
|
|
1363
1429
|
try {
|
|
1364
|
-
const res = await
|
|
1430
|
+
const res = await import_ky7.default.get(url, {
|
|
1365
1431
|
headers: this.authHeaders(),
|
|
1366
1432
|
retry: 0,
|
|
1367
1433
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1389,7 +1455,7 @@ var NcsClient = class {
|
|
|
1389
1455
|
async getWorkloadScheduleHistory(id) {
|
|
1390
1456
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/schedulehistory`;
|
|
1391
1457
|
try {
|
|
1392
|
-
const res = await
|
|
1458
|
+
const res = await import_ky7.default.get(url, {
|
|
1393
1459
|
headers: this.authHeaders(),
|
|
1394
1460
|
retry: 0,
|
|
1395
1461
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1418,7 +1484,7 @@ var NcsClient = class {
|
|
|
1418
1484
|
async createTemplate(body) {
|
|
1419
1485
|
const url = `${this.baseUrl}/templates`;
|
|
1420
1486
|
try {
|
|
1421
|
-
const res = await
|
|
1487
|
+
const res = await import_ky7.default.post(url, {
|
|
1422
1488
|
headers: this.authHeaders(),
|
|
1423
1489
|
json: body,
|
|
1424
1490
|
retry: 0,
|
|
@@ -1445,7 +1511,7 @@ var NcsClient = class {
|
|
|
1445
1511
|
async deleteTemplate(id) {
|
|
1446
1512
|
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}`;
|
|
1447
1513
|
try {
|
|
1448
|
-
const res = await
|
|
1514
|
+
const res = await import_ky7.default.delete(url, {
|
|
1449
1515
|
headers: this.authHeaders(),
|
|
1450
1516
|
retry: 0,
|
|
1451
1517
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1466,7 +1532,7 @@ var NcsClient = class {
|
|
|
1466
1532
|
async createTemplateVersion(id, body) {
|
|
1467
1533
|
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}/versions`;
|
|
1468
1534
|
try {
|
|
1469
|
-
const res = await
|
|
1535
|
+
const res = await import_ky7.default.post(url, {
|
|
1470
1536
|
headers: this.authHeaders(),
|
|
1471
1537
|
json: body,
|
|
1472
1538
|
retry: 0,
|
|
@@ -1493,7 +1559,7 @@ var NcsClient = class {
|
|
|
1493
1559
|
async deleteTemplateVersion(id, version) {
|
|
1494
1560
|
const url = `${this.baseUrl}/templates/${encodeURIComponent(id)}/versions/${encodeURIComponent(version)}`;
|
|
1495
1561
|
try {
|
|
1496
|
-
const res = await
|
|
1562
|
+
const res = await import_ky7.default.delete(url, {
|
|
1497
1563
|
headers: this.authHeaders(),
|
|
1498
1564
|
retry: 0,
|
|
1499
1565
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1511,7 +1577,7 @@ var NcsClient = class {
|
|
|
1511
1577
|
async pauseWorkload(id) {
|
|
1512
1578
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/pause`;
|
|
1513
1579
|
try {
|
|
1514
|
-
const res = await
|
|
1580
|
+
const res = await import_ky7.default.post(url, {
|
|
1515
1581
|
headers: this.authHeaders(),
|
|
1516
1582
|
retry: 0,
|
|
1517
1583
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1529,7 +1595,7 @@ var NcsClient = class {
|
|
|
1529
1595
|
async resumeWorkload(id) {
|
|
1530
1596
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/resume`;
|
|
1531
1597
|
try {
|
|
1532
|
-
const res = await
|
|
1598
|
+
const res = await import_ky7.default.post(url, {
|
|
1533
1599
|
headers: this.authHeaders(),
|
|
1534
1600
|
retry: 0,
|
|
1535
1601
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1547,7 +1613,7 @@ var NcsClient = class {
|
|
|
1547
1613
|
async restartWorkloadTask(id, taskId) {
|
|
1548
1614
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}/tasks/${encodeURIComponent(taskId)}/restart`;
|
|
1549
1615
|
try {
|
|
1550
|
-
const res = await
|
|
1616
|
+
const res = await import_ky7.default.post(url, {
|
|
1551
1617
|
headers: this.authHeaders(),
|
|
1552
1618
|
retry: 0,
|
|
1553
1619
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1567,7 +1633,7 @@ var NcsClient = class {
|
|
|
1567
1633
|
async createWorkload(body) {
|
|
1568
1634
|
const url = `${this.baseUrl}/workloads`;
|
|
1569
1635
|
try {
|
|
1570
|
-
const res = await
|
|
1636
|
+
const res = await import_ky7.default.post(url, {
|
|
1571
1637
|
headers: this.authHeaders(),
|
|
1572
1638
|
json: body,
|
|
1573
1639
|
retry: 0,
|
|
@@ -1595,7 +1661,7 @@ var NcsClient = class {
|
|
|
1595
1661
|
async updateWorkload(id, body) {
|
|
1596
1662
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}`;
|
|
1597
1663
|
try {
|
|
1598
|
-
const res = await
|
|
1664
|
+
const res = await import_ky7.default.put(url, {
|
|
1599
1665
|
headers: this.authHeaders(),
|
|
1600
1666
|
json: body,
|
|
1601
1667
|
retry: 0,
|
|
@@ -1625,7 +1691,7 @@ var NcsClient = class {
|
|
|
1625
1691
|
async patchWorkload(id, patch) {
|
|
1626
1692
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}`;
|
|
1627
1693
|
try {
|
|
1628
|
-
const res = await
|
|
1694
|
+
const res = await import_ky7.default.patch(url, {
|
|
1629
1695
|
headers: { ...this.authHeaders(), "Content-Type": "application/json-patch+json" },
|
|
1630
1696
|
json: patch,
|
|
1631
1697
|
retry: 0,
|
|
@@ -1677,7 +1743,7 @@ var NcsClient = class {
|
|
|
1677
1743
|
async deleteWorkload(id) {
|
|
1678
1744
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(id)}`;
|
|
1679
1745
|
try {
|
|
1680
|
-
const res = await
|
|
1746
|
+
const res = await import_ky7.default.delete(url, {
|
|
1681
1747
|
headers: this.authHeaders(),
|
|
1682
1748
|
retry: 0,
|
|
1683
1749
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1696,7 +1762,7 @@ var NcsClient = class {
|
|
|
1696
1762
|
async getMalwareConfig() {
|
|
1697
1763
|
const url = `${this.baseUrl}/malware/config`;
|
|
1698
1764
|
try {
|
|
1699
|
-
const res = await
|
|
1765
|
+
const res = await import_ky7.default.get(url, {
|
|
1700
1766
|
headers: this.authHeaders(),
|
|
1701
1767
|
retry: 0,
|
|
1702
1768
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1725,7 +1791,7 @@ var NcsClient = class {
|
|
|
1725
1791
|
async setMalwareConfig(enabled) {
|
|
1726
1792
|
const url = `${this.baseUrl}/malware/config`;
|
|
1727
1793
|
try {
|
|
1728
|
-
const res = await
|
|
1794
|
+
const res = await import_ky7.default.post(url, {
|
|
1729
1795
|
headers: this.authHeaders(),
|
|
1730
1796
|
json: { enabled },
|
|
1731
1797
|
retry: 0,
|
|
@@ -1755,7 +1821,7 @@ var NcsClient = class {
|
|
|
1755
1821
|
async getMalwareResult(workloadId, historyId) {
|
|
1756
1822
|
const url = `${this.baseUrl}/workloads/${encodeURIComponent(workloadId)}/history/${encodeURIComponent(historyId)}/malware`;
|
|
1757
1823
|
try {
|
|
1758
|
-
const res = await
|
|
1824
|
+
const res = await import_ky7.default.get(url, {
|
|
1759
1825
|
headers: this.authHeaders(),
|
|
1760
1826
|
retry: 0,
|
|
1761
1827
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -1855,12 +1921,12 @@ async function verifyLogncrash(uak, appkey) {
|
|
|
1855
1921
|
}
|
|
1856
1922
|
|
|
1857
1923
|
// src/commands/configure.ts
|
|
1858
|
-
async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigateway, doVerify, logncrashUak = uak) {
|
|
1924
|
+
async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigateway, deploy, doVerify, logncrashUak = uak) {
|
|
1859
1925
|
if (doVerify) {
|
|
1860
1926
|
if (uak) {
|
|
1861
1927
|
const ok = await verifyUserAccessKey(uak);
|
|
1862
1928
|
if (ok) {
|
|
1863
|
-
process.stderr.write(
|
|
1929
|
+
process.stderr.write(import_chalk2.default.green(" \u2713 UAK \uC5F0\uACB0 \uC131\uACF5\n"));
|
|
1864
1930
|
} else {
|
|
1865
1931
|
throw new NhnCloudCliError(
|
|
1866
1932
|
"UAK \uC778\uC99D \uC2E4\uD328 \u2014 uak-id / uak-secret \uC744 \uD655\uC778\uD558\uC138\uC694.",
|
|
@@ -1877,7 +1943,7 @@ async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigat
|
|
|
1877
1943
|
}
|
|
1878
1944
|
const ok = await verifyLogncrash(logncrashUak, logncrash.appkey ?? "");
|
|
1879
1945
|
if (ok) {
|
|
1880
|
-
process.stderr.write(
|
|
1946
|
+
process.stderr.write(import_chalk2.default.green(" \u2713 logncrash \uC5F0\uACB0 \uC131\uACF5\n"));
|
|
1881
1947
|
} else {
|
|
1882
1948
|
throw new NhnCloudCliError(
|
|
1883
1949
|
"logncrash \uC778\uC99D \uC2E4\uD328 \u2014 appkey \uB610\uB294 UAK\uB97C \uD655\uC778\uD558\uC138\uC694.",
|
|
@@ -1888,7 +1954,7 @@ async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigat
|
|
|
1888
1954
|
if (iaas) {
|
|
1889
1955
|
const ok = await verifyIaas(iaas);
|
|
1890
1956
|
if (ok) {
|
|
1891
|
-
process.stderr.write(
|
|
1957
|
+
process.stderr.write(import_chalk2.default.green(" \u2713 iaas \uC5F0\uACB0 \uC131\uACF5\n"));
|
|
1892
1958
|
} else {
|
|
1893
1959
|
throw new NhnCloudCliError(
|
|
1894
1960
|
"iaas \uC778\uC99D \uC2E4\uD328 \u2014 tenantId / username / API \uBE44\uBC00\uBC88\uD638\uB97C \uD655\uC778\uD558\uC138\uC694.",
|
|
@@ -1901,7 +1967,7 @@ async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigat
|
|
|
1901
1967
|
const appkey = ncr.appkey ?? "";
|
|
1902
1968
|
const ok = await verifyNcr(uak, appkey);
|
|
1903
1969
|
if (ok) {
|
|
1904
|
-
process.stderr.write(
|
|
1970
|
+
process.stderr.write(import_chalk2.default.green(" \u2713 ncr \uC5F0\uACB0 \uC131\uACF5 (kr1)\n"));
|
|
1905
1971
|
} else {
|
|
1906
1972
|
throw new NhnCloudCliError(
|
|
1907
1973
|
"ncr \uC778\uC99D \uC2E4\uD328 \u2014 appkey \uB610\uB294 UAK \uB97C \uD655\uC778\uD558\uC138\uC694.",
|
|
@@ -1910,7 +1976,7 @@ async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigat
|
|
|
1910
1976
|
}
|
|
1911
1977
|
} else {
|
|
1912
1978
|
process.stderr.write(
|
|
1913
|
-
|
|
1979
|
+
import_chalk2.default.yellow(
|
|
1914
1980
|
" \u26A0 ncr verify \uAC74\uB108\uB700 \u2014 \uC774\uBC88 \uC124\uC815\uC5D0 UAK \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. ncr \uBA85\uB839\uC740 \uACF5\uD1B5 UAK \uAC00 \uD544\uC694\uD558\uB2C8 \uBA3C\uC800 \uC124\uC815\uD558\uC138\uC694.\n"
|
|
1915
1981
|
)
|
|
1916
1982
|
);
|
|
@@ -1921,7 +1987,7 @@ async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigat
|
|
|
1921
1987
|
const appkey = ncs.appkey ?? "";
|
|
1922
1988
|
const ok = await verifyNcs(uak, appkey);
|
|
1923
1989
|
if (ok) {
|
|
1924
|
-
process.stderr.write(
|
|
1990
|
+
process.stderr.write(import_chalk2.default.green(" \u2713 ncs \uC5F0\uACB0 \uC131\uACF5 (kr1)\n"));
|
|
1925
1991
|
} else {
|
|
1926
1992
|
throw new NhnCloudCliError(
|
|
1927
1993
|
"ncs \uC778\uC99D \uC2E4\uD328 \u2014 appkey \uB610\uB294 UAK \uB97C \uD655\uC778\uD558\uC138\uC694.",
|
|
@@ -1930,7 +1996,7 @@ async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigat
|
|
|
1930
1996
|
}
|
|
1931
1997
|
} else {
|
|
1932
1998
|
process.stderr.write(
|
|
1933
|
-
|
|
1999
|
+
import_chalk2.default.yellow(
|
|
1934
2000
|
" \u26A0 ncs verify \uAC74\uB108\uB700 \u2014 \uC774\uBC88 \uC124\uC815\uC5D0 UAK \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. ncs \uBA85\uB839\uC740 \uACF5\uD1B5 UAK \uAC00 \uD544\uC694\uD558\uB2C8 \uBA3C\uC800 \uC124\uC815\uD558\uC138\uC694.\n"
|
|
1935
2001
|
)
|
|
1936
2002
|
);
|
|
@@ -1955,7 +2021,10 @@ async function saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, apigat
|
|
|
1955
2021
|
if (apigateway) {
|
|
1956
2022
|
await setServiceCredential(profileName, "apigateway", apigateway);
|
|
1957
2023
|
}
|
|
1958
|
-
|
|
2024
|
+
if (deploy) {
|
|
2025
|
+
await setServiceCredential(profileName, "deploy", deploy);
|
|
2026
|
+
}
|
|
2027
|
+
process.stderr.write(import_chalk2.default.green(`
|
|
1959
2028
|
\u2713 profile "${profileName}" \uC124\uC815\uC774 \uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
1960
2029
|
`));
|
|
1961
2030
|
}
|
|
@@ -1986,7 +2055,7 @@ async function runInteractive(opts) {
|
|
|
1986
2055
|
}
|
|
1987
2056
|
}
|
|
1988
2057
|
if (!uak) {
|
|
1989
|
-
process.stderr.write(
|
|
2058
|
+
process.stderr.write(import_chalk2.default.gray("\n\u2014 \uAC1C\uC778 UAK (User Access Key) \u2014\n"));
|
|
1990
2059
|
const uakId = await input({
|
|
1991
2060
|
message: "UAK ID"
|
|
1992
2061
|
});
|
|
@@ -2002,7 +2071,7 @@ async function runInteractive(opts) {
|
|
|
2002
2071
|
default: false
|
|
2003
2072
|
});
|
|
2004
2073
|
if (setupLogncrash) {
|
|
2005
|
-
process.stderr.write(
|
|
2074
|
+
process.stderr.write(import_chalk2.default.gray("\n\u2014 logncrash \uC790\uACA9\uC99D\uBA85 \u2014\n"));
|
|
2006
2075
|
const appkey = await input({
|
|
2007
2076
|
message: "logncrash appkey",
|
|
2008
2077
|
validate: (v) => v.trim().length > 0 || "logncrash appkey \uB97C \uC785\uB825\uD558\uC138\uC694"
|
|
@@ -2015,9 +2084,9 @@ async function runInteractive(opts) {
|
|
|
2015
2084
|
default: false
|
|
2016
2085
|
});
|
|
2017
2086
|
if (setupIaas) {
|
|
2018
|
-
process.stderr.write(
|
|
2087
|
+
process.stderr.write(import_chalk2.default.gray("\n\u2014 iaas (Compute) \uC790\uACA9\uC99D\uBA85 \u2014\n"));
|
|
2019
2088
|
process.stderr.write(
|
|
2020
|
-
|
|
2089
|
+
import_chalk2.default.yellow(
|
|
2021
2090
|
" \u203B password \uB294 NHN Cloud \uCF58\uC194 IAM \uC758 API \uBE44\uBC00\uBC88\uD638\uC785\uB2C8\uB2E4 (\uB85C\uADF8\uC778 \uBE44\uBC00\uBC88\uD638\uAC00 \uC544\uB2D9\uB2C8\uB2E4).\n"
|
|
2022
2091
|
)
|
|
2023
2092
|
);
|
|
@@ -2043,7 +2112,7 @@ async function runInteractive(opts) {
|
|
|
2043
2112
|
default: false
|
|
2044
2113
|
});
|
|
2045
2114
|
if (setupNcr) {
|
|
2046
|
-
process.stderr.write(
|
|
2115
|
+
process.stderr.write(import_chalk2.default.gray("\n\u2014 ncr (Container Registry) \uC790\uACA9\uC99D\uBA85 \u2014\n"));
|
|
2047
2116
|
const ncrAppkey = await input({
|
|
2048
2117
|
message: "ncr appkey",
|
|
2049
2118
|
validate: (v) => v.trim().length > 0 || "ncr appkey \uB97C \uC785\uB825\uD558\uC138\uC694"
|
|
@@ -2056,38 +2125,51 @@ async function runInteractive(opts) {
|
|
|
2056
2125
|
default: false
|
|
2057
2126
|
});
|
|
2058
2127
|
if (setupNcs) {
|
|
2059
|
-
process.stderr.write(
|
|
2128
|
+
process.stderr.write(import_chalk2.default.gray("\n\u2014 ncs (Container Service) \uC790\uACA9\uC99D\uBA85 \u2014\n"));
|
|
2060
2129
|
const ncsAppkey = await input({
|
|
2061
2130
|
message: "ncs appkey",
|
|
2062
2131
|
validate: (v) => v.trim().length > 0 || "ncs appkey \uB97C \uC785\uB825\uD558\uC138\uC694"
|
|
2063
2132
|
});
|
|
2064
2133
|
ncs = { appkey: ncsAppkey.trim() };
|
|
2065
2134
|
}
|
|
2135
|
+
let deploy;
|
|
2136
|
+
const setupDeploy = await confirm({
|
|
2137
|
+
message: "deploy \uC790\uACA9\uC99D\uBA85\uB3C4 \uC124\uC815\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
|
|
2138
|
+
default: false
|
|
2139
|
+
});
|
|
2140
|
+
if (setupDeploy) {
|
|
2141
|
+
process.stderr.write(import_chalk2.default.gray("\n\u2014 deploy \uC790\uACA9\uC99D\uBA85 \u2014\n"));
|
|
2142
|
+
const deployAppkey = await input({
|
|
2143
|
+
message: "deploy appkey",
|
|
2144
|
+
validate: (v) => v.trim().length > 0 || "deploy appkey \uB97C \uC785\uB825\uD558\uC138\uC694"
|
|
2145
|
+
});
|
|
2146
|
+
deploy = { appkey: deployAppkey.trim() };
|
|
2147
|
+
}
|
|
2066
2148
|
if (opts.verify) {
|
|
2067
|
-
process.stderr.write(
|
|
2149
|
+
process.stderr.write(import_chalk2.default.gray("\n\u2014 \uC5F0\uACB0 \uD14C\uC2A4\uD2B8 \uC911\u2026 \u2014\n"));
|
|
2068
2150
|
}
|
|
2069
2151
|
if (opts.verify) {
|
|
2070
2152
|
try {
|
|
2071
|
-
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, true, uak);
|
|
2153
|
+
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, deploy, true, uak);
|
|
2072
2154
|
} catch (err) {
|
|
2073
2155
|
if (err instanceof NhnCloudCliError && err.exitCode === EXIT_AUTH_ERROR) {
|
|
2074
|
-
process.stderr.write(
|
|
2156
|
+
process.stderr.write(import_chalk2.default.red(` \u2717 ${sanitizeMultilineForTerminal(err.message)}
|
|
2075
2157
|
`));
|
|
2076
2158
|
const saveDespite = await confirm({
|
|
2077
2159
|
message: "\uAC80\uC99D \uC2E4\uD328\uC5D0\uB3C4 \uC800\uC7A5\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
|
|
2078
2160
|
default: false
|
|
2079
2161
|
});
|
|
2080
2162
|
if (!saveDespite) {
|
|
2081
|
-
process.stderr.write(
|
|
2163
|
+
process.stderr.write(import_chalk2.default.yellow("\uC800\uC7A5\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
2082
2164
|
return;
|
|
2083
2165
|
}
|
|
2084
|
-
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, false, uak);
|
|
2166
|
+
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, deploy, false, uak);
|
|
2085
2167
|
} else {
|
|
2086
2168
|
throw err;
|
|
2087
2169
|
}
|
|
2088
2170
|
}
|
|
2089
2171
|
} else {
|
|
2090
|
-
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, false, uak);
|
|
2172
|
+
await saveAndVerify(profileName, uak, logncrash, iaas, ncr, ncs, void 0, deploy, false, uak);
|
|
2091
2173
|
}
|
|
2092
2174
|
}
|
|
2093
2175
|
async function runNonInteractive(opts) {
|
|
@@ -2111,9 +2193,12 @@ async function runNonInteractive(opts) {
|
|
|
2111
2193
|
if (opts.apigatewayAppkey !== void 0 && opts.apigatewayAppkey.trim().length === 0) {
|
|
2112
2194
|
throw new NhnCloudCliError("--apigateway-appkey \uAC12\uC740 \uBE44\uC5B4 \uC788\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
2113
2195
|
}
|
|
2196
|
+
if (opts.deployAppkey !== void 0 && opts.deployAppkey.trim().length === 0) {
|
|
2197
|
+
throw new NhnCloudCliError("--deploy-appkey \uAC12\uC740 \uBE44\uC5B4 \uC788\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
2198
|
+
}
|
|
2114
2199
|
if (opts.logncrashSecret !== void 0) {
|
|
2115
2200
|
process.stderr.write(
|
|
2116
|
-
|
|
2201
|
+
import_chalk2.default.yellow(
|
|
2117
2202
|
"\uACBD\uACE0: --logncrash-secret\uC740 \uD3D0\uAE30 \uC608\uC815\uC774\uBA70 Search v3 \uC778\uC99D\uC5D0 \uC0AC\uC6A9\uD558\uAC70\uB098 \uC800\uC7A5\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n"
|
|
2118
2203
|
)
|
|
2119
2204
|
);
|
|
@@ -2130,9 +2215,10 @@ async function runNonInteractive(opts) {
|
|
|
2130
2215
|
const ncr = opts.ncrAppkey?.trim() ? { appkey: opts.ncrAppkey.trim() } : void 0;
|
|
2131
2216
|
const ncs = opts.ncsAppkey?.trim() ? { appkey: opts.ncsAppkey.trim() } : void 0;
|
|
2132
2217
|
const apigateway = opts.apigatewayAppkey?.trim() ? { appkey: opts.apigatewayAppkey.trim() } : void 0;
|
|
2133
|
-
|
|
2218
|
+
const deploy = opts.deployAppkey?.trim() ? { appkey: opts.deployAppkey.trim() } : void 0;
|
|
2219
|
+
if (!uak && !logncrash && !iaas && !ncr && !ncs && !apigateway && !deploy) {
|
|
2134
2220
|
throw new NhnCloudCliError(
|
|
2135
|
-
"\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, \uB610\uB294 --
|
|
2221
|
+
"\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.",
|
|
2136
2222
|
EXIT_PARAM_ERROR
|
|
2137
2223
|
);
|
|
2138
2224
|
}
|
|
@@ -2141,7 +2227,7 @@ async function runNonInteractive(opts) {
|
|
|
2141
2227
|
logncrashUak = await getUserAccessKey(profileName);
|
|
2142
2228
|
}
|
|
2143
2229
|
if (opts.verify) {
|
|
2144
|
-
process.stderr.write(
|
|
2230
|
+
process.stderr.write(import_chalk2.default.gray("\uC5F0\uACB0 \uD14C\uC2A4\uD2B8 \uC911\u2026\n"));
|
|
2145
2231
|
}
|
|
2146
2232
|
await saveAndVerify(
|
|
2147
2233
|
profileName,
|
|
@@ -2151,6 +2237,7 @@ async function runNonInteractive(opts) {
|
|
|
2151
2237
|
ncr,
|
|
2152
2238
|
ncs,
|
|
2153
2239
|
apigateway,
|
|
2240
|
+
deploy,
|
|
2154
2241
|
opts.verify,
|
|
2155
2242
|
logncrashUak
|
|
2156
2243
|
);
|
|
@@ -2158,8 +2245,8 @@ async function runNonInteractive(opts) {
|
|
|
2158
2245
|
var configureCommand = new import_commander.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(
|
|
2159
2246
|
"--iaas-password <pass>",
|
|
2160
2247
|
"iaas API \uBE44\uBC00\uBC88\uD638 (\uBE44\uB300\uD654\uD615, \uB178\uCD9C \uBC29\uC9C0\uB85C env NHNCLOUD_IAAS_PASSWORD \uAD8C\uC7A5)"
|
|
2161
|
-
).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("--no-verify", "\uC5F0\uACB0 \uD14C\uC2A4\uD2B8 \uC0DD\uB7B5").action(async (opts) => {
|
|
2162
|
-
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;
|
|
2248
|
+
).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) => {
|
|
2249
|
+
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;
|
|
2163
2250
|
try {
|
|
2164
2251
|
if (hasFlag) {
|
|
2165
2252
|
await runNonInteractive(opts);
|
|
@@ -2168,7 +2255,7 @@ var configureCommand = new import_commander.Command("configure").description("\u
|
|
|
2168
2255
|
}
|
|
2169
2256
|
} catch (err) {
|
|
2170
2257
|
if (err instanceof import_core.ExitPromptError) {
|
|
2171
|
-
process.stderr.write(
|
|
2258
|
+
process.stderr.write(import_chalk2.default.yellow("\n\uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
2172
2259
|
return;
|
|
2173
2260
|
}
|
|
2174
2261
|
throw err;
|
|
@@ -2317,14 +2404,14 @@ function compareByCodePoint(left, right) {
|
|
|
2317
2404
|
return leftPoints.length - rightPoints.length;
|
|
2318
2405
|
}
|
|
2319
2406
|
function ensureRegularFile(filePath) {
|
|
2320
|
-
let
|
|
2407
|
+
let stat3;
|
|
2321
2408
|
try {
|
|
2322
|
-
|
|
2409
|
+
stat3 = (0, import_node_fs2.lstatSync)(filePath);
|
|
2323
2410
|
} catch (error) {
|
|
2324
2411
|
const reason = error instanceof Error ? error.message : String(error);
|
|
2325
2412
|
throw new NhnCloudCliError(`\uC2A4\uD0AC \uD30C\uC77C\uC744 \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${filePath} (${reason})`, EXIT_PARAM_ERROR);
|
|
2326
2413
|
}
|
|
2327
|
-
if (
|
|
2414
|
+
if (stat3.isSymbolicLink() || !stat3.isFile()) {
|
|
2328
2415
|
throw new NhnCloudCliError(`\uC2A4\uD0AC \uCF58\uD150\uCE20\uB294 \uC815\uADDC \uD30C\uC77C\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4: ${filePath}`, EXIT_PARAM_ERROR);
|
|
2329
2416
|
}
|
|
2330
2417
|
}
|
|
@@ -2341,21 +2428,21 @@ function collectReferenceFiles(referencesRoot, currentDir, files) {
|
|
|
2341
2428
|
}
|
|
2342
2429
|
for (const entry of entries) {
|
|
2343
2430
|
const entryPath = import_node_path4.default.join(currentDir, entry.name);
|
|
2344
|
-
let
|
|
2431
|
+
let stat3;
|
|
2345
2432
|
try {
|
|
2346
|
-
|
|
2433
|
+
stat3 = (0, import_node_fs2.lstatSync)(entryPath);
|
|
2347
2434
|
} catch (error) {
|
|
2348
2435
|
const reason = error instanceof Error ? error.message : String(error);
|
|
2349
2436
|
throw new NhnCloudCliError(`\uC2A4\uD0AC \uCF58\uD150\uCE20\uB97C \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${entryPath} (${reason})`, EXIT_PARAM_ERROR);
|
|
2350
2437
|
}
|
|
2351
|
-
if (
|
|
2438
|
+
if (stat3.isSymbolicLink()) {
|
|
2352
2439
|
throw new NhnCloudCliError(`\uC2A4\uD0AC \uCF58\uD150\uCE20\uC5D0 \uC2EC\uBCFC\uB9AD \uB9C1\uD06C\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${entryPath}`, EXIT_PARAM_ERROR);
|
|
2353
2440
|
}
|
|
2354
|
-
if (
|
|
2441
|
+
if (stat3.isDirectory()) {
|
|
2355
2442
|
collectReferenceFiles(referencesRoot, entryPath, files);
|
|
2356
2443
|
continue;
|
|
2357
2444
|
}
|
|
2358
|
-
if (!
|
|
2445
|
+
if (!stat3.isFile()) {
|
|
2359
2446
|
throw new NhnCloudCliError(`\uC2A4\uD0AC \uCF58\uD150\uCE20\uB294 \uC815\uADDC \uD30C\uC77C \uB610\uB294 \uB514\uB809\uD130\uB9AC\uC5EC\uC57C \uD569\uB2C8\uB2E4: ${entryPath}`, EXIT_PARAM_ERROR);
|
|
2360
2447
|
}
|
|
2361
2448
|
files.push(`references/${import_node_path4.default.relative(referencesRoot, entryPath).split(import_node_path4.default.sep).join("/")}`);
|
|
@@ -3023,7 +3110,7 @@ var skillsCommand = createSkillsCommand();
|
|
|
3023
3110
|
|
|
3024
3111
|
// src/commands/doctor.ts
|
|
3025
3112
|
var import_commander3 = require("commander");
|
|
3026
|
-
var
|
|
3113
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
3027
3114
|
var import_promises4 = require("fs/promises");
|
|
3028
3115
|
var import_node_os4 = require("os");
|
|
3029
3116
|
var import_node_path6 = __toESM(require("path"));
|
|
@@ -3054,40 +3141,40 @@ async function readDefaultProfile() {
|
|
|
3054
3141
|
}
|
|
3055
3142
|
}
|
|
3056
3143
|
var doctorCommand = new import_commander3.Command("doctor").description("\uC790\uACA9\uC99D\uBA85\xB7\uC2A4\uD0AC \uC124\uCE58 \uC0C1\uD0DC\uB97C \uC9C4\uB2E8\uD55C\uB2E4(\uC624\uD504\uB77C\uC778 \u2014 \uC5F0\uACB0 \uD14C\uC2A4\uD2B8\uB294 configure \uB85C)").action(async () => {
|
|
3057
|
-
console.log(
|
|
3144
|
+
console.log(import_chalk3.default.bold("\n\u{1F50D} nhncloud-cli \uC9C4\uB2E8\n"));
|
|
3058
3145
|
const creds = await readProfiles();
|
|
3059
3146
|
const defaultProfile = await readDefaultProfile();
|
|
3060
|
-
console.log(
|
|
3147
|
+
console.log(import_chalk3.default.bold("\uC790\uACA9\uC99D\uBA85"));
|
|
3061
3148
|
if (creds.missing) {
|
|
3062
|
-
console.log(` ${
|
|
3149
|
+
console.log(` ${import_chalk3.default.red("\u274C \uBBF8\uC124\uC815")} \u2014 ${CREDENTIALS_PATH2} \uC5C6\uC74C. nhncloud configure \uB85C \uC124\uC815\uD558\uC138\uC694.`);
|
|
3063
3150
|
} else if (creds.parseError) {
|
|
3064
|
-
console.log(` ${
|
|
3151
|
+
console.log(` ${import_chalk3.default.red("\u274C \uD30C\uC2F1 \uC624\uB958")} \u2014 ${CREDENTIALS_PATH2} \uAC00 \uC62C\uBC14\uB978 JSON \uC778\uC9C0 \uD655\uC778\uD558\uC138\uC694.`);
|
|
3065
3152
|
} else if (creds.profiles.length === 0) {
|
|
3066
|
-
console.log(` ${
|
|
3153
|
+
console.log(` ${import_chalk3.default.yellow("\u26A0 profile \uC5C6\uC74C")} \u2014 nhncloud configure \uB85C \uC124\uC815\uD558\uC138\uC694.`);
|
|
3067
3154
|
} else {
|
|
3068
|
-
console.log(` ${
|
|
3069
|
-
console.log(` \uAE30\uBCF8 profile: ${defaultProfile ?
|
|
3155
|
+
console.log(` ${import_chalk3.default.green("\u2713 \uC124\uC815\uB428")} \u2014 profile: ${creds.profiles.join(", ")}`);
|
|
3156
|
+
console.log(` \uAE30\uBCF8 profile: ${defaultProfile ? import_chalk3.default.green(defaultProfile) : import_chalk3.default.gray("\uBBF8\uC9C0\uC815 (default \uC0AC\uC6A9)")}`);
|
|
3070
3157
|
}
|
|
3071
|
-
console.log(
|
|
3158
|
+
console.log(import_chalk3.default.bold("\nClaude Code \uC2A4\uD0AC"));
|
|
3072
3159
|
const skillStatus = await inspectSkill(createSkillManagerContext());
|
|
3073
3160
|
if (skillStatus.status === "current") {
|
|
3074
3161
|
console.log(
|
|
3075
|
-
` ${SKILL_NAME4}: ${
|
|
3162
|
+
` ${SKILL_NAME4}: ${import_chalk3.default.green(`\u2713 current (${skillStatus.installedVersion ?? skillStatus.currentVersion})`)}`
|
|
3076
3163
|
);
|
|
3077
3164
|
} else if (skillStatus.status === "missing") {
|
|
3078
3165
|
console.log(
|
|
3079
|
-
` ${SKILL_NAME4}: ${
|
|
3166
|
+
` ${SKILL_NAME4}: ${import_chalk3.default.gray(`\uBBF8\uC124\uCE58 \u2014 ${skillRecoveryCommand(skillStatus.status)}`)}`
|
|
3080
3167
|
);
|
|
3081
3168
|
} else {
|
|
3082
3169
|
console.log(
|
|
3083
|
-
` ${SKILL_NAME4}: ${
|
|
3170
|
+
` ${SKILL_NAME4}: ${import_chalk3.default.yellow(`\u26A0 ${skillStatus.status}`)} \u2014 ${skillRecoveryCommand(skillStatus.status)}`
|
|
3084
3171
|
);
|
|
3085
3172
|
}
|
|
3086
3173
|
console.log();
|
|
3087
3174
|
if (!creds.missing && !creds.parseError && creds.profiles.length > 0) {
|
|
3088
|
-
console.log(
|
|
3175
|
+
console.log(import_chalk3.default.green("\u2713 \uAE30\uBCF8 \uC124\uC815\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."));
|
|
3089
3176
|
} else {
|
|
3090
|
-
console.log(
|
|
3177
|
+
console.log(import_chalk3.default.yellow("\u26A0 \uC124\uC815\uC774 \uD544\uC694\uD569\uB2C8\uB2E4: nhncloud configure"));
|
|
3091
3178
|
}
|
|
3092
3179
|
console.log();
|
|
3093
3180
|
});
|
|
@@ -3133,10 +3220,17 @@ function resolveTime(input) {
|
|
|
3133
3220
|
}
|
|
3134
3221
|
return toLocalISOString(now);
|
|
3135
3222
|
}
|
|
3136
|
-
const isoPattern = /^\d{4}-\d{2}-\d{2}
|
|
3223
|
+
const isoPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}([+-]\d{2}:\d{2}|Z)$/;
|
|
3137
3224
|
if (isoPattern.test(trimmed)) {
|
|
3138
3225
|
return trimmed;
|
|
3139
3226
|
}
|
|
3227
|
+
const partialIso = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2})?)?$/.test(trimmed);
|
|
3228
|
+
if (partialIso) {
|
|
3229
|
+
throw new NhnCloudCliError(
|
|
3230
|
+
`\uC2DC\uAC04 \uD615\uC2DD \uC624\uB958: "${input}" \u2014 \uCD08\uC640 \uC2DC\uAC04\uB300\uAE4C\uC9C0 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4 (\uC608: 2026-08-03T00:00:00+09:00 \uB610\uB294 2026-08-03T00:00:00Z).`,
|
|
3231
|
+
EXIT_PARAM_ERROR
|
|
3232
|
+
);
|
|
3233
|
+
}
|
|
3140
3234
|
throw new NhnCloudCliError(
|
|
3141
3235
|
`\uC2DC\uAC04 \uD615\uC2DD \uC624\uB958: "${input}" \u2014 ISO8601 (\uC608: 2024-01-01T00:00:00+09:00) \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (\uC608: 1h, 30m, 2d, now) \uC744 \uC0AC\uC6A9\uD558\uC138\uC694.`,
|
|
3142
3236
|
EXIT_PARAM_ERROR
|
|
@@ -3144,6 +3238,49 @@ function resolveTime(input) {
|
|
|
3144
3238
|
}
|
|
3145
3239
|
var MAX_RANGE_DAYS = 31;
|
|
3146
3240
|
var MAX_LOOKBACK_DAYS = 90;
|
|
3241
|
+
var MIN_SPLIT_WINDOW_MS = 10 * 60 * 1e3;
|
|
3242
|
+
function splitTimeRange(fromIso, toIso, windowMs) {
|
|
3243
|
+
if (windowMs < MIN_SPLIT_WINDOW_MS) {
|
|
3244
|
+
throw new NhnCloudCliError(
|
|
3245
|
+
`\uAC80\uC0C9 \uBD84\uD560 \uCC3D\uC740 \uCD5C\uC18C ${MIN_SPLIT_WINDOW_MS / 6e4}\uBD84\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.`,
|
|
3246
|
+
EXIT_PARAM_ERROR
|
|
3247
|
+
);
|
|
3248
|
+
}
|
|
3249
|
+
const normalizedWindowMs = Math.floor(windowMs / 1e3) * 1e3;
|
|
3250
|
+
const fromMs = floorToSecond(new Date(fromIso).getTime());
|
|
3251
|
+
const toMs = floorToSecond(new Date(toIso).getTime());
|
|
3252
|
+
if (normalizedWindowMs >= toMs - fromMs) {
|
|
3253
|
+
return [{ from: fromIso, to: toIso }];
|
|
3254
|
+
}
|
|
3255
|
+
const windows = [];
|
|
3256
|
+
let windowFromMs = fromMs;
|
|
3257
|
+
let windowFrom = fromIso;
|
|
3258
|
+
while (windowFromMs < toMs) {
|
|
3259
|
+
const windowToMs = Math.min(windowFromMs + normalizedWindowMs, toMs);
|
|
3260
|
+
const windowTo = windowToMs === toMs ? toIso : formatSplitBoundary(windowToMs, fromIso);
|
|
3261
|
+
windows.push({ from: windowFrom, to: windowTo });
|
|
3262
|
+
windowFromMs = windowToMs;
|
|
3263
|
+
windowFrom = windowTo;
|
|
3264
|
+
}
|
|
3265
|
+
return windows;
|
|
3266
|
+
}
|
|
3267
|
+
function floorToSecond(timestampMs) {
|
|
3268
|
+
return Math.floor(timestampMs / 1e3) * 1e3;
|
|
3269
|
+
}
|
|
3270
|
+
function formatSplitBoundary(timestampMs, referenceIso) {
|
|
3271
|
+
const secondTimestampMs = floorToSecond(timestampMs);
|
|
3272
|
+
if (referenceIso.endsWith("Z")) {
|
|
3273
|
+
return `${new Date(secondTimestampMs).toISOString().slice(0, 19)}Z`;
|
|
3274
|
+
}
|
|
3275
|
+
const offsetMatch = referenceIso.match(/([+-])(\d{2}):(\d{2})$/);
|
|
3276
|
+
if (!offsetMatch) {
|
|
3277
|
+
return toLocalISOString(new Date(secondTimestampMs));
|
|
3278
|
+
}
|
|
3279
|
+
const direction = offsetMatch[1] === "+" ? 1 : -1;
|
|
3280
|
+
const offsetMinutes = direction * (Number(offsetMatch[2]) * 60 + Number(offsetMatch[3]));
|
|
3281
|
+
const shifted = new Date(secondTimestampMs + offsetMinutes * 6e4).toISOString().slice(0, 19);
|
|
3282
|
+
return `${shifted}${offsetMatch[0]}`;
|
|
3283
|
+
}
|
|
3147
3284
|
function assertSearchRange(fromIso, toIso) {
|
|
3148
3285
|
const from = new Date(fromIso);
|
|
3149
3286
|
const to = new Date(toIso);
|
|
@@ -3186,7 +3323,7 @@ function formatLogRow(log) {
|
|
|
3186
3323
|
const body = truncate(getString(log["logBody"] ?? log["body"] ?? log["message"] ?? ""), 60);
|
|
3187
3324
|
return [logTime, logType, body];
|
|
3188
3325
|
}
|
|
3189
|
-
var searchCommand = new import_commander4.Command("search").description("Log & Crash \uB85C\uADF8 \uAC80\uC0C9").option("--query <lucene>", "Lucene \uC9C8\uC758 \uBB38\uC790\uC5F4 (\uD544\uC218)").option("--from <time>", "\uAC80\uC0C9 \uC2DC\uC791: ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (1h/30m/2d/now) (\uD544\uC218)").option("--to <time>", "\uAC80\uC0C9 \uB05D: ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (\uD544\uC218)").option("--page <n>", "\uC804\uD658 \uD638\uD658\uC6A9 pageNumber. 0\uB9CC \uD5C8\uC6A9 (\uB2E4\uC74C \uD398\uC774\uC9C0\uB294 --cursor)", "0").option("--size <n>", "pageSize (\uAE30\uBCF8 10, \uCD5C\uB300 100)", "10").option("--cursor <value>", "\uB2E4\uC74C \uD398\uC774\uC9C0 \uC870\uD68C\uC6A9 opaque cursor").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3326
|
+
var searchCommand = new import_commander4.Command("search").description("Log & Crash \uB85C\uADF8 \uAC80\uC0C9").option("--query <lucene>", "Lucene \uC9C8\uC758 \uBB38\uC790\uC5F4 (\uD544\uC218)").option("--from <time>", "\uAC80\uC0C9 \uC2DC\uC791: \uCD08\xB7\uC2DC\uAC04\uB300 \uD3EC\uD568 ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (1h/30m/2d/now) (\uD544\uC218)").option("--to <time>", "\uAC80\uC0C9 \uB05D: \uCD08\xB7\uC2DC\uAC04\uB300 \uD3EC\uD568 ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (\uD544\uC218)").option("--page <n>", "\uC804\uD658 \uD638\uD658\uC6A9 pageNumber. 0\uB9CC \uD5C8\uC6A9 (\uB2E4\uC74C \uD398\uC774\uC9C0\uB294 --cursor)", "0").option("--size <n>", "pageSize (\uAE30\uBCF8 10, \uCD5C\uB300 100)", "10").option("--cursor <value>", "\uB2E4\uC74C \uD398\uC774\uC9C0 \uC870\uD68C\uC6A9 opaque cursor").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3190
3327
|
const opts = cmd.optsWithGlobals();
|
|
3191
3328
|
if (!opts.query) {
|
|
3192
3329
|
throw new NhnCloudCliError(`--query \uC635\uC158\uC740 \uD544\uC218\uC785\uB2C8\uB2E4. \uC608: --query 'logType:"NORMAL"'`, EXIT_PARAM_ERROR);
|
|
@@ -3224,6 +3361,17 @@ var searchCommand = new import_commander4.Command("search").description("Log & C
|
|
|
3224
3361
|
});
|
|
3225
3362
|
} catch (err) {
|
|
3226
3363
|
stopSpinner(false);
|
|
3364
|
+
if (isRateLimitError(err)) {
|
|
3365
|
+
throw withRateLimitHint(err);
|
|
3366
|
+
}
|
|
3367
|
+
if (err instanceof LogncrashServerError) {
|
|
3368
|
+
const requestId = err.requestId === null ? "" : ` (requestId: ${err.requestId})`;
|
|
3369
|
+
throw new LogncrashServerError(
|
|
3370
|
+
`${err.message}
|
|
3371
|
+
\uAC80\uC0C9 \uAE30\uAC04\uC774 \uB113\uC5B4 \uC11C\uBC84\uAC00 \uCC98\uB9AC\uD558\uC9C0 \uBABB\uD588\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uAE30\uAC04\uC744 \uC904\uC5EC \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uAC70\uB098 logncrash export\uB97C \uC0AC\uC6A9\uD558\uC138\uC694.${requestId}`,
|
|
3372
|
+
err.requestId
|
|
3373
|
+
);
|
|
3374
|
+
}
|
|
3227
3375
|
throw err;
|
|
3228
3376
|
}
|
|
3229
3377
|
stopSpinner(true);
|
|
@@ -3251,19 +3399,19 @@ var VALID_LEVELS = ["DEBUG", "INFO", "WARN", "ERROR", "FATAL"];
|
|
|
3251
3399
|
function resolveBody(opts) {
|
|
3252
3400
|
if (opts.body !== void 0) return opts.body;
|
|
3253
3401
|
if (opts.file !== void 0) {
|
|
3254
|
-
let
|
|
3402
|
+
let stat3;
|
|
3255
3403
|
try {
|
|
3256
|
-
|
|
3404
|
+
stat3 = (0, import_node_fs3.statSync)(opts.file);
|
|
3257
3405
|
} catch (e) {
|
|
3258
3406
|
const reason = e.code ?? (e instanceof Error ? e.message : String(e));
|
|
3259
3407
|
throw new NhnCloudCliError(`\uB85C\uADF8 \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${opts.file} (${reason})`, EXIT_PARAM_ERROR);
|
|
3260
3408
|
}
|
|
3261
|
-
if (!
|
|
3409
|
+
if (!stat3.isFile()) {
|
|
3262
3410
|
throw new NhnCloudCliError(`\uB85C\uADF8 \uD30C\uC77C\uC774 \uC77C\uBC18 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${opts.file}`, EXIT_PARAM_ERROR);
|
|
3263
3411
|
}
|
|
3264
|
-
if (
|
|
3412
|
+
if (stat3.size > MAX_LOG_BYTES) {
|
|
3265
3413
|
throw new NhnCloudCliError(
|
|
3266
|
-
`\uB85C\uADF8 \uD30C\uC77C\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${
|
|
3414
|
+
`\uB85C\uADF8 \uD30C\uC77C\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${stat3.size} \uBC14\uC774\uD2B8 (\uD55C\uB3C4 ${MAX_LOG_BYTES} \uBC14\uC774\uD2B8).`,
|
|
3267
3415
|
EXIT_PARAM_ERROR
|
|
3268
3416
|
);
|
|
3269
3417
|
}
|
|
@@ -3351,7 +3499,7 @@ function assertWritable(path5, force) {
|
|
|
3351
3499
|
EXIT_PARAM_ERROR
|
|
3352
3500
|
);
|
|
3353
3501
|
}
|
|
3354
|
-
var exportCommand = new import_commander6.Command("export").description("Log & Crash \uB85C\uADF8\uB97C scroll \uB85C \uC804\uCCB4 \uCD94\uCD9C\uD574 \uD30C\uC77C\uB85C \uC800\uC7A5 (\uB300\uB7C9 \uCD94\uCD9C)").option("--query <lucene>", "Lucene \uC9C8\uC758 \uBB38\uC790\uC5F4 (\uD544\uC218)").option("--from <time>", "\uAC80\uC0C9 \uC2DC\uC791: ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (1h/30m/2d/now) (\uD544\uC218)").option("--to <time>", "\uAC80\uC0C9 \uB05D: ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (\uD544\uC218)").option("--output <file>", "\uCD9C\uB825 \uD30C\uC77C \uACBD\uB85C (\uD544\uC218)").option("--format <fmt>", "\uCD9C\uB825 \uD615\uC2DD: jsonl(\uAE30\uBCF8, \uD55C \uC904\uB2F9 \uD55C \uB85C\uADF8) \uB610\uB294 json(\uBC30\uC5F4)", "jsonl").option("--size <n>", "\uD3D0\uAE30 \uC608\uC815: Search v3\uC5D0\uC11C\uB294 \uBB34\uC2DC\uB428 (\uD638\uD658 \uAC80\uC99D \uBC94\uC704 10~100)").option("--force", "\uCD9C\uB825 \uD30C\uC77C\uC774 \uC788\uC73C\uBA74 \uB36E\uC5B4\uC4F4\uB2E4").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3502
|
+
var exportCommand = new import_commander6.Command("export").description("Log & Crash \uB85C\uADF8\uB97C scroll \uB85C \uC804\uCCB4 \uCD94\uCD9C\uD574 \uD30C\uC77C\uB85C \uC800\uC7A5 (\uB300\uB7C9 \uCD94\uCD9C)").option("--query <lucene>", "Lucene \uC9C8\uC758 \uBB38\uC790\uC5F4 (\uD544\uC218)").option("--from <time>", "\uAC80\uC0C9 \uC2DC\uC791: \uCD08\xB7\uC2DC\uAC04\uB300 \uD3EC\uD568 ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (1h/30m/2d/now) (\uD544\uC218)").option("--to <time>", "\uAC80\uC0C9 \uB05D: \uCD08\xB7\uC2DC\uAC04\uB300 \uD3EC\uD568 ISO8601 \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04 (\uD544\uC218)").option("--output <file>", "\uCD9C\uB825 \uD30C\uC77C \uACBD\uB85C (\uD544\uC218)").option("--format <fmt>", "\uCD9C\uB825 \uD615\uC2DD: jsonl(\uAE30\uBCF8, \uD55C \uC904\uB2F9 \uD55C \uB85C\uADF8) \uB610\uB294 json(\uBC30\uC5F4)", "jsonl").option("--size <n>", "\uD3D0\uAE30 \uC608\uC815: Search v3\uC5D0\uC11C\uB294 \uBB34\uC2DC\uB428 (\uD638\uD658 \uAC80\uC99D \uBC94\uC704 10~100)").option("--force", "\uCD9C\uB825 \uD30C\uC77C\uC774 \uC788\uC73C\uBA74 \uB36E\uC5B4\uC4F4\uB2E4").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3355
3503
|
const opts = cmd.optsWithGlobals();
|
|
3356
3504
|
if (!opts.query) {
|
|
3357
3505
|
throw new NhnCloudCliError(`--query \uC635\uC158\uC740 \uD544\uC218\uC785\uB2C8\uB2E4. \uC608: --query 'logType:"NORMAL"'`, EXIT_PARAM_ERROR);
|
|
@@ -3387,54 +3535,126 @@ var exportCommand = new import_commander6.Command("export").description("Log & C
|
|
|
3387
3535
|
assertWritable(opts.output, opts.force ?? false);
|
|
3388
3536
|
const client = await resolveLogncrashClient(opts.profile);
|
|
3389
3537
|
const tmp = opts.output + "." + (0, import_node_crypto4.randomBytes)(4).toString("hex") + ".tmp";
|
|
3390
|
-
|
|
3538
|
+
let stream = (0, import_node_fs4.createWriteStream)(tmp, { encoding: "utf-8" });
|
|
3391
3539
|
const spinner = startSpinner("\uB85C\uADF8 \uCD94\uCD9C \uC911...");
|
|
3392
3540
|
let count = 0;
|
|
3393
3541
|
let total = 0;
|
|
3542
|
+
let hasUnqueriedWindows = false;
|
|
3394
3543
|
let first = true;
|
|
3544
|
+
let bytePosition = 0;
|
|
3545
|
+
let resumeFrom = "";
|
|
3546
|
+
const write = (chunk) => {
|
|
3547
|
+
stream.write(chunk);
|
|
3548
|
+
bytePosition += Buffer.byteLength(chunk, "utf-8");
|
|
3549
|
+
};
|
|
3395
3550
|
const writePage = (data) => {
|
|
3396
3551
|
for (const log of data) {
|
|
3397
3552
|
if (count >= MAX_TOTAL) break;
|
|
3398
3553
|
const json = JSON.stringify(log);
|
|
3399
|
-
|
|
3554
|
+
write(format === "json" ? first ? json : "," + json : json + "\n");
|
|
3400
3555
|
first = false;
|
|
3401
3556
|
count++;
|
|
3402
3557
|
}
|
|
3403
3558
|
};
|
|
3404
3559
|
try {
|
|
3405
|
-
if (format === "json")
|
|
3406
|
-
let
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3560
|
+
if (format === "json") write("[");
|
|
3561
|
+
let pendingWindows = [{ from: fromIso, to: toIso }];
|
|
3562
|
+
let completedWindows = 0;
|
|
3563
|
+
const progressText = () => {
|
|
3564
|
+
const totalWindows = completedWindows + pendingWindows.length + 1;
|
|
3565
|
+
const windowPart = totalWindows > 1 ? `\uCC3D ${completedWindows + 1}/${totalWindows} ` : "";
|
|
3566
|
+
return `\uB85C\uADF8 \uCD94\uCD9C \uC911... ${windowPart}${count}/${total}`;
|
|
3567
|
+
};
|
|
3568
|
+
while (pendingWindows.length > 0) {
|
|
3569
|
+
const window = pendingWindows.shift();
|
|
3570
|
+
if (!window) break;
|
|
3571
|
+
resumeFrom = window.from;
|
|
3572
|
+
const checkpoint = {
|
|
3573
|
+
bytesWritten: bytePosition,
|
|
3574
|
+
count,
|
|
3575
|
+
first,
|
|
3576
|
+
total
|
|
3577
|
+
};
|
|
3578
|
+
try {
|
|
3579
|
+
let res = await client.scrollStart({
|
|
3580
|
+
query: opts.query,
|
|
3581
|
+
from: window.from,
|
|
3582
|
+
to: window.to
|
|
3583
|
+
});
|
|
3584
|
+
total += res.totalItems;
|
|
3585
|
+
writePage(res.data);
|
|
3586
|
+
spinner.text = progressText();
|
|
3587
|
+
while (res.data.length > 0 && res.scrollKey && count < Math.min(total, MAX_TOTAL)) {
|
|
3588
|
+
res = await scrollNextWithHint(client, res.scrollKey);
|
|
3589
|
+
writePage(res.data);
|
|
3590
|
+
spinner.text = progressText();
|
|
3591
|
+
}
|
|
3592
|
+
completedWindows++;
|
|
3593
|
+
if (count >= MAX_TOTAL && pendingWindows.length > 0) {
|
|
3594
|
+
hasUnqueriedWindows = true;
|
|
3595
|
+
break;
|
|
3596
|
+
}
|
|
3597
|
+
} catch (err) {
|
|
3598
|
+
if (!(err instanceof LogncrashServerError)) throw err;
|
|
3599
|
+
await endAndClose(stream);
|
|
3600
|
+
await (0, import_promises5.truncate)(tmp, checkpoint.bytesWritten);
|
|
3601
|
+
stream = (0, import_node_fs4.createWriteStream)(tmp, { encoding: "utf-8", flags: "a" });
|
|
3602
|
+
bytePosition = checkpoint.bytesWritten;
|
|
3603
|
+
count = checkpoint.count;
|
|
3604
|
+
first = checkpoint.first;
|
|
3605
|
+
total = checkpoint.total;
|
|
3606
|
+
const currentWindowMs = new Date(window.to).getTime() - new Date(window.from).getTime();
|
|
3607
|
+
const smallerWindowMs = Math.ceil(currentWindowMs / 2);
|
|
3608
|
+
if (smallerWindowMs < MIN_SPLIT_WINDOW_MS) throw err;
|
|
3609
|
+
pendingWindows = splitTimeRange(window.from, toIso, smallerWindowMs);
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
await endAndClose(stream);
|
|
3613
|
+
if (format === "json") await (0, import_promises5.appendFile)(tmp, "]\n");
|
|
3424
3614
|
} catch (err) {
|
|
3425
3615
|
stopSpinner(false);
|
|
3616
|
+
const failure = isRateLimitError(err) ? withRateLimitHint(err) : err;
|
|
3426
3617
|
await new Promise((resolve) => {
|
|
3427
|
-
if (stream.
|
|
3618
|
+
if (stream.closed) {
|
|
3428
3619
|
resolve();
|
|
3429
3620
|
return;
|
|
3430
3621
|
}
|
|
3431
3622
|
stream.once("close", () => resolve());
|
|
3432
|
-
stream.
|
|
3623
|
+
stream.once("error", () => resolve());
|
|
3624
|
+
if (stream.destroyed) return;
|
|
3625
|
+
stream.end();
|
|
3433
3626
|
});
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3627
|
+
if (count === 0) {
|
|
3628
|
+
await (0, import_promises5.rm)(tmp, { force: true }).catch(() => {
|
|
3629
|
+
});
|
|
3630
|
+
throw failure;
|
|
3631
|
+
}
|
|
3632
|
+
const partial = `${opts.output}.partial`;
|
|
3633
|
+
try {
|
|
3634
|
+
if (format === "json") await (0, import_promises5.appendFile)(tmp, "]\n");
|
|
3635
|
+
await (0, import_promises5.rename)(tmp, partial);
|
|
3636
|
+
} catch {
|
|
3637
|
+
process.stderr.write(
|
|
3638
|
+
`\uACBD\uACE0: \uBD80\uBD84 \uACB0\uACFC\uB97C ${partial} \uC5D0 \uB0A8\uAE30\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uC784\uC2DC \uD30C\uC77C: ${tmp}
|
|
3639
|
+
`
|
|
3640
|
+
);
|
|
3641
|
+
throw failure;
|
|
3642
|
+
}
|
|
3643
|
+
process.stderr.write(`\uC548\uB0B4: \uC5EC\uAE30\uAE4C\uC9C0 \uBC1B\uC740 ${count}\uAC74\uC744 ${partial} \uC5D0 \uB0A8\uACBC\uC2B5\uB2C8\uB2E4.
|
|
3644
|
+
`);
|
|
3645
|
+
if (resumeFrom === fromIso) {
|
|
3646
|
+
process.stderr.write(
|
|
3647
|
+
`\uC548\uB0B4: \uC774\uC5B4\uBC1B\uC744 \uC9C0\uC810\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. \uAC19\uC740 \uBA85\uB839\uC744 \uB2E4\uC2DC \uC2E4\uD589\uD558\uBA74 ${count}\uAC74\uB3C4 \uB2E4\uC2DC \uC870\uD68C\uB429\uB2C8\uB2E4.
|
|
3648
|
+
`
|
|
3649
|
+
);
|
|
3650
|
+
} else {
|
|
3651
|
+
process.stderr.write(
|
|
3652
|
+
`\uC548\uB0B4: \uC774\uC5B4\uBC1B\uC73C\uB824\uBA74 --from "${resumeFrom}" --to "${toIso}" \uB85C \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694. \uACBD\uACC4 \uAD6C\uAC04\uC758 \uB85C\uADF8\uAC00 \uC911\uBCF5\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
|
|
3653
|
+
`
|
|
3654
|
+
);
|
|
3655
|
+
}
|
|
3656
|
+
throw failure;
|
|
3657
|
+
}
|
|
3438
3658
|
stopSpinner(true, `${count}\uAC74 \uCD94\uCD9C \uC644\uB8CC`);
|
|
3439
3659
|
try {
|
|
3440
3660
|
await (0, import_promises5.rename)(tmp, opts.output);
|
|
@@ -3444,9 +3664,12 @@ var exportCommand = new import_commander6.Command("export").description("Log & C
|
|
|
3444
3664
|
const reason = err.code ?? (err instanceof Error ? err.message : String(err));
|
|
3445
3665
|
throw new NhnCloudCliError(`\uCD9C\uB825 \uD30C\uC77C\uC744 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${opts.output} (${reason})`, EXIT_PARAM_ERROR);
|
|
3446
3666
|
}
|
|
3447
|
-
|
|
3667
|
+
await (0, import_promises5.rm)(`${opts.output}.partial`, { force: true }).catch(() => {
|
|
3668
|
+
});
|
|
3669
|
+
if (count >= MAX_TOTAL && (total > MAX_TOTAL || hasUnqueriedWindows)) {
|
|
3670
|
+
const totalDescription = hasUnqueriedWindows ? `\uC870\uD68C\uD55C \uCC3D\uC5D0\uC11C ${total}\uAC74\uC744 \uD655\uC778\uD588\uACE0 \uB0A8\uC740 \uCC3D\uC744 \uC870\uD68C\uD558\uC9C0 \uC54A\uC740 \uCC44` : `\uC804\uCCB4 ${total}\uAC74 \uC911`;
|
|
3448
3671
|
process.stderr.write(
|
|
3449
|
-
`\uACBD\uACE0:
|
|
3672
|
+
`\uACBD\uACE0: ${totalDescription} \uC0C1\uD55C ${MAX_TOTAL}\uAC74\uAE4C\uC9C0\uB9CC \uCD94\uCD9C\uD588\uC2B5\uB2C8\uB2E4. \uAC80\uC0C9 \uBC94\uC704\uB97C \uC881\uD600 \uB098\uB220 \uCD94\uCD9C\uD558\uC138\uC694.
|
|
3450
3673
|
`
|
|
3451
3674
|
);
|
|
3452
3675
|
}
|
|
@@ -3457,6 +3680,8 @@ async function scrollNextWithHint(client, scrollKey) {
|
|
|
3457
3680
|
try {
|
|
3458
3681
|
return await client.scrollNext(scrollKey);
|
|
3459
3682
|
} catch (err) {
|
|
3683
|
+
if (isRateLimitError(err)) throw err;
|
|
3684
|
+
if (err instanceof LogncrashServerError) throw err;
|
|
3460
3685
|
if (err instanceof NhnCloudCliError && err.exitCode === EXIT_API_ERROR) {
|
|
3461
3686
|
throw new NhnCloudCliError(
|
|
3462
3687
|
`scroll \uB2E4\uC74C \uD398\uC774\uC9C0 \uC694\uCCAD\uC774 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4 (\uC6D0\uC778: ${err.message}). \uAC80\uC0C9 \uBC94\uC704\uB97C \uC881\uD600 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.`,
|
|
@@ -3466,12 +3691,19 @@ async function scrollNextWithHint(client, scrollKey) {
|
|
|
3466
3691
|
throw err;
|
|
3467
3692
|
}
|
|
3468
3693
|
}
|
|
3694
|
+
async function endAndClose(stream) {
|
|
3695
|
+
await new Promise((resolve, reject) => {
|
|
3696
|
+
stream.once("error", reject);
|
|
3697
|
+
stream.once("close", resolve);
|
|
3698
|
+
stream.end();
|
|
3699
|
+
});
|
|
3700
|
+
}
|
|
3469
3701
|
|
|
3470
3702
|
// src/commands/deploy/run.ts
|
|
3471
3703
|
var import_commander7 = require("commander");
|
|
3472
3704
|
|
|
3473
3705
|
// src/services/deploy/client.ts
|
|
3474
|
-
var
|
|
3706
|
+
var import_ky8 = __toESM(require("ky"));
|
|
3475
3707
|
function isBinaryGroup(val) {
|
|
3476
3708
|
if (typeof val !== "object" || val === null) return false;
|
|
3477
3709
|
const obj = val;
|
|
@@ -3517,7 +3749,7 @@ var DeployClient = class {
|
|
|
3517
3749
|
payload["targetServerHostnames"] = params.targetHosts;
|
|
3518
3750
|
}
|
|
3519
3751
|
try {
|
|
3520
|
-
const res = await
|
|
3752
|
+
const res = await import_ky8.default.post(url, {
|
|
3521
3753
|
headers: {
|
|
3522
3754
|
...this.authHeaders(),
|
|
3523
3755
|
"Content-Type": "application/json"
|
|
@@ -3537,7 +3769,7 @@ var DeployClient = class {
|
|
|
3537
3769
|
async artifacts(appKey) {
|
|
3538
3770
|
const url = `${this.baseUrl}/api/v2.1/projects/${encodeURIComponent(appKey)}/artifacts`;
|
|
3539
3771
|
try {
|
|
3540
|
-
const res = await
|
|
3772
|
+
const res = await import_ky8.default.get(url, {
|
|
3541
3773
|
headers: this.authHeaders(),
|
|
3542
3774
|
retry: 0,
|
|
3543
3775
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -3553,7 +3785,7 @@ var DeployClient = class {
|
|
|
3553
3785
|
async serverGroups(appKey, artifactId) {
|
|
3554
3786
|
const url = `${this.baseUrl}/api/v2.1/projects/${encodeURIComponent(appKey)}/artifacts/${encodeURIComponent(artifactId)}/server-groups`;
|
|
3555
3787
|
try {
|
|
3556
|
-
const res = await
|
|
3788
|
+
const res = await import_ky8.default.get(url, {
|
|
3557
3789
|
headers: this.authHeaders(),
|
|
3558
3790
|
retry: 0,
|
|
3559
3791
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -3569,7 +3801,7 @@ var DeployClient = class {
|
|
|
3569
3801
|
async histories(appKey, artifactId) {
|
|
3570
3802
|
const url = `${this.baseUrl}/api/v2.1/projects/${encodeURIComponent(appKey)}/artifacts/${encodeURIComponent(artifactId)}/deploy-histories`;
|
|
3571
3803
|
try {
|
|
3572
|
-
const res = await
|
|
3804
|
+
const res = await import_ky8.default.get(url, {
|
|
3573
3805
|
headers: this.authHeaders(),
|
|
3574
3806
|
retry: 0,
|
|
3575
3807
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -3585,7 +3817,7 @@ var DeployClient = class {
|
|
|
3585
3817
|
async binaryGroups(appKey, artifactId) {
|
|
3586
3818
|
const url = `${this.baseUrl}/api/v2.1/projects/${encodeURIComponent(appKey)}/artifacts/${encodeURIComponent(artifactId)}/binary-groups`;
|
|
3587
3819
|
try {
|
|
3588
|
-
const res = await
|
|
3820
|
+
const res = await import_ky8.default.get(url, {
|
|
3589
3821
|
headers: this.authHeaders(),
|
|
3590
3822
|
retry: 0,
|
|
3591
3823
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -3615,7 +3847,7 @@ var DeployClient = class {
|
|
|
3615
3847
|
if (params.sortKey !== void 0) searchParams["sortKey"] = params.sortKey;
|
|
3616
3848
|
if (params.sortDirection !== void 0) searchParams["sortDirection"] = params.sortDirection;
|
|
3617
3849
|
try {
|
|
3618
|
-
const res = await
|
|
3850
|
+
const res = await import_ky8.default.get(url, {
|
|
3619
3851
|
headers: this.authHeaders(),
|
|
3620
3852
|
searchParams,
|
|
3621
3853
|
retry: 0,
|
|
@@ -3657,7 +3889,7 @@ var DeployClient = class {
|
|
|
3657
3889
|
form.append("description", params.description);
|
|
3658
3890
|
}
|
|
3659
3891
|
try {
|
|
3660
|
-
const res = await
|
|
3892
|
+
const res = await import_ky8.default.post(url, {
|
|
3661
3893
|
headers: this.authHeaders(),
|
|
3662
3894
|
// 인증 헤더만 — multipart boundary 는 ky 가 자동 설정
|
|
3663
3895
|
body: form,
|
|
@@ -3693,7 +3925,7 @@ var DeployClient = class {
|
|
|
3693
3925
|
async downloadBinary(appKey, artifactId, binaryGroupKey, binaryKey) {
|
|
3694
3926
|
const url = `${this.baseUrl}/api/v2.1/projects/${encodeURIComponent(appKey)}/artifacts/${encodeURIComponent(artifactId)}/binary-group/${binaryGroupKey}/binaries/${binaryKey}`;
|
|
3695
3927
|
try {
|
|
3696
|
-
const ab = await
|
|
3928
|
+
const ab = await import_ky8.default.get(url, {
|
|
3697
3929
|
headers: this.authHeaders(),
|
|
3698
3930
|
retry: 0,
|
|
3699
3931
|
timeout: SYNC_TIMEOUT_MS
|
|
@@ -3713,17 +3945,39 @@ async function createDeployClient(profileOpt) {
|
|
|
3713
3945
|
const accessToken = await getAccessToken(profileName, uak.id, uak.secret);
|
|
3714
3946
|
return { client: new DeployClient(accessToken), profileName };
|
|
3715
3947
|
}
|
|
3948
|
+
async function resolveDeployAppKey(profileName) {
|
|
3949
|
+
let cred;
|
|
3950
|
+
try {
|
|
3951
|
+
cred = await getServiceCredential("deploy", profileName);
|
|
3952
|
+
} catch (err) {
|
|
3953
|
+
if (!(err instanceof NhnCloudCliError) || err.exitCode !== EXIT_CONFIG_ERROR) {
|
|
3954
|
+
throw err;
|
|
3955
|
+
}
|
|
3956
|
+
}
|
|
3957
|
+
if (!cred?.appkey) {
|
|
3958
|
+
throw new NhnCloudCliError(
|
|
3959
|
+
"Deploy appKey \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\nnhncloud configure --deploy-appkey <key> \uB97C \uC2E4\uD589\uD574 \uC124\uC815\uD558\uC138\uC694.",
|
|
3960
|
+
EXIT_CONFIG_ERROR
|
|
3961
|
+
);
|
|
3962
|
+
}
|
|
3963
|
+
return cred.appkey;
|
|
3964
|
+
}
|
|
3965
|
+
function requireCoordinate(value, flag) {
|
|
3966
|
+
if (!value) {
|
|
3967
|
+
throw new NhnCloudCliError(`${flag} \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.`, EXIT_PARAM_ERROR);
|
|
3968
|
+
}
|
|
3969
|
+
return value;
|
|
3970
|
+
}
|
|
3716
3971
|
|
|
3717
3972
|
// src/commands/deploy/run.ts
|
|
3718
|
-
var runCommand = new import_commander7.Command("run").description("\uBC30\uD3EC\uB97C \uC2E4\uD589\uD55C\uB2E4").
|
|
3973
|
+
var runCommand = new import_commander7.Command("run").description("\uBC30\uD3EC\uB97C \uC2E4\uD589\uD55C\uB2E4").option("--artifact-id <id>", "\uBC30\uD3EC\uD560 \uC544\uD2F0\uD329\uD2B8 ID (artifacts \uB85C \uD655\uC778)").option("--server-group-id <id>", "\uBC30\uD3EC \uB300\uC0C1 \uC11C\uBC84\uADF8\uB8F9 ID (server-groups \uB85C \uD655\uC778)").option("--scenario-ids <csv>", "\uC2E4\uD589\uD560 \uC2DC\uB098\uB9AC\uC624 ID \uBAA9\uB85D (\uC27C\uD45C \uAD6C\uBD84)").option("--target-hosts <csv>", "\uB300\uC0C1 \uD638\uC2A4\uD2B8 (\uC0DD\uB7B5 \uC2DC \uC11C\uBC84\uADF8\uB8F9 \uC804\uCCB4)").option("--concurrent <n>", "\uBCD1\uB82C \uBC30\uD3EC \uC218 (\uAE30\uBCF8 1)", "1").option("--next-when-fail", "\uC2DC\uB098\uB9AC\uC624 \uC2E4\uD328 \uC2DC\uC5D0\uB3C4 \uC9C4\uD589").option("--note <s>", "\uBC30\uD3EC \uBA54\uBAA8").option("--async", "\uC989\uC2DC \uBC18\uD658 (\uAE30\uBCF8\uC740 \uC644\uB8CC \uB300\uAE30)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3719
3974
|
const opts = cmd.optsWithGlobals();
|
|
3720
3975
|
const concurrentNum = parsePositiveIntegerOption(opts.concurrent ?? "1", "--concurrent");
|
|
3721
|
-
const
|
|
3722
|
-
const
|
|
3723
|
-
const
|
|
3724
|
-
const
|
|
3725
|
-
const
|
|
3726
|
-
const { client } = await createDeployClient(opts.profile);
|
|
3976
|
+
const artifactId = requireCoordinate(opts.artifactId, "--artifact-id");
|
|
3977
|
+
const serverGroupId = requireCoordinate(opts.serverGroupId, "--server-group-id");
|
|
3978
|
+
const scenarioIds = requireCoordinate(opts.scenarioIds, "--scenario-ids");
|
|
3979
|
+
const { client, profileName } = await createDeployClient(opts.profile);
|
|
3980
|
+
const appKey = await resolveDeployAppKey(profileName);
|
|
3727
3981
|
startSpinner("\uBC30\uD3EC \uC2E4\uD589 \uC911...");
|
|
3728
3982
|
let result;
|
|
3729
3983
|
try {
|
|
@@ -3753,21 +4007,10 @@ var runCommand = new import_commander7.Command("run").description("\uBC30\uD3EC\
|
|
|
3753
4007
|
|
|
3754
4008
|
// src/commands/deploy/artifacts.ts
|
|
3755
4009
|
var import_commander8 = require("commander");
|
|
3756
|
-
var artifactsCommand = new import_commander8.Command("artifacts").description("\uC544\uD2F0\uD329\uD2B8 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").
|
|
4010
|
+
var artifactsCommand = new import_commander8.Command("artifacts").description("\uC544\uD2F0\uD329\uD2B8 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3757
4011
|
const opts = cmd.optsWithGlobals();
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
appKey = opts.appKey;
|
|
3761
|
-
} else if (targetName) {
|
|
3762
|
-
const target = await getDeployTarget(targetName);
|
|
3763
|
-
appKey = target.appKey;
|
|
3764
|
-
} else {
|
|
3765
|
-
throw new NhnCloudCliError(
|
|
3766
|
-
"target \uC774\uB984 \uB610\uB294 --app-key \uC635\uC158\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \uC608: deploy artifacts <target> \uB610\uB294 deploy artifacts --app-key <appKey>",
|
|
3767
|
-
EXIT_PARAM_ERROR
|
|
3768
|
-
);
|
|
3769
|
-
}
|
|
3770
|
-
const { client } = await createDeployClient(opts.profile);
|
|
4012
|
+
const { client, profileName } = await createDeployClient(opts.profile);
|
|
4013
|
+
const appKey = await resolveDeployAppKey(profileName);
|
|
3771
4014
|
startSpinner("\uC544\uD2F0\uD329\uD2B8 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
3772
4015
|
let result;
|
|
3773
4016
|
try {
|
|
@@ -3794,12 +4037,11 @@ var artifactsCommand = new import_commander8.Command("artifacts").description("\
|
|
|
3794
4037
|
|
|
3795
4038
|
// src/commands/deploy/server-groups.ts
|
|
3796
4039
|
var import_commander9 = require("commander");
|
|
3797
|
-
var serverGroupsCommand = new import_commander9.Command("server-groups").description("\uC11C\uBC84\uADF8\uB8F9 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").
|
|
4040
|
+
var serverGroupsCommand = new import_commander9.Command("server-groups").description("\uC11C\uBC84\uADF8\uB8F9 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--artifact-id <id>", "\uC870\uD68C\uD560 \uC544\uD2F0\uD329\uD2B8 ID (artifacts \uB85C \uD655\uC778)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3798
4041
|
const opts = cmd.optsWithGlobals();
|
|
3799
|
-
const
|
|
3800
|
-
const
|
|
3801
|
-
const
|
|
3802
|
-
const { client } = await createDeployClient(opts.profile);
|
|
4042
|
+
const artifactId = requireCoordinate(opts.artifactId, "--artifact-id");
|
|
4043
|
+
const { client, profileName } = await createDeployClient(opts.profile);
|
|
4044
|
+
const appKey = await resolveDeployAppKey(profileName);
|
|
3803
4045
|
startSpinner("\uC11C\uBC84\uADF8\uB8F9 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
3804
4046
|
let result;
|
|
3805
4047
|
try {
|
|
@@ -3819,12 +4061,11 @@ var serverGroupsCommand = new import_commander9.Command("server-groups").descrip
|
|
|
3819
4061
|
|
|
3820
4062
|
// src/commands/deploy/histories.ts
|
|
3821
4063
|
var import_commander10 = require("commander");
|
|
3822
|
-
var historiesCommand = new import_commander10.Command("histories").description("\uBC30\uD3EC \uC774\uB825\uC744 \uC870\uD68C\uD55C\uB2E4").
|
|
4064
|
+
var historiesCommand = new import_commander10.Command("histories").description("\uBC30\uD3EC \uC774\uB825\uC744 \uC870\uD68C\uD55C\uB2E4").option("--artifact-id <id>", "\uC870\uD68C\uD560 \uC544\uD2F0\uD329\uD2B8 ID (artifacts \uB85C \uD655\uC778)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3823
4065
|
const opts = cmd.optsWithGlobals();
|
|
3824
|
-
const
|
|
3825
|
-
const
|
|
3826
|
-
const
|
|
3827
|
-
const { client } = await createDeployClient(opts.profile);
|
|
4066
|
+
const artifactId = requireCoordinate(opts.artifactId, "--artifact-id");
|
|
4067
|
+
const { client, profileName } = await createDeployClient(opts.profile);
|
|
4068
|
+
const appKey = await resolveDeployAppKey(profileName);
|
|
3828
4069
|
startSpinner("\uBC30\uD3EC \uC774\uB825 \uC870\uD68C \uC911...");
|
|
3829
4070
|
let result;
|
|
3830
4071
|
try {
|
|
@@ -3844,12 +4085,11 @@ var historiesCommand = new import_commander10.Command("histories").description("
|
|
|
3844
4085
|
|
|
3845
4086
|
// src/commands/deploy/binary-groups.ts
|
|
3846
4087
|
var import_commander11 = require("commander");
|
|
3847
|
-
var binaryGroupsCommand = new import_commander11.Command("binary-groups").description("\uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").
|
|
4088
|
+
var binaryGroupsCommand = new import_commander11.Command("binary-groups").description("\uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--artifact-id <id>", "\uC870\uD68C\uD560 \uC544\uD2F0\uD329\uD2B8 ID (artifacts \uB85C \uD655\uC778)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3848
4089
|
const opts = cmd.optsWithGlobals();
|
|
3849
|
-
const
|
|
3850
|
-
const
|
|
3851
|
-
const
|
|
3852
|
-
const { client } = await createDeployClient(opts.profile);
|
|
4090
|
+
const artifactId = requireCoordinate(opts.artifactId, "--artifact-id");
|
|
4091
|
+
const { client, profileName } = await createDeployClient(opts.profile);
|
|
4092
|
+
const appKey = await resolveDeployAppKey(profileName);
|
|
3853
4093
|
startSpinner("\uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
3854
4094
|
let groups;
|
|
3855
4095
|
try {
|
|
@@ -3887,7 +4127,7 @@ function parsePositiveInt(value, flag) {
|
|
|
3887
4127
|
}
|
|
3888
4128
|
return Number(value);
|
|
3889
4129
|
}
|
|
3890
|
-
var binariesCommand = new import_commander12.Command("binaries").description("\uD2B9\uC815 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9\uC758 \uBC14\uC774\uB108\uB9AC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").
|
|
4130
|
+
var binariesCommand = new import_commander12.Command("binaries").description("\uD2B9\uC815 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9\uC758 \uBC14\uC774\uB108\uB9AC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").requiredOption("--binary-group <key>", "\uC870\uD68C\uD560 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 key (binary-groups \uB85C \uD655\uC778)").option("--page-num <n>", "\uD398\uC774\uC9C0 \uBC88\uD638 (1 \uC774\uC0C1)").option("--page-size <n>", "\uD398\uC774\uC9C0 \uD06C\uAE30 (1 \uC774\uC0C1)").option("--sort-key <k>", "\uC815\uB82C \uAE30\uC900 (\uC608: UPLOAD_DATE)").option("--sort-direction <d>", "\uC815\uB82C \uBC29\uD5A5 (\uC608: DESC)").option("--artifact-id <id>", "\uC870\uD68C\uD560 \uC544\uD2F0\uD329\uD2B8 ID (artifacts \uB85C \uD655\uC778)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3891
4131
|
const opts = cmd.optsWithGlobals();
|
|
3892
4132
|
const binaryGroupKey = parsePositiveInt(opts.binaryGroup, "--binary-group");
|
|
3893
4133
|
if (binaryGroupKey === void 0) {
|
|
@@ -3895,10 +4135,9 @@ var binariesCommand = new import_commander12.Command("binaries").description("\u
|
|
|
3895
4135
|
}
|
|
3896
4136
|
const pageNum = parsePositiveInt(opts.pageNum, "--page-num");
|
|
3897
4137
|
const pageSize = parsePositiveInt(opts.pageSize, "--page-size");
|
|
3898
|
-
const
|
|
3899
|
-
const
|
|
3900
|
-
const
|
|
3901
|
-
const { client } = await createDeployClient(opts.profile);
|
|
4138
|
+
const artifactId = requireCoordinate(opts.artifactId, "--artifact-id");
|
|
4139
|
+
const { client, profileName } = await createDeployClient(opts.profile);
|
|
4140
|
+
const appKey = await resolveDeployAppKey(profileName);
|
|
3902
4141
|
startSpinner("\uBC14\uC774\uB108\uB9AC \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
3903
4142
|
let result;
|
|
3904
4143
|
try {
|
|
@@ -3946,16 +4185,17 @@ function parsePositiveInt2(value, flag) {
|
|
|
3946
4185
|
}
|
|
3947
4186
|
return Number(value);
|
|
3948
4187
|
}
|
|
3949
|
-
var uploadCommand = new import_commander13.Command("upload").description("\uB85C\uCEEC \uD30C\uC77C\uC744 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9\uC5D0 \uC5C5\uB85C\uB4DC\uD55C\uB2E4").
|
|
4188
|
+
var uploadCommand = new import_commander13.Command("upload").description("\uB85C\uCEEC \uD30C\uC77C\uC744 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9\uC5D0 \uC5C5\uB85C\uB4DC\uD55C\uB2E4").requiredOption("--file <path>", "\uC5C5\uB85C\uB4DC\uD560 \uD30C\uC77C \uACBD\uB85C").requiredOption("--binary-group <key>", "\uC5C5\uB85C\uB4DC \uB300\uC0C1 \uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 key (binary-groups \uB85C \uD655\uC778)").option("--application-type <type>", "applicationType (\uC608: server)", "server").option("--description <text>", "\uBC14\uC774\uB108\uB9AC \uC124\uBA85").option("--artifact-id <id>", "\uC5C5\uB85C\uB4DC \uB300\uC0C1 \uC544\uD2F0\uD329\uD2B8 ID (artifacts \uB85C \uD655\uC778)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
3950
4189
|
const opts = cmd.optsWithGlobals();
|
|
3951
4190
|
const binaryGroupKey = parsePositiveInt2(opts.binaryGroup, "--binary-group");
|
|
3952
4191
|
if (binaryGroupKey === void 0) {
|
|
3953
4192
|
throw new NhnCloudCliError("--binary-group \uC774 \uD544\uC694\uD569\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
3954
4193
|
}
|
|
4194
|
+
const artifactId = requireCoordinate(opts.artifactId, "--artifact-id");
|
|
3955
4195
|
const filePath = opts.file;
|
|
3956
|
-
let
|
|
4196
|
+
let stat3;
|
|
3957
4197
|
try {
|
|
3958
|
-
|
|
4198
|
+
stat3 = (0, import_node_fs5.statSync)(filePath);
|
|
3959
4199
|
} catch (e) {
|
|
3960
4200
|
const reason = e.code ?? (e instanceof Error ? e.message : String(e));
|
|
3961
4201
|
throw new NhnCloudCliError(
|
|
@@ -3963,21 +4203,19 @@ var uploadCommand = new import_commander13.Command("upload").description("\uB85C
|
|
|
3963
4203
|
EXIT_PARAM_ERROR
|
|
3964
4204
|
);
|
|
3965
4205
|
}
|
|
3966
|
-
if (!
|
|
4206
|
+
if (!stat3.isFile()) {
|
|
3967
4207
|
throw new NhnCloudCliError(`--file \uC774 \uC77C\uBC18 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${filePath}`, EXIT_PARAM_ERROR);
|
|
3968
4208
|
}
|
|
3969
|
-
if (
|
|
4209
|
+
if (stat3.size > MAX_UPLOAD_BYTES) {
|
|
3970
4210
|
throw new NhnCloudCliError(
|
|
3971
|
-
`--file \uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${
|
|
4211
|
+
`--file \uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${stat3.size} \uBC14\uC774\uD2B8). \uC5C5\uB85C\uB4DC \uD55C\uB3C4 ${MAX_UPLOAD_BYTES} \uBC14\uC774\uD2B8.`,
|
|
3972
4212
|
EXIT_PARAM_ERROR
|
|
3973
4213
|
);
|
|
3974
4214
|
}
|
|
3975
4215
|
const fileBuffer = (0, import_node_fs5.readFileSync)(filePath);
|
|
3976
4216
|
const fileName = (0, import_node_path7.basename)(filePath);
|
|
3977
|
-
const
|
|
3978
|
-
const appKey =
|
|
3979
|
-
const artifactId = opts.artifactId ?? target.artifactId;
|
|
3980
|
-
const { client } = await createDeployClient(opts.profile);
|
|
4217
|
+
const { client, profileName } = await createDeployClient(opts.profile);
|
|
4218
|
+
const appKey = await resolveDeployAppKey(profileName);
|
|
3981
4219
|
startSpinner("\uBC14\uC774\uB108\uB9AC \uC5C5\uB85C\uB4DC \uC911...");
|
|
3982
4220
|
let result;
|
|
3983
4221
|
try {
|
|
@@ -4010,7 +4248,7 @@ var uploadCommand = new import_commander13.Command("upload").description("\uB85C
|
|
|
4010
4248
|
// src/commands/deploy/download.ts
|
|
4011
4249
|
var import_commander14 = require("commander");
|
|
4012
4250
|
var import_node_fs6 = require("fs");
|
|
4013
|
-
var
|
|
4251
|
+
var import_chalk4 = __toESM(require("chalk"));
|
|
4014
4252
|
function parsePositiveInt3(value, flag) {
|
|
4015
4253
|
if (value === void 0) return void 0;
|
|
4016
4254
|
if (!/^[1-9]\d*$/.test(value)) {
|
|
@@ -4038,19 +4276,18 @@ function assertWritable2(path5, force) {
|
|
|
4038
4276
|
EXIT_PARAM_ERROR
|
|
4039
4277
|
);
|
|
4040
4278
|
}
|
|
4041
|
-
var downloadCommand = new import_commander14.Command("download").description("\uBC14\uC774\uB108\uB9AC\uB97C \uB85C\uCEEC \uD30C\uC77C\uB85C \uB2E4\uC6B4\uB85C\uB4DC\uD55C\uB2E4").
|
|
4279
|
+
var downloadCommand = new import_commander14.Command("download").description("\uBC14\uC774\uB108\uB9AC\uB97C \uB85C\uCEEC \uD30C\uC77C\uB85C \uB2E4\uC6B4\uB85C\uB4DC\uD55C\uB2E4").requiredOption("--binary-group <key>", "\uBC14\uC774\uB108\uB9AC \uADF8\uB8F9 key (binary-groups \uB85C \uD655\uC778)").requiredOption("--binary-key <key>", "\uB2E4\uC6B4\uB85C\uB4DC\uD560 \uBC14\uC774\uB108\uB9AC key (binaries \uB610\uB294 upload \uB85C \uD655\uC778)").requiredOption("-o, --output <file>", "\uC800\uC7A5\uD560 \uD30C\uC77C \uACBD\uB85C").option("--force", "\uB300\uC0C1 \uD30C\uC77C\uC774 \uC788\uC73C\uBA74 \uB36E\uC5B4\uC4F4\uB2E4").option("--artifact-id <id>", "\uB300\uC0C1 \uC544\uD2F0\uD329\uD2B8 ID (artifacts \uB85C \uD655\uC778)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
4042
4280
|
const opts = cmd.optsWithGlobals();
|
|
4043
4281
|
const binaryGroupKey = parsePositiveInt3(opts.binaryGroup, "--binary-group");
|
|
4044
4282
|
const binaryKey = parsePositiveInt3(opts.binaryKey, "--binary-key");
|
|
4045
4283
|
if (binaryGroupKey === void 0 || binaryKey === void 0) {
|
|
4046
4284
|
throw new NhnCloudCliError("--binary-group / --binary-key \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
4047
4285
|
}
|
|
4286
|
+
const artifactId = requireCoordinate(opts.artifactId, "--artifact-id");
|
|
4048
4287
|
const outPath = opts.output;
|
|
4049
4288
|
assertWritable2(outPath, opts.force ?? false);
|
|
4050
|
-
const
|
|
4051
|
-
const appKey =
|
|
4052
|
-
const artifactId = opts.artifactId ?? target.artifactId;
|
|
4053
|
-
const { client } = await createDeployClient(opts.profile);
|
|
4289
|
+
const { client, profileName } = await createDeployClient(opts.profile);
|
|
4290
|
+
const appKey = await resolveDeployAppKey(profileName);
|
|
4054
4291
|
startSpinner("\uBC14\uC774\uB108\uB9AC \uB2E4\uC6B4\uB85C\uB4DC \uC911...");
|
|
4055
4292
|
try {
|
|
4056
4293
|
const buffer = await client.downloadBinary(appKey, artifactId, binaryGroupKey, binaryKey);
|
|
@@ -4061,7 +4298,7 @@ var downloadCommand = new import_commander14.Command("download").description("\u
|
|
|
4061
4298
|
}
|
|
4062
4299
|
stopSpinner(true);
|
|
4063
4300
|
if (!opts.quiet) {
|
|
4064
|
-
process.stderr.write(
|
|
4301
|
+
process.stderr.write(import_chalk4.default.green(` \uC800\uC7A5\uB428: ${outPath}
|
|
4065
4302
|
`));
|
|
4066
4303
|
}
|
|
4067
4304
|
});
|
|
@@ -4079,7 +4316,7 @@ async function resolveIaasTokenContext(opts) {
|
|
|
4079
4316
|
}
|
|
4080
4317
|
|
|
4081
4318
|
// src/services/instance/client.ts
|
|
4082
|
-
var
|
|
4319
|
+
var import_ky9 = __toESM(require("ky"));
|
|
4083
4320
|
var DEFAULT_POLL_INTERVAL_MS = 5e3;
|
|
4084
4321
|
function isServer(val) {
|
|
4085
4322
|
if (typeof val !== "object" || val === null) return false;
|
|
@@ -4208,7 +4445,7 @@ var InstanceClient = class {
|
|
|
4208
4445
|
async list() {
|
|
4209
4446
|
const url = `${this.computeEndpoint}/servers/detail`;
|
|
4210
4447
|
try {
|
|
4211
|
-
const raw = await
|
|
4448
|
+
const raw = await import_ky9.default.get(url, {
|
|
4212
4449
|
headers: this.authHeaders(),
|
|
4213
4450
|
retry: 0,
|
|
4214
4451
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -4230,7 +4467,7 @@ var InstanceClient = class {
|
|
|
4230
4467
|
async get(id) {
|
|
4231
4468
|
const url = `${this.computeEndpoint}/servers/${encodeURIComponent(id)}`;
|
|
4232
4469
|
try {
|
|
4233
|
-
const raw = await
|
|
4470
|
+
const raw = await import_ky9.default.get(url, {
|
|
4234
4471
|
headers: this.authHeaders(),
|
|
4235
4472
|
retry: 0,
|
|
4236
4473
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -4289,7 +4526,7 @@ var InstanceClient = class {
|
|
|
4289
4526
|
}
|
|
4290
4527
|
let raw;
|
|
4291
4528
|
try {
|
|
4292
|
-
raw = await
|
|
4529
|
+
raw = await import_ky9.default.post(url, {
|
|
4293
4530
|
headers: this.authHeaders(),
|
|
4294
4531
|
json: { server: serverBody },
|
|
4295
4532
|
retry: 0,
|
|
@@ -4312,7 +4549,7 @@ var InstanceClient = class {
|
|
|
4312
4549
|
async delete(id) {
|
|
4313
4550
|
const url = `${this.computeEndpoint}/servers/${encodeURIComponent(id)}`;
|
|
4314
4551
|
try {
|
|
4315
|
-
await
|
|
4552
|
+
await import_ky9.default.delete(url, {
|
|
4316
4553
|
headers: this.authHeaders(),
|
|
4317
4554
|
retry: 0,
|
|
4318
4555
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -4330,7 +4567,7 @@ var InstanceClient = class {
|
|
|
4330
4567
|
async serverAction(id, payload) {
|
|
4331
4568
|
const url = `${this.computeEndpoint}/servers/${encodeURIComponent(id)}/action`;
|
|
4332
4569
|
try {
|
|
4333
|
-
await
|
|
4570
|
+
await import_ky9.default.post(url, {
|
|
4334
4571
|
headers: this.authHeaders(),
|
|
4335
4572
|
json: payload,
|
|
4336
4573
|
retry: 0,
|
|
@@ -4375,7 +4612,7 @@ var InstanceClient = class {
|
|
|
4375
4612
|
if (params.minDisk !== void 0) searchParams["minDisk"] = params.minDisk;
|
|
4376
4613
|
if (params.minRam !== void 0) searchParams["minRam"] = params.minRam;
|
|
4377
4614
|
try {
|
|
4378
|
-
const raw = await
|
|
4615
|
+
const raw = await import_ky9.default.get(url, {
|
|
4379
4616
|
headers: this.authHeaders(),
|
|
4380
4617
|
searchParams,
|
|
4381
4618
|
retry: 0,
|
|
@@ -4408,7 +4645,7 @@ var InstanceClient = class {
|
|
|
4408
4645
|
async listAvailabilityZones() {
|
|
4409
4646
|
const url = `${this.computeEndpoint}/os-availability-zone`;
|
|
4410
4647
|
try {
|
|
4411
|
-
const raw = await
|
|
4648
|
+
const raw = await import_ky9.default.get(url, {
|
|
4412
4649
|
headers: this.authHeaders(),
|
|
4413
4650
|
retry: 0,
|
|
4414
4651
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -4428,7 +4665,7 @@ var InstanceClient = class {
|
|
|
4428
4665
|
async listKeypairs() {
|
|
4429
4666
|
const url = `${this.computeEndpoint}/os-keypairs`;
|
|
4430
4667
|
try {
|
|
4431
|
-
const raw = await
|
|
4668
|
+
const raw = await import_ky9.default.get(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS }).json();
|
|
4432
4669
|
if (!isKeypairsResponse(raw)) {
|
|
4433
4670
|
throw new NhnCloudCliError(
|
|
4434
4671
|
"instance keypairs \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 keypairs \uBC30\uC5F4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -4444,7 +4681,7 @@ var InstanceClient = class {
|
|
|
4444
4681
|
async getKeypair(name) {
|
|
4445
4682
|
const url = `${this.computeEndpoint}/os-keypairs/${encodeURIComponent(name)}`;
|
|
4446
4683
|
try {
|
|
4447
|
-
const raw = await
|
|
4684
|
+
const raw = await import_ky9.default.get(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS }).json();
|
|
4448
4685
|
if (!isKeypairDetailResponse(raw)) {
|
|
4449
4686
|
throw new NhnCloudCliError(
|
|
4450
4687
|
`instance keypair get(${name}) \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 keypair \uC0C1\uC138 \uD544\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.`,
|
|
@@ -4469,7 +4706,7 @@ var InstanceClient = class {
|
|
|
4469
4706
|
}
|
|
4470
4707
|
let raw;
|
|
4471
4708
|
try {
|
|
4472
|
-
raw = await
|
|
4709
|
+
raw = await import_ky9.default.post(url, {
|
|
4473
4710
|
headers: this.authHeaders(),
|
|
4474
4711
|
json: { keypair: keypairBody },
|
|
4475
4712
|
retry: 0,
|
|
@@ -4498,7 +4735,7 @@ var InstanceClient = class {
|
|
|
4498
4735
|
async deleteKeypair(name) {
|
|
4499
4736
|
const url = `${this.computeEndpoint}/os-keypairs/${encodeURIComponent(name)}`;
|
|
4500
4737
|
try {
|
|
4501
|
-
await
|
|
4738
|
+
await import_ky9.default.delete(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS });
|
|
4502
4739
|
} catch (err) {
|
|
4503
4740
|
throw toNhnCloudCliError(err);
|
|
4504
4741
|
}
|
|
@@ -4518,7 +4755,7 @@ var InstanceClient = class {
|
|
|
4518
4755
|
if (params.owner !== void 0) searchParams["owner"] = params.owner;
|
|
4519
4756
|
if (params.status !== void 0) searchParams["status"] = params.status;
|
|
4520
4757
|
try {
|
|
4521
|
-
const raw = await
|
|
4758
|
+
const raw = await import_ky9.default.get(url, {
|
|
4522
4759
|
headers: this.authHeaders(),
|
|
4523
4760
|
searchParams,
|
|
4524
4761
|
retry: 0,
|
|
@@ -4542,7 +4779,7 @@ var InstanceClient = class {
|
|
|
4542
4779
|
async listVolumeAttachments(serverId) {
|
|
4543
4780
|
const url = `${this.computeEndpoint}/servers/${encodeURIComponent(serverId)}/os-volume_attachments`;
|
|
4544
4781
|
try {
|
|
4545
|
-
const raw = await
|
|
4782
|
+
const raw = await import_ky9.default.get(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS }).json();
|
|
4546
4783
|
if (!isVolumeAttachmentsResponse(raw)) {
|
|
4547
4784
|
throw new NhnCloudCliError(
|
|
4548
4785
|
"instance volumes \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 volumeAttachments \uBC30\uC5F4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -4561,7 +4798,7 @@ var InstanceClient = class {
|
|
|
4561
4798
|
async attachVolume(serverId, volumeId) {
|
|
4562
4799
|
const url = `${this.computeEndpoint}/servers/${encodeURIComponent(serverId)}/os-volume_attachments`;
|
|
4563
4800
|
try {
|
|
4564
|
-
const res = await
|
|
4801
|
+
const res = await import_ky9.default.post(url, {
|
|
4565
4802
|
headers: this.authHeaders(),
|
|
4566
4803
|
json: { volumeAttachment: { volumeId } },
|
|
4567
4804
|
retry: 0,
|
|
@@ -4589,7 +4826,7 @@ var InstanceClient = class {
|
|
|
4589
4826
|
async detachVolume(serverId, volumeId) {
|
|
4590
4827
|
const url = `${this.computeEndpoint}/servers/${encodeURIComponent(serverId)}/os-volume_attachments/${encodeURIComponent(volumeId)}`;
|
|
4591
4828
|
try {
|
|
4592
|
-
await
|
|
4829
|
+
await import_ky9.default.delete(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS });
|
|
4593
4830
|
} catch (err) {
|
|
4594
4831
|
throw toNhnCloudCliError(err);
|
|
4595
4832
|
}
|
|
@@ -4656,7 +4893,7 @@ var listCommand = new import_commander15.Command("list").description("\uC778\uC2
|
|
|
4656
4893
|
var import_commander16 = require("commander");
|
|
4657
4894
|
|
|
4658
4895
|
// src/services/blockstorage/client.ts
|
|
4659
|
-
var
|
|
4896
|
+
var import_ky10 = __toESM(require("ky"));
|
|
4660
4897
|
function isVolume(val) {
|
|
4661
4898
|
if (typeof val !== "object" || val === null) return false;
|
|
4662
4899
|
const obj = val;
|
|
@@ -4687,7 +4924,7 @@ var BlockStorageClient = class {
|
|
|
4687
4924
|
if (params?.offset !== void 0) searchParams["offset"] = params.offset;
|
|
4688
4925
|
if (params?.marker !== void 0) searchParams["marker"] = params.marker;
|
|
4689
4926
|
try {
|
|
4690
|
-
const raw = await
|
|
4927
|
+
const raw = await import_ky10.default.get(url, { headers: this.authHeaders(), searchParams, retry: 0, timeout: DEFAULT_TIMEOUT_MS }).json();
|
|
4691
4928
|
if (typeof raw !== "object" || raw === null) {
|
|
4692
4929
|
throw new NhnCloudCliError(
|
|
4693
4930
|
"volume list \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 volumes \uBC30\uC5F4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -4715,7 +4952,7 @@ var BlockStorageClient = class {
|
|
|
4715
4952
|
async get(id) {
|
|
4716
4953
|
const url = `${this.endpoint}/volumes/${encodeURIComponent(id)}`;
|
|
4717
4954
|
try {
|
|
4718
|
-
const raw = await
|
|
4955
|
+
const raw = await import_ky10.default.get(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS }).json();
|
|
4719
4956
|
if (!isVolumeResponse(raw)) {
|
|
4720
4957
|
throw new NhnCloudCliError(
|
|
4721
4958
|
"volume get \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 volume \uAC1D\uCCB4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -4736,7 +4973,7 @@ var BlockStorageClient = class {
|
|
|
4736
4973
|
if (params.availability_zone !== void 0) volumeBody["availability_zone"] = params.availability_zone;
|
|
4737
4974
|
if (params.snapshot_id !== void 0) volumeBody["snapshot_id"] = params.snapshot_id;
|
|
4738
4975
|
try {
|
|
4739
|
-
const raw = await
|
|
4976
|
+
const raw = await import_ky10.default.post(url, {
|
|
4740
4977
|
headers: this.authHeaders(),
|
|
4741
4978
|
json: { volume: volumeBody },
|
|
4742
4979
|
retry: 0,
|
|
@@ -4838,7 +5075,7 @@ var getCommand = new import_commander17.Command("get").description("\uB2E8\uC77C
|
|
|
4838
5075
|
|
|
4839
5076
|
// src/commands/volume/create.ts
|
|
4840
5077
|
var import_commander18 = require("commander");
|
|
4841
|
-
var
|
|
5078
|
+
var import_chalk5 = __toESM(require("chalk"));
|
|
4842
5079
|
var createCommand = new import_commander18.Command("create").description("\uBCFC\uB968\uC744 \uBC1C\uAE09\uD55C\uB2E4").requiredOption("--size <gb>", "\uBCFC\uB968 \uD06C\uAE30(GB) \u2014 \uD544\uC218").option("--name <name>", "\uBCFC\uB968 \uC774\uB984").option("--description <text>", "\uBCFC\uB968 \uC124\uBA85").option("--volume-type <type>", "\uBCFC\uB968 \uD0C0\uC785").option("--availability-zone <az>", "\uAC00\uC6A9\uC131 \uC601\uC5ED(AZ). instance availability-zones \uB85C \uC870\uD68C\uD55C zoneName \uC9C0\uC815").option("--snapshot-id <id>", "\uC2A4\uB0C5\uC0F7 ID (\uC2A4\uB0C5\uC0F7\uC5D0\uC11C \uBCFC\uB968 \uC0DD\uC131)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
4843
5080
|
const opts = cmd.optsWithGlobals();
|
|
4844
5081
|
if (!/^[1-9]\d*$/.test(opts.size)) {
|
|
@@ -4872,7 +5109,7 @@ var createCommand = new import_commander18.Command("create").description("\uBCFC
|
|
|
4872
5109
|
throw err;
|
|
4873
5110
|
}
|
|
4874
5111
|
stopSpinner(true);
|
|
4875
|
-
process.stderr.write(
|
|
5112
|
+
process.stderr.write(import_chalk5.default.green(`\uBCFC\uB968 \uBC1C\uAE09 \uC694\uCCAD \uC644\uB8CC (id: ${volume.id}, status: ${volume.status})
|
|
4876
5113
|
`));
|
|
4877
5114
|
const rows = [
|
|
4878
5115
|
["id", volume.id],
|
|
@@ -4895,7 +5132,7 @@ var createCommand = new import_commander18.Command("create").description("\uBCFC
|
|
|
4895
5132
|
var import_commander19 = require("commander");
|
|
4896
5133
|
|
|
4897
5134
|
// src/services/network/client.ts
|
|
4898
|
-
var
|
|
5135
|
+
var import_ky11 = __toESM(require("ky"));
|
|
4899
5136
|
function isVpc(val) {
|
|
4900
5137
|
if (typeof val !== "object" || val === null) return false;
|
|
4901
5138
|
const obj = val;
|
|
@@ -4948,7 +5185,7 @@ var NetworkClient = class {
|
|
|
4948
5185
|
async listVpcs() {
|
|
4949
5186
|
const url = `${this.networkEndpoint}/vpcs`;
|
|
4950
5187
|
try {
|
|
4951
|
-
const raw = await
|
|
5188
|
+
const raw = await import_ky11.default.get(url, {
|
|
4952
5189
|
headers: this.authHeaders(),
|
|
4953
5190
|
retry: 0,
|
|
4954
5191
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -4970,7 +5207,7 @@ var NetworkClient = class {
|
|
|
4970
5207
|
async listSubnets() {
|
|
4971
5208
|
const url = `${this.networkEndpoint}/vpcsubnets`;
|
|
4972
5209
|
try {
|
|
4973
|
-
const raw = await
|
|
5210
|
+
const raw = await import_ky11.default.get(url, {
|
|
4974
5211
|
headers: this.authHeaders(),
|
|
4975
5212
|
retry: 0,
|
|
4976
5213
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -4990,7 +5227,7 @@ var NetworkClient = class {
|
|
|
4990
5227
|
async listFloatingIps() {
|
|
4991
5228
|
const url = `${this.networkEndpoint}/floatingips`;
|
|
4992
5229
|
try {
|
|
4993
|
-
const raw = await
|
|
5230
|
+
const raw = await import_ky11.default.get(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS }).json();
|
|
4994
5231
|
if (!isFloatingIpsResponse(raw)) {
|
|
4995
5232
|
throw new NhnCloudCliError(
|
|
4996
5233
|
"floatingip list \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 floatingips \uBC30\uC5F4\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -5006,7 +5243,7 @@ var NetworkClient = class {
|
|
|
5006
5243
|
async createFloatingIp(params) {
|
|
5007
5244
|
const url = `${this.networkEndpoint}/floatingips`;
|
|
5008
5245
|
try {
|
|
5009
|
-
const raw = await
|
|
5246
|
+
const raw = await import_ky11.default.post(url, {
|
|
5010
5247
|
headers: this.authHeaders(),
|
|
5011
5248
|
json: { floatingip: { floating_network_id: params.floating_network_id } },
|
|
5012
5249
|
retry: 0,
|
|
@@ -5027,7 +5264,7 @@ var NetworkClient = class {
|
|
|
5027
5264
|
async deleteFloatingIp(id) {
|
|
5028
5265
|
const url = `${this.networkEndpoint}/floatingips/${encodeURIComponent(id)}`;
|
|
5029
5266
|
try {
|
|
5030
|
-
await
|
|
5267
|
+
await import_ky11.default.delete(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS });
|
|
5031
5268
|
} catch (err) {
|
|
5032
5269
|
throw toNhnCloudCliError(err);
|
|
5033
5270
|
}
|
|
@@ -5041,7 +5278,7 @@ var NetworkClient = class {
|
|
|
5041
5278
|
async findExternalNetworkId() {
|
|
5042
5279
|
const url = `${this.networkEndpoint}/vpcs`;
|
|
5043
5280
|
try {
|
|
5044
|
-
const raw = await
|
|
5281
|
+
const raw = await import_ky11.default.get(url, {
|
|
5045
5282
|
headers: this.authHeaders(),
|
|
5046
5283
|
searchParams: { "router:external": "true" },
|
|
5047
5284
|
retry: 0,
|
|
@@ -5150,7 +5387,7 @@ var listCommand4 = new import_commander21.Command("list").description("Floating
|
|
|
5150
5387
|
|
|
5151
5388
|
// src/commands/floatingip/create.ts
|
|
5152
5389
|
var import_commander22 = require("commander");
|
|
5153
|
-
var
|
|
5390
|
+
var import_chalk6 = __toESM(require("chalk"));
|
|
5154
5391
|
var createCommand2 = new import_commander22.Command("create").description("Floating IP \uB97C \uBC1C\uAE09\uD55C\uB2E4 (--network \uBBF8\uC9C0\uC815 \uC2DC \uC678\uBD80 VPC \uC790\uB3D9 \uC870\uD68C)").option("--network <id>", "\uC678\uBD80 \uB124\uD2B8\uC6CC\uD06C(VPC) id (\uBBF8\uC9C0\uC815 \uC2DC router:external=true \uC790\uB3D9 \uC870\uD68C)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
5155
5392
|
const opts = cmd.optsWithGlobals();
|
|
5156
5393
|
const { client } = await resolveNetworkClient(opts);
|
|
@@ -5182,7 +5419,7 @@ var createCommand2 = new import_commander22.Command("create").description("Float
|
|
|
5182
5419
|
}
|
|
5183
5420
|
stopSpinner(true);
|
|
5184
5421
|
process.stderr.write(
|
|
5185
|
-
|
|
5422
|
+
import_chalk6.default.green(`\u2713 Floating IP "${fip.floating_ip_address}" \uB97C \uBC1C\uAE09\uD588\uC2B5\uB2C8\uB2E4 (id: ${fip.id}).
|
|
5186
5423
|
`)
|
|
5187
5424
|
);
|
|
5188
5425
|
output(opts, {
|
|
@@ -5195,7 +5432,7 @@ var createCommand2 = new import_commander22.Command("create").description("Float
|
|
|
5195
5432
|
|
|
5196
5433
|
// src/commands/floatingip/delete.ts
|
|
5197
5434
|
var import_commander23 = require("commander");
|
|
5198
|
-
var
|
|
5435
|
+
var import_chalk7 = __toESM(require("chalk"));
|
|
5199
5436
|
var deleteCommand = new import_commander23.Command("delete").description("Floating IP \uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "Floating IP ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
5200
5437
|
const opts = cmd.optsWithGlobals();
|
|
5201
5438
|
const isTTY = process.stdin.isTTY;
|
|
@@ -5212,7 +5449,7 @@ var deleteCommand = new import_commander23.Command("delete").description("Floati
|
|
|
5212
5449
|
default: false
|
|
5213
5450
|
});
|
|
5214
5451
|
if (!ok) {
|
|
5215
|
-
process.stderr.write(
|
|
5452
|
+
process.stderr.write(import_chalk7.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
5216
5453
|
return;
|
|
5217
5454
|
}
|
|
5218
5455
|
}
|
|
@@ -5225,7 +5462,7 @@ var deleteCommand = new import_commander23.Command("delete").description("Floati
|
|
|
5225
5462
|
throw err;
|
|
5226
5463
|
}
|
|
5227
5464
|
stopSpinner(true);
|
|
5228
|
-
process.stderr.write(
|
|
5465
|
+
process.stderr.write(import_chalk7.default.green(`\u2713 Floating IP "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
5229
5466
|
`));
|
|
5230
5467
|
});
|
|
5231
5468
|
|
|
@@ -5337,7 +5574,7 @@ var getCommand2 = new import_commander26.Command("get").description("\uB2E8\uC77
|
|
|
5337
5574
|
// src/commands/instance/create.ts
|
|
5338
5575
|
var import_commander27 = require("commander");
|
|
5339
5576
|
var import_node_fs7 = require("fs");
|
|
5340
|
-
var
|
|
5577
|
+
var import_chalk8 = __toESM(require("chalk"));
|
|
5341
5578
|
function getFirstIp(server) {
|
|
5342
5579
|
for (const list of Object.values(server.addresses)) {
|
|
5343
5580
|
for (const addr of list) {
|
|
@@ -5360,9 +5597,9 @@ var createCommand3 = new import_commander27.Command("create").description("\uC77
|
|
|
5360
5597
|
}
|
|
5361
5598
|
let userDataBase64;
|
|
5362
5599
|
if (opts.userData !== void 0) {
|
|
5363
|
-
let
|
|
5600
|
+
let stat3;
|
|
5364
5601
|
try {
|
|
5365
|
-
|
|
5602
|
+
stat3 = (0, import_node_fs7.statSync)(opts.userData);
|
|
5366
5603
|
} catch (e) {
|
|
5367
5604
|
const reason = e.code ?? (e instanceof Error ? e.message : String(e));
|
|
5368
5605
|
throw new NhnCloudCliError(
|
|
@@ -5370,15 +5607,15 @@ var createCommand3 = new import_commander27.Command("create").description("\uC77
|
|
|
5370
5607
|
EXIT_PARAM_ERROR
|
|
5371
5608
|
);
|
|
5372
5609
|
}
|
|
5373
|
-
if (!
|
|
5610
|
+
if (!stat3.isFile()) {
|
|
5374
5611
|
throw new NhnCloudCliError(
|
|
5375
5612
|
`--user-data \uAC00 \uC77C\uBC18 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${opts.userData}`,
|
|
5376
5613
|
EXIT_PARAM_ERROR
|
|
5377
5614
|
);
|
|
5378
5615
|
}
|
|
5379
|
-
if (
|
|
5616
|
+
if (stat3.size > 49149) {
|
|
5380
5617
|
throw new NhnCloudCliError(
|
|
5381
|
-
`--user-data \uAC00 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${
|
|
5618
|
+
`--user-data \uAC00 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${stat3.size} \uBC14\uC774\uD2B8). base64 \uC778\uCF54\uB529 \uD6C4 65535 \uBC14\uC774\uD2B8 \uD55C\uB3C4\uB77C raw 49149 \uBC14\uC774\uD2B8\uAE4C\uC9C0\uB9CC \uD5C8\uC6A9\uB429\uB2C8\uB2E4.`,
|
|
5382
5619
|
EXIT_PARAM_ERROR
|
|
5383
5620
|
);
|
|
5384
5621
|
}
|
|
@@ -5431,7 +5668,7 @@ var createCommand3 = new import_commander27.Command("create").description("\uC77
|
|
|
5431
5668
|
return;
|
|
5432
5669
|
}
|
|
5433
5670
|
if (opts.wait) {
|
|
5434
|
-
process.stderr.write(
|
|
5671
|
+
process.stderr.write(import_chalk8.default.green(` IP: ${getIps3(server)}
|
|
5435
5672
|
`));
|
|
5436
5673
|
}
|
|
5437
5674
|
const rows = [
|
|
@@ -5452,7 +5689,7 @@ var createCommand3 = new import_commander27.Command("create").description("\uC77
|
|
|
5452
5689
|
|
|
5453
5690
|
// src/commands/instance/delete.ts
|
|
5454
5691
|
var import_commander28 = require("commander");
|
|
5455
|
-
var
|
|
5692
|
+
var import_chalk9 = __toESM(require("chalk"));
|
|
5456
5693
|
var deleteCommand2 = new import_commander28.Command("delete").description("\uC778\uC2A4\uD134\uC2A4\uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
5457
5694
|
const opts = cmd.optsWithGlobals();
|
|
5458
5695
|
const isTTY = process.stdin.isTTY;
|
|
@@ -5469,7 +5706,7 @@ var deleteCommand2 = new import_commander28.Command("delete").description("\uC77
|
|
|
5469
5706
|
default: false
|
|
5470
5707
|
});
|
|
5471
5708
|
if (!ok) {
|
|
5472
|
-
process.stderr.write(
|
|
5709
|
+
process.stderr.write(import_chalk9.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
5473
5710
|
return;
|
|
5474
5711
|
}
|
|
5475
5712
|
}
|
|
@@ -5482,13 +5719,13 @@ var deleteCommand2 = new import_commander28.Command("delete").description("\uC77
|
|
|
5482
5719
|
throw err;
|
|
5483
5720
|
}
|
|
5484
5721
|
stopSpinner(true);
|
|
5485
|
-
process.stderr.write(
|
|
5722
|
+
process.stderr.write(import_chalk9.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
5486
5723
|
`));
|
|
5487
5724
|
});
|
|
5488
5725
|
|
|
5489
5726
|
// src/commands/instance/power.ts
|
|
5490
5727
|
var import_commander29 = require("commander");
|
|
5491
|
-
var
|
|
5728
|
+
var import_chalk10 = __toESM(require("chalk"));
|
|
5492
5729
|
var startCommand = new import_commander29.Command("start").description("\uC778\uC2A4\uD134\uC2A4\uB97C \uC2DC\uC791\uD55C\uB2E4 (SHUTOFF \u2192 ACTIVE)").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
5493
5730
|
const opts = cmd.optsWithGlobals();
|
|
5494
5731
|
const { client } = await resolveInstanceClient(opts);
|
|
@@ -5500,7 +5737,7 @@ var startCommand = new import_commander29.Command("start").description("\uC778\u
|
|
|
5500
5737
|
throw err;
|
|
5501
5738
|
}
|
|
5502
5739
|
stopSpinner(true);
|
|
5503
|
-
process.stderr.write(
|
|
5740
|
+
process.stderr.write(import_chalk10.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uC2DC\uC791\uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\u2192 ACTIVE).
|
|
5504
5741
|
`));
|
|
5505
5742
|
});
|
|
5506
5743
|
var stopCommand = new import_commander29.Command("stop").description("\uC778\uC2A4\uD134\uC2A4\uB97C \uC815\uC9C0\uD55C\uB2E4 (ACTIVE/ERROR \u2192 SHUTOFF)").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
@@ -5514,7 +5751,7 @@ var stopCommand = new import_commander29.Command("stop").description("\uC778\uC2
|
|
|
5514
5751
|
throw err;
|
|
5515
5752
|
}
|
|
5516
5753
|
stopSpinner(true);
|
|
5517
|
-
process.stderr.write(
|
|
5754
|
+
process.stderr.write(import_chalk10.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uC815\uC9C0\uB97C \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\u2192 SHUTOFF).
|
|
5518
5755
|
`));
|
|
5519
5756
|
});
|
|
5520
5757
|
var rebootCommand = new import_commander29.Command("reboot").description("\uC778\uC2A4\uD134\uC2A4\uB97C \uC7AC\uBD80\uD305\uD55C\uB2E4 (\uAE30\uBCF8 SOFT, --hard \uB85C HARD)").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--hard", "HARD \uC7AC\uBD80\uD305 (\uAC15\uC81C \uC804\uC6D0 cycle, \uAE30\uBCF8\uC740 SOFT)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
@@ -5529,13 +5766,13 @@ var rebootCommand = new import_commander29.Command("reboot").description("\uC778
|
|
|
5529
5766
|
throw err;
|
|
5530
5767
|
}
|
|
5531
5768
|
stopSpinner(true);
|
|
5532
|
-
process.stderr.write(
|
|
5769
|
+
process.stderr.write(import_chalk10.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" ${type} \uC7AC\uBD80\uD305\uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4.
|
|
5533
5770
|
`));
|
|
5534
5771
|
});
|
|
5535
5772
|
|
|
5536
5773
|
// src/commands/instance/resize.ts
|
|
5537
5774
|
var import_commander30 = require("commander");
|
|
5538
|
-
var
|
|
5775
|
+
var import_chalk11 = __toESM(require("chalk"));
|
|
5539
5776
|
var resizeCommand = new import_commander30.Command("resize").description("\uC778\uC2A4\uD134\uC2A4 \uD0C0\uC785(flavor)\uC744 \uBCC0\uACBD\uD55C\uB2E4").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").requiredOption("--flavor <id>", "\uBCC0\uACBD\uD560 flavor ID (instance flavors \uB85C \uD6C4\uBCF4 \uC870\uD68C)").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
5540
5777
|
const opts = cmd.optsWithGlobals();
|
|
5541
5778
|
const { client } = await resolveInstanceClient(opts);
|
|
@@ -5548,7 +5785,7 @@ var resizeCommand = new import_commander30.Command("resize").description("\uC778
|
|
|
5548
5785
|
}
|
|
5549
5786
|
stopSpinner(true);
|
|
5550
5787
|
process.stderr.write(
|
|
5551
|
-
|
|
5788
|
+
import_chalk11.default.green(
|
|
5552
5789
|
`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" \uD0C0\uC785 \uBCC0\uACBD(flavor: ${opts.flavor}) \uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\u2192 VERIFY_RESIZE, instance get \uC73C\uB85C \uD655\uC778 \uD6C4 resize-confirm/resize-revert).
|
|
5553
5790
|
`
|
|
5554
5791
|
)
|
|
@@ -5565,7 +5802,7 @@ var resizeConfirmCommand = new import_commander30.Command("resize-confirm").desc
|
|
|
5565
5802
|
throw err;
|
|
5566
5803
|
}
|
|
5567
5804
|
stopSpinner(true);
|
|
5568
|
-
process.stderr.write(
|
|
5805
|
+
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).
|
|
5569
5806
|
`));
|
|
5570
5807
|
});
|
|
5571
5808
|
var resizeRevertCommand = new import_commander30.Command("resize-revert").description("resize \uB97C \uB864\uBC31\uD55C\uB2E4 (VERIFY_RESIZE \u2192 ACTIVE, \uC774\uC804 flavor \uB85C \uBCF5\uADC0)").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
@@ -5580,7 +5817,7 @@ var resizeRevertCommand = new import_commander30.Command("resize-revert").descri
|
|
|
5580
5817
|
}
|
|
5581
5818
|
stopSpinner(true);
|
|
5582
5819
|
process.stderr.write(
|
|
5583
|
-
|
|
5820
|
+
import_chalk11.default.green(`\u2713 \uC778\uC2A4\uD134\uC2A4 "${id}" resize \uB864\uBC31\uC744 \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4 (\uC774\uC804 flavor \uB85C \uBCF5\uADC0).
|
|
5584
5821
|
`)
|
|
5585
5822
|
);
|
|
5586
5823
|
});
|
|
@@ -5661,11 +5898,11 @@ var keypairsCommand = new import_commander32.Command("keypairs").description("\u
|
|
|
5661
5898
|
var import_commander33 = require("commander");
|
|
5662
5899
|
var import_node_fs8 = require("fs");
|
|
5663
5900
|
var import_node_crypto5 = require("crypto");
|
|
5664
|
-
var
|
|
5901
|
+
var import_chalk12 = __toESM(require("chalk"));
|
|
5665
5902
|
function resolvePublicKey(value) {
|
|
5666
|
-
let
|
|
5903
|
+
let stat3;
|
|
5667
5904
|
try {
|
|
5668
|
-
|
|
5905
|
+
stat3 = (0, import_node_fs8.statSync)(value);
|
|
5669
5906
|
} catch (e) {
|
|
5670
5907
|
const err = e;
|
|
5671
5908
|
if (err.code && err.code !== "ENOENT") {
|
|
@@ -5676,7 +5913,7 @@ function resolvePublicKey(value) {
|
|
|
5676
5913
|
}
|
|
5677
5914
|
return value;
|
|
5678
5915
|
}
|
|
5679
|
-
if (!
|
|
5916
|
+
if (!stat3.isFile()) {
|
|
5680
5917
|
throw new NhnCloudCliError(`--public-key \uAC00 \uC77C\uBC18 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${value}`, EXIT_PARAM_ERROR);
|
|
5681
5918
|
}
|
|
5682
5919
|
return (0, import_node_fs8.readFileSync)(value, "utf-8").trim();
|
|
@@ -5755,19 +5992,19 @@ var createKeypairCmd = new import_commander33.Command("create").description("\uD
|
|
|
5755
5992
|
if (opts.output !== void 0) {
|
|
5756
5993
|
try {
|
|
5757
5994
|
savePrivateKey(opts.output, result.private_key);
|
|
5758
|
-
process.stderr.write(
|
|
5995
|
+
process.stderr.write(import_chalk12.default.green(` private_key \uB97C ${opts.output} \uC5D0 \uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4 (mode 0600).
|
|
5759
5996
|
`));
|
|
5760
5997
|
} catch (saveErr) {
|
|
5761
5998
|
const reason = saveErr instanceof Error ? saveErr.message : String(saveErr);
|
|
5762
5999
|
process.stderr.write(
|
|
5763
|
-
|
|
6000
|
+
import_chalk12.default.red(` \u26A0 private_key \uD30C\uC77C \uC800\uC7A5 \uC2E4\uD328 (${reason}). \uC720\uC2E4 \uBC29\uC9C0\uB97C \uC704\uD574 \uC544\uB798\uC5D0 \uCD9C\uB825\uD569\uB2C8\uB2E4 \u2014 \uC989\uC2DC \uC548\uC804\uD55C \uACF3\uC5D0 \uBCF4\uAD00\uD558\uC138\uC694.
|
|
5764
6001
|
`)
|
|
5765
6002
|
);
|
|
5766
6003
|
process.stdout.write(result.private_key + "\n");
|
|
5767
6004
|
}
|
|
5768
6005
|
} else {
|
|
5769
6006
|
process.stderr.write(
|
|
5770
|
-
|
|
6007
|
+
import_chalk12.default.yellow(" \u26A0 private_key \uB294 \uC9C0\uAE08 \uD55C \uBC88\uB9CC \uD45C\uC2DC\uB429\uB2C8\uB2E4. \uBD84\uC2E4 \uC2DC \uBCF5\uAD6C \uBD88\uAC00 \u2014 \uC548\uC804\uD55C \uACF3\uC5D0 \uBCF4\uAD00\uD558\uC138\uC694.\n")
|
|
5771
6008
|
);
|
|
5772
6009
|
process.stdout.write(result.private_key + "\n");
|
|
5773
6010
|
}
|
|
@@ -5796,14 +6033,14 @@ var deleteKeypairCmd = new import_commander33.Command("delete").description("\uD
|
|
|
5796
6033
|
throw err;
|
|
5797
6034
|
}
|
|
5798
6035
|
stopSpinner(true);
|
|
5799
|
-
process.stderr.write(
|
|
6036
|
+
process.stderr.write(import_chalk12.default.green(`\u2713 \uD0A4\uD398\uC5B4 "${name}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
5800
6037
|
`));
|
|
5801
6038
|
});
|
|
5802
6039
|
var keypairCommand = new import_commander33.Command("keypair").description("\uD0A4\uD398\uC5B4 \uB2E8\uAC74 \uAD00\uB9AC (get / create / delete)").addCommand(getKeypairCmd).addCommand(createKeypairCmd).addCommand(deleteKeypairCmd);
|
|
5803
6040
|
|
|
5804
6041
|
// src/commands/instance/volume.ts
|
|
5805
6042
|
var import_commander34 = require("commander");
|
|
5806
|
-
var
|
|
6043
|
+
var import_chalk13 = __toESM(require("chalk"));
|
|
5807
6044
|
var attachCommand = new import_commander34.Command("attach").description("\uBCFC\uB968\uC744 \uC778\uC2A4\uD134\uC2A4\uC5D0 \uC5F0\uACB0\uD55C\uB2E4").argument("<id>", "\uC778\uC2A4\uD134\uC2A4 ID").requiredOption("--volume <volumeId>", "\uC5F0\uACB0\uD560 \uBCFC\uB968 ID").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
5808
6045
|
const opts = cmd.optsWithGlobals();
|
|
5809
6046
|
const { client } = await resolveInstanceClient(opts);
|
|
@@ -5817,7 +6054,7 @@ var attachCommand = new import_commander34.Command("attach").description("\uBCFC
|
|
|
5817
6054
|
}
|
|
5818
6055
|
stopSpinner(true);
|
|
5819
6056
|
process.stderr.write(
|
|
5820
|
-
|
|
6057
|
+
import_chalk13.default.green(`\uBCFC\uB968 \uC5F0\uACB0 \uC644\uB8CC (volumeId: ${att.volumeId}, device: ${att.device})
|
|
5821
6058
|
`)
|
|
5822
6059
|
);
|
|
5823
6060
|
output(opts, {
|
|
@@ -5844,7 +6081,7 @@ var detachCommand = new import_commander34.Command("detach").description("\uBCFC
|
|
|
5844
6081
|
}
|
|
5845
6082
|
stopSpinner(true);
|
|
5846
6083
|
process.stderr.write(
|
|
5847
|
-
|
|
6084
|
+
import_chalk13.default.green(`\uBCFC\uB968 \uC5F0\uACB0 \uD574\uC81C \uC694\uCCAD \uC644\uB8CC (volumeId: ${volumeId})
|
|
5848
6085
|
`)
|
|
5849
6086
|
);
|
|
5850
6087
|
});
|
|
@@ -5880,7 +6117,7 @@ var volumesCommand = new import_commander35.Command("volumes").description("\uC7
|
|
|
5880
6117
|
var import_commander36 = require("commander");
|
|
5881
6118
|
|
|
5882
6119
|
// src/services/ncr/harbor-client.ts
|
|
5883
|
-
var
|
|
6120
|
+
var import_ky12 = __toESM(require("ky"));
|
|
5884
6121
|
var PAGE_SIZE = 100;
|
|
5885
6122
|
var MAX_PAGES = 1e3;
|
|
5886
6123
|
var HarborClient = class {
|
|
@@ -5909,7 +6146,7 @@ var HarborClient = class {
|
|
|
5909
6146
|
try {
|
|
5910
6147
|
for (; ; ) {
|
|
5911
6148
|
const url = `https://${this.host}${path5}?page=${page}&page_size=${PAGE_SIZE}`;
|
|
5912
|
-
const res = await
|
|
6149
|
+
const res = await import_ky12.default.get(url, {
|
|
5913
6150
|
headers: this.basicAuthHeaders(),
|
|
5914
6151
|
retry: 0,
|
|
5915
6152
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -5969,8 +6206,7 @@ async function createNcrClient(opts) {
|
|
|
5969
6206
|
const region = opts.region ?? "kr1";
|
|
5970
6207
|
return { client: new NcrClient(uak.id, uak.secret, region), profileName };
|
|
5971
6208
|
}
|
|
5972
|
-
async function resolveAppKey(profileName
|
|
5973
|
-
if (appKeyOpt) return appKeyOpt;
|
|
6209
|
+
async function resolveAppKey(profileName) {
|
|
5974
6210
|
let cred;
|
|
5975
6211
|
try {
|
|
5976
6212
|
cred = await getServiceCredential("ncr", profileName);
|
|
@@ -5981,7 +6217,7 @@ async function resolveAppKey(profileName, appKeyOpt) {
|
|
|
5981
6217
|
}
|
|
5982
6218
|
if (!cred?.appkey) {
|
|
5983
6219
|
throw new NhnCloudCliError(
|
|
5984
|
-
"NCR appKey \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4
|
|
6220
|
+
"NCR appKey \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\nnhncloud configure --ncr-appkey <key> \uB97C \uC2E4\uD589\uD574 \uC124\uC815\uD558\uC138\uC694.",
|
|
5985
6221
|
EXIT_CONFIG_ERROR
|
|
5986
6222
|
);
|
|
5987
6223
|
}
|
|
@@ -5989,7 +6225,7 @@ async function resolveAppKey(profileName, appKeyOpt) {
|
|
|
5989
6225
|
}
|
|
5990
6226
|
async function createHarborClient(opts, registryArg) {
|
|
5991
6227
|
const { client: ncrClient, profileName } = await createNcrClient(opts);
|
|
5992
|
-
const appKey = await resolveAppKey(profileName
|
|
6228
|
+
const appKey = await resolveAppKey(profileName);
|
|
5993
6229
|
const uak = await getUserAccessKey(profileName);
|
|
5994
6230
|
const reg = await ncrClient.getRegistry(appKey, registryArg);
|
|
5995
6231
|
const host = parseHarborHost(reg.uri);
|
|
@@ -6015,10 +6251,10 @@ function parseHarborHost(uri) {
|
|
|
6015
6251
|
}
|
|
6016
6252
|
|
|
6017
6253
|
// src/commands/ncr/list.ts
|
|
6018
|
-
var listCommand5 = new import_commander36.Command("list").description("NCR \uB808\uC9C0\uC2A4\uD2B8\uB9AC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--
|
|
6254
|
+
var listCommand5 = new import_commander36.Command("list").description("NCR \uB808\uC9C0\uC2A4\uD2B8\uB9AC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
6019
6255
|
const opts = cmd.optsWithGlobals();
|
|
6020
6256
|
const { client, profileName } = await createNcrClient(opts);
|
|
6021
|
-
const appKey = await resolveAppKey(profileName
|
|
6257
|
+
const appKey = await resolveAppKey(profileName);
|
|
6022
6258
|
startSpinner("\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
6023
6259
|
let registries;
|
|
6024
6260
|
try {
|
|
@@ -6042,7 +6278,7 @@ var listCommand5 = new import_commander36.Command("list").description("NCR \uB80
|
|
|
6042
6278
|
|
|
6043
6279
|
// src/commands/ncr/get.ts
|
|
6044
6280
|
var import_commander37 = require("commander");
|
|
6045
|
-
var getCommand3 = new import_commander37.Command("get").description("\uB2E8\uC77C NCR \uB808\uC9C0\uC2A4\uD2B8\uB9AC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<registry>", "\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uC774\uB984 \uB610\uB294 ID").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--
|
|
6281
|
+
var getCommand3 = new import_commander37.Command("get").description("\uB2E8\uC77C NCR \uB808\uC9C0\uC2A4\uD2B8\uB9AC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<registry>", "\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uC774\uB984 \uB610\uB294 ID").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (registry, _opts, cmd) => {
|
|
6046
6282
|
const opts = cmd.optsWithGlobals();
|
|
6047
6283
|
if (!registry.trim()) {
|
|
6048
6284
|
throw new NhnCloudCliError(
|
|
@@ -6051,7 +6287,7 @@ var getCommand3 = new import_commander37.Command("get").description("\uB2E8\uC77
|
|
|
6051
6287
|
);
|
|
6052
6288
|
}
|
|
6053
6289
|
const { client, profileName } = await createNcrClient(opts);
|
|
6054
|
-
const appKey = await resolveAppKey(profileName
|
|
6290
|
+
const appKey = await resolveAppKey(profileName);
|
|
6055
6291
|
startSpinner(`\uB808\uC9C0\uC2A4\uD2B8\uB9AC "${registry}" \uC870\uD68C \uC911...`);
|
|
6056
6292
|
let reg;
|
|
6057
6293
|
try {
|
|
@@ -6071,7 +6307,7 @@ var getCommand3 = new import_commander37.Command("get").description("\uB2E8\uC77
|
|
|
6071
6307
|
|
|
6072
6308
|
// src/commands/ncr/images.ts
|
|
6073
6309
|
var import_commander38 = require("commander");
|
|
6074
|
-
var imagesCommand2 = new import_commander38.Command("images").description("\uB808\uC9C0\uC2A4\uD2B8\uB9AC\uC758 \uC774\uBBF8\uC9C0(repository) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<registry>", "\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uC774\uB984").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--
|
|
6310
|
+
var imagesCommand2 = new import_commander38.Command("images").description("\uB808\uC9C0\uC2A4\uD2B8\uB9AC\uC758 \uC774\uBBF8\uC9C0(repository) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<registry>", "\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uC774\uB984").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (registry, _opts, cmd) => {
|
|
6075
6311
|
const opts = cmd.optsWithGlobals();
|
|
6076
6312
|
if (!registry.trim()) {
|
|
6077
6313
|
throw new NhnCloudCliError(
|
|
@@ -6106,7 +6342,7 @@ var imagesCommand2 = new import_commander38.Command("images").description("\uB80
|
|
|
6106
6342
|
|
|
6107
6343
|
// src/commands/ncr/tags.ts
|
|
6108
6344
|
var import_commander39 = require("commander");
|
|
6109
|
-
var tagsCommand = new import_commander39.Command("tags").description("\uD2B9\uC815 \uC774\uBBF8\uC9C0\uC758 \uD0DC\uADF8 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<registry>", "\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uC774\uB984").argument("<repository>", "\uC774\uBBF8\uC9C0(repository) \uC774\uB984 (\uC9E7\uC740 \uC774\uB984 \uB610\uB294 {project}/{repo})").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--
|
|
6345
|
+
var tagsCommand = new import_commander39.Command("tags").description("\uD2B9\uC815 \uC774\uBBF8\uC9C0\uC758 \uD0DC\uADF8 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<registry>", "\uB808\uC9C0\uC2A4\uD2B8\uB9AC \uC774\uB984").argument("<repository>", "\uC774\uBBF8\uC9C0(repository) \uC774\uB984 (\uC9E7\uC740 \uC774\uB984 \uB610\uB294 {project}/{repo})").option("--region <region>", "NCR region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (registry, repository, _opts, cmd) => {
|
|
6110
6346
|
const opts = cmd.optsWithGlobals();
|
|
6111
6347
|
if (!registry.trim()) {
|
|
6112
6348
|
throw new NhnCloudCliError(
|
|
@@ -6208,7 +6444,7 @@ var import_commander41 = require("commander");
|
|
|
6208
6444
|
var import_promises6 = require("fs/promises");
|
|
6209
6445
|
|
|
6210
6446
|
// src/services/nks/client.ts
|
|
6211
|
-
var
|
|
6447
|
+
var import_ky13 = __toESM(require("ky"));
|
|
6212
6448
|
|
|
6213
6449
|
// src/services/nks/types.ts
|
|
6214
6450
|
function isNksClusterSummary(val) {
|
|
@@ -6266,6 +6502,11 @@ function isBooleanLike(val) {
|
|
|
6266
6502
|
function isNksUuidResponse(val) {
|
|
6267
6503
|
return isPlainObject(val) && typeof val["uuid"] === "string";
|
|
6268
6504
|
}
|
|
6505
|
+
function isNksClusterEvent(val) {
|
|
6506
|
+
if (!isPlainObject(val)) return false;
|
|
6507
|
+
if ("header" in val || "body" in val) return false;
|
|
6508
|
+
return typeof val["id"] === "number" && typeof val["uuid"] === "string";
|
|
6509
|
+
}
|
|
6269
6510
|
|
|
6270
6511
|
// src/services/nks/client.ts
|
|
6271
6512
|
function isArrayFieldResponse(key, val, itemGuard) {
|
|
@@ -6276,8 +6517,8 @@ function isArrayFieldResponse(key, val, itemGuard) {
|
|
|
6276
6517
|
function isClustersResponse(val) {
|
|
6277
6518
|
return isArrayFieldResponse("clusters", val, isNksClusterSummary);
|
|
6278
6519
|
}
|
|
6279
|
-
function
|
|
6280
|
-
return isArrayFieldResponse(
|
|
6520
|
+
function isClusterEventsResponse(val) {
|
|
6521
|
+
return isArrayFieldResponse("events", val, isNksClusterEvent);
|
|
6281
6522
|
}
|
|
6282
6523
|
function isConfigResponse(val) {
|
|
6283
6524
|
if (typeof val !== "object" || val === null) return false;
|
|
@@ -6310,7 +6551,7 @@ var NksClient = class {
|
|
|
6310
6551
|
async supports() {
|
|
6311
6552
|
const url = `${this.nksEndpoint}/supports`;
|
|
6312
6553
|
try {
|
|
6313
|
-
const raw = await
|
|
6554
|
+
const raw = await import_ky13.default.get(url, {
|
|
6314
6555
|
headers: this.authHeaders(),
|
|
6315
6556
|
retry: 0,
|
|
6316
6557
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -6330,7 +6571,7 @@ var NksClient = class {
|
|
|
6330
6571
|
async listClusters() {
|
|
6331
6572
|
const url = `${this.nksEndpoint}/clusters`;
|
|
6332
6573
|
try {
|
|
6333
|
-
const raw = await
|
|
6574
|
+
const raw = await import_ky13.default.get(url, {
|
|
6334
6575
|
headers: this.authHeaders(),
|
|
6335
6576
|
retry: 0,
|
|
6336
6577
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -6405,18 +6646,29 @@ var NksClient = class {
|
|
|
6405
6646
|
"nks cluster set-control-plane-log \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 uuid \uD544\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
6406
6647
|
);
|
|
6407
6648
|
}
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6649
|
+
/** 이벤트 엔드포인트는 클러스터 이름을 받지 않는다. 반드시 UUID 를 넘긴다. */
|
|
6650
|
+
async listClusterEvents(clusterUuid) {
|
|
6651
|
+
const raw = await this.getJson(`/clusters/${encodeURIComponent(clusterUuid)}/events`);
|
|
6652
|
+
if (!isClusterEventsResponse(raw)) {
|
|
6653
|
+
throw new NhnCloudCliError(
|
|
6654
|
+
"nks cluster events \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 events \uBC30\uC5F4\uC774 \uC5C6\uAC70\uB098 \uD56D\uBAA9\uC5D0 id / uuid \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
6655
|
+
EXIT_API_ERROR
|
|
6656
|
+
);
|
|
6657
|
+
}
|
|
6658
|
+
return raw.events;
|
|
6414
6659
|
}
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6660
|
+
/** event 는 정수 `id` 가 아니라 `uuid` 로 조회한다. `id` 를 넘기면 서버가 400 을 준다. */
|
|
6661
|
+
async getClusterEvent(clusterUuid, eventUuid) {
|
|
6662
|
+
const raw = await this.getJson(
|
|
6663
|
+
`/clusters/${encodeURIComponent(clusterUuid)}/events/${encodeURIComponent(eventUuid)}`
|
|
6419
6664
|
);
|
|
6665
|
+
if (!isNksClusterEvent(raw)) {
|
|
6666
|
+
throw new NhnCloudCliError(
|
|
6667
|
+
"nks cluster event \uC751\uB2F5 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 \u2014 id / uuid \uAC00 \uC788\uB294 event \uAC1D\uCCB4\uAC00 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
6668
|
+
EXIT_API_ERROR
|
|
6669
|
+
);
|
|
6670
|
+
}
|
|
6671
|
+
return raw;
|
|
6420
6672
|
}
|
|
6421
6673
|
async getClusterKubeconfig(cluster) {
|
|
6422
6674
|
const raw = await this.getJson(`/clusters/${encodeURIComponent(cluster)}/config`);
|
|
@@ -6627,7 +6879,7 @@ var NksClient = class {
|
|
|
6627
6879
|
async removeClusterAddon(cluster, addon) {
|
|
6628
6880
|
const url = `${this.nksEndpoint}/clusters/${encodeURIComponent(cluster)}/addons/${encodeURIComponent(addon)}`;
|
|
6629
6881
|
try {
|
|
6630
|
-
const raw = await
|
|
6882
|
+
const raw = await import_ky13.default.delete(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS }).json();
|
|
6631
6883
|
if (!isNksUuidResponse(raw)) {
|
|
6632
6884
|
throw new NhnCloudCliError(
|
|
6633
6885
|
"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.",
|
|
@@ -6639,13 +6891,6 @@ var NksClient = class {
|
|
|
6639
6891
|
throw toNhnCloudCliError(err);
|
|
6640
6892
|
}
|
|
6641
6893
|
}
|
|
6642
|
-
async getNamedResourceArray(key, path5, errorMessage) {
|
|
6643
|
-
const raw = await this.getJson(path5);
|
|
6644
|
-
if (!isNamedResourceArrayResponse(key, raw)) {
|
|
6645
|
-
throw new NhnCloudCliError(errorMessage, EXIT_API_ERROR);
|
|
6646
|
-
}
|
|
6647
|
-
return raw[key];
|
|
6648
|
-
}
|
|
6649
6894
|
async getFlatNamedResource(path5, errorMessage) {
|
|
6650
6895
|
const raw = await this.getJson(path5);
|
|
6651
6896
|
if (!isNksNamedResource(raw)) {
|
|
@@ -6656,7 +6901,7 @@ var NksClient = class {
|
|
|
6656
6901
|
async getJson(path5, searchParams) {
|
|
6657
6902
|
const url = `${this.nksEndpoint}${path5}`;
|
|
6658
6903
|
try {
|
|
6659
|
-
return await
|
|
6904
|
+
return await import_ky13.default.get(url, {
|
|
6660
6905
|
headers: this.authHeaders(),
|
|
6661
6906
|
searchParams,
|
|
6662
6907
|
retry: 0,
|
|
@@ -6677,10 +6922,10 @@ var NksClient = class {
|
|
|
6677
6922
|
const url = `${this.nksEndpoint}${path5}`;
|
|
6678
6923
|
try {
|
|
6679
6924
|
if (method === "delete") {
|
|
6680
|
-
await
|
|
6925
|
+
await import_ky13.default.delete(url, { headers: this.authHeaders(), retry: 0, timeout: DEFAULT_TIMEOUT_MS });
|
|
6681
6926
|
return;
|
|
6682
6927
|
}
|
|
6683
|
-
await
|
|
6928
|
+
await import_ky13.default.post(url, { headers: this.authHeaders(), json: payload, retry: 0, timeout: DEFAULT_TIMEOUT_MS });
|
|
6684
6929
|
} catch (err) {
|
|
6685
6930
|
throw toNhnCloudCliError(err);
|
|
6686
6931
|
}
|
|
@@ -6689,7 +6934,7 @@ var NksClient = class {
|
|
|
6689
6934
|
const url = `${this.nksEndpoint}${path5}`;
|
|
6690
6935
|
try {
|
|
6691
6936
|
const options = { headers: this.authHeaders(), json: payload, retry: 0, timeout: DEFAULT_TIMEOUT_MS };
|
|
6692
|
-
return method === "post" ? await
|
|
6937
|
+
return method === "post" ? await import_ky13.default.post(url, options).json() : await import_ky13.default.patch(url, options).json();
|
|
6693
6938
|
} catch (err) {
|
|
6694
6939
|
throw toNhnCloudCliError(err);
|
|
6695
6940
|
}
|
|
@@ -6709,6 +6954,22 @@ async function resolveNksClient(opts) {
|
|
|
6709
6954
|
const { profileName, tokenId, nksEndpoint } = await resolveIaasTokenContext(opts);
|
|
6710
6955
|
return { client: new NksClient(tokenId, nksEndpoint), profileName };
|
|
6711
6956
|
}
|
|
6957
|
+
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
6958
|
+
function isUuid(value) {
|
|
6959
|
+
return UUID_PATTERN.test(value);
|
|
6960
|
+
}
|
|
6961
|
+
async function resolveClusterUuid(client, cluster) {
|
|
6962
|
+
if (isUuid(cluster)) return cluster;
|
|
6963
|
+
const detail = await client.getCluster(cluster);
|
|
6964
|
+
const uuid = detail.uuid;
|
|
6965
|
+
if (typeof uuid !== "string" || uuid === "") {
|
|
6966
|
+
throw new NhnCloudCliError(
|
|
6967
|
+
`\uD074\uB7EC\uC2A4\uD130 "${cluster}" \uC758 UUID \uB97C \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uC751\uB2F5\uC5D0 uuid \uD544\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.`,
|
|
6968
|
+
EXIT_API_ERROR
|
|
6969
|
+
);
|
|
6970
|
+
}
|
|
6971
|
+
return uuid;
|
|
6972
|
+
}
|
|
6712
6973
|
async function readJsonFile(path5) {
|
|
6713
6974
|
let raw;
|
|
6714
6975
|
try {
|
|
@@ -6776,7 +7037,7 @@ var supportsCommand = new import_commander41.Command("supports").description("NK
|
|
|
6776
7037
|
// src/commands/nks/cluster.ts
|
|
6777
7038
|
var import_promises7 = require("fs/promises");
|
|
6778
7039
|
var import_commander42 = require("commander");
|
|
6779
|
-
var
|
|
7040
|
+
var import_chalk14 = __toESM(require("chalk"));
|
|
6780
7041
|
var listCommand6 = new import_commander42.Command("list").description("NKS \uD074\uB7EC\uC2A4\uD130 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
6781
7042
|
const opts = cmd.optsWithGlobals();
|
|
6782
7043
|
const { client } = await resolveNksClient(opts);
|
|
@@ -6813,6 +7074,16 @@ function resourceRow(resource) {
|
|
|
6813
7074
|
resource.status ?? ""
|
|
6814
7075
|
];
|
|
6815
7076
|
}
|
|
7077
|
+
function eventRow(event) {
|
|
7078
|
+
return [
|
|
7079
|
+
event.uuid,
|
|
7080
|
+
String(event.id),
|
|
7081
|
+
event.type ?? "",
|
|
7082
|
+
event.state ?? "",
|
|
7083
|
+
event.resource_name ?? "",
|
|
7084
|
+
event.created_at ?? ""
|
|
7085
|
+
];
|
|
7086
|
+
}
|
|
6816
7087
|
function addonRow(addon) {
|
|
6817
7088
|
return [
|
|
6818
7089
|
addon.uuid ?? addon.id ?? addon.name,
|
|
@@ -6830,7 +7101,7 @@ function clusterIpAclRow(ipAcl) {
|
|
|
6830
7101
|
];
|
|
6831
7102
|
}
|
|
6832
7103
|
function uuidOutput(opts, result, label) {
|
|
6833
|
-
process.stderr.write(
|
|
7104
|
+
process.stderr.write(import_chalk14.default.green(`\u2713 ${label} \uC694\uCCAD \uC644\uB8CC (uuid: ${result.uuid})
|
|
6834
7105
|
`));
|
|
6835
7106
|
output(opts, {
|
|
6836
7107
|
headers: ["field", "value"],
|
|
@@ -6851,7 +7122,7 @@ async function confirmDangerousAction(message, yes) {
|
|
|
6851
7122
|
const { confirm } = await import("@inquirer/prompts");
|
|
6852
7123
|
const ok = await confirm({ message, default: false });
|
|
6853
7124
|
if (!ok) {
|
|
6854
|
-
process.stderr.write(
|
|
7125
|
+
process.stderr.write(import_chalk14.default.yellow("\uC791\uC5C5\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
6855
7126
|
}
|
|
6856
7127
|
return ok;
|
|
6857
7128
|
}
|
|
@@ -6901,7 +7172,7 @@ var deleteCommand3 = new import_commander42.Command("delete").description("NKS \
|
|
|
6901
7172
|
throw err;
|
|
6902
7173
|
}
|
|
6903
7174
|
stopSpinner(true);
|
|
6904
|
-
process.stderr.write(
|
|
7175
|
+
process.stderr.write(import_chalk14.default.green(`\u2713 NKS \uD074\uB7EC\uC2A4\uD130 "${cluster}" \uC0AD\uC81C \uC694\uCCAD \uC644\uB8CC
|
|
6905
7176
|
`));
|
|
6906
7177
|
});
|
|
6907
7178
|
var resizeCommand2 = new import_commander42.Command("resize").description("NKS \uD074\uB7EC\uC2A4\uD130 \uB178\uB4DC \uADF8\uB8F9 \uD06C\uAE30\uB97C \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--nodegroup <name-or-uuid>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--node-count <n>", "\uBCC0\uACBD\uD560 \uB178\uB4DC \uC218").option("--nodes-to-remove <csv>", "\uC0AD\uC81C\uD560 \uB178\uB4DC \uC774\uB984/ID CSV").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
@@ -6909,7 +7180,7 @@ var resizeCommand2 = new import_commander42.Command("resize").description("NKS \
|
|
|
6909
7180
|
const nodeCount = parsePositiveInteger(opts.nodeCount, "--node-count");
|
|
6910
7181
|
const nodesToRemove = opts.nodesToRemove?.split(",").map((node) => node.trim()).filter(Boolean);
|
|
6911
7182
|
if (!nodesToRemove || nodesToRemove.length === 0) {
|
|
6912
|
-
process.stderr.write(
|
|
7183
|
+
process.stderr.write(import_chalk14.default.yellow("\uC8FC\uC758: --nodes-to-remove \uAC00 \uC5C6\uC73C\uBA74 \uAC10\uCD95 \uC2DC API\uAC00 \uC0AD\uC81C \uB178\uB4DC\uB97C \uC120\uD0DD\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n"));
|
|
6913
7184
|
}
|
|
6914
7185
|
const { client } = await resolveNksClient(opts);
|
|
6915
7186
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 resize \uC694\uCCAD \uC911...");
|
|
@@ -7015,36 +7286,48 @@ var eventsCommand = new import_commander42.Command("events").description("NKS \u
|
|
|
7015
7286
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC791\uC5C5 \uC774\uB825 \uC870\uD68C \uC911...");
|
|
7016
7287
|
let events;
|
|
7017
7288
|
try {
|
|
7018
|
-
|
|
7289
|
+
const clusterUuid = await resolveClusterUuid(client, cluster);
|
|
7290
|
+
events = await client.listClusterEvents(clusterUuid);
|
|
7019
7291
|
} catch (err) {
|
|
7020
7292
|
stopSpinner(false);
|
|
7021
7293
|
throw err;
|
|
7022
7294
|
}
|
|
7023
7295
|
stopSpinner(true);
|
|
7024
7296
|
output(opts, {
|
|
7025
|
-
headers: ["id", "
|
|
7026
|
-
rows: events.map(
|
|
7297
|
+
headers: ["uuid", "id", "type", "state", "resource_name", "created_at"],
|
|
7298
|
+
rows: events.map(eventRow),
|
|
7027
7299
|
raw: events,
|
|
7028
|
-
|
|
7300
|
+
// 단건 조회가 uuid 로만 되므로 --quiet 식별자도 uuid 를 쓴다.
|
|
7301
|
+
ids: events.map((event) => event.uuid)
|
|
7029
7302
|
});
|
|
7030
7303
|
});
|
|
7031
|
-
var eventCommand = new import_commander42.Command("event").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC791\uC5C5 \uC774\uB825 \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<event>", "\uC791\uC5C5 \uC774\uB825 UUID \
|
|
7304
|
+
var eventCommand = new import_commander42.Command("event").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC791\uC5C5 \uC774\uB825 \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<event>", "\uC791\uC5C5 \uC774\uB825 UUID (\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) => {
|
|
7032
7305
|
const opts = cmd.optsWithGlobals();
|
|
7306
|
+
if (!isUuid(event)) {
|
|
7307
|
+
throw new NhnCloudCliError(
|
|
7308
|
+
`\uC791\uC5C5 \uC774\uB825\uC740 UUID \uB85C \uC870\uD68C\uD55C\uB2E4. events \uCD9C\uB825\uC758 uuid \uC5F4 \uAC12\uC744 \uB118\uAE34\uB2E4 (\uC785\uB825: ${JSON.stringify(event)}).`,
|
|
7309
|
+
EXIT_PARAM_ERROR
|
|
7310
|
+
);
|
|
7311
|
+
}
|
|
7033
7312
|
const { client } = await resolveNksClient(opts);
|
|
7034
7313
|
startSpinner("NKS \uD074\uB7EC\uC2A4\uD130 \uC791\uC5C5 \uC774\uB825 \uC870\uD68C \uC911...");
|
|
7035
7314
|
let result;
|
|
7036
7315
|
try {
|
|
7037
|
-
|
|
7316
|
+
const clusterUuid = await resolveClusterUuid(client, cluster);
|
|
7317
|
+
result = await client.getClusterEvent(clusterUuid, event);
|
|
7038
7318
|
} catch (err) {
|
|
7039
7319
|
stopSpinner(false);
|
|
7040
7320
|
throw err;
|
|
7041
7321
|
}
|
|
7042
7322
|
stopSpinner(true);
|
|
7043
7323
|
output(opts, {
|
|
7044
|
-
headers: ["
|
|
7045
|
-
rows:
|
|
7324
|
+
headers: ["field", "value"],
|
|
7325
|
+
rows: Object.entries(result).map(([key, value]) => [
|
|
7326
|
+
key,
|
|
7327
|
+
truncate(typeof value === "object" && value !== null ? JSON.stringify(value) : String(value), 80)
|
|
7328
|
+
]),
|
|
7046
7329
|
raw: result,
|
|
7047
|
-
ids: [
|
|
7330
|
+
ids: [result.uuid]
|
|
7048
7331
|
});
|
|
7049
7332
|
});
|
|
7050
7333
|
var kubeconfigCommand = new import_commander42.Command("kubeconfig").description("NKS \uD074\uB7EC\uC2A4\uD130 kubeconfig \uB97C \uCD9C\uB825\uD558\uAC70\uB098 \uC800\uC7A5\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").option("--output <file>", "kubeconfig \uC800\uC7A5 \uACBD\uB85C").option("--force", "\uAE30\uC874 \uD30C\uC77C \uB36E\uC5B4\uC4F0\uAE30").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
@@ -7061,7 +7344,7 @@ var kubeconfigCommand = new import_commander42.Command("kubeconfig").description
|
|
|
7061
7344
|
stopSpinner(true);
|
|
7062
7345
|
if (opts.output) {
|
|
7063
7346
|
await writeKubeconfigFile(opts.output, kubeconfig, opts.force);
|
|
7064
|
-
process.stderr.write(
|
|
7347
|
+
process.stderr.write(import_chalk14.default.green(`\u2713 kubeconfig \uB97C \uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4: ${opts.output}
|
|
7065
7348
|
`));
|
|
7066
7349
|
return;
|
|
7067
7350
|
}
|
|
@@ -7133,7 +7416,7 @@ function parseResolveConflicts(value) {
|
|
|
7133
7416
|
EXIT_PARAM_ERROR
|
|
7134
7417
|
);
|
|
7135
7418
|
}
|
|
7136
|
-
var clusterAddonInstallCommand = new import_commander42.Command("install").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628\uC744 \uC124\uCE58\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--name <name>", "\uC560\uB4DC\uC628 \uC774\uB984").requiredOption("--version <version>", "\uC560\uB4DC\uC628 \uBC84\uC804").requiredOption("--resolve-conflicts <none|overwrite|preserve>", "\uCDA9\uB3CC \uD574\uACB0 \uC815\uCC45").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
7419
|
+
var clusterAddonInstallCommand = new import_commander42.Command("install").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628\uC744 \uC124\uCE58\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").requiredOption("--name <name>", "\uC560\uB4DC\uC628 \uC774\uB984").requiredOption("--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) => {
|
|
7137
7420
|
const opts = cmd.optsWithGlobals();
|
|
7138
7421
|
const resolveConflicts = parseResolveConflicts(opts.resolveConflicts);
|
|
7139
7422
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7142,7 +7425,7 @@ var clusterAddonInstallCommand = new import_commander42.Command("install").descr
|
|
|
7142
7425
|
try {
|
|
7143
7426
|
result = await client.installClusterAddon(cluster, {
|
|
7144
7427
|
name: opts.name,
|
|
7145
|
-
version: opts.
|
|
7428
|
+
version: opts.addonVersion,
|
|
7146
7429
|
resolveConflicts
|
|
7147
7430
|
});
|
|
7148
7431
|
} catch (err) {
|
|
@@ -7152,7 +7435,7 @@ var clusterAddonInstallCommand = new import_commander42.Command("install").descr
|
|
|
7152
7435
|
stopSpinner(true);
|
|
7153
7436
|
uuidOutput(opts, result, "\uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628 \uC124\uCE58");
|
|
7154
7437
|
});
|
|
7155
|
-
var clusterAddonUpdateCommand = new import_commander42.Command("update").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628\uC744 \uC5C5\uB370\uC774\uD2B8\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<addon>", "\uC560\uB4DC\uC628 UUID \uB610\uB294 \uC774\uB984").requiredOption("--version <version>", "\uC560\uB4DC\uC628 \uBC84\uC804").requiredOption("--resolve-conflicts <none|overwrite|preserve>", "\uCDA9\uB3CC \uD574\uACB0 \uC815\uCC45").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, addon, _opts, cmd) => {
|
|
7438
|
+
var clusterAddonUpdateCommand = new import_commander42.Command("update").description("NKS \uD074\uB7EC\uC2A4\uD130 \uC560\uB4DC\uC628\uC744 \uC5C5\uB370\uC774\uD2B8\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<addon>", "\uC560\uB4DC\uC628 UUID \uB610\uB294 \uC774\uB984").requiredOption("--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) => {
|
|
7156
7439
|
const opts = cmd.optsWithGlobals();
|
|
7157
7440
|
const resolveConflicts = parseResolveConflicts(opts.resolveConflicts);
|
|
7158
7441
|
const { client } = await resolveNksClient(opts);
|
|
@@ -7160,7 +7443,7 @@ var clusterAddonUpdateCommand = new import_commander42.Command("update").descrip
|
|
|
7160
7443
|
let result;
|
|
7161
7444
|
try {
|
|
7162
7445
|
result = await client.updateClusterAddon(cluster, addon, {
|
|
7163
|
-
version: opts.
|
|
7446
|
+
version: opts.addonVersion,
|
|
7164
7447
|
resolveConflicts
|
|
7165
7448
|
});
|
|
7166
7449
|
} catch (err) {
|
|
@@ -7191,7 +7474,7 @@ var clusterCommand = new import_commander42.Command("cluster").description("NKS
|
|
|
7191
7474
|
|
|
7192
7475
|
// src/commands/nks/nodegroup.ts
|
|
7193
7476
|
var import_commander43 = require("commander");
|
|
7194
|
-
var
|
|
7477
|
+
var import_chalk15 = __toESM(require("chalk"));
|
|
7195
7478
|
function nodeGroupRow(nodegroup) {
|
|
7196
7479
|
return [
|
|
7197
7480
|
nodegroup.uuid,
|
|
@@ -7208,7 +7491,7 @@ function rawObjectRows(resource) {
|
|
|
7208
7491
|
]);
|
|
7209
7492
|
}
|
|
7210
7493
|
function uuidOutput2(opts, result, label) {
|
|
7211
|
-
process.stderr.write(
|
|
7494
|
+
process.stderr.write(import_chalk15.default.green(`\u2713 ${label} \uC694\uCCAD \uC644\uB8CC (uuid: ${result.uuid})
|
|
7212
7495
|
`));
|
|
7213
7496
|
output(opts, {
|
|
7214
7497
|
headers: ["field", "value"],
|
|
@@ -7241,7 +7524,7 @@ async function confirmDangerousAction2(message, yes) {
|
|
|
7241
7524
|
if (!isTTY || yes) return true;
|
|
7242
7525
|
const { confirm } = await import("@inquirer/prompts");
|
|
7243
7526
|
const ok = await confirm({ message, default: false });
|
|
7244
|
-
if (!ok) process.stderr.write(
|
|
7527
|
+
if (!ok) process.stderr.write(import_chalk15.default.yellow("\uC791\uC5C5\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
7245
7528
|
return ok;
|
|
7246
7529
|
}
|
|
7247
7530
|
var listCommand7 = new import_commander43.Command("list").description("NKS \uB178\uB4DC \uADF8\uB8F9 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").option("--region <region>", "region override (\uAE30\uBCF8: iaas \uC790\uACA9\uC99D\uBA85\uC758 region)").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (cluster, _opts, cmd) => {
|
|
@@ -7310,7 +7593,7 @@ var deleteCommand4 = new import_commander43.Command("delete").description("NKS \
|
|
|
7310
7593
|
throw err;
|
|
7311
7594
|
}
|
|
7312
7595
|
stopSpinner(true);
|
|
7313
|
-
process.stderr.write(
|
|
7596
|
+
process.stderr.write(import_chalk15.default.green(`\u2713 NKS \uB178\uB4DC \uADF8\uB8F9 "${nodegroup}" \uC0AD\uC81C \uC694\uCCAD \uC644\uB8CC
|
|
7314
7597
|
`));
|
|
7315
7598
|
});
|
|
7316
7599
|
function nodeActionCommand(name) {
|
|
@@ -7379,14 +7662,14 @@ var setMetricAutoscaleCommand = new import_commander43.Command("set-metric-autos
|
|
|
7379
7662
|
stopSpinner(true);
|
|
7380
7663
|
uuidOutput2(opts, result, "metric autoscale \uBCC0\uACBD");
|
|
7381
7664
|
});
|
|
7382
|
-
var upgradeCommand = new import_commander43.Command("upgrade").description("NKS \uB178\uB4DC \uADF8\uB8F9 Kubernetes version \uC744 \uC5C5\uADF8\uB808\uC774\uB4DC\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--version <v>", "\uB300\uC0C1 Kubernetes version").option("--num-buffer-nodes <n>", "
|
|
7665
|
+
var upgradeCommand = new import_commander43.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) => {
|
|
7383
7666
|
const opts = cmd.optsWithGlobals();
|
|
7384
7667
|
const { client } = await resolveNksClient(opts);
|
|
7385
7668
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 upgrade \uC694\uCCAD \uC911...");
|
|
7386
7669
|
let result;
|
|
7387
7670
|
try {
|
|
7388
7671
|
result = await client.upgradeNodeGroup(cluster, nodegroup, {
|
|
7389
|
-
version: opts.
|
|
7672
|
+
version: opts.kubeVersion,
|
|
7390
7673
|
numBufferNodes: optionalNonNegativeInteger(opts.numBufferNodes, "--num-buffer-nodes"),
|
|
7391
7674
|
numMaxUnavailableNodes: optionalPositiveInteger(opts.numMaxUnavailableNodes, "--num-max-unavailable-nodes")
|
|
7392
7675
|
});
|
|
@@ -7412,7 +7695,7 @@ var setUserscriptCommand = new import_commander43.Command("set-userscript").desc
|
|
|
7412
7695
|
stopSpinner(true);
|
|
7413
7696
|
uuidOutput2(opts, result, "user script \uBCC0\uACBD");
|
|
7414
7697
|
});
|
|
7415
|
-
var updateFlavorCommand = new import_commander43.Command("update-flavor").description("NKS \uB178\uB4DC \uADF8\uB8F9 flavor \uB97C \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--flavor <uuid>", "\uBCC0\uACBD\uD560 flavor UUID").option("--num-buffer-nodes <n>", "
|
|
7698
|
+
var updateFlavorCommand = new import_commander43.Command("update-flavor").description("NKS \uB178\uB4DC \uADF8\uB8F9 flavor \uB97C \uBCC0\uACBD\uD55C\uB2E4").argument("<cluster>", "\uD074\uB7EC\uC2A4\uD130 UUID \uB610\uB294 \uC774\uB984").argument("<nodegroup>", "\uB178\uB4DC \uADF8\uB8F9 UUID \uB610\uB294 \uC774\uB984").requiredOption("--flavor <uuid>", "\uBCC0\uACBD\uD560 flavor UUID").option("--num-buffer-nodes <n>", "\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) => {
|
|
7416
7699
|
const opts = cmd.optsWithGlobals();
|
|
7417
7700
|
const { client } = await resolveNksClient(opts);
|
|
7418
7701
|
startSpinner("NKS \uB178\uB4DC \uADF8\uB8F9 flavor \uBCC0\uACBD \uC694\uCCAD \uC911...");
|
|
@@ -7551,11 +7834,15 @@ var addonCommand = new import_commander44.Command("addon").description("NKS \uC5
|
|
|
7551
7834
|
|
|
7552
7835
|
// src/commands/ncs/template.ts
|
|
7553
7836
|
var import_commander45 = require("commander");
|
|
7554
|
-
var
|
|
7837
|
+
var import_chalk16 = __toESM(require("chalk"));
|
|
7555
7838
|
|
|
7556
7839
|
// src/commands/ncs/helpers.ts
|
|
7557
7840
|
var import_node_fs9 = require("fs");
|
|
7558
|
-
|
|
7841
|
+
|
|
7842
|
+
// src/utils/limits.ts
|
|
7843
|
+
var MAX_JSON_INPUT_BYTES = 1e6;
|
|
7844
|
+
|
|
7845
|
+
// src/commands/ncs/helpers.ts
|
|
7559
7846
|
var NCS_RFC3339_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(Z|([+-])(\d{2}):(\d{2}))$/;
|
|
7560
7847
|
var NCS_RELATIVE_TIME_PATTERN = /^(\d+)(m|h|d)$/;
|
|
7561
7848
|
var NCS_TIME_EXAMPLES = "\uC2DC\uAC04\uB300 \uD3EC\uD568 RFC3339(\uC608: 2026-05-01T00:00:00+09:00) \uB610\uB294 \uC0C1\uB300\uC2DC\uAC04(\uC608: 30m, 1h, 2d, now)";
|
|
@@ -7652,8 +7939,7 @@ function normalizeNcsTimeRange(from, to, now) {
|
|
|
7652
7939
|
...normalizedTo === void 0 ? {} : { to: normalizedTo.value }
|
|
7653
7940
|
};
|
|
7654
7941
|
}
|
|
7655
|
-
async function resolveNcsAppKey(profileName
|
|
7656
|
-
if (appKeyOpt) return appKeyOpt;
|
|
7942
|
+
async function resolveNcsAppKey(profileName) {
|
|
7657
7943
|
let cred;
|
|
7658
7944
|
try {
|
|
7659
7945
|
cred = await getServiceCredential("ncs", profileName);
|
|
@@ -7664,7 +7950,7 @@ async function resolveNcsAppKey(profileName, appKeyOpt) {
|
|
|
7664
7950
|
}
|
|
7665
7951
|
if (!cred?.appkey) {
|
|
7666
7952
|
throw new NhnCloudCliError(
|
|
7667
|
-
"NCS appKey \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. nhncloud configure
|
|
7953
|
+
"NCS appKey \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. nhncloud configure --ncs-appkey <key> \uB97C \uC2E4\uD589\uD574 \uC124\uC815\uD558\uC138\uC694.",
|
|
7668
7954
|
EXIT_CONFIG_ERROR
|
|
7669
7955
|
);
|
|
7670
7956
|
}
|
|
@@ -7674,14 +7960,14 @@ async function resolveNcsClient(opts) {
|
|
|
7674
7960
|
const profileName = await resolveProfileName(opts.profile);
|
|
7675
7961
|
const uak = await getUserAccessKey(profileName);
|
|
7676
7962
|
const accessToken = await getAccessToken(profileName, uak.id, uak.secret);
|
|
7677
|
-
const appKey = await resolveNcsAppKey(profileName
|
|
7963
|
+
const appKey = await resolveNcsAppKey(profileName);
|
|
7678
7964
|
const region = opts.region ?? "kr1";
|
|
7679
7965
|
return { client: new NcsClient(accessToken, region, appKey), profileName };
|
|
7680
7966
|
}
|
|
7681
7967
|
function readJsonPayload(filePath) {
|
|
7682
|
-
let
|
|
7968
|
+
let stat3;
|
|
7683
7969
|
try {
|
|
7684
|
-
|
|
7970
|
+
stat3 = (0, import_node_fs9.statSync)(filePath);
|
|
7685
7971
|
} catch (err) {
|
|
7686
7972
|
const reason = err.code ?? (err instanceof Error ? err.message : String(err));
|
|
7687
7973
|
throw new NhnCloudCliError(
|
|
@@ -7689,12 +7975,12 @@ function readJsonPayload(filePath) {
|
|
|
7689
7975
|
EXIT_PARAM_ERROR
|
|
7690
7976
|
);
|
|
7691
7977
|
}
|
|
7692
|
-
if (!
|
|
7978
|
+
if (!stat3.isFile()) {
|
|
7693
7979
|
throw new NhnCloudCliError(`--file \uC774 \uC77C\uBC18 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${filePath}`, EXIT_PARAM_ERROR);
|
|
7694
7980
|
}
|
|
7695
|
-
if (
|
|
7981
|
+
if (stat3.size > MAX_JSON_INPUT_BYTES) {
|
|
7696
7982
|
throw new NhnCloudCliError(
|
|
7697
|
-
`--file \uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${
|
|
7983
|
+
`--file \uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${stat3.size} \uBC14\uC774\uD2B8). JSON spec \uD55C\uB3C4 ${MAX_JSON_INPUT_BYTES} \uBC14\uC774\uD2B8.`,
|
|
7698
7984
|
EXIT_PARAM_ERROR
|
|
7699
7985
|
);
|
|
7700
7986
|
}
|
|
@@ -7730,7 +8016,7 @@ async function confirmDestructive(message, yes) {
|
|
|
7730
8016
|
}
|
|
7731
8017
|
|
|
7732
8018
|
// src/commands/ncs/template.ts
|
|
7733
|
-
var listCommand8 = new import_commander45.Command("list").description("NCS \uC124\uACC4\uB3C4(template) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8019
|
+
var listCommand8 = new import_commander45.Command("list").description("NCS \uC124\uACC4\uB3C4(template) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--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) => {
|
|
7734
8020
|
const opts = cmd.optsWithGlobals();
|
|
7735
8021
|
const { client } = await resolveNcsClient(opts);
|
|
7736
8022
|
startSpinner("NCS \uC124\uACC4\uB3C4 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -7761,7 +8047,7 @@ var listCommand8 = new import_commander45.Command("list").description("NCS \uC12
|
|
|
7761
8047
|
ids: templates.map((t) => t.id)
|
|
7762
8048
|
});
|
|
7763
8049
|
});
|
|
7764
|
-
var getCommand6 = new import_commander45.Command("get").description("NCS \uC124\uACC4\uB3C4(template) \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "template ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8050
|
+
var getCommand6 = new import_commander45.Command("get").description("NCS \uC124\uACC4\uB3C4(template) \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "template ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7765
8051
|
const opts = cmd.optsWithGlobals();
|
|
7766
8052
|
requireNonEmpty(id, "id");
|
|
7767
8053
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -7789,7 +8075,7 @@ var getCommand6 = new import_commander45.Command("get").description("NCS \uC124\
|
|
|
7789
8075
|
ids: [template.id]
|
|
7790
8076
|
});
|
|
7791
8077
|
});
|
|
7792
|
-
var createCommand6 = new import_commander45.Command("create").description("NCS \uC124\uACC4\uB3C4(template) \uB97C \uC0DD\uC131\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC)").requiredOption("--file <path>", "template \uC0DD\uC131 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8078
|
+
var createCommand6 = new import_commander45.Command("create").description("NCS \uC124\uACC4\uB3C4(template) \uB97C \uC0DD\uC131\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC)").requiredOption("--file <path>", "template \uC0DD\uC131 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
7793
8079
|
const opts = cmd.optsWithGlobals();
|
|
7794
8080
|
const payload = readJsonPayload(opts.file);
|
|
7795
8081
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -7817,12 +8103,12 @@ var createCommand6 = new import_commander45.Command("create").description("NCS \
|
|
|
7817
8103
|
ids: [template.id]
|
|
7818
8104
|
});
|
|
7819
8105
|
});
|
|
7820
|
-
var deleteCommand5 = new import_commander45.Command("delete").description("NCS \uC124\uACC4\uB3C4(template) \uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "template ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8106
|
+
var deleteCommand5 = new import_commander45.Command("delete").description("NCS \uC124\uACC4\uB3C4(template) \uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "template ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7821
8107
|
const opts = cmd.optsWithGlobals();
|
|
7822
8108
|
requireNonEmpty(id, "id");
|
|
7823
8109
|
const ok = await confirmDestructive(`NCS \uC124\uACC4\uB3C4 "${id}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
7824
8110
|
if (!ok) {
|
|
7825
|
-
process.stderr.write(
|
|
8111
|
+
process.stderr.write(import_chalk16.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
7826
8112
|
return;
|
|
7827
8113
|
}
|
|
7828
8114
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -7834,10 +8120,10 @@ var deleteCommand5 = new import_commander45.Command("delete").description("NCS \
|
|
|
7834
8120
|
throw err;
|
|
7835
8121
|
}
|
|
7836
8122
|
stopSpinner(true);
|
|
7837
|
-
process.stderr.write(
|
|
8123
|
+
process.stderr.write(import_chalk16.default.green(`\u2713 NCS \uC124\uACC4\uB3C4 "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
7838
8124
|
`));
|
|
7839
8125
|
});
|
|
7840
|
-
var versionListCommand = new import_commander45.Command("list").description("NCS \uC124\uACC4\uB3C4(template) \uC758 \uBC84\uC804 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "template ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8126
|
+
var versionListCommand = new import_commander45.Command("list").description("NCS \uC124\uACC4\uB3C4(template) \uC758 \uBC84\uC804 \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "template ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--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) => {
|
|
7841
8127
|
const opts = cmd.optsWithGlobals();
|
|
7842
8128
|
requireNonEmpty(id, "id");
|
|
7843
8129
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -7870,7 +8156,7 @@ var versionListCommand = new import_commander45.Command("list").description("NCS
|
|
|
7870
8156
|
ids: versions.map((v) => v.id)
|
|
7871
8157
|
});
|
|
7872
8158
|
});
|
|
7873
|
-
var versionGetCommand = new import_commander45.Command("get").description("NCS \uC124\uACC4\uB3C4(template) \uBC84\uC804 \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "template ID").argument("<version>", "\uBC84\uC804 \uAC12").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8159
|
+
var versionGetCommand = new import_commander45.Command("get").description("NCS \uC124\uACC4\uB3C4(template) \uBC84\uC804 \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "template ID").argument("<version>", "\uBC84\uC804 \uAC12").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, version, _opts, cmd) => {
|
|
7874
8160
|
const opts = cmd.optsWithGlobals();
|
|
7875
8161
|
requireNonEmpty(id, "id");
|
|
7876
8162
|
requireNonEmpty(version, "version");
|
|
@@ -7891,7 +8177,7 @@ var versionGetCommand = new import_commander45.Command("get").description("NCS \
|
|
|
7891
8177
|
ids: [detail.id]
|
|
7892
8178
|
});
|
|
7893
8179
|
});
|
|
7894
|
-
var versionCreateCommand = new import_commander45.Command("create").description("NCS \uC124\uACC4\uB3C4(template) \uC758 \uC0C8 \uBC84\uC804\uC744 \uC0DD\uC131\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC, sourceVersion \uD544\uC218)").argument("<id>", "template ID").requiredOption("--file <path>", "\uBC84\uC804 \uC0DD\uC131 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C (sourceVersion \uD544\uB4DC \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8180
|
+
var versionCreateCommand = new import_commander45.Command("create").description("NCS \uC124\uACC4\uB3C4(template) \uC758 \uC0C8 \uBC84\uC804\uC744 \uC0DD\uC131\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC, sourceVersion \uD544\uC218)").argument("<id>", "template ID").requiredOption("--file <path>", "\uBC84\uC804 \uC0DD\uC131 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C (sourceVersion \uD544\uB4DC \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7895
8181
|
const opts = cmd.optsWithGlobals();
|
|
7896
8182
|
requireNonEmpty(id, "id");
|
|
7897
8183
|
const payload = readJsonPayload(opts.file);
|
|
@@ -7912,7 +8198,7 @@ var versionCreateCommand = new import_commander45.Command("create").description(
|
|
|
7912
8198
|
ids: [version.id]
|
|
7913
8199
|
});
|
|
7914
8200
|
});
|
|
7915
|
-
var versionDeleteCommand = new import_commander45.Command("delete").description("NCS \uC124\uACC4\uB3C4(template) \uBC84\uC804\uC744 \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "template ID").argument("<version>", "\uBC84\uC804 \uAC12").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8201
|
+
var versionDeleteCommand = new import_commander45.Command("delete").description("NCS \uC124\uACC4\uB3C4(template) \uBC84\uC804\uC744 \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "template ID").argument("<version>", "\uBC84\uC804 \uAC12").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, version, _opts, cmd) => {
|
|
7916
8202
|
const opts = cmd.optsWithGlobals();
|
|
7917
8203
|
requireNonEmpty(id, "id");
|
|
7918
8204
|
requireNonEmpty(version, "version");
|
|
@@ -7921,7 +8207,7 @@ var versionDeleteCommand = new import_commander45.Command("delete").description(
|
|
|
7921
8207
|
opts.yes
|
|
7922
8208
|
);
|
|
7923
8209
|
if (!ok) {
|
|
7924
|
-
process.stderr.write(
|
|
8210
|
+
process.stderr.write(import_chalk16.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
7925
8211
|
return;
|
|
7926
8212
|
}
|
|
7927
8213
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -7934,7 +8220,7 @@ var versionDeleteCommand = new import_commander45.Command("delete").description(
|
|
|
7934
8220
|
}
|
|
7935
8221
|
stopSpinner(true);
|
|
7936
8222
|
process.stderr.write(
|
|
7937
|
-
|
|
8223
|
+
import_chalk16.default.green(`\u2713 NCS \uC124\uACC4\uB3C4 "${id}" \uBC84\uC804 "${version}" \uC774 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
7938
8224
|
`)
|
|
7939
8225
|
);
|
|
7940
8226
|
});
|
|
@@ -7943,7 +8229,7 @@ var templateCommand = new import_commander45.Command("template").description("NC
|
|
|
7943
8229
|
|
|
7944
8230
|
// src/commands/ncs/workload.ts
|
|
7945
8231
|
var import_commander46 = require("commander");
|
|
7946
|
-
var
|
|
8232
|
+
var import_chalk17 = __toESM(require("chalk"));
|
|
7947
8233
|
function workloadRows(w) {
|
|
7948
8234
|
return [
|
|
7949
8235
|
[
|
|
@@ -7957,7 +8243,7 @@ function workloadRows(w) {
|
|
|
7957
8243
|
];
|
|
7958
8244
|
}
|
|
7959
8245
|
var WORKLOAD_HEADERS = ["id", "name", "type", "status", "desired", "available"];
|
|
7960
|
-
var listCommand9 = new import_commander46.Command("list").description("NCS workload(\uB7F0\uD0C0\uC784 \uC2E4\uD589) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8246
|
+
var listCommand9 = new import_commander46.Command("list").description("NCS workload(\uB7F0\uD0C0\uC784 \uC2E4\uD589) \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--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) => {
|
|
7961
8247
|
const opts = cmd.optsWithGlobals();
|
|
7962
8248
|
const { client } = await resolveNcsClient(opts);
|
|
7963
8249
|
startSpinner("NCS workload \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -7990,7 +8276,7 @@ var listCommand9 = new import_commander46.Command("list").description("NCS workl
|
|
|
7990
8276
|
ids: workloads.map((w) => w.id)
|
|
7991
8277
|
});
|
|
7992
8278
|
});
|
|
7993
|
-
var getCommand7 = new import_commander46.Command("get").description("NCS workload \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8279
|
+
var getCommand7 = new import_commander46.Command("get").description("NCS workload \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
7994
8280
|
const opts = cmd.optsWithGlobals();
|
|
7995
8281
|
requireNonEmpty(id, "id");
|
|
7996
8282
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8020,7 +8306,7 @@ var getCommand7 = new import_commander46.Command("get").description("NCS workloa
|
|
|
8020
8306
|
ids: [workload.id]
|
|
8021
8307
|
});
|
|
8022
8308
|
});
|
|
8023
|
-
var logsCommand = new import_commander46.Command("logs").description("NCS workload task \uC758 \uCEE8\uD14C\uC774\uB108 \uB85C\uADF8\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8309
|
+
var logsCommand = new import_commander46.Command("logs").description("NCS workload task \uC758 \uCEE8\uD14C\uC774\uB108 \uB85C\uADF8\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--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(
|
|
8024
8310
|
"--from <time>",
|
|
8025
8311
|
"\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"
|
|
8026
8312
|
).option(
|
|
@@ -8065,7 +8351,7 @@ var logsCommand = new import_commander46.Command("logs").description("NCS worklo
|
|
|
8065
8351
|
ids: []
|
|
8066
8352
|
});
|
|
8067
8353
|
});
|
|
8068
|
-
var eventsCommand2 = new import_commander46.Command("events").description("NCS workload task \uC758 \uC774\uBCA4\uD2B8\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8354
|
+
var eventsCommand2 = new import_commander46.Command("events").description("NCS workload task \uC758 \uC774\uBCA4\uD2B8\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--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(
|
|
8069
8355
|
"--from <time>",
|
|
8070
8356
|
"\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"
|
|
8071
8357
|
).option(
|
|
@@ -8107,7 +8393,7 @@ var eventsCommand2 = new import_commander46.Command("events").description("NCS w
|
|
|
8107
8393
|
ids: []
|
|
8108
8394
|
});
|
|
8109
8395
|
});
|
|
8110
|
-
var historyGetCommand = new import_commander46.Command("get").description("NCS workload \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").argument("<historyId>", "\uD788\uC2A4\uD1A0\uB9AC ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8396
|
+
var historyGetCommand = new import_commander46.Command("get").description("NCS workload \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC \uB2E8\uAC74\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").argument("<historyId>", "\uD788\uC2A4\uD1A0\uB9AC ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, historyId, _opts, cmd) => {
|
|
8111
8397
|
const opts = cmd.optsWithGlobals();
|
|
8112
8398
|
requireNonEmpty(id, "id");
|
|
8113
8399
|
requireNonEmpty(historyId, "historyId");
|
|
@@ -8136,7 +8422,7 @@ var historyGetCommand = new import_commander46.Command("get").description("NCS w
|
|
|
8136
8422
|
ids: [String(detail.id)]
|
|
8137
8423
|
});
|
|
8138
8424
|
});
|
|
8139
|
-
var historyCommand = new import_commander46.Command("history").description("NCS workload \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8425
|
+
var historyCommand = new import_commander46.Command("history").description("NCS workload \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC \uBAA9\uB85D\uC744 \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--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) => {
|
|
8140
8426
|
const opts = cmd.optsWithGlobals();
|
|
8141
8427
|
requireNonEmpty(id, "id");
|
|
8142
8428
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8169,7 +8455,7 @@ var historyCommand = new import_commander46.Command("history").description("NCS
|
|
|
8169
8455
|
ids: history.map((h) => String(h.id))
|
|
8170
8456
|
});
|
|
8171
8457
|
}).addCommand(historyGetCommand);
|
|
8172
|
-
var scheduleHistoryCommand = new import_commander46.Command("schedule-history").description("NCS workload \uC608\uC57D \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8458
|
+
var scheduleHistoryCommand = new import_commander46.Command("schedule-history").description("NCS workload \uC608\uC57D \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8173
8459
|
const opts = cmd.optsWithGlobals();
|
|
8174
8460
|
requireNonEmpty(id, "id");
|
|
8175
8461
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8190,7 +8476,7 @@ var scheduleHistoryCommand = new import_commander46.Command("schedule-history").
|
|
|
8190
8476
|
ids: scheduleHistory.map((s) => s.id)
|
|
8191
8477
|
});
|
|
8192
8478
|
});
|
|
8193
|
-
var createCommand7 = new import_commander46.Command("create").description("NCS workload(\uB7F0\uD0C0\uC784 \uC2E4\uD589) \uB97C \uC0DD\uC131\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC)").requiredOption("--file <path>", "workload \uC0DD\uC131 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C").option("--wait", "workload \uAC00 Running \uC0C1\uD0DC\uAC00 \uB420 \uB54C\uAE4C\uC9C0 \uB300\uAE30").option("--timeout <sec>", "wait \uD0C0\uC784\uC544\uC6C3 (\uCD08, \uAE30\uBCF8 300)", "300").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8479
|
+
var createCommand7 = new import_commander46.Command("create").description("NCS workload(\uB7F0\uD0C0\uC784 \uC2E4\uD589) \uB97C \uC0DD\uC131\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC)").requiredOption("--file <path>", "workload \uC0DD\uC131 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C").option("--wait", "workload \uAC00 Running \uC0C1\uD0DC\uAC00 \uB420 \uB54C\uAE4C\uC9C0 \uB300\uAE30").option("--timeout <sec>", "wait \uD0C0\uC784\uC544\uC6C3 (\uCD08, \uAE30\uBCF8 300)", "300").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
8194
8480
|
const opts = cmd.optsWithGlobals();
|
|
8195
8481
|
const payload = readJsonPayload(opts.file);
|
|
8196
8482
|
const timeoutMs = parsePositiveIntegerOption(opts.timeout ?? "300", "--timeout") * 1e3;
|
|
@@ -8221,7 +8507,7 @@ var createCommand7 = new import_commander46.Command("create").description("NCS w
|
|
|
8221
8507
|
ids: [workload.id]
|
|
8222
8508
|
});
|
|
8223
8509
|
});
|
|
8224
|
-
var updateCommand = new import_commander46.Command("update").description("NCS workload \uB97C \uC804\uCCB4 \uAD50\uCCB4\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC, PUT)").argument("<id>", "workload ID").requiredOption("--file <path>", "workload \uAD50\uCCB4 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8510
|
+
var updateCommand = new import_commander46.Command("update").description("NCS workload \uB97C \uC804\uCCB4 \uAD50\uCCB4\uD55C\uB2E4 (--file \uB85C JSON spec \uC804\uB2EC, PUT)").argument("<id>", "workload ID").requiredOption("--file <path>", "workload \uAD50\uCCB4 spec \uC774 \uB2F4\uAE34 JSON \uD30C\uC77C \uACBD\uB85C").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8225
8511
|
const opts = cmd.optsWithGlobals();
|
|
8226
8512
|
requireNonEmpty(id, "id");
|
|
8227
8513
|
const payload = readJsonPayload(opts.file);
|
|
@@ -8242,7 +8528,7 @@ var updateCommand = new import_commander46.Command("update").description("NCS wo
|
|
|
8242
8528
|
ids: [workload.id]
|
|
8243
8529
|
});
|
|
8244
8530
|
});
|
|
8245
|
-
var patchCommand = new import_commander46.Command("patch").description("NCS workload \uB97C \uBD80\uBD84 \uBCC0\uACBD\uD55C\uB2E4 (--file \uB85C JSON Patch \uBC30\uC5F4 \uC804\uB2EC, RFC 6902)").argument("<id>", "workload ID").requiredOption("--file <path>", "JSON Patch \uBC30\uC5F4(op/path/value)\uC774 \uB2F4\uAE34 \uD30C\uC77C \uACBD\uB85C").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8531
|
+
var patchCommand = new import_commander46.Command("patch").description("NCS workload \uB97C \uBD80\uBD84 \uBCC0\uACBD\uD55C\uB2E4 (--file \uB85C JSON Patch \uBC30\uC5F4 \uC804\uB2EC, RFC 6902)").argument("<id>", "workload ID").requiredOption("--file <path>", "JSON Patch \uBC30\uC5F4(op/path/value)\uC774 \uB2F4\uAE34 \uD30C\uC77C \uACBD\uB85C").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8246
8532
|
const opts = cmd.optsWithGlobals();
|
|
8247
8533
|
requireNonEmpty(id, "id");
|
|
8248
8534
|
const payload = readJsonPayload(opts.file);
|
|
@@ -8263,7 +8549,7 @@ var patchCommand = new import_commander46.Command("patch").description("NCS work
|
|
|
8263
8549
|
ids: [workload.id]
|
|
8264
8550
|
});
|
|
8265
8551
|
});
|
|
8266
|
-
var pauseCommand = new import_commander46.Command("pause").description("NCS workload \uB97C \uC77C\uC2DC\uC815\uC9C0\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8552
|
+
var pauseCommand = new import_commander46.Command("pause").description("NCS workload \uB97C \uC77C\uC2DC\uC815\uC9C0\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8267
8553
|
const opts = cmd.optsWithGlobals();
|
|
8268
8554
|
requireNonEmpty(id, "id");
|
|
8269
8555
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8275,10 +8561,10 @@ var pauseCommand = new import_commander46.Command("pause").description("NCS work
|
|
|
8275
8561
|
throw err;
|
|
8276
8562
|
}
|
|
8277
8563
|
stopSpinner(true);
|
|
8278
|
-
process.stderr.write(
|
|
8564
|
+
process.stderr.write(import_chalk17.default.green(`\u2713 NCS workload "${id}" \uAC00 \uC77C\uC2DC\uC815\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
8279
8565
|
`));
|
|
8280
8566
|
});
|
|
8281
|
-
var resumeCommand = new import_commander46.Command("resume").description("NCS workload \uB97C \uC7AC\uAC1C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8567
|
+
var resumeCommand = new import_commander46.Command("resume").description("NCS workload \uB97C \uC7AC\uAC1C\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8282
8568
|
const opts = cmd.optsWithGlobals();
|
|
8283
8569
|
requireNonEmpty(id, "id");
|
|
8284
8570
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8290,10 +8576,10 @@ var resumeCommand = new import_commander46.Command("resume").description("NCS wo
|
|
|
8290
8576
|
throw err;
|
|
8291
8577
|
}
|
|
8292
8578
|
stopSpinner(true);
|
|
8293
|
-
process.stderr.write(
|
|
8579
|
+
process.stderr.write(import_chalk17.default.green(`\u2713 NCS workload "${id}" \uAC00 \uC7AC\uAC1C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
8294
8580
|
`));
|
|
8295
8581
|
});
|
|
8296
|
-
var restartCommand = new import_commander46.Command("restart").description("NCS workload task \uB97C \uC7AC\uC2DC\uC791\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8582
|
+
var restartCommand = new import_commander46.Command("restart").description("NCS workload task \uB97C \uC7AC\uC2DC\uC791\uD55C\uB2E4").argument("<id>", "workload ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").option("--task <taskId>", "task ID (\uD544\uC218)").action(async (id, _opts, cmd) => {
|
|
8297
8583
|
const opts = cmd.optsWithGlobals();
|
|
8298
8584
|
requireNonEmpty(id, "id");
|
|
8299
8585
|
if (!opts.task || !opts.task.trim()) {
|
|
@@ -8312,16 +8598,16 @@ var restartCommand = new import_commander46.Command("restart").description("NCS
|
|
|
8312
8598
|
}
|
|
8313
8599
|
stopSpinner(true);
|
|
8314
8600
|
process.stderr.write(
|
|
8315
|
-
|
|
8601
|
+
import_chalk17.default.green(`\u2713 NCS workload "${id}" task "${opts.task}" \uAC00 \uC7AC\uC2DC\uC791\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
8316
8602
|
`)
|
|
8317
8603
|
);
|
|
8318
8604
|
});
|
|
8319
|
-
var deleteCommand6 = new import_commander46.Command("delete").description("NCS workload \uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "workload ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8605
|
+
var deleteCommand6 = new import_commander46.Command("delete").description("NCS workload \uB97C \uC0AD\uC81C\uD55C\uB2E4").argument("<id>", "workload ID").option("--yes", "\uD655\uC778 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 (CI/\uBE44\uB300\uD654\uD615 \uD544\uC218)").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (id, _opts, cmd) => {
|
|
8320
8606
|
const opts = cmd.optsWithGlobals();
|
|
8321
8607
|
requireNonEmpty(id, "id");
|
|
8322
8608
|
const ok = await confirmDestructive(`NCS workload "${id}" \uB97C \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?`, opts.yes);
|
|
8323
8609
|
if (!ok) {
|
|
8324
|
-
process.stderr.write(
|
|
8610
|
+
process.stderr.write(import_chalk17.default.yellow("\uC0AD\uC81C\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n"));
|
|
8325
8611
|
return;
|
|
8326
8612
|
}
|
|
8327
8613
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8333,7 +8619,7 @@ var deleteCommand6 = new import_commander46.Command("delete").description("NCS w
|
|
|
8333
8619
|
throw err;
|
|
8334
8620
|
}
|
|
8335
8621
|
stopSpinner(true);
|
|
8336
|
-
process.stderr.write(
|
|
8622
|
+
process.stderr.write(import_chalk17.default.green(`\u2713 NCS workload "${id}" \uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
8337
8623
|
`));
|
|
8338
8624
|
});
|
|
8339
8625
|
var workloadCommand = new import_commander46.Command("workload").description("NCS workload(\uB7F0\uD0C0\uC784 \uC2E4\uD589) \uAD00\uB9AC").addCommand(listCommand9).addCommand(getCommand7).addCommand(logsCommand).addCommand(eventsCommand2).addCommand(historyCommand).addCommand(scheduleHistoryCommand).addCommand(createCommand7).addCommand(updateCommand).addCommand(patchCommand).addCommand(pauseCommand).addCommand(resumeCommand).addCommand(restartCommand).addCommand(deleteCommand6);
|
|
@@ -8348,7 +8634,7 @@ function parseEnabledOption(value) {
|
|
|
8348
8634
|
EXIT_PARAM_ERROR
|
|
8349
8635
|
);
|
|
8350
8636
|
}
|
|
8351
|
-
var configGetCommand = new import_commander47.Command("get").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8637
|
+
var configGetCommand = new import_commander47.Command("get").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815\uC744 \uC870\uD68C\uD55C\uB2E4").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
8352
8638
|
const opts = cmd.optsWithGlobals();
|
|
8353
8639
|
const { client } = await resolveNcsClient(opts);
|
|
8354
8640
|
startSpinner("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815 \uC870\uD68C \uC911...");
|
|
@@ -8367,7 +8653,7 @@ var configGetCommand = new import_commander47.Command("get").description("NCS \u
|
|
|
8367
8653
|
ids: []
|
|
8368
8654
|
});
|
|
8369
8655
|
});
|
|
8370
|
-
var configSetCommand = new import_commander47.Command("set").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815\uC744 \uBCC0\uACBD\uD55C\uB2E4").requiredOption("--enabled <true|false>", "\uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC0AC\uC6A9 \uC5EC\uBD80").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8656
|
+
var configSetCommand = new import_commander47.Command("set").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815\uC744 \uBCC0\uACBD\uD55C\uB2E4").requiredOption("--enabled <true|false>", "\uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC0AC\uC6A9 \uC5EC\uBD80").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (_opts, cmd) => {
|
|
8371
8657
|
const opts = cmd.optsWithGlobals();
|
|
8372
8658
|
const enabled = parseEnabledOption(opts.enabled);
|
|
8373
8659
|
const { client } = await resolveNcsClient(opts);
|
|
@@ -8388,7 +8674,7 @@ var configSetCommand = new import_commander47.Command("set").description("NCS \u
|
|
|
8388
8674
|
});
|
|
8389
8675
|
});
|
|
8390
8676
|
var configCommand = new import_commander47.Command("config").description("NCS \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uC124\uC815 \uAD00\uB9AC").addCommand(configGetCommand).addCommand(configSetCommand);
|
|
8391
|
-
var resultCommand = new import_commander47.Command("result").description("NCS workload \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC\uC758 \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uACB0\uACFC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<workloadId>", "workload ID").argument("<historyId>", "\uD788\uC2A4\uD1A0\uB9AC ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--
|
|
8677
|
+
var resultCommand = new import_commander47.Command("result").description("NCS workload \uC2E4\uD589 \uD788\uC2A4\uD1A0\uB9AC\uC758 \uC545\uC131\uCF54\uB4DC \uAC80\uC0AC \uACB0\uACFC\uB97C \uC870\uD68C\uD55C\uB2E4").argument("<workloadId>", "workload ID").argument("<historyId>", "\uD788\uC2A4\uD1A0\uB9AC ID").option("--region <region>", "NCS region (\uAE30\uBCF8: kr1, kr1/kr3 \uB9CC \uC9C0\uC6D0)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984").action(async (workloadId, historyId, _opts, cmd) => {
|
|
8392
8678
|
const opts = cmd.optsWithGlobals();
|
|
8393
8679
|
requireNonEmpty(workloadId, "workloadId");
|
|
8394
8680
|
requireNonEmpty(historyId, "historyId");
|
|
@@ -8424,8 +8710,11 @@ var malwareCommand = new import_commander47.Command("malware").description("NCS
|
|
|
8424
8710
|
// src/commands/apigateway/service.ts
|
|
8425
8711
|
var import_commander48 = require("commander");
|
|
8426
8712
|
|
|
8713
|
+
// src/commands/apigateway/helpers.ts
|
|
8714
|
+
var import_promises8 = require("fs/promises");
|
|
8715
|
+
|
|
8427
8716
|
// src/services/apigateway/client.ts
|
|
8428
|
-
var
|
|
8717
|
+
var import_ky14 = __toESM(require("ky"));
|
|
8429
8718
|
|
|
8430
8719
|
// src/services/apigateway/types.ts
|
|
8431
8720
|
function isApiGatewayService(value) {
|
|
@@ -8438,6 +8727,19 @@ function isApiGatewayPaging(value) {
|
|
|
8438
8727
|
const obj = value;
|
|
8439
8728
|
return typeof obj["limit"] === "number" && Number.isInteger(obj["limit"]) && obj["limit"] > 0 && typeof obj["page"] === "number" && Number.isInteger(obj["page"]) && obj["page"] > 0 && typeof obj["totalCount"] === "number" && Number.isInteger(obj["totalCount"]) && obj["totalCount"] >= 0;
|
|
8440
8729
|
}
|
|
8730
|
+
var PATH_PLUGIN_TYPES = [
|
|
8731
|
+
"CORS",
|
|
8732
|
+
"SET_REQUEST_HEADER",
|
|
8733
|
+
"SET_RESPONSE_HEADER",
|
|
8734
|
+
"ADD_REQUEST_QUERY_PARAMETER"
|
|
8735
|
+
];
|
|
8736
|
+
var METHOD_PLUGIN_TYPES = [
|
|
8737
|
+
"HTTP",
|
|
8738
|
+
"MOCK",
|
|
8739
|
+
"SET_REQUEST_HEADER",
|
|
8740
|
+
"SET_RESPONSE_HEADER",
|
|
8741
|
+
"ADD_REQUEST_QUERY_PARAMETER"
|
|
8742
|
+
];
|
|
8441
8743
|
function isNullableString(value) {
|
|
8442
8744
|
return typeof value === "string" || value === null;
|
|
8443
8745
|
}
|
|
@@ -8451,6 +8753,11 @@ function isResource(value) {
|
|
|
8451
8753
|
const obj = value;
|
|
8452
8754
|
return typeof obj["resourceId"] === "string" && typeof obj["apigwServiceId"] === "string" && isNullableString(obj["parentPath"]) && typeof obj["path"] === "string" && isNullableString(obj["methodType"]) && isNullableString(obj["methodName"]) && isNullableString(obj["methodDescription"]) && typeof obj["createdAt"] === "string" && typeof obj["updatedAt"] === "string" && Array.isArray(obj["resourcePluginList"]);
|
|
8453
8755
|
}
|
|
8756
|
+
function isUpdatedResource(value) {
|
|
8757
|
+
if (typeof value !== "object" || value === null) return false;
|
|
8758
|
+
const obj = value;
|
|
8759
|
+
return typeof obj["resourceId"] === "string" && typeof obj["path"] === "string" && (obj["methodType"] === void 0 || isNullableString(obj["methodType"]));
|
|
8760
|
+
}
|
|
8454
8761
|
function isResourceParameters(value) {
|
|
8455
8762
|
if (typeof value !== "object" || value === null) return false;
|
|
8456
8763
|
const obj = value;
|
|
@@ -8461,6 +8768,8 @@ function isResourceResponses(value) {
|
|
|
8461
8768
|
const obj = value;
|
|
8462
8769
|
return Array.isArray(obj["responseList"]) && Array.isArray(obj["contentTypeList"]);
|
|
8463
8770
|
}
|
|
8771
|
+
var DEPLOY_STATUS_COMPLETE = "COMPLETE";
|
|
8772
|
+
var DEPLOY_STATUS_DEPLOYING = "DEPLOYING";
|
|
8464
8773
|
function isRecord(value) {
|
|
8465
8774
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8466
8775
|
}
|
|
@@ -8476,6 +8785,10 @@ function isStage(value) {
|
|
|
8476
8785
|
if (!isRecord(value)) return false;
|
|
8477
8786
|
return typeof value["stageId"] === "string" && typeof value["apigwServiceId"] === "string" && typeof value["regionCode"] === "string" && isNullableString(value["stageName"]) && typeof value["stageDescription"] === "string" && typeof value["stageUrl"] === "string" && typeof value["backendEndpointUrl"] === "string" && typeof value["resourceUpdatedAt"] === "string" && typeof value["createdAt"] === "string" && typeof value["updatedAt"] === "string" && typeof value["stageCustomUrl"] === "string" && Array.isArray(value["stageCustomDomainList"]) && value["stageCustomDomainList"].every(isStageCustomDomain) && Array.isArray(value["stageAliasDomainList"]) && value["stageAliasDomainList"].every(isStageAliasDomain);
|
|
8478
8787
|
}
|
|
8788
|
+
function isUpdatedStage(value) {
|
|
8789
|
+
if (!isRecord(value)) return false;
|
|
8790
|
+
return typeof value["stageId"] === "string" && isNullableString(value["stageName"]) && typeof value["stageUrl"] === "string" && typeof value["backendEndpointUrl"] === "string" && typeof value["updatedAt"] === "string";
|
|
8791
|
+
}
|
|
8479
8792
|
function isStageResourcePlugin(value) {
|
|
8480
8793
|
return isRecord(value);
|
|
8481
8794
|
}
|
|
@@ -8483,6 +8796,10 @@ function isStageResource(value) {
|
|
|
8483
8796
|
if (!isRecord(value)) return false;
|
|
8484
8797
|
return typeof value["stageResourceId"] === "string" && typeof value["path"] === "string" && isNullableString(value["methodType"]) && isNullableString(value["methodName"]) && isNullableString(value["methodDescription"]) && isNullableString(value["customBackendEndpointUrl"]) && typeof value["updatedAt"] === "string" && Array.isArray(value["stageResourcePluginList"]) && value["stageResourcePluginList"].every(isStageResourcePlugin);
|
|
8485
8798
|
}
|
|
8799
|
+
function isWrittenStageResource(value) {
|
|
8800
|
+
if (!isRecord(value)) return false;
|
|
8801
|
+
return typeof value["stageResourceId"] === "string" && typeof value["path"] === "string" && (value["methodType"] === void 0 || isNullableString(value["methodType"])) && (value["methodName"] === void 0 || isNullableString(value["methodName"])) && (value["stageResourcePluginList"] === void 0 || Array.isArray(value["stageResourcePluginList"]) && value["stageResourcePluginList"].every(isStageResourcePlugin));
|
|
8802
|
+
}
|
|
8486
8803
|
function isDeployHistory(value) {
|
|
8487
8804
|
if (!isRecord(value)) return false;
|
|
8488
8805
|
return typeof value["deployId"] === "string" && typeof value["stageId"] === "string" && typeof value["deployedAt"] === "string" && isNullableString(value["rollbackAt"]) && typeof value["deployDescription"] === "string" && typeof value["isBase"] === "boolean";
|
|
@@ -8496,6 +8813,7 @@ function isSwaggerData(value) {
|
|
|
8496
8813
|
}
|
|
8497
8814
|
|
|
8498
8815
|
// src/services/apigateway/client.ts
|
|
8816
|
+
var DEFAULT_DEPLOY_POLL_INTERVAL_MS = 3e3;
|
|
8499
8817
|
var ApiGatewayClient = class {
|
|
8500
8818
|
accessToken;
|
|
8501
8819
|
baseUrl;
|
|
@@ -8513,7 +8831,7 @@ var ApiGatewayClient = class {
|
|
|
8513
8831
|
let page = params.page ?? 1;
|
|
8514
8832
|
try {
|
|
8515
8833
|
while (true) {
|
|
8516
|
-
const response = await
|
|
8834
|
+
const response = await import_ky14.default.get(`${this.baseUrl}/services`, {
|
|
8517
8835
|
headers: this.authHeaders(),
|
|
8518
8836
|
searchParams: { page, limit },
|
|
8519
8837
|
retry: 0,
|
|
@@ -8553,7 +8871,7 @@ var ApiGatewayClient = class {
|
|
|
8553
8871
|
/** API Gateway service 한 건을 조회한다. */
|
|
8554
8872
|
async getService(apigwServiceId) {
|
|
8555
8873
|
try {
|
|
8556
|
-
const response = await
|
|
8874
|
+
const response = await import_ky14.default.get(`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}`, {
|
|
8557
8875
|
headers: this.authHeaders(),
|
|
8558
8876
|
retry: 0,
|
|
8559
8877
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -8574,7 +8892,7 @@ var ApiGatewayClient = class {
|
|
|
8574
8892
|
/** paging 없이 API Gateway resource 전체를 한 번에 조회한다. */
|
|
8575
8893
|
async listResources(apigwServiceId) {
|
|
8576
8894
|
try {
|
|
8577
|
-
const response = await
|
|
8895
|
+
const response = await import_ky14.default.get(
|
|
8578
8896
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resources`,
|
|
8579
8897
|
{
|
|
8580
8898
|
headers: this.authHeaders(),
|
|
@@ -8595,10 +8913,60 @@ var ApiGatewayClient = class {
|
|
|
8595
8913
|
throw toNhnCloudCliError(err);
|
|
8596
8914
|
}
|
|
8597
8915
|
}
|
|
8916
|
+
/** API Gateway resource 경로 플러그인을 upsert한다. */
|
|
8917
|
+
async setPathPlugins(apigwServiceId, resourceId2, pathPluginList) {
|
|
8918
|
+
try {
|
|
8919
|
+
const response = await import_ky14.default.put(
|
|
8920
|
+
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resource-paths/${encodeURIComponent(resourceId2)}`,
|
|
8921
|
+
{
|
|
8922
|
+
headers: this.authHeaders(),
|
|
8923
|
+
json: { pathPluginList },
|
|
8924
|
+
retry: 0,
|
|
8925
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
8926
|
+
}
|
|
8927
|
+
).json();
|
|
8928
|
+
unwrapHeader(response);
|
|
8929
|
+
if (!Array.isArray(response.resourceList) || !response.resourceList.every(isUpdatedResource)) {
|
|
8930
|
+
throw new NhnCloudCliError(
|
|
8931
|
+
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: resourceList \uAC00 \uC62C\uBC14\uB978 \uC218\uC815 \uC751\uB2F5 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
8932
|
+
EXIT_API_ERROR
|
|
8933
|
+
);
|
|
8934
|
+
}
|
|
8935
|
+
return response.resourceList;
|
|
8936
|
+
} catch (error) {
|
|
8937
|
+
if (error instanceof NhnCloudCliError) throw error;
|
|
8938
|
+
throw toNhnCloudCliError(error);
|
|
8939
|
+
}
|
|
8940
|
+
}
|
|
8941
|
+
/** API Gateway resource 메서드 플러그인을 upsert한다. */
|
|
8942
|
+
async setMethodPlugins(apigwServiceId, resourceId2, body) {
|
|
8943
|
+
try {
|
|
8944
|
+
const response = await import_ky14.default.put(
|
|
8945
|
+
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resource-methods/${encodeURIComponent(resourceId2)}`,
|
|
8946
|
+
{
|
|
8947
|
+
headers: this.authHeaders(),
|
|
8948
|
+
json: body,
|
|
8949
|
+
retry: 0,
|
|
8950
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
8951
|
+
}
|
|
8952
|
+
).json();
|
|
8953
|
+
unwrapHeader(response);
|
|
8954
|
+
if (!Array.isArray(response.resourceList) || !response.resourceList.every(isUpdatedResource)) {
|
|
8955
|
+
throw new NhnCloudCliError(
|
|
8956
|
+
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: resourceList \uAC00 \uC62C\uBC14\uB978 \uC218\uC815 \uC751\uB2F5 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
8957
|
+
EXIT_API_ERROR
|
|
8958
|
+
);
|
|
8959
|
+
}
|
|
8960
|
+
return response.resourceList;
|
|
8961
|
+
} catch (error) {
|
|
8962
|
+
if (error instanceof NhnCloudCliError) throw error;
|
|
8963
|
+
throw toNhnCloudCliError(error);
|
|
8964
|
+
}
|
|
8965
|
+
}
|
|
8598
8966
|
/** API Gateway resource 요청 parameter를 조회한다. */
|
|
8599
8967
|
async getResourceParameters(apigwServiceId, resourceId2) {
|
|
8600
8968
|
try {
|
|
8601
|
-
const response = await
|
|
8969
|
+
const response = await import_ky14.default.get(
|
|
8602
8970
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resources/${encodeURIComponent(resourceId2)}/parameters`,
|
|
8603
8971
|
{
|
|
8604
8972
|
headers: this.authHeaders(),
|
|
@@ -8628,7 +8996,7 @@ var ApiGatewayClient = class {
|
|
|
8628
8996
|
/** API Gateway resource 응답 정의를 조회한다. */
|
|
8629
8997
|
async getResourceResponses(apigwServiceId, resourceId2) {
|
|
8630
8998
|
try {
|
|
8631
|
-
const response = await
|
|
8999
|
+
const response = await import_ky14.default.get(
|
|
8632
9000
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/resources/${encodeURIComponent(resourceId2)}/responses`,
|
|
8633
9001
|
{
|
|
8634
9002
|
headers: this.authHeaders(),
|
|
@@ -8659,7 +9027,7 @@ var ApiGatewayClient = class {
|
|
|
8659
9027
|
let page = 1;
|
|
8660
9028
|
try {
|
|
8661
9029
|
while (true) {
|
|
8662
|
-
const response = await
|
|
9030
|
+
const response = await import_ky14.default.get(
|
|
8663
9031
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages`,
|
|
8664
9032
|
{
|
|
8665
9033
|
headers: this.authHeaders(),
|
|
@@ -8699,10 +9067,35 @@ var ApiGatewayClient = class {
|
|
|
8699
9067
|
throw toNhnCloudCliError(err);
|
|
8700
9068
|
}
|
|
8701
9069
|
}
|
|
9070
|
+
/** API Gateway stage의 backend endpoint와 설명을 수정한다. */
|
|
9071
|
+
async updateStage(apigwServiceId, stageId, body) {
|
|
9072
|
+
try {
|
|
9073
|
+
const response = await import_ky14.default.put(
|
|
9074
|
+
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}`,
|
|
9075
|
+
{
|
|
9076
|
+
headers: this.authHeaders(),
|
|
9077
|
+
json: body,
|
|
9078
|
+
retry: 0,
|
|
9079
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
9080
|
+
}
|
|
9081
|
+
).json();
|
|
9082
|
+
unwrapHeader(response);
|
|
9083
|
+
if (!isUpdatedStage(response.stage)) {
|
|
9084
|
+
throw new NhnCloudCliError(
|
|
9085
|
+
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: stage \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uC62C\uBC14\uB978 \uC218\uC815 \uC751\uB2F5\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
9086
|
+
EXIT_API_ERROR
|
|
9087
|
+
);
|
|
9088
|
+
}
|
|
9089
|
+
return response.stage;
|
|
9090
|
+
} catch (error) {
|
|
9091
|
+
if (error instanceof NhnCloudCliError) throw error;
|
|
9092
|
+
throw toNhnCloudCliError(error);
|
|
9093
|
+
}
|
|
9094
|
+
}
|
|
8702
9095
|
/** 사용자 정의 Swagger 객체를 내부 해석 없이 반환한다. */
|
|
8703
9096
|
async getStageSwagger(apigwServiceId, stageId) {
|
|
8704
9097
|
try {
|
|
8705
|
-
const response = await
|
|
9098
|
+
const response = await import_ky14.default.get(
|
|
8706
9099
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/swagger`,
|
|
8707
9100
|
{
|
|
8708
9101
|
headers: this.authHeaders(),
|
|
@@ -8726,7 +9119,7 @@ var ApiGatewayClient = class {
|
|
|
8726
9119
|
/** paging 없이 배포된 API Gateway stage resource 전체를 한 번에 조회한다. */
|
|
8727
9120
|
async listStageResources(apigwServiceId, stageId) {
|
|
8728
9121
|
try {
|
|
8729
|
-
const response = await
|
|
9122
|
+
const response = await import_ky14.default.get(
|
|
8730
9123
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/resources`,
|
|
8731
9124
|
{
|
|
8732
9125
|
headers: this.authHeaders(),
|
|
@@ -8747,57 +9140,124 @@ var ApiGatewayClient = class {
|
|
|
8747
9140
|
throw toNhnCloudCliError(err);
|
|
8748
9141
|
}
|
|
8749
9142
|
}
|
|
8750
|
-
/**
|
|
8751
|
-
async
|
|
8752
|
-
const deploys = [];
|
|
8753
|
-
const limit = 1e3;
|
|
8754
|
-
let page = 1;
|
|
9143
|
+
/** API Gateway service resource를 stage에 반영한다. */
|
|
9144
|
+
async importStageResources(apigwServiceId, stageId) {
|
|
8755
9145
|
try {
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
retry: 0,
|
|
8763
|
-
timeout: DEFAULT_TIMEOUT_MS
|
|
8764
|
-
}
|
|
8765
|
-
).json();
|
|
8766
|
-
unwrapHeader(response);
|
|
8767
|
-
if (!Array.isArray(response.stageDeployHistoryList) || !response.stageDeployHistoryList.every(isDeployHistory)) {
|
|
8768
|
-
throw new NhnCloudCliError(
|
|
8769
|
-
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: stageDeployHistoryList \uAC00 \uC62C\uBC14\uB978 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
8770
|
-
EXIT_API_ERROR
|
|
8771
|
-
);
|
|
8772
|
-
}
|
|
8773
|
-
if (!isApiGatewayPaging(response.paging)) {
|
|
8774
|
-
throw new NhnCloudCliError(
|
|
8775
|
-
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: paging \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
8776
|
-
EXIT_API_ERROR
|
|
8777
|
-
);
|
|
8778
|
-
}
|
|
8779
|
-
deploys.push(...response.stageDeployHistoryList);
|
|
8780
|
-
if (response.paging.page * response.paging.limit >= response.paging.totalCount) {
|
|
8781
|
-
break;
|
|
8782
|
-
}
|
|
8783
|
-
if (response.stageDeployHistoryList.length === 0) {
|
|
8784
|
-
throw new NhnCloudCliError(
|
|
8785
|
-
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: paging.totalCount \uC804\uC5D0 \uBE48 deploy \uD398\uC774\uC9C0\uAC00 \uBC18\uD658\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
|
|
8786
|
-
EXIT_API_ERROR
|
|
8787
|
-
);
|
|
9146
|
+
const response = await import_ky14.default.put(
|
|
9147
|
+
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/resources`,
|
|
9148
|
+
{
|
|
9149
|
+
headers: this.authHeaders(),
|
|
9150
|
+
retry: 0,
|
|
9151
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
8788
9152
|
}
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
9153
|
+
).json();
|
|
9154
|
+
unwrapHeader(response);
|
|
9155
|
+
if (!Array.isArray(response.stageResourceList) || !response.stageResourceList.every(isWrittenStageResource)) {
|
|
9156
|
+
throw new NhnCloudCliError(
|
|
9157
|
+
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: stageResourceList \uAC00 \uC62C\uBC14\uB978 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
9158
|
+
EXIT_API_ERROR
|
|
9159
|
+
);
|
|
9160
|
+
}
|
|
9161
|
+
return response.stageResourceList;
|
|
9162
|
+
} catch (err) {
|
|
9163
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
9164
|
+
throw toNhnCloudCliError(err);
|
|
9165
|
+
}
|
|
9166
|
+
}
|
|
9167
|
+
/** API Gateway stage 배포를 요청한다. */
|
|
9168
|
+
async createDeploy(apigwServiceId, stageId, body) {
|
|
9169
|
+
const json = body.deployDescription === void 0 ? {} : { deployDescription: body.deployDescription };
|
|
9170
|
+
try {
|
|
9171
|
+
const response = await import_ky14.default.post(
|
|
9172
|
+
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/deploys`,
|
|
9173
|
+
{
|
|
9174
|
+
headers: this.authHeaders(),
|
|
9175
|
+
json,
|
|
9176
|
+
retry: 0,
|
|
9177
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
9178
|
+
}
|
|
9179
|
+
).json();
|
|
9180
|
+
unwrapHeader(response);
|
|
9181
|
+
} catch (err) {
|
|
9182
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
9183
|
+
throw toNhnCloudCliError(err);
|
|
9184
|
+
}
|
|
9185
|
+
}
|
|
9186
|
+
/** 배포 이력의 설정으로 API Gateway stage를 롤백한다. */
|
|
9187
|
+
async rollbackDeploy(apigwServiceId, stageId, deployId) {
|
|
9188
|
+
try {
|
|
9189
|
+
const response = await import_ky14.default.post(
|
|
9190
|
+
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/deploys/${encodeURIComponent(deployId)}/rollback`,
|
|
9191
|
+
{
|
|
9192
|
+
headers: this.authHeaders(),
|
|
9193
|
+
retry: 0,
|
|
9194
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
9195
|
+
}
|
|
9196
|
+
).json();
|
|
9197
|
+
unwrapHeader(response);
|
|
9198
|
+
if (!Array.isArray(response.stageResourceList) || !response.stageResourceList.every(isWrittenStageResource)) {
|
|
9199
|
+
throw new NhnCloudCliError(
|
|
9200
|
+
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: stageResourceList \uAC00 \uC62C\uBC14\uB978 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
9201
|
+
EXIT_API_ERROR
|
|
9202
|
+
);
|
|
9203
|
+
}
|
|
9204
|
+
return response.stageResourceList;
|
|
9205
|
+
} catch (err) {
|
|
9206
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
9207
|
+
throw toNhnCloudCliError(err);
|
|
9208
|
+
}
|
|
9209
|
+
}
|
|
9210
|
+
/** paging.totalCount 를 기준으로 API Gateway stage 배포 이력 전체를 수집한다. */
|
|
9211
|
+
async listDeploys(apigwServiceId, stageId) {
|
|
9212
|
+
const deploys = [];
|
|
9213
|
+
const limit = 1e3;
|
|
9214
|
+
let page = 1;
|
|
9215
|
+
try {
|
|
9216
|
+
while (true) {
|
|
9217
|
+
const response = await import_ky14.default.get(
|
|
9218
|
+
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/deploys`,
|
|
9219
|
+
{
|
|
9220
|
+
headers: this.authHeaders(),
|
|
9221
|
+
searchParams: { page, limit },
|
|
9222
|
+
retry: 0,
|
|
9223
|
+
timeout: DEFAULT_TIMEOUT_MS
|
|
9224
|
+
}
|
|
9225
|
+
).json();
|
|
9226
|
+
unwrapHeader(response);
|
|
9227
|
+
if (!Array.isArray(response.stageDeployHistoryList) || !response.stageDeployHistoryList.every(isDeployHistory)) {
|
|
9228
|
+
throw new NhnCloudCliError(
|
|
9229
|
+
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: stageDeployHistoryList \uAC00 \uC62C\uBC14\uB978 \uBC30\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4.",
|
|
9230
|
+
EXIT_API_ERROR
|
|
9231
|
+
);
|
|
9232
|
+
}
|
|
9233
|
+
if (!isApiGatewayPaging(response.paging)) {
|
|
9234
|
+
throw new NhnCloudCliError(
|
|
9235
|
+
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: paging \uD544\uB4DC\uAC00 \uC5C6\uAC70\uB098 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
9236
|
+
EXIT_API_ERROR
|
|
9237
|
+
);
|
|
9238
|
+
}
|
|
9239
|
+
deploys.push(...response.stageDeployHistoryList);
|
|
9240
|
+
if (response.paging.page * response.paging.limit >= response.paging.totalCount) {
|
|
9241
|
+
break;
|
|
9242
|
+
}
|
|
9243
|
+
if (response.stageDeployHistoryList.length === 0) {
|
|
9244
|
+
throw new NhnCloudCliError(
|
|
9245
|
+
"API Gateway \uC751\uB2F5 \uD615\uC2DD \uC624\uB958: paging.totalCount \uC804\uC5D0 \uBE48 deploy \uD398\uC774\uC9C0\uAC00 \uBC18\uD658\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
|
|
9246
|
+
EXIT_API_ERROR
|
|
9247
|
+
);
|
|
9248
|
+
}
|
|
9249
|
+
page = response.paging.page + 1;
|
|
9250
|
+
}
|
|
9251
|
+
return deploys;
|
|
9252
|
+
} catch (err) {
|
|
9253
|
+
if (err instanceof NhnCloudCliError) throw err;
|
|
9254
|
+
throw toNhnCloudCliError(err);
|
|
8795
9255
|
}
|
|
8796
9256
|
}
|
|
8797
9257
|
/** API Gateway stage 최신 배포 결과를 조회한다. */
|
|
8798
9258
|
async getLatestDeploy(apigwServiceId, stageId) {
|
|
8799
9259
|
try {
|
|
8800
|
-
const response = await
|
|
9260
|
+
const response = await import_ky14.default.get(
|
|
8801
9261
|
`${this.baseUrl}/services/${encodeURIComponent(apigwServiceId)}/stages/${encodeURIComponent(stageId)}/deploys/latest`,
|
|
8802
9262
|
{
|
|
8803
9263
|
headers: this.authHeaders(),
|
|
@@ -8818,14 +9278,118 @@ var ApiGatewayClient = class {
|
|
|
8818
9278
|
throw toNhnCloudCliError(err);
|
|
8819
9279
|
}
|
|
8820
9280
|
}
|
|
9281
|
+
/** 직전 배포 ID와 상태를 비교해 이번 stage 배포가 종료될 때까지 대기한다. */
|
|
9282
|
+
async waitForDeploy(apigwServiceId, stageId, opts) {
|
|
9283
|
+
const intervalMs = opts.intervalMs ?? DEFAULT_DEPLOY_POLL_INTERVAL_MS;
|
|
9284
|
+
const deadline = Date.now() + opts.timeoutMs;
|
|
9285
|
+
let lastDeploy = null;
|
|
9286
|
+
while (Date.now() < deadline) {
|
|
9287
|
+
const deploy = await this.getLatestDeploy(apigwServiceId, stageId);
|
|
9288
|
+
lastDeploy = deploy;
|
|
9289
|
+
const isNewDeploy = opts.baselineDeployId === null || deploy.deployId !== opts.baselineDeployId;
|
|
9290
|
+
if (isNewDeploy && deploy.deployStatus !== DEPLOY_STATUS_DEPLOYING) {
|
|
9291
|
+
return deploy;
|
|
9292
|
+
}
|
|
9293
|
+
const remaining = deadline - Date.now();
|
|
9294
|
+
if (remaining <= 0) break;
|
|
9295
|
+
await new Promise(
|
|
9296
|
+
(resolve) => setTimeout(resolve, Math.min(intervalMs, remaining))
|
|
9297
|
+
);
|
|
9298
|
+
}
|
|
9299
|
+
const lastDeploySummary = lastDeploy ? `\uB9C8\uC9C0\uB9C9 \uC0C1\uD0DC: ${lastDeploy.deployStatus}, \uB9C8\uC9C0\uB9C9 \uBC30\uD3EC ID: ${lastDeploy.deployId}` : "\uB9C8\uC9C0\uB9C9 \uC870\uD68C \uC5C6\uC74C";
|
|
9300
|
+
const baselineDeployId = opts.baselineDeployId ?? "\uC5C6\uC74C";
|
|
9301
|
+
throw new NhnCloudCliError(
|
|
9302
|
+
`API Gateway stage \uBC30\uD3EC\uAC00 \uC644\uB8CC\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4 (${lastDeploySummary}, \uAE30\uC900 \uBC30\uD3EC ID: ${baselineDeployId}). \uB300\uAE30 \uC0C1\uD55C(${Math.round(opts.timeoutMs / 1e3)}\uCD08)\uC744 \uB118\uACBC\uC2B5\uB2C8\uB2E4. --timeout \uC73C\uB85C \uB298\uB9B4 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`,
|
|
9303
|
+
EXIT_API_ERROR
|
|
9304
|
+
);
|
|
9305
|
+
}
|
|
8821
9306
|
};
|
|
8822
9307
|
|
|
8823
9308
|
// src/commands/apigateway/helpers.ts
|
|
8824
|
-
function
|
|
8825
|
-
|
|
9309
|
+
function fileErrorReason(error) {
|
|
9310
|
+
if (typeof error === "object" && error !== null && "code" in error) {
|
|
9311
|
+
const code = error.code;
|
|
9312
|
+
if (typeof code === "string") return code;
|
|
9313
|
+
}
|
|
9314
|
+
return error instanceof Error ? error.message : String(error);
|
|
9315
|
+
}
|
|
9316
|
+
function requireYes(yes, operation) {
|
|
9317
|
+
if (!yes) {
|
|
9318
|
+
throw new NhnCloudCliError(
|
|
9319
|
+
`${operation}\uC5D0\uB294 --yes \uD50C\uB798\uADF8\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.`,
|
|
9320
|
+
EXIT_PARAM_ERROR
|
|
9321
|
+
);
|
|
9322
|
+
}
|
|
9323
|
+
return true;
|
|
9324
|
+
}
|
|
9325
|
+
async function readPluginConfigFile(path5) {
|
|
9326
|
+
let fileStat;
|
|
9327
|
+
try {
|
|
9328
|
+
fileStat = await (0, import_promises8.stat)(path5);
|
|
9329
|
+
} catch (error) {
|
|
9330
|
+
const reason = fileErrorReason(error);
|
|
9331
|
+
throw new NhnCloudCliError(
|
|
9332
|
+
`\uD50C\uB7EC\uADF8\uC778 \uC124\uC815 \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${JSON.stringify(path5)} (${JSON.stringify(reason)}).`,
|
|
9333
|
+
EXIT_PARAM_ERROR
|
|
9334
|
+
);
|
|
9335
|
+
}
|
|
9336
|
+
if (!fileStat.isFile()) {
|
|
9337
|
+
const reason = fileStat.isDirectory() ? "EISDIR" : "EINVAL";
|
|
9338
|
+
throw new NhnCloudCliError(
|
|
9339
|
+
`\uD50C\uB7EC\uADF8\uC778 \uC124\uC815 \uACBD\uB85C\uAC00 \uC77C\uBC18 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4: ${JSON.stringify(path5)} (${reason}).`,
|
|
9340
|
+
EXIT_PARAM_ERROR
|
|
9341
|
+
);
|
|
9342
|
+
}
|
|
9343
|
+
if (fileStat.size > MAX_JSON_INPUT_BYTES) {
|
|
9344
|
+
throw new NhnCloudCliError(
|
|
9345
|
+
`\uD50C\uB7EC\uADF8\uC778 \uC124\uC815 \uD30C\uC77C\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4 (${fileStat.size} \uBC14\uC774\uD2B8). \uD5C8\uC6A9 \uC0C1\uD55C\uC740 ${MAX_JSON_INPUT_BYTES} \uBC14\uC774\uD2B8\uC785\uB2C8\uB2E4.`,
|
|
9346
|
+
EXIT_PARAM_ERROR
|
|
9347
|
+
);
|
|
9348
|
+
}
|
|
9349
|
+
let raw;
|
|
9350
|
+
try {
|
|
9351
|
+
raw = await (0, import_promises8.readFile)(path5, "utf-8");
|
|
9352
|
+
} catch (error) {
|
|
9353
|
+
const reason = fileErrorReason(error);
|
|
9354
|
+
throw new NhnCloudCliError(
|
|
9355
|
+
`\uD50C\uB7EC\uADF8\uC778 \uC124\uC815 \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${JSON.stringify(path5)} (${JSON.stringify(reason)}).`,
|
|
9356
|
+
EXIT_PARAM_ERROR
|
|
9357
|
+
);
|
|
9358
|
+
}
|
|
9359
|
+
try {
|
|
9360
|
+
return JSON.parse(raw);
|
|
9361
|
+
} catch (error) {
|
|
9362
|
+
const reason = sanitizeForTerminal(
|
|
9363
|
+
error instanceof Error ? error.message : String(error)
|
|
9364
|
+
);
|
|
9365
|
+
throw new NhnCloudCliError(
|
|
9366
|
+
`\uD50C\uB7EC\uADF8\uC778 \uC124\uC815 JSON \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: ${JSON.stringify(path5)} (${reason}).`,
|
|
9367
|
+
EXIT_PARAM_ERROR
|
|
9368
|
+
);
|
|
9369
|
+
}
|
|
9370
|
+
}
|
|
9371
|
+
function collectAffectedPaths(resources, targetPath) {
|
|
9372
|
+
if (targetPath === "/") return resources;
|
|
9373
|
+
const childPrefix = `${targetPath}/`;
|
|
9374
|
+
return resources.filter(
|
|
9375
|
+
(resource) => resource.path === targetPath || resource.path.startsWith(childPrefix)
|
|
9376
|
+
);
|
|
8826
9377
|
}
|
|
8827
|
-
|
|
8828
|
-
|
|
9378
|
+
function writtenStageResourceOutput(resources) {
|
|
9379
|
+
return {
|
|
9380
|
+
headers: ["stageResourceId", "path", "methodType", "methodName", "plugins"],
|
|
9381
|
+
rows: resources.map((resource) => [
|
|
9382
|
+
sanitizeForTerminal(resource.stageResourceId),
|
|
9383
|
+
sanitizeForTerminal(resource.path),
|
|
9384
|
+
resource.methodType == null ? "-" : sanitizeForTerminal(resource.methodType),
|
|
9385
|
+
resource.methodName == null ? "-" : sanitizeForTerminal(resource.methodName),
|
|
9386
|
+
String(resource.stageResourcePluginList?.length ?? 0)
|
|
9387
|
+
]),
|
|
9388
|
+
raw: resources,
|
|
9389
|
+
ids: resources.map((resource) => sanitizeForTerminal(resource.stageResourceId))
|
|
9390
|
+
};
|
|
9391
|
+
}
|
|
9392
|
+
async function resolveApiGatewayAppKey(profileName) {
|
|
8829
9393
|
let credential;
|
|
8830
9394
|
try {
|
|
8831
9395
|
credential = await getServiceCredential("apigateway", profileName);
|
|
@@ -8836,7 +9400,7 @@ async function resolveApiGatewayAppKey(profileName, appKeyOption) {
|
|
|
8836
9400
|
}
|
|
8837
9401
|
if (!credential?.appkey) {
|
|
8838
9402
|
throw new NhnCloudCliError(
|
|
8839
|
-
"API Gateway appKey\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. nhncloud configure --apigateway-appkey <key>\uB85C \uC124\uC815\uD558\
|
|
9403
|
+
"API Gateway appKey\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. nhncloud configure --apigateway-appkey <key>\uB85C \uC124\uC815\uD558\uC138\uC694.",
|
|
8840
9404
|
EXIT_CONFIG_ERROR
|
|
8841
9405
|
);
|
|
8842
9406
|
}
|
|
@@ -8846,7 +9410,7 @@ async function resolveApiGatewayClient(opts) {
|
|
|
8846
9410
|
const profileName = await resolveProfileName(opts.profile);
|
|
8847
9411
|
const uak = await getUserAccessKey(profileName);
|
|
8848
9412
|
const accessToken = await getAccessToken(profileName, uak.id, uak.secret);
|
|
8849
|
-
const appKey = await resolveApiGatewayAppKey(profileName
|
|
9413
|
+
const appKey = await resolveApiGatewayAppKey(profileName);
|
|
8850
9414
|
return {
|
|
8851
9415
|
client: new ApiGatewayClient(accessToken, opts.region ?? "kr1", appKey),
|
|
8852
9416
|
profileName
|
|
@@ -8854,7 +9418,7 @@ async function resolveApiGatewayClient(opts) {
|
|
|
8854
9418
|
}
|
|
8855
9419
|
|
|
8856
9420
|
// src/commands/apigateway/service.ts
|
|
8857
|
-
var listCommand10 = new import_commander48.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("--
|
|
9421
|
+
var listCommand10 = new import_commander48.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) => {
|
|
8858
9422
|
const opts = command.optsWithGlobals();
|
|
8859
9423
|
const { client } = await resolveApiGatewayClient(opts);
|
|
8860
9424
|
startSpinner("API Gateway service \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
@@ -8885,7 +9449,7 @@ var listCommand10 = new import_commander48.Command("list").description("API Gate
|
|
|
8885
9449
|
ids: services.map((service) => sanitizeForTerminal(service.apigwServiceId))
|
|
8886
9450
|
});
|
|
8887
9451
|
});
|
|
8888
|
-
var getCommand8 = new import_commander48.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("--
|
|
9452
|
+
var getCommand8 = new import_commander48.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) => {
|
|
8889
9453
|
const opts = command.optsWithGlobals();
|
|
8890
9454
|
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
8891
9455
|
const displayServiceId = sanitizeForTerminal(parsedServiceId);
|
|
@@ -8923,12 +9487,85 @@ var serviceCommand = new import_commander48.Command("service").description("API
|
|
|
8923
9487
|
// src/commands/apigateway/resource.ts
|
|
8924
9488
|
var import_commander49 = require("commander");
|
|
8925
9489
|
function addApiGatewayOptions(command) {
|
|
8926
|
-
return command.option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--
|
|
9490
|
+
return command.option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984");
|
|
8927
9491
|
}
|
|
8928
9492
|
function displayUnknown(value) {
|
|
8929
9493
|
const serialized = JSON.stringify(value);
|
|
8930
9494
|
return serialized ?? String(value);
|
|
8931
9495
|
}
|
|
9496
|
+
function isRecord2(value) {
|
|
9497
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9498
|
+
}
|
|
9499
|
+
function configError(message) {
|
|
9500
|
+
throw new NhnCloudCliError(message, EXIT_PARAM_ERROR);
|
|
9501
|
+
}
|
|
9502
|
+
function parsePluginInput(value, allowedTypes, label, rejectApplyChildPath) {
|
|
9503
|
+
if (!isRecord2(value)) {
|
|
9504
|
+
return configError(`${label} \uD56D\uBAA9\uC740 JSON \uAC1D\uCCB4\uC5EC\uC57C \uD569\uB2C8\uB2E4.`);
|
|
9505
|
+
}
|
|
9506
|
+
if (typeof value["pluginType"] !== "string" || !allowedTypes.includes(value["pluginType"])) {
|
|
9507
|
+
return configError(`${label}\uC758 pluginType\uC774 \uD5C8\uC6A9\uB41C \uD0C0\uC785\uC774 \uC544\uB2D9\uB2C8\uB2E4.`);
|
|
9508
|
+
}
|
|
9509
|
+
if (rejectApplyChildPath && "applyChildPath" in value) {
|
|
9510
|
+
return configError(`${label}\uC5D0\uB294 applyChildPath\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.`);
|
|
9511
|
+
}
|
|
9512
|
+
if ("delete" in value && typeof value["delete"] !== "boolean") {
|
|
9513
|
+
return configError(`${label}\uC758 delete\uB294 boolean\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.`);
|
|
9514
|
+
}
|
|
9515
|
+
if ("applyChildPath" in value && typeof value["applyChildPath"] !== "boolean") {
|
|
9516
|
+
return configError(`${label}\uC758 applyChildPath\uB294 boolean\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.`);
|
|
9517
|
+
}
|
|
9518
|
+
if (value["delete"] !== true && value["pluginConfigJson"] === void 0) {
|
|
9519
|
+
return configError(`${label}\uC5D0\uC11C delete\uAC00 true\uAC00 \uC544\uB2C8\uBA74 pluginConfigJson\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.`);
|
|
9520
|
+
}
|
|
9521
|
+
if (value["pluginConfigJson"] !== void 0 && !isRecord2(value["pluginConfigJson"])) {
|
|
9522
|
+
return configError(`${label}\uC758 pluginConfigJson\uC740 JSON \uAC1D\uCCB4\uC5EC\uC57C \uD569\uB2C8\uB2E4.`);
|
|
9523
|
+
}
|
|
9524
|
+
return {
|
|
9525
|
+
pluginType: value["pluginType"],
|
|
9526
|
+
...isRecord2(value["pluginConfigJson"]) ? { pluginConfigJson: value["pluginConfigJson"] } : {},
|
|
9527
|
+
...typeof value["delete"] === "boolean" ? { delete: value["delete"] } : {},
|
|
9528
|
+
...typeof value["applyChildPath"] === "boolean" ? { applyChildPath: value["applyChildPath"] } : {}
|
|
9529
|
+
};
|
|
9530
|
+
}
|
|
9531
|
+
function parsePathPluginConfig(value) {
|
|
9532
|
+
if (!isRecord2(value) || !Array.isArray(value["pathPluginList"]) || value["pathPluginList"].length === 0) {
|
|
9533
|
+
return configError("\uC124\uC815 \uD30C\uC77C\uC758 pathPluginList\uB294 \uBE44\uC5B4 \uC788\uC9C0 \uC54A\uC740 \uBC30\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.");
|
|
9534
|
+
}
|
|
9535
|
+
return value["pathPluginList"].map(
|
|
9536
|
+
(item, index) => parsePluginInput(item, PATH_PLUGIN_TYPES, `pathPluginList[${index}]`, false)
|
|
9537
|
+
);
|
|
9538
|
+
}
|
|
9539
|
+
function parseMethodPluginConfig(value) {
|
|
9540
|
+
if (!isRecord2(value) || !Array.isArray(value["methodPluginList"]) || value["methodPluginList"].length === 0) {
|
|
9541
|
+
return configError("\uC124\uC815 \uD30C\uC77C\uC758 methodPluginList\uB294 \uBE44\uC5B4 \uC788\uC9C0 \uC54A\uC740 \uBC30\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.");
|
|
9542
|
+
}
|
|
9543
|
+
if (value["methodName"] !== void 0 && typeof value["methodName"] !== "string") {
|
|
9544
|
+
return configError("methodName\uC740 \uBB38\uC790\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.");
|
|
9545
|
+
}
|
|
9546
|
+
if (value["methodDescription"] !== void 0 && typeof value["methodDescription"] !== "string") {
|
|
9547
|
+
return configError("methodDescription\uC740 \uBB38\uC790\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.");
|
|
9548
|
+
}
|
|
9549
|
+
return {
|
|
9550
|
+
methodName: value["methodName"],
|
|
9551
|
+
methodDescription: value["methodDescription"],
|
|
9552
|
+
methodPluginList: value["methodPluginList"].map(
|
|
9553
|
+
(item, index) => parsePluginInput(item, METHOD_PLUGIN_TYPES, `methodPluginList[${index}]`, true)
|
|
9554
|
+
)
|
|
9555
|
+
};
|
|
9556
|
+
}
|
|
9557
|
+
function updatedResourceOutput(opts, resources) {
|
|
9558
|
+
output(opts, {
|
|
9559
|
+
headers: ["resourceId", "path", "methodType"],
|
|
9560
|
+
rows: resources.map((resource) => [
|
|
9561
|
+
sanitizeForTerminal(resource.resourceId),
|
|
9562
|
+
sanitizeForTerminal(resource.path),
|
|
9563
|
+
resource.methodType == null ? "-" : sanitizeForTerminal(resource.methodType)
|
|
9564
|
+
]),
|
|
9565
|
+
raw: resources,
|
|
9566
|
+
ids: resources.map((resource) => sanitizeForTerminal(resource.resourceId))
|
|
9567
|
+
});
|
|
9568
|
+
}
|
|
8932
9569
|
var listCommand11 = addApiGatewayOptions(
|
|
8933
9570
|
new import_commander49.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")
|
|
8934
9571
|
).action(async (serviceId, _opts, command) => {
|
|
@@ -9013,16 +9650,179 @@ var responsesCommand = addApiGatewayOptions(
|
|
|
9013
9650
|
ids: []
|
|
9014
9651
|
});
|
|
9015
9652
|
});
|
|
9016
|
-
var
|
|
9653
|
+
var setPathPluginCommand = addApiGatewayOptions(
|
|
9654
|
+
new import_commander49.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")
|
|
9655
|
+
).action(async (serviceId, resourceId2, _opts, command) => {
|
|
9656
|
+
const opts = command.optsWithGlobals();
|
|
9657
|
+
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
9658
|
+
const parsedResourceId = parseRequiredArgument(resourceId2, "resource-id");
|
|
9659
|
+
const plugins = parsePathPluginConfig(await readPluginConfigFile(opts.configFile));
|
|
9660
|
+
if (plugins.some((plugin) => plugin.pluginType === "CORS")) {
|
|
9661
|
+
process.stderr.write(
|
|
9662
|
+
"\uACBD\uACE0: CORS \uD50C\uB7EC\uADF8\uC778\uC740 \uD558\uC704\uC5D0 OPTIONS \uBA54\uC11C\uB4DC\uB97C \uC790\uB3D9 \uC0DD\uC131\uD558\uBA70 \uAE30\uC874 OPTIONS\uB97C \uC0AD\uC81C\xB7\uB300\uCCB4\uD569\uB2C8\uB2E4.\n"
|
|
9663
|
+
);
|
|
9664
|
+
}
|
|
9665
|
+
if (plugins.some((plugin) => plugin.applyChildPath === true && plugin.delete === true)) {
|
|
9666
|
+
process.stderr.write(
|
|
9667
|
+
"\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"
|
|
9668
|
+
);
|
|
9669
|
+
}
|
|
9670
|
+
if (!opts.dryRun) requireYes(opts.yes, "\uB9AC\uC18C\uC2A4 \uACBD\uB85C \uD50C\uB7EC\uADF8\uC778 \uC124\uC815");
|
|
9671
|
+
const { client } = await resolveApiGatewayClient(opts);
|
|
9672
|
+
const displayResourceId = sanitizeForTerminal(parsedResourceId);
|
|
9673
|
+
const spinnerAction = opts.dryRun ? "\uACBD\uB85C \uD50C\uB7EC\uADF8\uC778 \uC601\uD5A5 \uBC94\uC704 \uD655\uC778" : "\uACBD\uB85C \uD50C\uB7EC\uADF8\uC778 \uC124\uC815";
|
|
9674
|
+
startSpinner(`API Gateway resource "${displayResourceId}" ${spinnerAction} \uC911...`);
|
|
9675
|
+
let target;
|
|
9676
|
+
let applyChildPath;
|
|
9677
|
+
let affected;
|
|
9678
|
+
let updatedResources = [];
|
|
9679
|
+
try {
|
|
9680
|
+
const resources = await client.listResources(parsedServiceId);
|
|
9681
|
+
const matchedResource = resources.find(
|
|
9682
|
+
(resource) => resource.resourceId === parsedResourceId
|
|
9683
|
+
);
|
|
9684
|
+
if (matchedResource === void 0) {
|
|
9685
|
+
throw new NhnCloudCliError(
|
|
9686
|
+
`API Gateway resource "${displayResourceId}"\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.`,
|
|
9687
|
+
EXIT_PARAM_ERROR
|
|
9688
|
+
);
|
|
9689
|
+
}
|
|
9690
|
+
target = matchedResource;
|
|
9691
|
+
applyChildPath = plugins.some((plugin) => plugin.applyChildPath === true);
|
|
9692
|
+
affected = applyChildPath ? collectAffectedPaths(resources, target.path) : [target];
|
|
9693
|
+
if (!opts.dryRun) {
|
|
9694
|
+
updatedResources = await client.setPathPlugins(
|
|
9695
|
+
parsedServiceId,
|
|
9696
|
+
parsedResourceId,
|
|
9697
|
+
plugins
|
|
9698
|
+
);
|
|
9699
|
+
}
|
|
9700
|
+
} catch (error) {
|
|
9701
|
+
stopSpinner(false);
|
|
9702
|
+
throw error;
|
|
9703
|
+
}
|
|
9704
|
+
stopSpinner(true);
|
|
9705
|
+
if (opts.dryRun) {
|
|
9706
|
+
const appliedPluginTypes = plugins.map((plugin) => plugin.pluginType).join(",");
|
|
9707
|
+
output(opts, {
|
|
9708
|
+
headers: ["resourceId", "path", "methodType", "appliedPluginTypes"],
|
|
9709
|
+
rows: affected.map((resource) => [
|
|
9710
|
+
sanitizeForTerminal(resource.resourceId),
|
|
9711
|
+
sanitizeForTerminal(resource.path),
|
|
9712
|
+
resource.methodType === null ? "-" : sanitizeForTerminal(resource.methodType),
|
|
9713
|
+
appliedPluginTypes
|
|
9714
|
+
]),
|
|
9715
|
+
raw: { targetPath: target.path, applyChildPath, plugins, affected },
|
|
9716
|
+
ids: affected.map((resource) => sanitizeForTerminal(resource.resourceId))
|
|
9717
|
+
});
|
|
9718
|
+
if (applyChildPath) {
|
|
9719
|
+
process.stderr.write(
|
|
9720
|
+
"\uACBD\uACE0: dry-run \uC601\uD5A5 \uBC94\uC704\uB294 path \uC811\uB450 \uBE44\uAD50\uB85C \uACC4\uC0B0\uD55C \uCD94\uC815\uAC12\uC774\uBA70 \uC11C\uBC84 \uD310\uC815\uACFC \uB2E4\uB97C \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n"
|
|
9721
|
+
);
|
|
9722
|
+
}
|
|
9723
|
+
return;
|
|
9724
|
+
}
|
|
9725
|
+
updatedResourceOutput(opts, updatedResources);
|
|
9726
|
+
});
|
|
9727
|
+
var setMethodPluginCommand = addApiGatewayOptions(
|
|
9728
|
+
new import_commander49.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")
|
|
9729
|
+
).action(async (serviceId, resourceId2, _opts, command) => {
|
|
9730
|
+
const opts = command.optsWithGlobals();
|
|
9731
|
+
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
9732
|
+
const parsedResourceId = parseRequiredArgument(resourceId2, "resource-id");
|
|
9733
|
+
const config = parseMethodPluginConfig(await readPluginConfigFile(opts.configFile));
|
|
9734
|
+
if (!opts.dryRun) requireYes(opts.yes, "\uB9AC\uC18C\uC2A4 \uBA54\uC11C\uB4DC \uD50C\uB7EC\uADF8\uC778 \uC124\uC815");
|
|
9735
|
+
const { client } = await resolveApiGatewayClient(opts);
|
|
9736
|
+
const displayResourceId = sanitizeForTerminal(parsedResourceId);
|
|
9737
|
+
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";
|
|
9738
|
+
startSpinner(`API Gateway resource "${displayResourceId}" ${spinnerAction} \uC911...`);
|
|
9739
|
+
let target;
|
|
9740
|
+
let methodName;
|
|
9741
|
+
let methodDescription;
|
|
9742
|
+
let updatedResources = [];
|
|
9743
|
+
try {
|
|
9744
|
+
const resources = await client.listResources(parsedServiceId);
|
|
9745
|
+
const matchedResource = resources.find(
|
|
9746
|
+
(resource) => resource.resourceId === parsedResourceId
|
|
9747
|
+
);
|
|
9748
|
+
if (matchedResource === void 0) {
|
|
9749
|
+
throw new NhnCloudCliError(
|
|
9750
|
+
`API Gateway resource "${displayResourceId}"\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.`,
|
|
9751
|
+
EXIT_PARAM_ERROR
|
|
9752
|
+
);
|
|
9753
|
+
}
|
|
9754
|
+
target = matchedResource;
|
|
9755
|
+
if (target.methodType === null) {
|
|
9756
|
+
throw new NhnCloudCliError(
|
|
9757
|
+
"\uB300\uC0C1 resource\uB294 \uBA54\uC11C\uB4DC\uAC00 \uC544\uB2CC \uACBD\uB85C\uC785\uB2C8\uB2E4. set-path-plugin\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.",
|
|
9758
|
+
EXIT_PARAM_ERROR
|
|
9759
|
+
);
|
|
9760
|
+
}
|
|
9761
|
+
const resolvedMethodName = config.methodName ?? target.methodName;
|
|
9762
|
+
if (resolvedMethodName === null) {
|
|
9763
|
+
throw new NhnCloudCliError(
|
|
9764
|
+
"\uAE30\uC874 methodName\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. \uC124\uC815 \uD30C\uC77C\uC5D0 methodName\uC744 \uB123\uC73C\uC138\uC694.",
|
|
9765
|
+
EXIT_PARAM_ERROR
|
|
9766
|
+
);
|
|
9767
|
+
}
|
|
9768
|
+
methodName = resolvedMethodName;
|
|
9769
|
+
methodDescription = config.methodDescription ?? target.methodDescription ?? void 0;
|
|
9770
|
+
if (!opts.dryRun) {
|
|
9771
|
+
const body = {
|
|
9772
|
+
methodName,
|
|
9773
|
+
...methodDescription === void 0 ? {} : { methodDescription },
|
|
9774
|
+
methodPluginList: config.methodPluginList
|
|
9775
|
+
};
|
|
9776
|
+
updatedResources = await client.setMethodPlugins(
|
|
9777
|
+
parsedServiceId,
|
|
9778
|
+
parsedResourceId,
|
|
9779
|
+
body
|
|
9780
|
+
);
|
|
9781
|
+
}
|
|
9782
|
+
} catch (error) {
|
|
9783
|
+
stopSpinner(false);
|
|
9784
|
+
throw error;
|
|
9785
|
+
}
|
|
9786
|
+
stopSpinner(true);
|
|
9787
|
+
if (opts.dryRun) {
|
|
9788
|
+
const appliedPluginTypes = config.methodPluginList.map((plugin) => plugin.pluginType).join(",");
|
|
9789
|
+
output(opts, {
|
|
9790
|
+
headers: [
|
|
9791
|
+
"resourceId",
|
|
9792
|
+
"path",
|
|
9793
|
+
"methodType",
|
|
9794
|
+
"methodName",
|
|
9795
|
+
"appliedPluginTypes"
|
|
9796
|
+
],
|
|
9797
|
+
rows: [[
|
|
9798
|
+
sanitizeForTerminal(target.resourceId),
|
|
9799
|
+
sanitizeForTerminal(target.path),
|
|
9800
|
+
sanitizeForTerminal(target.methodType),
|
|
9801
|
+
sanitizeForTerminal(methodName),
|
|
9802
|
+
appliedPluginTypes
|
|
9803
|
+
]],
|
|
9804
|
+
raw: {
|
|
9805
|
+
target,
|
|
9806
|
+
methodName,
|
|
9807
|
+
methodDescription,
|
|
9808
|
+
plugins: config.methodPluginList
|
|
9809
|
+
},
|
|
9810
|
+
ids: [sanitizeForTerminal(target.resourceId)]
|
|
9811
|
+
});
|
|
9812
|
+
return;
|
|
9813
|
+
}
|
|
9814
|
+
updatedResourceOutput(opts, updatedResources);
|
|
9815
|
+
});
|
|
9816
|
+
var resourceCommand = new import_commander49.Command("resource").description("API Gateway resource \uC870\uD68C \uBC0F \uBCC0\uACBD \uBA85\uB839").addCommand(listCommand11).addCommand(parametersCommand).addCommand(responsesCommand).addCommand(setPathPluginCommand).addCommand(setMethodPluginCommand);
|
|
9017
9817
|
|
|
9018
9818
|
// src/commands/apigateway/stage.ts
|
|
9019
|
-
var
|
|
9819
|
+
var import_promises9 = require("fs/promises");
|
|
9020
9820
|
var import_commander51 = require("commander");
|
|
9021
9821
|
|
|
9022
9822
|
// src/commands/apigateway/deploy.ts
|
|
9023
9823
|
var import_commander50 = require("commander");
|
|
9024
9824
|
function addApiGatewayOptions2(command) {
|
|
9025
|
-
return command.option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--
|
|
9825
|
+
return command.option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984");
|
|
9026
9826
|
}
|
|
9027
9827
|
var listCommand12 = addApiGatewayOptions2(
|
|
9028
9828
|
new import_commander50.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")
|
|
@@ -9083,13 +9883,140 @@ var latestCommand = addApiGatewayOptions2(
|
|
|
9083
9883
|
ids: [sanitizeForTerminal(deploy.deployId)]
|
|
9084
9884
|
});
|
|
9085
9885
|
});
|
|
9086
|
-
var
|
|
9886
|
+
var createCommand8 = addApiGatewayOptions2(
|
|
9887
|
+
new import_commander50.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")
|
|
9888
|
+
).action(async (serviceId, stageId, _opts, command) => {
|
|
9889
|
+
const opts = command.optsWithGlobals();
|
|
9890
|
+
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
9891
|
+
const parsedStageId = parseRequiredArgument(stageId, "stage-id");
|
|
9892
|
+
if (opts.description !== void 0 && opts.description.trim().length === 0) {
|
|
9893
|
+
throw new NhnCloudCliError(
|
|
9894
|
+
"--description \uC740 \uBE44\uC5B4 \uC788\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
9895
|
+
EXIT_PARAM_ERROR
|
|
9896
|
+
);
|
|
9897
|
+
}
|
|
9898
|
+
if (opts.description !== void 0 && [...opts.description].length > 200) {
|
|
9899
|
+
throw new NhnCloudCliError(
|
|
9900
|
+
"--description \uC740 \uCD5C\uB300 200\uC790\uAE4C\uC9C0 \uC9C0\uC815\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.",
|
|
9901
|
+
EXIT_PARAM_ERROR
|
|
9902
|
+
);
|
|
9903
|
+
}
|
|
9904
|
+
const timeoutMs = parsePositiveIntegerOption(opts.timeout ?? "300", "--timeout") * 1e3;
|
|
9905
|
+
requireYes(opts.yes, "\uC2A4\uD14C\uC774\uC9C0 \uBC30\uD3EC");
|
|
9906
|
+
const displayStageId = sanitizeForTerminal(parsedStageId);
|
|
9907
|
+
const { client } = await resolveApiGatewayClient(opts);
|
|
9908
|
+
let baselineDeployId = null;
|
|
9909
|
+
let baselineLookupFailed = false;
|
|
9910
|
+
let deploy;
|
|
9911
|
+
if (opts.wait) {
|
|
9912
|
+
startSpinner("\uC9C1\uC804 \uBC30\uD3EC \uD655\uC778 \uC911...");
|
|
9913
|
+
try {
|
|
9914
|
+
const baseline = await client.getLatestDeploy(parsedServiceId, parsedStageId);
|
|
9915
|
+
baselineDeployId = baseline.deployId;
|
|
9916
|
+
stopSpinner(true);
|
|
9917
|
+
} catch {
|
|
9918
|
+
baselineLookupFailed = true;
|
|
9919
|
+
stopSpinner(false);
|
|
9920
|
+
}
|
|
9921
|
+
}
|
|
9922
|
+
if (baselineLookupFailed) {
|
|
9923
|
+
process.stderr.write("\uC548\uB0B4: \uC9C1\uC804 \uBC30\uD3EC ID \uB97C \uC77D\uC9C0 \uBABB\uD574 \uC0C1\uD0DC\uB9CC\uC73C\uB85C \uC644\uB8CC\uB97C \uD310\uC815\uD569\uB2C8\uB2E4.\n");
|
|
9924
|
+
}
|
|
9925
|
+
startSpinner(`API Gateway stage "${displayStageId}" \uBC30\uD3EC \uC911...`);
|
|
9926
|
+
let deployAccepted = false;
|
|
9927
|
+
let deployResultKnown = false;
|
|
9928
|
+
try {
|
|
9929
|
+
await client.createDeploy(parsedServiceId, parsedStageId, {
|
|
9930
|
+
deployDescription: opts.description
|
|
9931
|
+
});
|
|
9932
|
+
deployAccepted = true;
|
|
9933
|
+
if (opts.wait) {
|
|
9934
|
+
deploy = await client.waitForDeploy(parsedServiceId, parsedStageId, {
|
|
9935
|
+
timeoutMs,
|
|
9936
|
+
baselineDeployId
|
|
9937
|
+
});
|
|
9938
|
+
if (deploy.deployStatus !== DEPLOY_STATUS_COMPLETE) {
|
|
9939
|
+
deployResultKnown = true;
|
|
9940
|
+
throw new NhnCloudCliError(
|
|
9941
|
+
`API Gateway stage \uBC30\uD3EC \uC2E4\uD328: deployId=${deploy.deployId}, deployStatus=${deploy.deployStatus}`,
|
|
9942
|
+
EXIT_API_ERROR
|
|
9943
|
+
);
|
|
9944
|
+
}
|
|
9945
|
+
}
|
|
9946
|
+
} catch (error) {
|
|
9947
|
+
stopSpinner(false);
|
|
9948
|
+
if (deployAccepted && !deployResultKnown) {
|
|
9949
|
+
process.stderr.write(
|
|
9950
|
+
"\uC8FC\uC758: \uBC30\uD3EC \uC694\uCCAD\uC740 \uC774\uBBF8 \uC811\uC218\uB410\uC2B5\uB2C8\uB2E4. \uC7AC\uC2E4\uD589\uD558\uC9C0 \uB9D0\uACE0 apigateway stage deploy latest \uB85C \uACB0\uACFC\uB97C \uD655\uC778\uD558\uC138\uC694.\n"
|
|
9951
|
+
);
|
|
9952
|
+
}
|
|
9953
|
+
throw error;
|
|
9954
|
+
}
|
|
9955
|
+
stopSpinner(true);
|
|
9956
|
+
if (!opts.wait) {
|
|
9957
|
+
if (opts.json) {
|
|
9958
|
+
printJson({ requested: true });
|
|
9959
|
+
} else if (!opts.quiet) {
|
|
9960
|
+
process.stderr.write(
|
|
9961
|
+
"\uC548\uB0B4: \uBC30\uD3EC\uB97C \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4. \uACB0\uACFC\uB294 apigateway stage deploy latest \uB85C \uD655\uC778\uD558\uC138\uC694.\n"
|
|
9962
|
+
);
|
|
9963
|
+
}
|
|
9964
|
+
return;
|
|
9965
|
+
}
|
|
9966
|
+
if (deploy === void 0) {
|
|
9967
|
+
throw new NhnCloudCliError(
|
|
9968
|
+
"API Gateway stage \uBC30\uD3EC \uACB0\uACFC\uB97C \uD655\uC778\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
9969
|
+
EXIT_API_ERROR
|
|
9970
|
+
);
|
|
9971
|
+
}
|
|
9972
|
+
output(opts, {
|
|
9973
|
+
headers: ["deployId", "deployStatus", "deployedAt", "deployDescription"],
|
|
9974
|
+
rows: [[
|
|
9975
|
+
sanitizeForTerminal(deploy.deployId),
|
|
9976
|
+
sanitizeForTerminal(deploy.deployStatus),
|
|
9977
|
+
sanitizeForTerminal(deploy.deployedAt),
|
|
9978
|
+
sanitizeForTerminal(deploy.deployDescription)
|
|
9979
|
+
]],
|
|
9980
|
+
raw: deploy,
|
|
9981
|
+
ids: [sanitizeForTerminal(deploy.deployId)]
|
|
9982
|
+
});
|
|
9983
|
+
});
|
|
9984
|
+
var rollbackCommand = addApiGatewayOptions2(
|
|
9985
|
+
new import_commander50.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")
|
|
9986
|
+
).action(async (serviceId, stageId, deployId, _opts, command) => {
|
|
9987
|
+
const opts = command.optsWithGlobals();
|
|
9988
|
+
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
9989
|
+
const parsedStageId = parseRequiredArgument(stageId, "stage-id");
|
|
9990
|
+
const parsedDeployId = parseRequiredArgument(deployId, "deploy-id");
|
|
9991
|
+
requireYes(opts.yes, "\uC2A4\uD14C\uC774\uC9C0 \uB418\uB3CC\uB9AC\uAE30");
|
|
9992
|
+
const displayStageId = sanitizeForTerminal(parsedStageId);
|
|
9993
|
+
const { client } = await resolveApiGatewayClient(opts);
|
|
9994
|
+
startSpinner(`API Gateway stage "${displayStageId}" \uB418\uB3CC\uB9AC\uB294 \uC911...`);
|
|
9995
|
+
let resources;
|
|
9996
|
+
try {
|
|
9997
|
+
resources = await client.rollbackDeploy(
|
|
9998
|
+
parsedServiceId,
|
|
9999
|
+
parsedStageId,
|
|
10000
|
+
parsedDeployId
|
|
10001
|
+
);
|
|
10002
|
+
} catch (error) {
|
|
10003
|
+
stopSpinner(false);
|
|
10004
|
+
throw error;
|
|
10005
|
+
}
|
|
10006
|
+
stopSpinner(true);
|
|
10007
|
+
output(opts, writtenStageResourceOutput(resources));
|
|
10008
|
+
process.stderr.write(
|
|
10009
|
+
"\uC548\uB0B4: \uB418\uB3CC\uB9AC\uAE30\uB294 \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"
|
|
10010
|
+
);
|
|
10011
|
+
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");
|
|
10012
|
+
});
|
|
10013
|
+
var deployCommand = new import_commander50.Command("deploy").description("API Gateway stage \uBC30\uD3EC \uC870\uD68C\uC640 \uC2E4\uD589 \uBA85\uB839").addCommand(listCommand12).addCommand(latestCommand).addCommand(createCommand8).addCommand(rollbackCommand);
|
|
9087
10014
|
|
|
9088
10015
|
// src/commands/apigateway/stage.ts
|
|
9089
10016
|
function addApiGatewayOptions3(command) {
|
|
9090
|
-
return command.option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--
|
|
10017
|
+
return command.option("--region <region>", "API Gateway region (\uAE30\uBCF8: kr1)", "kr1").option("--profile <name>", "\uC0AC\uC6A9\uD560 profile \uC774\uB984");
|
|
9091
10018
|
}
|
|
9092
|
-
function
|
|
10019
|
+
function fileErrorReason2(error) {
|
|
9093
10020
|
if (typeof error === "object" && error !== null && "code" in error) {
|
|
9094
10021
|
const code = error.code;
|
|
9095
10022
|
if (typeof code === "string") return code;
|
|
@@ -9098,12 +10025,12 @@ function fileErrorReason(error) {
|
|
|
9098
10025
|
}
|
|
9099
10026
|
async function writeStageSwaggerFile(path5, swagger, force) {
|
|
9100
10027
|
try {
|
|
9101
|
-
await (0,
|
|
10028
|
+
await (0, import_promises9.writeFile)(path5, JSON.stringify(swagger, null, 2) + "\n", {
|
|
9102
10029
|
encoding: "utf-8",
|
|
9103
10030
|
flag: force ? "w" : "wx"
|
|
9104
10031
|
});
|
|
9105
10032
|
} catch (error) {
|
|
9106
|
-
const reason =
|
|
10033
|
+
const reason = fileErrorReason2(error);
|
|
9107
10034
|
const guidance = reason === "EEXIST" ? " \uB36E\uC5B4\uC4F0\uB824\uBA74 --force \uB97C \uC9C0\uC815\uD558\uC138\uC694." : "";
|
|
9108
10035
|
throw new NhnCloudCliError(
|
|
9109
10036
|
`Swagger \uD30C\uC77C \uC800\uC7A5 \uC2E4\uD328: ${JSON.stringify(path5)} (${JSON.stringify(reason)}).${guidance}`,
|
|
@@ -9194,7 +10121,79 @@ var resourcesCommand = addApiGatewayOptions3(
|
|
|
9194
10121
|
ids: resources.map((resource) => sanitizeForTerminal(resource.stageResourceId))
|
|
9195
10122
|
});
|
|
9196
10123
|
});
|
|
9197
|
-
var
|
|
10124
|
+
var updateCommand2 = addApiGatewayOptions3(
|
|
10125
|
+
new import_commander51.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")
|
|
10126
|
+
).action(async (serviceId, stageId, _opts, command) => {
|
|
10127
|
+
const opts = command.optsWithGlobals();
|
|
10128
|
+
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
10129
|
+
const parsedStageId = parseRequiredArgument(stageId, "stage-id");
|
|
10130
|
+
if (opts.backendEndpointUrl === void 0 && opts.description === void 0) {
|
|
10131
|
+
throw new NhnCloudCliError(
|
|
10132
|
+
"\uC2A4\uD14C\uC774\uC9C0 \uC218\uC815\uC5D0\uC11C \uBC14\uAFC0 \uAC12\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. --backend-endpoint-url \uB610\uB294 --description\uC744 \uC9C0\uC815\uD558\uC138\uC694.",
|
|
10133
|
+
EXIT_PARAM_ERROR
|
|
10134
|
+
);
|
|
10135
|
+
}
|
|
10136
|
+
requireYes(opts.yes, "\uC2A4\uD14C\uC774\uC9C0 \uC218\uC815");
|
|
10137
|
+
const displayStageId = sanitizeForTerminal(parsedStageId);
|
|
10138
|
+
const { client } = await resolveApiGatewayClient(opts);
|
|
10139
|
+
startSpinner(`API Gateway stage "${displayStageId}" \uC218\uC815 \uC911...`);
|
|
10140
|
+
let updatedStage;
|
|
10141
|
+
try {
|
|
10142
|
+
const stages = await client.listStages(parsedServiceId);
|
|
10143
|
+
const existingStage = stages.find((stage) => stage.stageId === parsedStageId);
|
|
10144
|
+
if (existingStage === void 0) {
|
|
10145
|
+
throw new NhnCloudCliError(
|
|
10146
|
+
`API Gateway stage "${displayStageId}"\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.`,
|
|
10147
|
+
EXIT_PARAM_ERROR
|
|
10148
|
+
);
|
|
10149
|
+
}
|
|
10150
|
+
updatedStage = await client.updateStage(parsedServiceId, parsedStageId, {
|
|
10151
|
+
backendEndpointUrl: opts.backendEndpointUrl ?? existingStage.backendEndpointUrl,
|
|
10152
|
+
stageDescription: opts.description ?? existingStage.stageDescription
|
|
10153
|
+
});
|
|
10154
|
+
} catch (error) {
|
|
10155
|
+
stopSpinner(false);
|
|
10156
|
+
throw error;
|
|
10157
|
+
}
|
|
10158
|
+
stopSpinner(true);
|
|
10159
|
+
output(opts, {
|
|
10160
|
+
headers: ["stageId", "stageName", "stageUrl", "backendEndpointUrl", "updatedAt"],
|
|
10161
|
+
rows: [[
|
|
10162
|
+
sanitizeForTerminal(updatedStage.stageId),
|
|
10163
|
+
updatedStage.stageName === null ? "-" : sanitizeForTerminal(updatedStage.stageName),
|
|
10164
|
+
sanitizeForTerminal(updatedStage.stageUrl),
|
|
10165
|
+
sanitizeForTerminal(updatedStage.backendEndpointUrl),
|
|
10166
|
+
sanitizeForTerminal(updatedStage.updatedAt)
|
|
10167
|
+
]],
|
|
10168
|
+
raw: updatedStage,
|
|
10169
|
+
ids: [sanitizeForTerminal(updatedStage.stageId)]
|
|
10170
|
+
});
|
|
10171
|
+
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");
|
|
10172
|
+
});
|
|
10173
|
+
var importResourcesCommand = addApiGatewayOptions3(
|
|
10174
|
+
new import_commander51.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")
|
|
10175
|
+
).action(async (serviceId, stageId, _opts, command) => {
|
|
10176
|
+
const opts = command.optsWithGlobals();
|
|
10177
|
+
const parsedServiceId = parseRequiredArgument(serviceId, "service-id");
|
|
10178
|
+
const parsedStageId = parseRequiredArgument(stageId, "stage-id");
|
|
10179
|
+
requireYes(opts.yes, "\uC2A4\uD14C\uC774\uC9C0 \uBC18\uC601");
|
|
10180
|
+
const displayStageId = sanitizeForTerminal(parsedStageId);
|
|
10181
|
+
const { client } = await resolveApiGatewayClient(opts);
|
|
10182
|
+
startSpinner(`API Gateway stage "${displayStageId}" \uB9AC\uC18C\uC2A4 \uBC18\uC601 \uC911...`);
|
|
10183
|
+
let resources;
|
|
10184
|
+
try {
|
|
10185
|
+
resources = await client.importStageResources(parsedServiceId, parsedStageId);
|
|
10186
|
+
} catch (error) {
|
|
10187
|
+
stopSpinner(false);
|
|
10188
|
+
throw error;
|
|
10189
|
+
}
|
|
10190
|
+
stopSpinner(true);
|
|
10191
|
+
output(opts, writtenStageResourceOutput(resources));
|
|
10192
|
+
process.stderr.write(
|
|
10193
|
+
"\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"
|
|
10194
|
+
);
|
|
10195
|
+
});
|
|
10196
|
+
var stageCommand = new import_commander51.Command("stage").description("API Gateway stage \uC870\uD68C \uBC0F \uBCC0\uACBD \uBA85\uB839").addCommand(listCommand13).addCommand(swaggerCommand).addCommand(resourcesCommand).addCommand(updateCommand2).addCommand(importResourcesCommand).addCommand(deployCommand);
|
|
9198
10197
|
|
|
9199
10198
|
// src/commands/loadbalancer/list.ts
|
|
9200
10199
|
var import_commander52 = require("commander");
|
|
@@ -9203,10 +10202,10 @@ var import_commander52 = require("commander");
|
|
|
9203
10202
|
var import_node_net = require("net");
|
|
9204
10203
|
|
|
9205
10204
|
// src/services/loadbalancer/client.ts
|
|
9206
|
-
var
|
|
10205
|
+
var import_ky15 = __toESM(require("ky"));
|
|
9207
10206
|
|
|
9208
10207
|
// src/services/loadbalancer/types.ts
|
|
9209
|
-
function
|
|
10208
|
+
function isRecord3(value) {
|
|
9210
10209
|
return typeof value === "object" && value !== null;
|
|
9211
10210
|
}
|
|
9212
10211
|
function isNonEmptyString(value) {
|
|
@@ -9216,29 +10215,29 @@ function isIpAclAction(value) {
|
|
|
9216
10215
|
return value === "ALLOW" || value === "DENY";
|
|
9217
10216
|
}
|
|
9218
10217
|
function isLoadBalancerIpAclGroup(value) {
|
|
9219
|
-
return
|
|
10218
|
+
return isRecord3(value) && isNonEmptyString(value["ipacl_group_id"]);
|
|
9220
10219
|
}
|
|
9221
10220
|
function isIpAclGroupLoadBalancer(value) {
|
|
9222
|
-
return
|
|
10221
|
+
return isRecord3(value) && isNonEmptyString(value["loadbalancer_id"]);
|
|
9223
10222
|
}
|
|
9224
10223
|
function isLoadBalancer(value) {
|
|
9225
|
-
if (!
|
|
10224
|
+
if (!isRecord3(value)) return false;
|
|
9226
10225
|
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);
|
|
9227
10226
|
}
|
|
9228
10227
|
function isIpAclGroup(value) {
|
|
9229
|
-
if (!
|
|
10228
|
+
if (!isRecord3(value)) return false;
|
|
9230
10229
|
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);
|
|
9231
10230
|
}
|
|
9232
10231
|
function isIpAclTarget(value) {
|
|
9233
|
-
if (!
|
|
10232
|
+
if (!isRecord3(value)) return false;
|
|
9234
10233
|
return isNonEmptyString(value["id"]) && typeof value["cidr_address"] === "string" && typeof value["description"] === "string" && isNonEmptyString(value["ipacl_group_id"]);
|
|
9235
10234
|
}
|
|
9236
10235
|
function isIpAclBinding(value) {
|
|
9237
|
-
return
|
|
10236
|
+
return isRecord3(value) && isNonEmptyString(value["loadbalancer_id"]) && isNonEmptyString(value["ipacl_group_id"]);
|
|
9238
10237
|
}
|
|
9239
10238
|
|
|
9240
10239
|
// src/services/loadbalancer/client.ts
|
|
9241
|
-
function
|
|
10240
|
+
function isRecord4(value) {
|
|
9242
10241
|
return typeof value === "object" && value !== null;
|
|
9243
10242
|
}
|
|
9244
10243
|
function requireNonEmptyId(id, label) {
|
|
@@ -9249,7 +10248,7 @@ function requireNonEmptyId(id, label) {
|
|
|
9249
10248
|
return normalized;
|
|
9250
10249
|
}
|
|
9251
10250
|
function readArrayField(response, key, itemGuard, missingKeyMessage, invalidItemMessage) {
|
|
9252
|
-
if (!
|
|
10251
|
+
if (!isRecord4(response) || !Array.isArray(response[key])) {
|
|
9253
10252
|
throw new NhnCloudCliError(missingKeyMessage, EXIT_API_ERROR);
|
|
9254
10253
|
}
|
|
9255
10254
|
const items = response[key];
|
|
@@ -9259,7 +10258,7 @@ function readArrayField(response, key, itemGuard, missingKeyMessage, invalidItem
|
|
|
9259
10258
|
return items;
|
|
9260
10259
|
}
|
|
9261
10260
|
function readObjectField(response, key, itemGuard, missingKeyMessage, invalidItemMessage) {
|
|
9262
|
-
if (!
|
|
10261
|
+
if (!isRecord4(response) || !(key in response)) {
|
|
9263
10262
|
throw new NhnCloudCliError(missingKeyMessage, EXIT_API_ERROR);
|
|
9264
10263
|
}
|
|
9265
10264
|
const item = response[key];
|
|
@@ -9400,7 +10399,7 @@ var LoadBalancerClient = class {
|
|
|
9400
10399
|
async getJson(path5, searchParams) {
|
|
9401
10400
|
const url = `${this.endpoint}${path5}`;
|
|
9402
10401
|
try {
|
|
9403
|
-
return await
|
|
10402
|
+
return await import_ky15.default.get(url, {
|
|
9404
10403
|
headers: this.authHeaders(),
|
|
9405
10404
|
searchParams,
|
|
9406
10405
|
retry: 0,
|
|
@@ -9413,7 +10412,7 @@ var LoadBalancerClient = class {
|
|
|
9413
10412
|
async postJson(path5, json) {
|
|
9414
10413
|
const url = `${this.endpoint}${path5}`;
|
|
9415
10414
|
try {
|
|
9416
|
-
return await
|
|
10415
|
+
return await import_ky15.default.post(url, {
|
|
9417
10416
|
headers: this.authHeaders(),
|
|
9418
10417
|
json,
|
|
9419
10418
|
retry: 0,
|
|
@@ -9426,7 +10425,7 @@ var LoadBalancerClient = class {
|
|
|
9426
10425
|
async putJson(path5, json) {
|
|
9427
10426
|
const url = `${this.endpoint}${path5}`;
|
|
9428
10427
|
try {
|
|
9429
|
-
return await
|
|
10428
|
+
return await import_ky15.default.put(url, {
|
|
9430
10429
|
headers: this.authHeaders(),
|
|
9431
10430
|
json,
|
|
9432
10431
|
retry: 0,
|
|
@@ -9439,7 +10438,7 @@ var LoadBalancerClient = class {
|
|
|
9439
10438
|
async deleteNoContent(path5) {
|
|
9440
10439
|
const url = `${this.endpoint}${path5}`;
|
|
9441
10440
|
try {
|
|
9442
|
-
await
|
|
10441
|
+
await import_ky15.default.delete(url, {
|
|
9443
10442
|
headers: this.authHeaders(),
|
|
9444
10443
|
retry: 0,
|
|
9445
10444
|
timeout: DEFAULT_TIMEOUT_MS
|
|
@@ -9462,7 +10461,7 @@ function optionalTrimmed(value) {
|
|
|
9462
10461
|
if (value === void 0) return void 0;
|
|
9463
10462
|
return value.trim();
|
|
9464
10463
|
}
|
|
9465
|
-
function
|
|
10464
|
+
function requireYes2(yes, operation) {
|
|
9466
10465
|
if (!yes) {
|
|
9467
10466
|
throw new NhnCloudCliError(
|
|
9468
10467
|
`${operation}\uC5D0\uB294 --yes \uD50C\uB798\uADF8\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.`,
|
|
@@ -9652,9 +10651,6 @@ var import_commander55 = require("commander");
|
|
|
9652
10651
|
var import_commander54 = require("commander");
|
|
9653
10652
|
|
|
9654
10653
|
// src/commands/loadbalancer/rebind.ts
|
|
9655
|
-
function sanitizeForTerminal2(value) {
|
|
9656
|
-
return value.replace(/[\x00-\x1F\x7F]/g, "?");
|
|
9657
|
-
}
|
|
9658
10654
|
function shellQuote(value) {
|
|
9659
10655
|
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
9660
10656
|
}
|
|
@@ -9765,9 +10761,9 @@ function writeTargetWarnings(group, result) {
|
|
|
9765
10761
|
`
|
|
9766
10762
|
);
|
|
9767
10763
|
for (const failure of result.rebind.failed) {
|
|
9768
|
-
process.stderr.write(`${
|
|
10764
|
+
process.stderr.write(`${sanitizeForTerminal(failure.retry_command)}
|
|
9769
10765
|
`);
|
|
9770
|
-
process.stderr.write(` \uC624\uB958: ${
|
|
10766
|
+
process.stderr.write(` \uC624\uB958: ${sanitizeForTerminal(failure.error)}
|
|
9771
10767
|
`);
|
|
9772
10768
|
}
|
|
9773
10769
|
}
|
|
@@ -9814,7 +10810,7 @@ var listCommand15 = new import_commander54.Command("list").description("IP ACL \
|
|
|
9814
10810
|
});
|
|
9815
10811
|
var addCommand = new import_commander54.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) => {
|
|
9816
10812
|
const opts = cmd.optsWithGlobals();
|
|
9817
|
-
|
|
10813
|
+
requireYes2(opts.yes, "IP ACL \uB300\uC0C1 \uCD94\uAC00");
|
|
9818
10814
|
const parsedGroup = requireResourceInput(groupInput, "IP ACL \uADF8\uB8F9");
|
|
9819
10815
|
const parsedCidr = parseIpOrCidr(opts.cidr ?? "");
|
|
9820
10816
|
const parsedDescription = optionalTrimmed(opts.description);
|
|
@@ -9851,7 +10847,7 @@ var addCommand = new import_commander54.Command("add").description("IP ACL \uB30
|
|
|
9851
10847
|
});
|
|
9852
10848
|
var removeCommand = new import_commander54.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) => {
|
|
9853
10849
|
const opts = cmd.optsWithGlobals();
|
|
9854
|
-
|
|
10850
|
+
requireYes2(opts.yes, "IP ACL \uB300\uC0C1 \uC0AD\uC81C");
|
|
9855
10851
|
const parsedTargetId = requireResourceInput(targetInput, "IP ACL \uB300\uC0C1");
|
|
9856
10852
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
9857
10853
|
startSpinner("IP ACL \uB300\uC0C1 \uC0AD\uC81C\uC640 Load Balancer \uC7AC\uBC14\uC778\uB529 \uC911...");
|
|
@@ -9947,7 +10943,7 @@ var getCommand10 = new import_commander55.Command("get").description("IP ACL \uA
|
|
|
9947
10943
|
ids: [group.id]
|
|
9948
10944
|
});
|
|
9949
10945
|
});
|
|
9950
|
-
var
|
|
10946
|
+
var createCommand9 = new import_commander55.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) => {
|
|
9951
10947
|
const opts = cmd.optsWithGlobals();
|
|
9952
10948
|
const parsedName = requireResourceInput(opts.name ?? "", "IP ACL \uADF8\uB8F9");
|
|
9953
10949
|
const parsedAction = parseIpAclAction(opts.action ?? "");
|
|
@@ -9980,7 +10976,7 @@ var createCommand8 = new import_commander55.Command("create").description("IP AC
|
|
|
9980
10976
|
});
|
|
9981
10977
|
var deleteCommand7 = new import_commander55.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) => {
|
|
9982
10978
|
const opts = cmd.optsWithGlobals();
|
|
9983
|
-
const confirmedYes =
|
|
10979
|
+
const confirmedYes = requireYes2(opts.yes, "IP ACL \uADF8\uB8F9 \uC0AD\uC81C");
|
|
9984
10980
|
const parsedGroup = requireResourceInput(groupInput, "IP ACL \uADF8\uB8F9");
|
|
9985
10981
|
if (confirmedYes) {
|
|
9986
10982
|
process.stderr.write(
|
|
@@ -10013,7 +11009,7 @@ var deleteCommand7 = new import_commander55.Command("delete").description("IP AC
|
|
|
10013
11009
|
var ipaclCommand = new import_commander55.Command("ipacl").description("IP ACL \uADF8\uB8F9\xB7\uB300\uC0C1 \uC870\uD68C");
|
|
10014
11010
|
ipaclCommand.addCommand(listCommand16);
|
|
10015
11011
|
ipaclCommand.addCommand(getCommand10);
|
|
10016
|
-
ipaclCommand.addCommand(
|
|
11012
|
+
ipaclCommand.addCommand(createCommand9);
|
|
10017
11013
|
ipaclCommand.addCommand(deleteCommand7);
|
|
10018
11014
|
ipaclCommand.addCommand(targetCommand);
|
|
10019
11015
|
|
|
@@ -10054,7 +11050,7 @@ var setIpAclCommand2 = new import_commander56.Command("set-ipacl").description("
|
|
|
10054
11050
|
collectOption
|
|
10055
11051
|
).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) => {
|
|
10056
11052
|
const opts = cmd.optsWithGlobals();
|
|
10057
|
-
const confirmedYes =
|
|
11053
|
+
const confirmedYes = requireYes2(opts.yes, "Load Balancer IP ACL \uC5F0\uACB0 \uAD50\uCCB4");
|
|
10058
11054
|
const parsedLoadBalancer = requireResourceInput(loadBalancerInput, "Load Balancer");
|
|
10059
11055
|
const parsedGroups = requireResourceInputs(opts.group ?? [], "IP ACL \uADF8\uB8F9");
|
|
10060
11056
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
@@ -10090,7 +11086,7 @@ var setIpAclCommand2 = new import_commander56.Command("set-ipacl").description("
|
|
|
10090
11086
|
});
|
|
10091
11087
|
var clearIpAclCommand = new import_commander56.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) => {
|
|
10092
11088
|
const opts = cmd.optsWithGlobals();
|
|
10093
|
-
const confirmedYes =
|
|
11089
|
+
const confirmedYes = requireYes2(opts.yes, "Load Balancer IP ACL \uC5F0\uACB0 \uD574\uC81C");
|
|
10094
11090
|
const parsedLoadBalancer = requireResourceInput(loadBalancerInput, "Load Balancer");
|
|
10095
11091
|
const { client } = await resolveLoadBalancerClient(opts);
|
|
10096
11092
|
startSpinner("Load Balancer IP ACL \uC5F0\uACB0 \uD574\uC81C \uC911...");
|
|
@@ -10125,9 +11121,9 @@ Agent workflow:
|
|
|
10125
11121
|
`;
|
|
10126
11122
|
var deployAgentWorkflow = `
|
|
10127
11123
|
Agent workflow:
|
|
10128
|
-
1. nhncloud deploy artifacts
|
|
10129
|
-
2. nhncloud deploy server-groups <
|
|
10130
|
-
3. nhncloud deploy run <
|
|
11124
|
+
1. nhncloud deploy artifacts --json
|
|
11125
|
+
2. nhncloud deploy server-groups --artifact-id <artifact-id> --json
|
|
11126
|
+
3. nhncloud deploy run --artifact-id <artifact-id> --server-group-id <server-group-id> --scenario-ids <ids>
|
|
10131
11127
|
`;
|
|
10132
11128
|
var instanceAgentWorkflow = `
|
|
10133
11129
|
Agent workflow:
|
|
@@ -10177,7 +11173,7 @@ Agent workflow:
|
|
|
10177
11173
|
3. nhncloud ncs workload get <id> --json
|
|
10178
11174
|
`;
|
|
10179
11175
|
var program = new import_commander57.Command();
|
|
10180
|
-
program.name("nhncloud").description("NHN Cloud CLI \u2014 AI agent & terminal friendly").version("0.
|
|
11176
|
+
program.name("nhncloud").description("NHN Cloud CLI \u2014 AI agent & terminal friendly").version("0.15.0").option("--json", "JSON \uD615\uC2DD\uC73C\uB85C \uCD9C\uB825").option("--quiet", "\uCD5C\uC18C \uCD9C\uB825 (\uC790\uB3D9\uD654\uC6A9)").option("--no-color", "\uC0C9\uC0C1 \uBE44\uD65C\uC131\uD654").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);
|
|
10181
11177
|
program.hook("preAction", () => {
|
|
10182
11178
|
const opts = program.opts();
|
|
10183
11179
|
const rawTimeout = opts.requestTimeout ?? process.env["NHNCLOUD_REQUEST_TIMEOUT"];
|
|
@@ -10188,7 +11184,7 @@ program.hook("preAction", () => {
|
|
|
10188
11184
|
{ min: 1, max: 3600 }
|
|
10189
11185
|
);
|
|
10190
11186
|
if (!opts.color || process.env["NO_COLOR"]) {
|
|
10191
|
-
|
|
11187
|
+
import_chalk18.default.level = 0;
|
|
10192
11188
|
}
|
|
10193
11189
|
if (opts.json || opts.quiet) {
|
|
10194
11190
|
setQuiet(true);
|
|
@@ -10204,6 +11200,9 @@ logncrashCommand.addCommand(sendCommand);
|
|
|
10204
11200
|
logncrashCommand.addCommand(exportCommand);
|
|
10205
11201
|
program.addCommand(logncrashCommand);
|
|
10206
11202
|
var deployCommand2 = new import_commander57.Command("deploy").description("NHN Cloud Deploy \uAD00\uB828 \uBA85\uB839").addHelpText("after", deployAgentWorkflow);
|
|
11203
|
+
deployCommand2.hook("preSubcommand", async () => {
|
|
11204
|
+
await warnLegacyDeployTargets();
|
|
11205
|
+
});
|
|
10207
11206
|
deployCommand2.addCommand(runCommand);
|
|
10208
11207
|
deployCommand2.addCommand(artifactsCommand);
|
|
10209
11208
|
deployCommand2.addCommand(serverGroupsCommand);
|
|
@@ -10283,8 +11282,10 @@ program.addCommand(skillsCommand);
|
|
|
10283
11282
|
program.addCommand(doctorCommand);
|
|
10284
11283
|
program.addCommand(createCommandsCommand(program));
|
|
10285
11284
|
program.parseAsync().catch((err) => {
|
|
10286
|
-
const message =
|
|
11285
|
+
const message = sanitizeMultilineForTerminal(
|
|
11286
|
+
err instanceof Error ? err.message : String(err)
|
|
11287
|
+
);
|
|
10287
11288
|
const exitCode = err instanceof NhnCloudCliError ? err.exitCode : 1;
|
|
10288
|
-
process.stderr.write(
|
|
11289
|
+
process.stderr.write(import_chalk18.default.red(`\uC624\uB958: ${message}`) + "\n");
|
|
10289
11290
|
process.exit(exitCode);
|
|
10290
11291
|
});
|