@axway/axway-central-cli 4.5.0 → 4.6.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/.security-profile-branches.json +18 -0
- package/package.json +1 -1
- package/dist/cli.js +0 -71
- package/dist/commands/apply/index.js +0 -112
- package/dist/commands/completion/index.js +0 -100
- package/dist/commands/config/common/index.js +0 -28
- package/dist/commands/config/index.js +0 -20
- package/dist/commands/config/list.js +0 -24
- package/dist/commands/config/set.js +0 -102
- package/dist/commands/config/unset.js +0 -48
- package/dist/commands/create/agentResource.js +0 -108
- package/dist/commands/create/environment.js +0 -62
- package/dist/commands/create/index.js +0 -109
- package/dist/commands/create/serviceAccount.js +0 -15
- package/dist/commands/delete/index.js +0 -196
- package/dist/commands/edit/environment.js +0 -101
- package/dist/commands/edit/index.js +0 -28
- package/dist/commands/get/index.js +0 -272
- package/dist/commands/install/agents.js +0 -290
- package/dist/commands/install/apigeexAgents.js +0 -223
- package/dist/commands/install/apigeexSaasAgents.js +0 -300
- package/dist/commands/install/awsAgents.js +0 -525
- package/dist/commands/install/awsSaasAgents.js +0 -508
- package/dist/commands/install/azureAgents.js +0 -242
- package/dist/commands/install/azureSaasAgents.js +0 -519
- package/dist/commands/install/backstageAgents.js +0 -167
- package/dist/commands/install/edgeAgents.js +0 -409
- package/dist/commands/install/gitHubSaasAgents.js +0 -294
- package/dist/commands/install/gitLabAgents.js +0 -178
- package/dist/commands/install/graylogAgent.js +0 -147
- package/dist/commands/install/helpers/creators.js +0 -359
- package/dist/commands/install/helpers/deleters.js +0 -36
- package/dist/commands/install/helpers/getters.js +0 -95
- package/dist/commands/install/helpers/index.js +0 -267
- package/dist/commands/install/helpers/inputs.js +0 -593
- package/dist/commands/install/helpers/regex.js +0 -67
- package/dist/commands/install/helpers/templates/apigeexTemplates.js +0 -109
- package/dist/commands/install/helpers/templates/awsTemplates.js +0 -129
- package/dist/commands/install/helpers/templates/azureTemplates.js +0 -125
- package/dist/commands/install/helpers/templates/backstageTemplates.js +0 -95
- package/dist/commands/install/helpers/templates/edgeTemplates.js +0 -360
- package/dist/commands/install/helpers/templates/gitLabTemplates.js +0 -66
- package/dist/commands/install/helpers/templates/graylogTemplates.js +0 -75
- package/dist/commands/install/helpers/templates/ibmAPIConnectTemplates.js +0 -116
- package/dist/commands/install/helpers/templates/istioTemplates.js +0 -214
- package/dist/commands/install/helpers/templates/kafkaTemplates.js +0 -194
- package/dist/commands/install/helpers/templates/sapApiPortalTemplates.js +0 -114
- package/dist/commands/install/helpers/templates/softwareAGWebMethodsTemplates.js +0 -93
- package/dist/commands/install/helpers/templates/traceableTemplates.js +0 -135
- package/dist/commands/install/helpers/templates/wso2Templates.js +0 -85
- package/dist/commands/install/helpers/util.js +0 -26
- package/dist/commands/install/ibmAPIConnectAgents.js +0 -213
- package/dist/commands/install/index.js +0 -36
- package/dist/commands/install/istioAgents.js +0 -346
- package/dist/commands/install/kafkaAgents.js +0 -303
- package/dist/commands/install/platform.js +0 -175
- package/dist/commands/install/sapApiPortalAgents.js +0 -198
- package/dist/commands/install/softwareAGWebMethodsAgents.js +0 -161
- package/dist/commands/install/swaggerHubSaasAgents.js +0 -272
- package/dist/commands/install/traceableAgents.js +0 -257
- package/dist/commands/install/traceableSaasAgents.js +0 -275
- package/dist/commands/install/wso2Agents.js +0 -163
- package/dist/commands/productize/helpers/productizationHelper.js +0 -408
- package/dist/commands/productize/index.js +0 -99
- package/dist/common/ApiServerClient.js +0 -1109
- package/dist/common/CacheController.js +0 -146
- package/dist/common/CliConfigManager.js +0 -76
- package/dist/common/CompositeError.js +0 -95
- package/dist/common/CoreConfigController.js +0 -174
- package/dist/common/DefinitionsManager.js +0 -298
- package/dist/common/Kubectl.js +0 -68
- package/dist/common/PlatformClient.js +0 -128
- package/dist/common/Renderer.js +0 -409
- package/dist/common/TmpFile.js +0 -96
- package/dist/common/bashCommands.js +0 -97
- package/dist/common/basicPrompts.js +0 -160
- package/dist/common/dataService.js +0 -312
- package/dist/common/errorHandler.js +0 -46
- package/dist/common/modules.d.js +0 -1
- package/dist/common/resultsRenderers.js +0 -164
- package/dist/common/types.js +0 -746
- package/dist/common/utils.js +0 -476
- package/dist/main.js +0 -8
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0",
|
|
3
|
+
"project": "Amplify - APIC CLI",
|
|
4
|
+
"repo_url": "https://git.ecd.axway.org/apigov/apicentral-cli",
|
|
5
|
+
"security_guide": "https://docs.axway.com/bundle/axway_resources/page/amplify_api_management_platform_security_white_paper.html",
|
|
6
|
+
"requirements": {
|
|
7
|
+
"fortify": false,
|
|
8
|
+
"irius-risk": false,
|
|
9
|
+
"pentest": false,
|
|
10
|
+
"twistlock": false,
|
|
11
|
+
"blackduck": true,
|
|
12
|
+
"third-party-policy-violation": false,
|
|
13
|
+
"appspider": false,
|
|
14
|
+
"insightvm": false
|
|
15
|
+
},
|
|
16
|
+
"suppressions": [
|
|
17
|
+
]
|
|
18
|
+
}
|
package/package.json
CHANGED
package/dist/cli.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.cliParams = void 0;
|
|
7
|
-
var _cliKit = _interopRequireDefault(require("cli-kit"));
|
|
8
|
-
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
-
var _relativeTime = _interopRequireDefault(require("dayjs/plugin/relativeTime"));
|
|
10
|
-
var _fsExtra = require("fs-extra");
|
|
11
|
-
var _apply = require("./commands/apply");
|
|
12
|
-
var _completion = require("./commands/completion");
|
|
13
|
-
var _config = require("./commands/config");
|
|
14
|
-
var _create = require("./commands/create");
|
|
15
|
-
var _delete = require("./commands/delete");
|
|
16
|
-
var _edit = require("./commands/edit");
|
|
17
|
-
var _get = require("./commands/get");
|
|
18
|
-
var _install = require("./commands/install");
|
|
19
|
-
var _utils = require("./common/utils");
|
|
20
|
-
var _productize = require("./commands/productize");
|
|
21
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
-
_dayjs.default.extend(_relativeTime.default);
|
|
23
|
-
require('tls').DEFAULT_ECDH_CURVE = 'auto';
|
|
24
|
-
(0, _utils.hbsCompare)();
|
|
25
|
-
const {
|
|
26
|
-
version
|
|
27
|
-
} = require('../package.json');
|
|
28
|
-
|
|
29
|
-
// Create the configFile if it doesn't exist yet and read all extensions on load
|
|
30
|
-
if (!(0, _fsExtra.existsSync)(_utils.configFile)) {
|
|
31
|
-
(0, _fsExtra.outputJsonSync)(_utils.configFile, {});
|
|
32
|
-
}
|
|
33
|
-
const extensions = [...Object.values((0, _fsExtra.readJsonSync)(_utils.configFile).extensions || {})];
|
|
34
|
-
|
|
35
|
-
// cliParams export only needed for "completion" command and its testing
|
|
36
|
-
const cliParams = exports.cliParams = {
|
|
37
|
-
title: 'Axway Engage CLI',
|
|
38
|
-
name: 'engage',
|
|
39
|
-
banner: '',
|
|
40
|
-
version,
|
|
41
|
-
commands: {
|
|
42
|
-
completion: _completion.completion,
|
|
43
|
-
apply: _apply.apply,
|
|
44
|
-
config: _config.config,
|
|
45
|
-
create: _create.create,
|
|
46
|
-
delete: _delete.deleteCmd,
|
|
47
|
-
edit: _edit.edit,
|
|
48
|
-
get: _get.get,
|
|
49
|
-
install: _install.install,
|
|
50
|
-
productize: _productize.productize
|
|
51
|
-
},
|
|
52
|
-
extensions
|
|
53
|
-
};
|
|
54
|
-
var _default = exports.default = new _cliKit.default({
|
|
55
|
-
title: 'Axway Central CLI',
|
|
56
|
-
name: 'central',
|
|
57
|
-
banner: '',
|
|
58
|
-
version,
|
|
59
|
-
commands: {
|
|
60
|
-
completion: _completion.completion,
|
|
61
|
-
apply: _apply.apply,
|
|
62
|
-
config: _config.config,
|
|
63
|
-
create: _create.create,
|
|
64
|
-
delete: _delete.deleteCmd,
|
|
65
|
-
edit: _edit.edit,
|
|
66
|
-
get: _get.get,
|
|
67
|
-
install: _install.install,
|
|
68
|
-
productize: _productize.productize
|
|
69
|
-
},
|
|
70
|
-
extensions
|
|
71
|
-
});
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.apply = void 0;
|
|
7
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
-
var _ApiServerClient = require("../../common/ApiServerClient");
|
|
10
|
-
var _basicPrompts = require("../../common/basicPrompts");
|
|
11
|
-
var _DefinitionsManager = require("../../common/DefinitionsManager");
|
|
12
|
-
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
13
|
-
var _types = require("../../common/types");
|
|
14
|
-
var _utils = require("../../common/utils");
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
const {
|
|
17
|
-
log
|
|
18
|
-
} = (0, _snooplogg.default)('engage: create');
|
|
19
|
-
const action = async ({
|
|
20
|
-
argv,
|
|
21
|
-
console
|
|
22
|
-
}) => {
|
|
23
|
-
const {
|
|
24
|
-
baseUrl,
|
|
25
|
-
account,
|
|
26
|
-
file,
|
|
27
|
-
output,
|
|
28
|
-
region,
|
|
29
|
-
cache,
|
|
30
|
-
yes,
|
|
31
|
-
language,
|
|
32
|
-
subresource
|
|
33
|
-
} = argv;
|
|
34
|
-
let isCmdError = false;
|
|
35
|
-
|
|
36
|
-
// need to verify args here since if "-f" is required
|
|
37
|
-
// cli-kit is also enforcing it on sub-commands
|
|
38
|
-
log(`verifying args`);
|
|
39
|
-
if (!file) throw new Error('File name is required, please provide -f, --file [path] option');
|
|
40
|
-
log(`verifying file: ${file}`);
|
|
41
|
-
(0, _utils.verifyFile)(file);
|
|
42
|
-
let results = [];
|
|
43
|
-
const render = new _Renderer.default(console, output).startSpin('Creating or updating resource(s)');
|
|
44
|
-
const client = new _ApiServerClient.ApiServerClient({
|
|
45
|
-
baseUrl,
|
|
46
|
-
region,
|
|
47
|
-
useCache: cache,
|
|
48
|
-
account
|
|
49
|
-
});
|
|
50
|
-
const defsManager = new _DefinitionsManager.DefinitionsManager(client);
|
|
51
|
-
log(`executing api calls`);
|
|
52
|
-
try {
|
|
53
|
-
await defsManager.init();
|
|
54
|
-
log(`loading and verifying specs`);
|
|
55
|
-
const {
|
|
56
|
-
docs,
|
|
57
|
-
isMissingName
|
|
58
|
-
} = await (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
|
|
59
|
-
if (!yes && isMissingName) {
|
|
60
|
-
render.stopSpin();
|
|
61
|
-
if ((await (0, _basicPrompts.askList)({
|
|
62
|
-
msg: `As your file contains resources with missing logical names, their logical names will be autogenerated. \nRun ${_chalk.default.cyan('axway engage apply -f <filepath> -o [yaml|json] -y > <output filepath>')} to capture the resource(s) with the autogenerated logical name(s) so you can use them again. \nNOTE: To suppress this prompt in the future, please use the '-y' flag. \nWould you like to continue *without* capturing the resource names in a new file?`,
|
|
63
|
-
choices: _types.YesNoChoices,
|
|
64
|
-
default: _types.YesNo.Yes
|
|
65
|
-
})) === _types.YesNo.No) process.exit(1);
|
|
66
|
-
render.startSpin('Creating or updating resource(s)');
|
|
67
|
-
}
|
|
68
|
-
const sortedKindsMap = defsManager.getSortedKindsMap();
|
|
69
|
-
results = await client.bulkCreateOrUpdate(docs, sortedKindsMap, language, subresource);
|
|
70
|
-
render.bulkCreateOrUpdateResult(results);
|
|
71
|
-
isCmdError = results.some(nextResult => {
|
|
72
|
-
var _nextResult$error$len, _nextResult$error;
|
|
73
|
-
return (_nextResult$error$len = (_nextResult$error = nextResult.error) === null || _nextResult$error === void 0 ? void 0 : _nextResult$error.length) !== null && _nextResult$error$len !== void 0 ? _nextResult$error$len : 0 > 0;
|
|
74
|
-
});
|
|
75
|
-
} catch (e) {
|
|
76
|
-
log('command error', e);
|
|
77
|
-
isCmdError = true;
|
|
78
|
-
if (results.some(nextResult => nextResult.data)) {
|
|
79
|
-
// Render the results that have completed.
|
|
80
|
-
render.bulkCreateOrUpdateResult(results);
|
|
81
|
-
}
|
|
82
|
-
render.anyError(e);
|
|
83
|
-
} finally {
|
|
84
|
-
log(`command finished, exit with error = ${isCmdError}`);
|
|
85
|
-
render.stopSpin();
|
|
86
|
-
if (isCmdError) process.exit(1);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
const apply = exports.apply = {
|
|
90
|
-
action,
|
|
91
|
-
desc: 'Update resources from a file',
|
|
92
|
-
options: {
|
|
93
|
-
..._types.commonCmdArgsDescription,
|
|
94
|
-
'-o, --output [value]': {
|
|
95
|
-
desc: `Additional output formats. One of: ${_types.OutputTypes.yaml} | ${_types.OutputTypes.json}`,
|
|
96
|
-
type: 'string'
|
|
97
|
-
},
|
|
98
|
-
'-f, --file [path]': {
|
|
99
|
-
desc: `Filename to use to create or update the resources. One of: yaml | json`,
|
|
100
|
-
type: 'string'
|
|
101
|
-
},
|
|
102
|
-
'-y, --yes': 'Automatically reply "yes" to any command prompts.',
|
|
103
|
-
'--language=[langCode]': {
|
|
104
|
-
desc: `Language Codes. One of: Comma Separated values of ${_types.LanguageTypes.French} | ${_types.LanguageTypes.US} | ${_types.LanguageTypes.German} | ${_types.LanguageTypes.Portugese}`,
|
|
105
|
-
type: 'string'
|
|
106
|
-
},
|
|
107
|
-
'--subresource=[name]': {
|
|
108
|
-
desc: 'Name of the 1 subresource to update. Will prevent main resource and all other subresources from being updated.',
|
|
109
|
-
type: 'string'
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.completion = void 0;
|
|
7
|
-
var _cli = require("../../cli");
|
|
8
|
-
const coreCliCmd = 'axway';
|
|
9
|
-
const completionZsh = `###-begin-amplify-central-completions-###
|
|
10
|
-
_amplify_central_completions()
|
|
11
|
-
{
|
|
12
|
-
local state
|
|
13
|
-
_arguments -C \\
|
|
14
|
-
{-f,--file=}':: :_files' \\
|
|
15
|
-
'1: :(engage)' \\
|
|
16
|
-
'*: :->cmd'
|
|
17
|
-
|
|
18
|
-
case $state in
|
|
19
|
-
cmd)
|
|
20
|
-
local reply
|
|
21
|
-
local si=$IFS
|
|
22
|
-
IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" ${coreCliCmd} central completion --get-completions "\${words[@]}"))
|
|
23
|
-
IFS=$si
|
|
24
|
-
_describe 'values' reply
|
|
25
|
-
;;
|
|
26
|
-
esac
|
|
27
|
-
}
|
|
28
|
-
compdef _amplify_central_completions amplify
|
|
29
|
-
###-end-amplify-central-completions-###
|
|
30
|
-
`;
|
|
31
|
-
const completionBash = `###-begin-amplify-central-completions-###
|
|
32
|
-
_amplify_central_completions()
|
|
33
|
-
{
|
|
34
|
-
local cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
35
|
-
local prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
36
|
-
local twoPrev="\${COMP_WORDS[COMP_CWORD-2]}"
|
|
37
|
-
local options=$(${coreCliCmd} engage completion --get-completions "\${COMP_WORDS[@]}")
|
|
38
|
-
|
|
39
|
-
case $COMP_CWORD in
|
|
40
|
-
1) COMPREPLY=("engage");;
|
|
41
|
-
2) COMPREPLY=($(compgen -W "$options" -- "$cur"));;
|
|
42
|
-
3) compopt +o default; COMPREPLY=();; # disable file completion
|
|
43
|
-
*)
|
|
44
|
-
if [ "$prev" == "-f" ] || \\
|
|
45
|
-
# the COMP_WORDBREAKS var includes '=' so --file= is handled as two words and comes out as '--file' '='
|
|
46
|
-
([ "$cur" == "=" ] && [ "$prev" == "--file" ]) || \\
|
|
47
|
-
([ "$prev" == "=" ] && [ "$twoPrev" == "--file" ]);
|
|
48
|
-
then
|
|
49
|
-
# add file completion
|
|
50
|
-
COMPREPLY=()
|
|
51
|
-
else
|
|
52
|
-
# disable file completion
|
|
53
|
-
compopt +o default; COMPREPLY=()
|
|
54
|
-
fi
|
|
55
|
-
;;
|
|
56
|
-
esac
|
|
57
|
-
}
|
|
58
|
-
complete -o default -F _amplify_central_completions amplify
|
|
59
|
-
###-end-amplify-central-completions-###
|
|
60
|
-
`;
|
|
61
|
-
const action = ({
|
|
62
|
-
argv,
|
|
63
|
-
console
|
|
64
|
-
}) => {
|
|
65
|
-
const {
|
|
66
|
-
args,
|
|
67
|
-
getCompletions,
|
|
68
|
-
zsh,
|
|
69
|
-
bash
|
|
70
|
-
} = argv;
|
|
71
|
-
if (getCompletions) {
|
|
72
|
-
if (args[0] === coreCliCmd && args[1] === 'engage' && args.length <= 3) {
|
|
73
|
-
/** get core commands from CLI-kit params */
|
|
74
|
-
Object.keys(_cli.cliParams.commands).forEach(cmd => console.log(cmd));
|
|
75
|
-
}
|
|
76
|
-
} else if (zsh) {
|
|
77
|
-
console.log(completionZsh);
|
|
78
|
-
} else if (bash) {
|
|
79
|
-
console.log(completionBash);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const completion = exports.completion = {
|
|
83
|
-
action,
|
|
84
|
-
args: ['args...'],
|
|
85
|
-
desc: 'Output shell completion code',
|
|
86
|
-
options: {
|
|
87
|
-
'--get-completions': {
|
|
88
|
-
type: 'bool',
|
|
89
|
-
hidden: true // used only by autocompletion script itself
|
|
90
|
-
},
|
|
91
|
-
'--zsh': {
|
|
92
|
-
type: 'bool',
|
|
93
|
-
desc: 'Autocompletion script for zsh.'
|
|
94
|
-
},
|
|
95
|
-
'--bash': {
|
|
96
|
-
type: 'bool',
|
|
97
|
-
desc: 'Autocompletion script for bash.'
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.readConfig = void 0;
|
|
7
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
8
|
-
var _fsExtra = require("fs-extra");
|
|
9
|
-
var _utils = require("../../../common/utils");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const {
|
|
12
|
-
log
|
|
13
|
-
} = (0, _snooplogg.default)('engage: config: common');
|
|
14
|
-
const readConfig = async () => {
|
|
15
|
-
log(`Reading config: ${_utils.configFile}`);
|
|
16
|
-
try {
|
|
17
|
-
if (!(0, _fsExtra.existsSync)(_utils.configFile)) {
|
|
18
|
-
return {}; // empty config file
|
|
19
|
-
}
|
|
20
|
-
// await so error can be handled below
|
|
21
|
-
const config = await (0, _fsExtra.readJson)(_utils.configFile);
|
|
22
|
-
return config;
|
|
23
|
-
} catch (err) {
|
|
24
|
-
log(`Error reading config file: ${err}`);
|
|
25
|
-
throw new Error(`Couldn't read config from ${_utils.configFile}`);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.readConfig = readConfig;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.config = void 0;
|
|
7
|
-
var _list = require("./list");
|
|
8
|
-
var _set = require("./set");
|
|
9
|
-
var _unset = require("./unset");
|
|
10
|
-
const config = exports.config = {
|
|
11
|
-
action: () => {
|
|
12
|
-
throw new Error(`Missing one of required commands: [list, set]`);
|
|
13
|
-
},
|
|
14
|
-
commands: {
|
|
15
|
-
list: _list.listCommand,
|
|
16
|
-
set: _set.setCommand,
|
|
17
|
-
unset: _unset.unset
|
|
18
|
-
},
|
|
19
|
-
desc: 'Configure Engage CLI settings'
|
|
20
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.listCommand = void 0;
|
|
7
|
-
var _common = require("./common");
|
|
8
|
-
const action = async ({
|
|
9
|
-
console
|
|
10
|
-
}) => {
|
|
11
|
-
try {
|
|
12
|
-
const config = await (0, _common.readConfig)();
|
|
13
|
-
console.log(config);
|
|
14
|
-
} catch (err) {
|
|
15
|
-
// report error and rethrow for proper exit code
|
|
16
|
-
console.error(err.message);
|
|
17
|
-
throw err;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const listCommand = exports.listCommand = {
|
|
21
|
-
action,
|
|
22
|
-
desc: 'View Engage CLI settings',
|
|
23
|
-
aliases: ['ls', 'view']
|
|
24
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.setCommand = void 0;
|
|
7
|
-
var _cliKit = require("cli-kit");
|
|
8
|
-
var _fsExtra = require("fs-extra");
|
|
9
|
-
var _set = _interopRequireDefault(require("lodash/set"));
|
|
10
|
-
var _types = require("../../common/types");
|
|
11
|
-
var _utils = require("../../common/utils");
|
|
12
|
-
var _common = require("./common");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
const {
|
|
15
|
-
log
|
|
16
|
-
} = (0, _cliKit.snooplogg)('engage: config: set');
|
|
17
|
-
const action = async ({
|
|
18
|
-
argv,
|
|
19
|
-
console
|
|
20
|
-
}) => {
|
|
21
|
-
var _argv$name;
|
|
22
|
-
const isValidRootConfig = argv.baseUrl || argv.clientId || argv.region || argv.platform || argv.apicDeployment;
|
|
23
|
-
const isValidExtension = ((_argv$name = argv.name) === null || _argv$name === void 0 ? void 0 : _argv$name.startsWith(`${_types.ConfigTypes.EXTENSIONS}.`)) && argv.value;
|
|
24
|
-
if (!isValidRootConfig && !isValidExtension) {
|
|
25
|
-
log((0, _cliKit.chalk)`{magenta Allowed engage config values weren't provided. Exiting...}`);
|
|
26
|
-
throw Error(` Allowed engage config values weren't provided`);
|
|
27
|
-
}
|
|
28
|
-
if (argv.clientId) {
|
|
29
|
-
log(`Unsupported values received`);
|
|
30
|
-
throw Error(`"client-id" configuration is no longer supported, please check the latest docs for updated examples.`);
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const config = await (0, _common.readConfig)();
|
|
34
|
-
if (isValidExtension) {
|
|
35
|
-
log(`Writing ${_types.ConfigTypes.EXTENSIONS}`);
|
|
36
|
-
(0, _set.default)(config, argv.name, argv.value);
|
|
37
|
-
}
|
|
38
|
-
if (argv.baseUrl) {
|
|
39
|
-
log(`Writing ${_types.ConfigTypes.BASE_URL}`);
|
|
40
|
-
config[_types.ConfigTypes.BASE_URL] = argv.baseUrl;
|
|
41
|
-
}
|
|
42
|
-
if (argv.region) {
|
|
43
|
-
// verify passed value
|
|
44
|
-
const parsedValue = String(argv.region).toUpperCase();
|
|
45
|
-
if (!(parsedValue in _types.Regions)) {
|
|
46
|
-
throw Error(`"--region" value is not correct, please provide one of: ${Object.values(_types.Regions).sort().join(', ')}. For example: "axway engage config set --region=US"`);
|
|
47
|
-
}
|
|
48
|
-
log(`Writing ${_types.ConfigTypes.REGION}`);
|
|
49
|
-
config[_types.ConfigTypes.REGION] = parsedValue;
|
|
50
|
-
}
|
|
51
|
-
if (argv.platform) {
|
|
52
|
-
const parsedValue = String(argv.platform).toLowerCase();
|
|
53
|
-
if (!(parsedValue in _types.Platforms)) {
|
|
54
|
-
throw Error(`"--platform" value is not correct, please provide one of: ${Object.values(_types.Platforms).sort().join(', ')}. For example: "axway engage config set --platform=staging"`);
|
|
55
|
-
}
|
|
56
|
-
log(`Writing ${_types.ConfigTypes.PLATFORM}`);
|
|
57
|
-
config[_types.ConfigTypes.PLATFORM] = parsedValue;
|
|
58
|
-
}
|
|
59
|
-
if (argv.apicDeployment) {
|
|
60
|
-
log(`Writing ${_types.ConfigTypes.APIC_DEPLOYMENT}`);
|
|
61
|
-
if (!Object.values(_types.APICDeployments).includes(argv.apicDeployment)) {
|
|
62
|
-
throw Error(`"--apic-deployment" value is not correct, please provide one of: ${Object.values(_types.APICDeployments).sort().join(', ')}. For example: "axway engage config set --apic-deployment=staging"`);
|
|
63
|
-
}
|
|
64
|
-
config[_types.ConfigTypes.APIC_DEPLOYMENT] = argv.apicDeployment;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// check for axway managed flag
|
|
68
|
-
if (argv.axwayManaged) {
|
|
69
|
-
log(`Writing ${_types.ConfigTypes.AXWAY_MANAGED}`);
|
|
70
|
-
config[_types.ConfigTypes.AXWAY_MANAGED] = true;
|
|
71
|
-
}
|
|
72
|
-
await (0, _fsExtra.outputJson)(_utils.configFile, config, {
|
|
73
|
-
spaces: '\t'
|
|
74
|
-
});
|
|
75
|
-
} catch (e) {
|
|
76
|
-
console.error(`Couldn't save config in ${_utils.configFile}`);
|
|
77
|
-
throw e;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
const setCommand = exports.setCommand = {
|
|
81
|
-
action,
|
|
82
|
-
desc: 'Set Engage CLI settings',
|
|
83
|
-
options: {
|
|
84
|
-
// TODO: client-id is no longer supported keeping for some time for validation purposes
|
|
85
|
-
// config rework is going to happen: https://jira.axway.com/browse/APIGOV-19737
|
|
86
|
-
'--client-id [value]': {
|
|
87
|
-
hidden: true,
|
|
88
|
-
descr: "Set your DevOps account's client ID"
|
|
89
|
-
},
|
|
90
|
-
'--region [value]': 'Set your region, one of: US or EU (US region is used by default if nothing set).',
|
|
91
|
-
'--base-url [value]': {
|
|
92
|
-
hidden: true
|
|
93
|
-
},
|
|
94
|
-
'--apic-deployment [value]': {
|
|
95
|
-
hidden: true
|
|
96
|
-
},
|
|
97
|
-
'--axway-managed': {
|
|
98
|
-
hidden: true
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
args: ['[name]', '[value]']
|
|
102
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.unset = void 0;
|
|
7
|
-
var _cliKit = require("cli-kit");
|
|
8
|
-
var _CliConfigManager = require("../../common/CliConfigManager");
|
|
9
|
-
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const {
|
|
12
|
-
log
|
|
13
|
-
} = (0, _cliKit.snooplogg)('engage: config: unset');
|
|
14
|
-
const action = async ({
|
|
15
|
-
argv,
|
|
16
|
-
console
|
|
17
|
-
}) => {
|
|
18
|
-
const {
|
|
19
|
-
keys
|
|
20
|
-
} = argv;
|
|
21
|
-
const renderer = new _Renderer.default(console);
|
|
22
|
-
let isCmdError = false;
|
|
23
|
-
try {
|
|
24
|
-
const config = new _CliConfigManager.CliConfigManager();
|
|
25
|
-
for (const key of keys.split(',')) {
|
|
26
|
-
config.validate(key);
|
|
27
|
-
config.unset(key);
|
|
28
|
-
renderer.success(`"${key}" has been successfully unset`);
|
|
29
|
-
}
|
|
30
|
-
} catch (e) {
|
|
31
|
-
log('command error', e);
|
|
32
|
-
isCmdError = true;
|
|
33
|
-
renderer.anyError(e);
|
|
34
|
-
} finally {
|
|
35
|
-
log('command complete');
|
|
36
|
-
if (isCmdError) process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const unset = exports.unset = {
|
|
40
|
-
action,
|
|
41
|
-
desc: 'Unset Axway engage configuration values',
|
|
42
|
-
args: [{
|
|
43
|
-
name: 'keys',
|
|
44
|
-
desc: 'Configuration values to unset (can be comma-separated values)',
|
|
45
|
-
required: true,
|
|
46
|
-
type: 'string'
|
|
47
|
-
}]
|
|
48
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.agentResource = void 0;
|
|
7
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
8
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
-
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
10
|
-
var _types = require("../../common/types");
|
|
11
|
-
var _helpers = require("../install/helpers");
|
|
12
|
-
var _ApiServerClient = require("../../common/ApiServerClient");
|
|
13
|
-
var _DefinitionsManager = require("../../common/DefinitionsManager");
|
|
14
|
-
var _basicPrompts = require("../../common/basicPrompts");
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
const {
|
|
17
|
-
log
|
|
18
|
-
} = (0, _snooplogg.default)('engage: create: agent-resource');
|
|
19
|
-
const action = async ({
|
|
20
|
-
argv,
|
|
21
|
-
console
|
|
22
|
-
}) => {
|
|
23
|
-
const {
|
|
24
|
-
baseUrl,
|
|
25
|
-
account,
|
|
26
|
-
region
|
|
27
|
-
} = argv;
|
|
28
|
-
const render = new _Renderer.default(console);
|
|
29
|
-
let isCmdError = false;
|
|
30
|
-
// parameters - all prompts answered will update this object; needed for the configuration of agent resrouces
|
|
31
|
-
let parameters = {
|
|
32
|
-
agentType: '',
|
|
33
|
-
dataPlaneName: '',
|
|
34
|
-
environmentName: '',
|
|
35
|
-
teamName: '',
|
|
36
|
-
discoveryAgentName: '',
|
|
37
|
-
ampcDiscoveryAgentName: '',
|
|
38
|
-
traceabilityAgentName: '',
|
|
39
|
-
ampcTraceabilityAgentName: ''
|
|
40
|
-
};
|
|
41
|
-
try {
|
|
42
|
-
const apiServerClient = new _ApiServerClient.ApiServerClient({
|
|
43
|
-
baseUrl,
|
|
44
|
-
account,
|
|
45
|
-
region
|
|
46
|
-
});
|
|
47
|
-
const defsManager = await new _DefinitionsManager.DefinitionsManager(apiServerClient).init();
|
|
48
|
-
|
|
49
|
-
// Agent resource Type
|
|
50
|
-
parameters.agentType = await askAgentType();
|
|
51
|
-
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;
|
|
53
|
-
|
|
54
|
-
// environment
|
|
55
|
-
const environmentInfo = await (0, _helpers.askEnvironmentName)(apiServerClient, defsManager);
|
|
56
|
-
if (isDiscoveryAgent) {
|
|
57
|
-
// Discovery Agent Name
|
|
58
|
-
parameters.discoveryAgentName = await (0, _helpers.askAgentName)(apiServerClient, defsManager, _types.AgentTypes.da, environmentInfo.name);
|
|
59
|
-
}
|
|
60
|
-
if (isTraceabilityAgent) {
|
|
61
|
-
// Traceability Agent Name
|
|
62
|
-
parameters.traceabilityAgentName = await (0, _helpers.askAgentName)(apiServerClient, defsManager, _types.AgentTypes.ta, environmentInfo.name);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// dataplane name
|
|
66
|
-
parameters.dataPlaneName = await askDataPlaneName();
|
|
67
|
-
if (parameters.dataPlaneName == _types.DataPlaneNames.OTHER) {
|
|
68
|
-
parameters.dataPlaneName = await (0, _basicPrompts.askInput)({
|
|
69
|
-
msg: 'Enter the type of dataplane type'
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Create Environment Name if necessary
|
|
74
|
-
parameters.environmentName = environmentInfo.isNew ? await (0, _helpers.createByResourceType)(apiServerClient, defsManager, environmentInfo.name, 'Environment', 'env') : environmentInfo.name;
|
|
75
|
-
if (isDiscoveryAgent) {
|
|
76
|
-
// Create DiscoveryAgent Resource
|
|
77
|
-
parameters.ampcDiscoveryAgentName = await (0, _helpers.createNewAgentResource)(apiServerClient, defsManager, parameters.environmentName, parameters.dataPlaneName, _types.AgentResourceKind.da, _types.AgentTypes.da, parameters.teamName, parameters.discoveryAgentName);
|
|
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`));
|
|
79
|
-
}
|
|
80
|
-
if (isTraceabilityAgent) {
|
|
81
|
-
// Create TraceabilityAgent Resource
|
|
82
|
-
parameters.ampcTraceabilityAgentName = await (0, _helpers.createNewAgentResource)(apiServerClient, defsManager, parameters.environmentName, parameters.dataPlaneName, _types.AgentResourceKind.ta, _types.AgentTypes.ta, parameters.teamName, parameters.traceabilityAgentName);
|
|
83
|
-
console.log(_chalk.default.cyan(`To use this resource, add the following to your traceability agent's environment variables file: CENTRAL_AGENTNAME=${parameters.traceabilityAgentName}`));
|
|
84
|
-
}
|
|
85
|
-
} catch (e) {
|
|
86
|
-
log('command error', e);
|
|
87
|
-
render.anyError(e);
|
|
88
|
-
isCmdError = true;
|
|
89
|
-
} finally {
|
|
90
|
-
log('command finished, error = ', isCmdError);
|
|
91
|
-
if (isCmdError) {
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const askAgentType = async () => await (0, _basicPrompts.askList)({
|
|
97
|
-
msg: 'Select the type of agent resource(s) you want to create',
|
|
98
|
-
choices: [_types.BundleType.ALL_AGENTS, _types.BundleType.DISCOVERY, _types.BundleType.TRACEABILITY]
|
|
99
|
-
});
|
|
100
|
-
const askDataPlaneName = async () => await (0, _basicPrompts.askList)({
|
|
101
|
-
msg: 'Select the type of dataplane you want to create',
|
|
102
|
-
choices: [_types.DataPlaneNames.AWS, _types.DataPlaneNames.AZURE, _types.DataPlaneNames.EDGE, _types.DataPlaneNames.OTHER]
|
|
103
|
-
});
|
|
104
|
-
const agentResource = exports.agentResource = {
|
|
105
|
-
aliases: ['agent-resource', 'agentresource'],
|
|
106
|
-
action,
|
|
107
|
-
desc: 'Create an agent resource'
|
|
108
|
-
};
|