@axway/axway-central-cli 2.17.0 → 2.18.0-rc.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/dist/cli.js +6 -28
- package/dist/commands/apply/index.js +9 -24
- package/dist/commands/completion/index.js +3 -9
- package/dist/commands/config/common/index.js +2 -11
- package/dist/commands/config/index.js +2 -7
- package/dist/commands/config/list.js +2 -6
- package/dist/commands/config/set.js +4 -31
- package/dist/commands/config/unset.js +2 -12
- package/dist/commands/create/agentResource.js +12 -32
- package/dist/commands/create/environment.js +6 -16
- package/dist/commands/create/index.js +9 -26
- package/dist/commands/create/serviceAccount.js +2 -6
- package/dist/commands/delete/index.js +15 -33
- package/dist/commands/edit/environment.js +6 -21
- package/dist/commands/edit/index.js +4 -8
- package/dist/commands/get/index.js +27 -44
- package/dist/commands/install/agents.js +44 -73
- package/dist/commands/install/apigeexSaasAgents.js +35 -98
- package/dist/commands/install/awsAgents.js +89 -139
- package/dist/commands/install/awsSaasAgents.js +50 -142
- package/dist/commands/install/azureAgents.js +39 -79
- package/dist/commands/install/edgeAgents.js +17 -110
- package/dist/commands/install/gitHubSaasAgents.js +286 -0
- package/dist/commands/install/helpers/creators.js +17 -70
- package/dist/commands/install/helpers/deleters.js +2 -11
- package/dist/commands/install/helpers/getters.js +4 -30
- package/dist/commands/install/helpers/index.js +13 -48
- package/dist/commands/install/helpers/inputs.js +26 -98
- package/dist/commands/install/helpers/regex.js +29 -34
- package/dist/commands/install/helpers/templates/awsTemplates.js +6 -23
- package/dist/commands/install/helpers/templates/azureTemplates.js +5 -24
- package/dist/commands/install/helpers/templates/edgeTemplates.js +7 -38
- package/dist/commands/install/helpers/templates/istioTemplates.js +5 -16
- package/dist/commands/install/index.js +4 -10
- package/dist/commands/install/istioAgents.js +40 -117
- package/dist/commands/install/platform.js +20 -52
- package/dist/commands/proxies/create.js +2 -18
- package/dist/commands/proxies/index.js +4 -8
- package/dist/commands/proxies/promote.js +2 -21
- package/dist/common/ApiServerClient.js +64 -173
- package/dist/common/CacheController.js +11 -32
- package/dist/common/CliConfigManager.js +14 -27
- package/dist/common/CompositeError.js +6 -30
- package/dist/common/CoreConfigController.js +18 -40
- package/dist/common/DefinitionsManager.js +29 -76
- package/dist/common/Kubectl.js +2 -25
- package/dist/common/PlatformClient.js +19 -63
- package/dist/common/Renderer.js +25 -87
- package/dist/common/TmpFile.js +11 -28
- package/dist/common/bashCommands.js +3 -22
- package/dist/common/basicPrompts.js +8 -43
- package/dist/common/dataService.js +22 -50
- package/dist/common/errorHandler.js +0 -9
- package/dist/common/resultsRenderers.js +10 -42
- package/dist/common/types.js +116 -341
- package/dist/common/utils.js +37 -99
- package/dist/main.js +0 -2
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -4,54 +4,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.cliParams = void 0;
|
|
7
|
-
|
|
8
7
|
var _cliKit = _interopRequireDefault(require("cli-kit"));
|
|
9
|
-
|
|
10
8
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
11
|
-
|
|
12
9
|
var _relativeTime = _interopRequireDefault(require("dayjs/plugin/relativeTime"));
|
|
13
|
-
|
|
14
10
|
var _fsExtra = require("fs-extra");
|
|
15
|
-
|
|
16
11
|
var _apply = require("./commands/apply");
|
|
17
|
-
|
|
18
12
|
var _completion = require("./commands/completion");
|
|
19
|
-
|
|
20
13
|
var _config = require("./commands/config");
|
|
21
|
-
|
|
22
14
|
var _create = require("./commands/create");
|
|
23
|
-
|
|
24
15
|
var _delete = require("./commands/delete");
|
|
25
|
-
|
|
26
16
|
var _edit = require("./commands/edit");
|
|
27
|
-
|
|
28
17
|
var _get = require("./commands/get");
|
|
29
|
-
|
|
30
18
|
var _install = require("./commands/install");
|
|
31
|
-
|
|
32
19
|
var _proxies = require("./commands/proxies");
|
|
33
|
-
|
|
34
20
|
var _utils = require("./common/utils");
|
|
35
|
-
|
|
36
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
-
|
|
38
22
|
_dayjs.default.extend(_relativeTime.default);
|
|
39
|
-
|
|
40
23
|
require('tls').DEFAULT_ECDH_CURVE = 'auto';
|
|
41
24
|
(0, _utils.hbsCompare)();
|
|
42
|
-
|
|
43
25
|
const {
|
|
44
26
|
version
|
|
45
|
-
} = require('../package.json');
|
|
46
|
-
|
|
27
|
+
} = require('../package.json');
|
|
47
28
|
|
|
29
|
+
// Create the configFile if it doesn't exist yet and read all extensions on load
|
|
48
30
|
if (!(0, _fsExtra.existsSync)(_utils.configFile)) {
|
|
49
31
|
(0, _fsExtra.outputJsonSync)(_utils.configFile, {});
|
|
50
32
|
}
|
|
33
|
+
const extensions = [...Object.values((0, _fsExtra.readJsonSync)(_utils.configFile).extensions || {})];
|
|
51
34
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const cliParams = {
|
|
35
|
+
// cliParams export only needed for "completion" command and its testing
|
|
36
|
+
const cliParams = exports.cliParams = {
|
|
55
37
|
title: 'Axway Central CLI',
|
|
56
38
|
name: 'central',
|
|
57
39
|
banner: '',
|
|
@@ -69,8 +51,4 @@ const cliParams = {
|
|
|
69
51
|
},
|
|
70
52
|
extensions
|
|
71
53
|
};
|
|
72
|
-
exports.
|
|
73
|
-
|
|
74
|
-
var _default = new _cliKit.default(cliParams);
|
|
75
|
-
|
|
76
|
-
exports.default = _default;
|
|
54
|
+
var _default = exports.default = new _cliKit.default(cliParams);
|
|
@@ -4,29 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.apply = void 0;
|
|
7
|
-
|
|
8
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
-
|
|
10
8
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
11
|
-
|
|
12
9
|
var _ApiServerClient = require("../../common/ApiServerClient");
|
|
13
|
-
|
|
14
10
|
var _basicPrompts = require("../../common/basicPrompts");
|
|
15
|
-
|
|
16
11
|
var _DefinitionsManager = require("../../common/DefinitionsManager");
|
|
17
|
-
|
|
18
12
|
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
19
|
-
|
|
20
13
|
var _types = require("../../common/types");
|
|
21
|
-
|
|
22
14
|
var _utils = require("../../common/utils");
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
16
|
const {
|
|
27
17
|
log
|
|
28
18
|
} = (0, _snooplogg.default)('central: create');
|
|
29
|
-
|
|
30
19
|
const action = async ({
|
|
31
20
|
argv,
|
|
32
21
|
console
|
|
@@ -40,9 +29,10 @@ const action = async ({
|
|
|
40
29
|
cache,
|
|
41
30
|
yes
|
|
42
31
|
} = argv;
|
|
43
|
-
let isCmdError = false;
|
|
44
|
-
// cli-kit is also enforcing it on sub-commands
|
|
32
|
+
let isCmdError = false;
|
|
45
33
|
|
|
34
|
+
// need to verify args here since if "-f" is required
|
|
35
|
+
// cli-kit is also enforcing it on sub-commands
|
|
46
36
|
log(`verifying args`);
|
|
47
37
|
if (!file) throw new Error('File name is required, please provide -f, --file [path] option');
|
|
48
38
|
log(`verifying file: ${file}`);
|
|
@@ -67,7 +57,6 @@ const action = async ({
|
|
|
67
57
|
});
|
|
68
58
|
const defsManager = new _DefinitionsManager.DefinitionsManager(client);
|
|
69
59
|
log(`executing api calls`);
|
|
70
|
-
|
|
71
60
|
try {
|
|
72
61
|
await defsManager.init();
|
|
73
62
|
log(`loading and verifying specs`);
|
|
@@ -75,7 +64,6 @@ const action = async ({
|
|
|
75
64
|
docs,
|
|
76
65
|
isMissingName
|
|
77
66
|
} = await (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
|
|
78
|
-
|
|
79
67
|
if (!yes && isMissingName) {
|
|
80
68
|
render.stopSpin();
|
|
81
69
|
if ((await (0, _basicPrompts.askList)({
|
|
@@ -85,19 +73,17 @@ const action = async ({
|
|
|
85
73
|
})) === _types.YesNo.No) process.exit(1);
|
|
86
74
|
render.startSpin('Creating or updating resource(s)');
|
|
87
75
|
}
|
|
88
|
-
|
|
89
76
|
const sortedKindsMap = defsManager.getSortedKindsMap();
|
|
90
77
|
results = await client.bulkCreateOrUpdate(docs, sortedKindsMap);
|
|
91
78
|
render.bulkCreateOrUpdateResult(results, 'has successfully been created.', 'has successfully been updated.', 'was created with an autogenerated logical name.');
|
|
92
79
|
isCmdError = results.created.error.length > 0 || results.updated.error.length > 0;
|
|
93
80
|
} catch (e) {
|
|
94
81
|
log('command error', e);
|
|
95
|
-
isCmdError = true;
|
|
96
|
-
|
|
82
|
+
isCmdError = true;
|
|
83
|
+
// if some calls completed, rendering the result
|
|
97
84
|
if (results.created.success.length || results.updated.success.length) {
|
|
98
85
|
render.bulkCreateOrUpdateResult(results, 'has successfully been created.', 'has successfully been updated.', 'was created with an autogenerated logical name.');
|
|
99
86
|
}
|
|
100
|
-
|
|
101
87
|
render.anyError(e);
|
|
102
88
|
} finally {
|
|
103
89
|
log(`command finished, exit with error = ${isCmdError}`);
|
|
@@ -105,11 +91,11 @@ const action = async ({
|
|
|
105
91
|
if (isCmdError) process.exit(1);
|
|
106
92
|
}
|
|
107
93
|
};
|
|
108
|
-
|
|
109
|
-
const apply = {
|
|
94
|
+
const apply = exports.apply = {
|
|
110
95
|
action,
|
|
111
96
|
desc: 'Update resources from a file',
|
|
112
|
-
options: {
|
|
97
|
+
options: {
|
|
98
|
+
..._types.commonCmdArgsDescription,
|
|
113
99
|
'-o, --output [value]': {
|
|
114
100
|
desc: `Additional output formats. One of: ${_types.OutputTypes.yaml} | ${_types.OutputTypes.json}`,
|
|
115
101
|
type: 'string'
|
|
@@ -120,5 +106,4 @@ const apply = {
|
|
|
120
106
|
},
|
|
121
107
|
'-y, --yes': 'Automatically reply "yes" to any command prompts.'
|
|
122
108
|
}
|
|
123
|
-
};
|
|
124
|
-
exports.apply = apply;
|
|
109
|
+
};
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.completion = void 0;
|
|
7
|
-
|
|
8
7
|
var _cli = require("../../cli");
|
|
9
|
-
|
|
10
8
|
const coreCliCmd = 'axway';
|
|
11
9
|
const completionZsh = `###-begin-amplify-central-completions-###
|
|
12
10
|
_amplify_central_completions()
|
|
@@ -60,7 +58,6 @@ _amplify_central_completions()
|
|
|
60
58
|
complete -o default -F _amplify_central_completions amplify
|
|
61
59
|
###-end-amplify-central-completions-###
|
|
62
60
|
`;
|
|
63
|
-
|
|
64
61
|
const action = ({
|
|
65
62
|
argv,
|
|
66
63
|
console
|
|
@@ -71,7 +68,6 @@ const action = ({
|
|
|
71
68
|
zsh,
|
|
72
69
|
bash
|
|
73
70
|
} = argv;
|
|
74
|
-
|
|
75
71
|
if (getCompletions) {
|
|
76
72
|
if (args[0] === coreCliCmd && args[1] === 'central' && args.length <= 3) {
|
|
77
73
|
/** get core commands from CLI-kit params */
|
|
@@ -83,8 +79,7 @@ const action = ({
|
|
|
83
79
|
console.log(completionBash);
|
|
84
80
|
}
|
|
85
81
|
};
|
|
86
|
-
|
|
87
|
-
const completion = {
|
|
82
|
+
const completion = exports.completion = {
|
|
88
83
|
action,
|
|
89
84
|
args: ['args...'],
|
|
90
85
|
desc: 'Output shell completion code',
|
|
@@ -92,8 +87,8 @@ const completion = {
|
|
|
92
87
|
'--get-completions': {
|
|
93
88
|
type: 'bool',
|
|
94
89
|
hidden: true // used only by autocompletion script itself
|
|
95
|
-
|
|
96
90
|
},
|
|
91
|
+
|
|
97
92
|
'--zsh': {
|
|
98
93
|
type: 'bool',
|
|
99
94
|
desc: 'Autocompletion script for zsh.'
|
|
@@ -103,5 +98,4 @@ const completion = {
|
|
|
103
98
|
desc: 'Autocompletion script for bash.'
|
|
104
99
|
}
|
|
105
100
|
}
|
|
106
|
-
};
|
|
107
|
-
exports.completion = completion;
|
|
101
|
+
};
|
|
@@ -4,28 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.readConfig = void 0;
|
|
7
|
-
|
|
8
7
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
-
|
|
10
8
|
var _fsExtra = require("fs-extra");
|
|
11
|
-
|
|
12
9
|
var _utils = require("../../../common/utils");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
const {
|
|
17
12
|
log
|
|
18
13
|
} = (0, _snooplogg.default)('central: config: common');
|
|
19
|
-
|
|
20
14
|
const readConfig = async () => {
|
|
21
15
|
log(`Reading config: ${_utils.configFile}`);
|
|
22
|
-
|
|
23
16
|
try {
|
|
24
17
|
if (!(0, _fsExtra.existsSync)(_utils.configFile)) {
|
|
25
18
|
return {}; // empty config file
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
}
|
|
20
|
+
// await so error can be handled below
|
|
29
21
|
const config = await (0, _fsExtra.readJson)(_utils.configFile);
|
|
30
22
|
return config;
|
|
31
23
|
} catch (err) {
|
|
@@ -33,5 +25,4 @@ const readConfig = async () => {
|
|
|
33
25
|
throw new Error(`Couldn't read config from ${_utils.configFile}`);
|
|
34
26
|
}
|
|
35
27
|
};
|
|
36
|
-
|
|
37
28
|
exports.readConfig = readConfig;
|
|
@@ -4,14 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.config = void 0;
|
|
7
|
-
|
|
8
7
|
var _list = require("./list");
|
|
9
|
-
|
|
10
8
|
var _set = require("./set");
|
|
11
|
-
|
|
12
9
|
var _unset = require("./unset");
|
|
13
|
-
|
|
14
|
-
const config = {
|
|
10
|
+
const config = exports.config = {
|
|
15
11
|
action: () => {
|
|
16
12
|
throw new Error(`Missing one of required commands: [list, set]`);
|
|
17
13
|
},
|
|
@@ -21,5 +17,4 @@ const config = {
|
|
|
21
17
|
unset: _unset.unset
|
|
22
18
|
},
|
|
23
19
|
desc: 'Configure Central CLI settings'
|
|
24
|
-
};
|
|
25
|
-
exports.config = config;
|
|
20
|
+
};
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.listCommand = void 0;
|
|
7
|
-
|
|
8
7
|
var _common = require("./common");
|
|
9
|
-
|
|
10
8
|
const action = async ({
|
|
11
9
|
console
|
|
12
10
|
}) => {
|
|
@@ -19,10 +17,8 @@ const action = async ({
|
|
|
19
17
|
throw err;
|
|
20
18
|
}
|
|
21
19
|
};
|
|
22
|
-
|
|
23
|
-
const listCommand = {
|
|
20
|
+
const listCommand = exports.listCommand = {
|
|
24
21
|
action,
|
|
25
22
|
desc: 'View Central CLI settings',
|
|
26
23
|
aliases: ['ls', 'view']
|
|
27
|
-
};
|
|
28
|
-
exports.listCommand = listCommand;
|
|
24
|
+
};
|
|
@@ -4,96 +4,71 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.setCommand = void 0;
|
|
7
|
-
|
|
8
7
|
var _cliKit = require("cli-kit");
|
|
9
|
-
|
|
10
8
|
var _fsExtra = require("fs-extra");
|
|
11
|
-
|
|
12
9
|
var _set = _interopRequireDefault(require("lodash/set"));
|
|
13
|
-
|
|
14
10
|
var _types = require("../../common/types");
|
|
15
|
-
|
|
16
11
|
var _utils = require("../../common/utils");
|
|
17
|
-
|
|
18
12
|
var _common = require("./common");
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
14
|
const {
|
|
23
15
|
log
|
|
24
16
|
} = (0, _cliKit.snooplogg)('central: config: set');
|
|
25
|
-
|
|
26
17
|
const action = async ({
|
|
27
18
|
argv,
|
|
28
19
|
console
|
|
29
20
|
}) => {
|
|
30
21
|
var _argv$name;
|
|
31
|
-
|
|
32
22
|
const isValidRootConfig = argv.baseUrl || argv.clientId || argv.region || argv.platform || argv.apicDeployment;
|
|
33
23
|
const isValidExtension = ((_argv$name = argv.name) === null || _argv$name === void 0 ? void 0 : _argv$name.startsWith(`${_types.ConfigTypes.EXTENSIONS}.`)) && argv.value;
|
|
34
|
-
|
|
35
24
|
if (!isValidRootConfig && !isValidExtension) {
|
|
36
25
|
log((0, _cliKit.chalk)`{magenta Allowed central config values weren't provided. Exiting...}`);
|
|
37
26
|
throw Error(` Allowed central config values weren't provided`);
|
|
38
27
|
}
|
|
39
|
-
|
|
40
28
|
if (argv.clientId) {
|
|
41
29
|
log(`Unsupported values received`);
|
|
42
30
|
throw Error(`"client-id" configuration is no longer supported, please check the latest docs for updated examples.`);
|
|
43
31
|
}
|
|
44
|
-
|
|
45
32
|
try {
|
|
46
33
|
const config = await (0, _common.readConfig)();
|
|
47
|
-
|
|
48
34
|
if (isValidExtension) {
|
|
49
35
|
log(`Writing ${_types.ConfigTypes.EXTENSIONS}`);
|
|
50
36
|
(0, _set.default)(config, argv.name, argv.value);
|
|
51
37
|
}
|
|
52
|
-
|
|
53
38
|
if (argv.baseUrl) {
|
|
54
39
|
log(`Writing ${_types.ConfigTypes.BASE_URL}`);
|
|
55
40
|
config[_types.ConfigTypes.BASE_URL] = argv.baseUrl;
|
|
56
41
|
}
|
|
57
|
-
|
|
58
42
|
if (argv.region) {
|
|
59
43
|
// verify passed value
|
|
60
44
|
const parsedValue = String(argv.region).toUpperCase();
|
|
61
|
-
|
|
62
45
|
if (!(parsedValue in _types.Regions)) {
|
|
63
46
|
throw Error(`"--region" value is not correct, please provide one of: ${Object.values(_types.Regions).sort().join(', ')}. For example: "axway central config set --region=US"`);
|
|
64
47
|
}
|
|
65
|
-
|
|
66
48
|
log(`Writing ${_types.ConfigTypes.REGION}`);
|
|
67
49
|
config[_types.ConfigTypes.REGION] = parsedValue;
|
|
68
50
|
}
|
|
69
|
-
|
|
70
51
|
if (argv.platform) {
|
|
71
52
|
const parsedValue = String(argv.platform).toLowerCase();
|
|
72
|
-
|
|
73
53
|
if (!(parsedValue in _types.Platforms)) {
|
|
74
54
|
throw Error(`"--platform" value is not correct, please provide one of: ${Object.values(_types.Platforms).sort().join(', ')}. For example: "axway central config set --platform=staging"`);
|
|
75
55
|
}
|
|
76
|
-
|
|
77
56
|
log(`Writing ${_types.ConfigTypes.PLATFORM}`);
|
|
78
57
|
config[_types.ConfigTypes.PLATFORM] = parsedValue;
|
|
79
58
|
}
|
|
80
|
-
|
|
81
59
|
if (argv.apicDeployment) {
|
|
82
60
|
log(`Writing ${_types.ConfigTypes.APIC_DEPLOYMENT}`);
|
|
83
|
-
|
|
84
61
|
if (!Object.values(_types.APICDeployments).includes(argv.apicDeployment)) {
|
|
85
62
|
throw Error(`"--apic-deployment" value is not correct, please provide one of: ${Object.values(_types.APICDeployments).sort().join(', ')}. For example: "axway central config set --apic-deployment=staging"`);
|
|
86
63
|
}
|
|
87
|
-
|
|
88
64
|
config[_types.ConfigTypes.APIC_DEPLOYMENT] = argv.apicDeployment;
|
|
89
|
-
}
|
|
90
|
-
|
|
65
|
+
}
|
|
91
66
|
|
|
67
|
+
// check for axway managed flag
|
|
92
68
|
if (argv.axwayManaged) {
|
|
93
69
|
log(`Writing ${_types.ConfigTypes.AXWAY_MANAGED}`);
|
|
94
70
|
config[_types.ConfigTypes.AXWAY_MANAGED] = true;
|
|
95
71
|
}
|
|
96
|
-
|
|
97
72
|
await (0, _fsExtra.outputJson)(_utils.configFile, config, {
|
|
98
73
|
spaces: '\t'
|
|
99
74
|
});
|
|
@@ -102,8 +77,7 @@ const action = async ({
|
|
|
102
77
|
throw e;
|
|
103
78
|
}
|
|
104
79
|
};
|
|
105
|
-
|
|
106
|
-
const setCommand = {
|
|
80
|
+
const setCommand = exports.setCommand = {
|
|
107
81
|
action,
|
|
108
82
|
desc: 'Set Central CLI settings',
|
|
109
83
|
options: {
|
|
@@ -125,5 +99,4 @@ const setCommand = {
|
|
|
125
99
|
}
|
|
126
100
|
},
|
|
127
101
|
args: ['[name]', '[value]']
|
|
128
|
-
};
|
|
129
|
-
exports.setCommand = setCommand;
|
|
102
|
+
};
|
|
@@ -4,19 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.unset = void 0;
|
|
7
|
-
|
|
8
7
|
var _cliKit = require("cli-kit");
|
|
9
|
-
|
|
10
8
|
var _CliConfigManager = require("../../common/CliConfigManager");
|
|
11
|
-
|
|
12
9
|
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
const {
|
|
17
12
|
log
|
|
18
13
|
} = (0, _cliKit.snooplogg)('central: config: unset');
|
|
19
|
-
|
|
20
14
|
const action = async ({
|
|
21
15
|
argv,
|
|
22
16
|
console
|
|
@@ -26,10 +20,8 @@ const action = async ({
|
|
|
26
20
|
} = argv;
|
|
27
21
|
const renderer = new _Renderer.default(console);
|
|
28
22
|
let isCmdError = false;
|
|
29
|
-
|
|
30
23
|
try {
|
|
31
24
|
const config = new _CliConfigManager.CliConfigManager();
|
|
32
|
-
|
|
33
25
|
for (const key of keys.split(',')) {
|
|
34
26
|
config.validate(key);
|
|
35
27
|
config.unset(key);
|
|
@@ -44,8 +36,7 @@ const action = async ({
|
|
|
44
36
|
if (isCmdError) process.exit(1);
|
|
45
37
|
}
|
|
46
38
|
};
|
|
47
|
-
|
|
48
|
-
const unset = {
|
|
39
|
+
const unset = exports.unset = {
|
|
49
40
|
action,
|
|
50
41
|
desc: 'Unset Axway Central configuration values',
|
|
51
42
|
args: [{
|
|
@@ -54,5 +45,4 @@ const unset = {
|
|
|
54
45
|
required: true,
|
|
55
46
|
type: 'string'
|
|
56
47
|
}]
|
|
57
|
-
};
|
|
58
|
-
exports.unset = unset;
|
|
48
|
+
};
|
|
@@ -4,29 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.agentResource = void 0;
|
|
7
|
-
|
|
8
7
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
-
|
|
10
8
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
|
-
|
|
12
9
|
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
13
|
-
|
|
14
10
|
var _types = require("../../common/types");
|
|
15
|
-
|
|
16
11
|
var _helpers = require("../install/helpers");
|
|
17
|
-
|
|
18
12
|
var _ApiServerClient = require("../../common/ApiServerClient");
|
|
19
|
-
|
|
20
13
|
var _DefinitionsManager = require("../../common/DefinitionsManager");
|
|
21
|
-
|
|
22
14
|
var _basicPrompts = require("../../common/basicPrompts");
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
16
|
const {
|
|
27
17
|
log
|
|
28
18
|
} = (0, _snooplogg.default)('central: create: agent-resource');
|
|
29
|
-
|
|
30
19
|
const action = async ({
|
|
31
20
|
argv,
|
|
32
21
|
console
|
|
@@ -37,8 +26,8 @@ const action = async ({
|
|
|
37
26
|
region
|
|
38
27
|
} = argv;
|
|
39
28
|
const render = new _Renderer.default(console);
|
|
40
|
-
let isCmdError = false;
|
|
41
|
-
|
|
29
|
+
let isCmdError = false;
|
|
30
|
+
// parameters - all prompts answered will update this object; needed for the configuration of agent resrouces
|
|
42
31
|
let parameters = {
|
|
43
32
|
agentType: '',
|
|
44
33
|
dataPlaneName: '',
|
|
@@ -49,49 +38,45 @@ const action = async ({
|
|
|
49
38
|
traceabilityAgentName: '',
|
|
50
39
|
ampcTraceabilityAgentName: ''
|
|
51
40
|
};
|
|
52
|
-
|
|
53
41
|
try {
|
|
54
42
|
const apiServerClient = new _ApiServerClient.ApiServerClient({
|
|
55
43
|
baseUrl,
|
|
56
44
|
account,
|
|
57
45
|
region
|
|
58
46
|
});
|
|
59
|
-
const defsManager = await new _DefinitionsManager.DefinitionsManager(apiServerClient).init();
|
|
47
|
+
const defsManager = await new _DefinitionsManager.DefinitionsManager(apiServerClient).init();
|
|
60
48
|
|
|
49
|
+
// Agent resource Type
|
|
61
50
|
parameters.agentType = await askAgentType();
|
|
62
51
|
const isDiscoveryAgent = parameters.agentType === _types.BundleType.DISCOVERY || parameters.agentType === _types.BundleType.ALL_AGENTS;
|
|
63
|
-
const isTraceabilityAgent = parameters.agentType === _types.BundleType.TRACEABILITY || parameters.agentType === _types.BundleType.ALL_AGENTS;
|
|
52
|
+
const isTraceabilityAgent = parameters.agentType === _types.BundleType.TRACEABILITY || parameters.agentType === _types.BundleType.ALL_AGENTS;
|
|
64
53
|
|
|
54
|
+
// environment
|
|
65
55
|
const environmentInfo = await (0, _helpers.askEnvironmentName)(apiServerClient, defsManager);
|
|
66
|
-
|
|
67
56
|
if (isDiscoveryAgent) {
|
|
68
57
|
// Discovery Agent Name
|
|
69
58
|
parameters.discoveryAgentName = await (0, _helpers.askAgentName)(apiServerClient, defsManager, _types.AgentTypes.da, environmentInfo.name);
|
|
70
59
|
}
|
|
71
|
-
|
|
72
60
|
if (isTraceabilityAgent) {
|
|
73
61
|
// Traceability Agent Name
|
|
74
62
|
parameters.traceabilityAgentName = await (0, _helpers.askAgentName)(apiServerClient, defsManager, _types.AgentTypes.ta, environmentInfo.name);
|
|
75
|
-
}
|
|
76
|
-
|
|
63
|
+
}
|
|
77
64
|
|
|
65
|
+
// dataplane name
|
|
78
66
|
parameters.dataPlaneName = await askDataPlaneName();
|
|
79
|
-
|
|
80
67
|
if (parameters.dataPlaneName == _types.DataPlaneNames.OTHER) {
|
|
81
68
|
parameters.dataPlaneName = await (0, _basicPrompts.askInput)({
|
|
82
69
|
msg: 'Enter the type of dataplane type'
|
|
83
70
|
});
|
|
84
|
-
}
|
|
85
|
-
|
|
71
|
+
}
|
|
86
72
|
|
|
73
|
+
// Create Environment Name if necessary
|
|
87
74
|
parameters.environmentName = environmentInfo.isNew ? await (0, _helpers.createByResourceType)(apiServerClient, defsManager, environmentInfo.name, 'Environment', 'env') : environmentInfo.name;
|
|
88
|
-
|
|
89
75
|
if (isDiscoveryAgent) {
|
|
90
76
|
// Create DiscoveryAgent Resource
|
|
91
77
|
parameters.ampcDiscoveryAgentName = await (0, _helpers.createNewAgentResource)(apiServerClient, defsManager, parameters.environmentName, parameters.dataPlaneName, _types.AgentResourceKind.da, _types.AgentTypes.da, parameters.teamName, parameters.discoveryAgentName);
|
|
92
78
|
console.log(_chalk.default.cyan(`To use this resource, add the following to your discovery agent's environment variables file: CENTRAL_AGENTNAME=${parameters.discoveryAgentName}\n`));
|
|
93
79
|
}
|
|
94
|
-
|
|
95
80
|
if (isTraceabilityAgent) {
|
|
96
81
|
// Create TraceabilityAgent Resource
|
|
97
82
|
parameters.ampcTraceabilityAgentName = await (0, _helpers.createNewAgentResource)(apiServerClient, defsManager, parameters.environmentName, parameters.dataPlaneName, _types.AgentResourceKind.ta, _types.AgentTypes.ta, parameters.teamName, parameters.traceabilityAgentName);
|
|
@@ -103,26 +88,21 @@ const action = async ({
|
|
|
103
88
|
isCmdError = true;
|
|
104
89
|
} finally {
|
|
105
90
|
log('command finished, error = ', isCmdError);
|
|
106
|
-
|
|
107
91
|
if (isCmdError) {
|
|
108
92
|
process.exit(1);
|
|
109
93
|
}
|
|
110
94
|
}
|
|
111
95
|
};
|
|
112
|
-
|
|
113
96
|
const askAgentType = async () => await (0, _basicPrompts.askList)({
|
|
114
97
|
msg: 'Select the type of agent resource(s) you want to create',
|
|
115
98
|
choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
|
|
116
99
|
});
|
|
117
|
-
|
|
118
100
|
const askDataPlaneName = async () => await (0, _basicPrompts.askList)({
|
|
119
101
|
msg: 'Select the type of dataplane you want to create',
|
|
120
102
|
choices: [_types.DataPlaneNames.AWS, _types.DataPlaneNames.AZURE, _types.DataPlaneNames.EDGE, _types.DataPlaneNames.OTHER]
|
|
121
103
|
});
|
|
122
|
-
|
|
123
|
-
const agentResource = {
|
|
104
|
+
const agentResource = exports.agentResource = {
|
|
124
105
|
aliases: ['agent-resource', 'agentresource'],
|
|
125
106
|
action,
|
|
126
107
|
desc: 'Create an agent resource'
|
|
127
|
-
};
|
|
128
|
-
exports.agentResource = agentResource;
|
|
108
|
+
};
|
|
@@ -4,21 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.environment = void 0;
|
|
7
|
-
|
|
8
7
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
-
|
|
10
8
|
var _dataService = require("../../common/dataService");
|
|
11
|
-
|
|
12
9
|
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
13
|
-
|
|
14
10
|
var _resultsRenderers = require("../../common/resultsRenderers");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
const {
|
|
19
13
|
log
|
|
20
14
|
} = (0, _snooplogg.default)('central: create: environment');
|
|
21
|
-
|
|
22
15
|
const action = async ({
|
|
23
16
|
argv,
|
|
24
17
|
console
|
|
@@ -32,7 +25,6 @@ const action = async ({
|
|
|
32
25
|
} = argv;
|
|
33
26
|
const render = new _Renderer.default(console, output).startSpin('Creating an environment');
|
|
34
27
|
let commandIsSuccessful = true;
|
|
35
|
-
|
|
36
28
|
try {
|
|
37
29
|
// send post request
|
|
38
30
|
const service = await (0, _dataService.dataService)({
|
|
@@ -43,13 +35,13 @@ const action = async ({
|
|
|
43
35
|
const response = await service.post('/management/v1alpha1/environments', {
|
|
44
36
|
name,
|
|
45
37
|
spec: {}
|
|
46
|
-
});
|
|
47
|
-
|
|
38
|
+
});
|
|
39
|
+
// render response
|
|
48
40
|
render.success(`"environment/${name}" has successfully been created.`, true);
|
|
49
41
|
output && (0, _resultsRenderers.renderResponse)(console, response, output);
|
|
50
42
|
} catch (e) {
|
|
51
|
-
log('command error', e);
|
|
52
|
-
|
|
43
|
+
log('command error', e);
|
|
44
|
+
// handleErrors(console, e, spinner);
|
|
53
45
|
render.anyError(e);
|
|
54
46
|
commandIsSuccessful = false;
|
|
55
47
|
} finally {
|
|
@@ -58,8 +50,7 @@ const action = async ({
|
|
|
58
50
|
!commandIsSuccessful && process.exit(1);
|
|
59
51
|
}
|
|
60
52
|
};
|
|
61
|
-
|
|
62
|
-
const environment = {
|
|
53
|
+
const environment = exports.environment = {
|
|
63
54
|
aliases: ['env'],
|
|
64
55
|
action,
|
|
65
56
|
desc: 'Create an environment with the specified name',
|
|
@@ -68,5 +59,4 @@ const environment = {
|
|
|
68
59
|
desc: 'Name of new environment',
|
|
69
60
|
required: true
|
|
70
61
|
}]
|
|
71
|
-
};
|
|
72
|
-
exports.environment = environment;
|
|
62
|
+
};
|