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