@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
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.environment = void 0;
|
|
7
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
8
|
-
var _dataService = require("../../common/dataService");
|
|
9
|
-
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
10
|
-
var _resultsRenderers = require("../../common/resultsRenderers");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const {
|
|
13
|
-
log
|
|
14
|
-
} = (0, _snooplogg.default)('engage: create: environment');
|
|
15
|
-
const action = async ({
|
|
16
|
-
argv,
|
|
17
|
-
console
|
|
18
|
-
}) => {
|
|
19
|
-
const {
|
|
20
|
-
baseUrl,
|
|
21
|
-
account,
|
|
22
|
-
name,
|
|
23
|
-
output,
|
|
24
|
-
region
|
|
25
|
-
} = argv;
|
|
26
|
-
const render = new _Renderer.default(console, output).startSpin('Creating an environment');
|
|
27
|
-
let commandIsSuccessful = true;
|
|
28
|
-
try {
|
|
29
|
-
// send post request
|
|
30
|
-
const service = await (0, _dataService.dataService)({
|
|
31
|
-
baseUrl,
|
|
32
|
-
account,
|
|
33
|
-
region
|
|
34
|
-
});
|
|
35
|
-
const response = await service.post('/management/v1alpha1/environments', {
|
|
36
|
-
name,
|
|
37
|
-
spec: {}
|
|
38
|
-
});
|
|
39
|
-
// render response
|
|
40
|
-
render.success(`"environment/${name}" has successfully been created.`, true);
|
|
41
|
-
output && (0, _resultsRenderers.renderResponse)(console, response, output);
|
|
42
|
-
} catch (e) {
|
|
43
|
-
log('command error', e);
|
|
44
|
-
// handleErrors(console, e, spinner);
|
|
45
|
-
render.anyError(e);
|
|
46
|
-
commandIsSuccessful = false;
|
|
47
|
-
} finally {
|
|
48
|
-
log(`command finished, success = ${commandIsSuccessful}`);
|
|
49
|
-
render.stopSpin();
|
|
50
|
-
!commandIsSuccessful && process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const environment = exports.environment = {
|
|
54
|
-
aliases: ['env'],
|
|
55
|
-
action,
|
|
56
|
-
desc: 'Create an environment with the specified name',
|
|
57
|
-
args: [{
|
|
58
|
-
name: 'name',
|
|
59
|
-
desc: 'Name of new environment',
|
|
60
|
-
required: true
|
|
61
|
-
}]
|
|
62
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.create = void 0;
|
|
7
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
8
|
-
var _ApiServerClient = require("../../common/ApiServerClient");
|
|
9
|
-
var _DefinitionsManager = require("../../common/DefinitionsManager");
|
|
10
|
-
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
11
|
-
var _types = require("../../common/types");
|
|
12
|
-
var _utils = require("../../common/utils");
|
|
13
|
-
var _environment = require("./environment");
|
|
14
|
-
var _serviceAccount = require("./serviceAccount");
|
|
15
|
-
var _agentResource = require("./agentResource");
|
|
16
|
-
var _basicPrompts = require("../../common/basicPrompts");
|
|
17
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
18
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
-
const {
|
|
20
|
-
log
|
|
21
|
-
} = (0, _snooplogg.default)('engage: create');
|
|
22
|
-
const action = async ({
|
|
23
|
-
argv,
|
|
24
|
-
console
|
|
25
|
-
}) => {
|
|
26
|
-
const {
|
|
27
|
-
baseUrl,
|
|
28
|
-
account,
|
|
29
|
-
file,
|
|
30
|
-
output,
|
|
31
|
-
region,
|
|
32
|
-
cache,
|
|
33
|
-
yes
|
|
34
|
-
} = argv;
|
|
35
|
-
let commandIsSuccessful = false;
|
|
36
|
-
|
|
37
|
-
// need to verify args here since if "-f" is required
|
|
38
|
-
// cli-kit is also enforcing it on sub-commands
|
|
39
|
-
log(`verifying args`);
|
|
40
|
-
if (!file) throw new Error('To create resources from a file, please provide -f, --file [path] option');
|
|
41
|
-
log(`verifying file: ${file}`);
|
|
42
|
-
(0, _utils.verifyFile)(file);
|
|
43
|
-
let results = {
|
|
44
|
-
success: [],
|
|
45
|
-
error: [],
|
|
46
|
-
warning: []
|
|
47
|
-
};
|
|
48
|
-
const render = new _Renderer.default(console, output).startSpin('Creating resource(s)');
|
|
49
|
-
const client = new _ApiServerClient.ApiServerClient({
|
|
50
|
-
baseUrl,
|
|
51
|
-
account,
|
|
52
|
-
region,
|
|
53
|
-
useCache: cache
|
|
54
|
-
});
|
|
55
|
-
const defsManager = new _DefinitionsManager.DefinitionsManager(client);
|
|
56
|
-
log(`executing api calls`);
|
|
57
|
-
try {
|
|
58
|
-
await defsManager.init();
|
|
59
|
-
log(`loading and verifying specs`);
|
|
60
|
-
const {
|
|
61
|
-
docs,
|
|
62
|
-
isMissingName
|
|
63
|
-
} = await (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
|
|
64
|
-
if (!yes && isMissingName) {
|
|
65
|
-
render.stopSpin();
|
|
66
|
-
if ((await (0, _basicPrompts.askList)({
|
|
67
|
-
msg: `As your file contains resources with missing logical names, their logical names will be autogenerated. \nRun ${_chalk.default.cyan('axway engage create -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?`,
|
|
68
|
-
choices: _types.YesNoChoices,
|
|
69
|
-
default: _types.YesNo.Yes
|
|
70
|
-
})) === _types.YesNo.No) process.exit(1);
|
|
71
|
-
render.startSpin('Creating resource(s)');
|
|
72
|
-
}
|
|
73
|
-
const sortedKindsMap = defsManager.getSortedKindsMap();
|
|
74
|
-
results = await client.bulkCreate(docs, sortedKindsMap);
|
|
75
|
-
render.bulkResult(results, 'has successfully been created.');
|
|
76
|
-
commandIsSuccessful = !results.error.length;
|
|
77
|
-
} catch (e) {
|
|
78
|
-
log('command error', e);
|
|
79
|
-
// if some calls have been completed, rendering the result
|
|
80
|
-
if (results.success.length || results.error.length) render.bulkResult(results, 'has successfully been created.');
|
|
81
|
-
render.anyError(e);
|
|
82
|
-
} finally {
|
|
83
|
-
log(`command finished, success = ${commandIsSuccessful}`);
|
|
84
|
-
render.stopSpin();
|
|
85
|
-
!commandIsSuccessful && process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const create = exports.create = {
|
|
89
|
-
action,
|
|
90
|
-
commands: {
|
|
91
|
-
'service-account': _serviceAccount.serviceAccount,
|
|
92
|
-
environment: _environment.environment,
|
|
93
|
-
'agent-resource': _agentResource.agentResource
|
|
94
|
-
},
|
|
95
|
-
desc: 'Create one or more resources from a file or stdin',
|
|
96
|
-
options: {
|
|
97
|
-
..._types.commonCmdArgsDescription,
|
|
98
|
-
'-o, --output [value]': {
|
|
99
|
-
desc: `Additional output formats. One of: ${_types.OutputTypes.yaml} | ${_types.OutputTypes.json}`,
|
|
100
|
-
type: 'string'
|
|
101
|
-
},
|
|
102
|
-
// TODO: -f is propagated to sub commands is there any way to remove it?
|
|
103
|
-
'-f, --file [path]': {
|
|
104
|
-
desc: `Filename to use to create the resource`,
|
|
105
|
-
type: 'string'
|
|
106
|
-
},
|
|
107
|
-
'-y, --yes': 'Automatically reply "yes" to any command prompts.'
|
|
108
|
-
}
|
|
109
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.serviceAccount = void 0;
|
|
7
|
-
const action = async ({}) => {
|
|
8
|
-
throw new Error('Creating a service account via "engage" is no longer supported. ' + 'Use the "axway" CLI instead. ' + 'Example: "axway service-account create [options]"');
|
|
9
|
-
};
|
|
10
|
-
const serviceAccount = exports.serviceAccount = {
|
|
11
|
-
aliases: ['service account', 'service-account', 'serviceaccount'],
|
|
12
|
-
action,
|
|
13
|
-
desc: 'Create a service account',
|
|
14
|
-
hidden: true // Hide this command line option since it's no longer supported.
|
|
15
|
-
};
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.deleteCmd = 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: delete');
|
|
19
|
-
const action = async ({
|
|
20
|
-
argv,
|
|
21
|
-
console
|
|
22
|
-
}) => {
|
|
23
|
-
const {
|
|
24
|
-
baseUrl,
|
|
25
|
-
account,
|
|
26
|
-
file,
|
|
27
|
-
wait,
|
|
28
|
-
args,
|
|
29
|
-
region,
|
|
30
|
-
cache,
|
|
31
|
-
yes,
|
|
32
|
-
forceDelete
|
|
33
|
-
} = argv;
|
|
34
|
-
let isCmdError = true; // let's be pessimistic.
|
|
35
|
-
const typedResource = args[0];
|
|
36
|
-
const typedName = args[1];
|
|
37
|
-
let bulkResults = {
|
|
38
|
-
success: [],
|
|
39
|
-
error: []
|
|
40
|
-
};
|
|
41
|
-
const render = new _Renderer.default(console);
|
|
42
|
-
const client = new _ApiServerClient.ApiServerClient({
|
|
43
|
-
baseUrl,
|
|
44
|
-
account,
|
|
45
|
-
region,
|
|
46
|
-
useCache: cache
|
|
47
|
-
});
|
|
48
|
-
const defsManager = new _DefinitionsManager.DefinitionsManager(client);
|
|
49
|
-
if (file && args.length) {
|
|
50
|
-
render.error('Error: Invalid command arguments, please provide a file path or resource type and name.');
|
|
51
|
-
console.log(`\nUSAGE:
|
|
52
|
-
To delete resources by filenames:\t"axway engage delete -f/--file <path>
|
|
53
|
-
To delete a single resource:\t\t"axway engage delete <Resource> <Name>"`);
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
log(`load and verify specs`);
|
|
58
|
-
await defsManager.init();
|
|
59
|
-
const scope = (0, _utils.parseScopeParam)(argv.scope);
|
|
60
|
-
if (!file && !args.length) {
|
|
61
|
-
// user typed just "axway engage delete"
|
|
62
|
-
render.error('Error: You must specify the type and name of the resource to delete or a file path.');
|
|
63
|
-
console.log(`\nUSAGE:
|
|
64
|
-
|
|
65
|
-
To delete resources by filename:
|
|
66
|
-
${_chalk.default.cyan(`axway engage delete -f/--file <path>`)}\n
|
|
67
|
-
To delete a single non-scoped resource:
|
|
68
|
-
${_chalk.default.cyan(`axway engage delete <Resource> <Name>`)}\n
|
|
69
|
-
To delete a scoped resource in all scopes with a specific name without confirmation dialog:
|
|
70
|
-
${_chalk.default.cyan(`axway engage delete <Resource> <Name> -s/--scope <Scope Name> --yes`)}\n
|
|
71
|
-
To delete a scoped resource in a specific scope:
|
|
72
|
-
${_chalk.default.cyan(`axway engage delete <Resource> <Name> -s/--scope <Scope Kind>/<Scope Name>`)}\n
|
|
73
|
-
|
|
74
|
-
The server supports the following resources:
|
|
75
|
-
|
|
76
|
-
${defsManager.getDefsTableForHelpMsg()}`);
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
79
|
-
if (args.length) {
|
|
80
|
-
// SINGLE RESOURCE MODE
|
|
81
|
-
log(`executing api calls in single delete mode`);
|
|
82
|
-
const defs = defsManager.findDefsByWord(typedResource);
|
|
83
|
-
if (!defs) throw Error(`the server doesn't have a resource type "${typedResource}"`);
|
|
84
|
-
if (!typedName) throw Error('resource name is required.');
|
|
85
|
-
if (defs.every(defs => !!defs.scope) && !scope) throw Error(`scope name param (-s/--scope) is required for the scoped "${defs[0].resource.spec.kind}" resource.`);
|
|
86
|
-
(0, _utils.verifyScopeParam)(defsManager.getAllKindsList(), defs, scope);
|
|
87
|
-
|
|
88
|
-
// find needed defs by specified resource type + scope name + scope kind (if provided)
|
|
89
|
-
const matchingDefs = defs.filter(defs => {
|
|
90
|
-
var _defs$scope;
|
|
91
|
-
return scope && (scope.kind && scope.kind === ((_defs$scope = defs.scope) === null || _defs$scope === void 0 ? void 0 : _defs$scope.spec.kind) || !scope.kind && !!defs.scope) || !scope && !defs.scope;
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// this should never happen, the filtering logic is probably invalid if true
|
|
95
|
-
if (!matchingDefs.length) throw Error(`can't find matching resource definitions.`);
|
|
96
|
-
|
|
97
|
-
// Ask user if it's okay to delete unless the "--yes" option is set.
|
|
98
|
-
// Note: Only prompt if it ends up deleting multiple associated resources.
|
|
99
|
-
if (!yes) {
|
|
100
|
-
let result = _types.YesNo.Yes;
|
|
101
|
-
if (!scope) {
|
|
102
|
-
result = await (0, _basicPrompts.askList)({
|
|
103
|
-
msg: 'Deleting this will delete all resources under its scope. Are you sure you want to do this?',
|
|
104
|
-
choices: _types.YesNoChoices,
|
|
105
|
-
default: _types.YesNo.No
|
|
106
|
-
});
|
|
107
|
-
} else if (matchingDefs.length > 1) {
|
|
108
|
-
result = await (0, _basicPrompts.askList)({
|
|
109
|
-
msg: 'The resource may exist in many scopes, and multiple entities might be deleted. Do you want to continue?',
|
|
110
|
-
choices: _types.YesNoChoices,
|
|
111
|
-
default: _types.YesNo.No
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
if (result === _types.YesNo.No) {
|
|
115
|
-
process.exit(1);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Ask user if it's okay to delete when "--forceDelete" option is set.
|
|
120
|
-
if (!yes && forceDelete) {
|
|
121
|
-
let result = _types.YesNo.Yes;
|
|
122
|
-
result = await (0, _basicPrompts.askList)({
|
|
123
|
-
msg: 'Are you sure you want to force delete this resource?',
|
|
124
|
-
choices: _types.YesNoChoices,
|
|
125
|
-
default: _types.YesNo.No
|
|
126
|
-
});
|
|
127
|
-
if (result === _types.YesNo.No) {
|
|
128
|
-
process.exit(1);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
render.startSpin(`Deleting resources${wait ? ' and waiting for them to be deleted' : ''}`);
|
|
132
|
-
const results = await Promise.all(matchingDefs.map(async defs => client.deleteResourceByName({
|
|
133
|
-
resourceDef: defs.resource,
|
|
134
|
-
resourceName: typedName,
|
|
135
|
-
scopeDef: defs.scope,
|
|
136
|
-
scopeName: scope === null || scope === void 0 ? void 0 : scope.name,
|
|
137
|
-
wait,
|
|
138
|
-
forceDelete
|
|
139
|
-
})));
|
|
140
|
-
|
|
141
|
-
// considering the command successful if at least 1 response found
|
|
142
|
-
isCmdError = !results.filter(res => res.data !== null).length;
|
|
143
|
-
results.forEach(res => {
|
|
144
|
-
var _res$error, _res$error2;
|
|
145
|
-
// rendering errors only if the command is unsuccessful
|
|
146
|
-
if (isCmdError && (_res$error = res.error) !== null && _res$error !== void 0 && _res$error.length) render.anyError(res.error[0]);else if (!((_res$error2 = res.error) !== null && _res$error2 !== void 0 && _res$error2.length)) render.success(`${render.resourceAndScopeKinds(res.data)} has successfully been deleted.`); // mind the non-null assertion
|
|
147
|
-
});
|
|
148
|
-
} else if (file) {
|
|
149
|
-
// BULK MODE
|
|
150
|
-
render.startSpin(`Deleting resources${wait ? ' and waiting for them to be deleted' : ''}`);
|
|
151
|
-
log(`executing api calls in bulk delete mode`);
|
|
152
|
-
log(`verifying file: ${file}`);
|
|
153
|
-
(0, _utils.verifyFile)(file);
|
|
154
|
-
const {
|
|
155
|
-
docs
|
|
156
|
-
} = await (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
|
|
157
|
-
bulkResults = await client.bulkDelete(docs, defsManager.getSortedKindsMap(), wait, forceDelete);
|
|
158
|
-
render.bulkResult(bulkResults, 'has successfully been deleted.');
|
|
159
|
-
isCmdError = !!bulkResults.error.length;
|
|
160
|
-
}
|
|
161
|
-
} catch (e) {
|
|
162
|
-
log('command error', e);
|
|
163
|
-
// if some calls finished, rendering the result
|
|
164
|
-
if (bulkResults.success.length || bulkResults.error.length) render.bulkResult(bulkResults, 'has successfully been deleted.');
|
|
165
|
-
render.anyError(e);
|
|
166
|
-
} finally {
|
|
167
|
-
log(`command finished, success = ${!isCmdError}`);
|
|
168
|
-
render.stopSpin();
|
|
169
|
-
isCmdError && process.exit(1);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
const deleteCmd = exports.deleteCmd = {
|
|
173
|
-
action,
|
|
174
|
-
desc: 'Delete resources',
|
|
175
|
-
args: [{
|
|
176
|
-
name: 'args',
|
|
177
|
-
desc: 'Command arguments, run "axway engage delete" to see the examples',
|
|
178
|
-
multiple: true,
|
|
179
|
-
required: false,
|
|
180
|
-
type: 'string'
|
|
181
|
-
}],
|
|
182
|
-
options: {
|
|
183
|
-
..._types.commonCmdArgsDescription,
|
|
184
|
-
'-f, --file [path]': {
|
|
185
|
-
desc: `Filename to use to delete the resource.`,
|
|
186
|
-
type: 'string'
|
|
187
|
-
},
|
|
188
|
-
'-s, --scope [name] or [kind/name]': {
|
|
189
|
-
desc: `Scope name or kind/name for scoped resources.`,
|
|
190
|
-
type: 'string'
|
|
191
|
-
},
|
|
192
|
-
'-y, --yes': 'Automatically reply "yes" to any command prompts.',
|
|
193
|
-
'--wait': 'Wait for the resources to be completely deleted.',
|
|
194
|
-
'--forceDelete': 'Force delete a resource (Warning: Ignores finalizers on the resource and the resources scoped under it)'
|
|
195
|
-
}
|
|
196
|
-
};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.environment = void 0;
|
|
7
|
-
var _cliKit = require("cli-kit");
|
|
8
|
-
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
9
|
-
var _dataService = require("../../common/dataService");
|
|
10
|
-
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
11
|
-
var _resultsRenderers = require("../../common/resultsRenderers");
|
|
12
|
-
var _TmpFile = _interopRequireDefault(require("../../common/TmpFile"));
|
|
13
|
-
var _types = require("../../common/types");
|
|
14
|
-
var _utils = require("../../common/utils");
|
|
15
|
-
var _ApiServerClient = require("../../common/ApiServerClient");
|
|
16
|
-
var _DefinitionsManager = require("../../common/DefinitionsManager");
|
|
17
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
const {
|
|
19
|
-
log
|
|
20
|
-
} = (0, _snooplogg.default)('engage:edit:environment');
|
|
21
|
-
const action = async ({
|
|
22
|
-
argv,
|
|
23
|
-
console
|
|
24
|
-
}) => {
|
|
25
|
-
const {
|
|
26
|
-
baseUrl,
|
|
27
|
-
account,
|
|
28
|
-
name,
|
|
29
|
-
output,
|
|
30
|
-
region,
|
|
31
|
-
cache
|
|
32
|
-
} = argv;
|
|
33
|
-
log(`editing ${name} env`);
|
|
34
|
-
let file;
|
|
35
|
-
let commandIsSuccessful = true;
|
|
36
|
-
const render = new _Renderer.default(console, output).startSpin(`Fetching details of "environment/${name}".`);
|
|
37
|
-
try {
|
|
38
|
-
var _defsManager$findDefs, _defsManager$findDefs2;
|
|
39
|
-
const client = new _ApiServerClient.ApiServerClient({
|
|
40
|
-
baseUrl,
|
|
41
|
-
account,
|
|
42
|
-
region,
|
|
43
|
-
useCache: cache
|
|
44
|
-
});
|
|
45
|
-
const defsManager = new _DefinitionsManager.DefinitionsManager(client);
|
|
46
|
-
await defsManager.init();
|
|
47
|
-
const def = (_defsManager$findDefs = defsManager.findDefsByWord('env')) === null || _defsManager$findDefs === void 0 ? void 0 : (_defsManager$findDefs2 = _defsManager$findDefs.find(def => def)) === null || _defsManager$findDefs2 === void 0 ? void 0 : _defsManager$findDefs2.resource;
|
|
48
|
-
const service = await (0, _dataService.dataService)({
|
|
49
|
-
baseUrl,
|
|
50
|
-
account,
|
|
51
|
-
region
|
|
52
|
-
});
|
|
53
|
-
let response;
|
|
54
|
-
let version = "v1alpha1";
|
|
55
|
-
if (def) {
|
|
56
|
-
version = (0, _utils.getLatestServedAPIVersion)(def);
|
|
57
|
-
}
|
|
58
|
-
response = await service.get(`/management/${version}/environments/${name}`);
|
|
59
|
-
file = new _TmpFile.default(response);
|
|
60
|
-
// stop spinner or it will interfere stdio of editor
|
|
61
|
-
render.stopSpin();
|
|
62
|
-
const {
|
|
63
|
-
isUpdated
|
|
64
|
-
} = await file.edit();
|
|
65
|
-
if (isUpdated) {
|
|
66
|
-
// intentionally taking just first doc even if user will provide more in the same file while editing.
|
|
67
|
-
const {
|
|
68
|
-
docs
|
|
69
|
-
} = await (0, _utils.loadAndVerifySpecs)(file.path, new Set([_types.Kind.Environment]));
|
|
70
|
-
response = await service.put(`/management/${version}/environments/${name}`, docs[0]);
|
|
71
|
-
render.success((0, _cliKit.chalk)`{greenBright "environment/${name}" has successfully been edited.}`);
|
|
72
|
-
// render result if output flag has been provided
|
|
73
|
-
output && (0, _resultsRenderers.renderResponse)(console, response, output);
|
|
74
|
-
} else {
|
|
75
|
-
log('no changes has been made to file');
|
|
76
|
-
render.error('Edit cancelled, no changes made.');
|
|
77
|
-
file.delete();
|
|
78
|
-
commandIsSuccessful = false;
|
|
79
|
-
}
|
|
80
|
-
} catch (e) {
|
|
81
|
-
log('command error', e);
|
|
82
|
-
file && console.log(`A copy of your changes has been stored to "${file.path}".`);
|
|
83
|
-
render.anyError(e);
|
|
84
|
-
commandIsSuccessful = false;
|
|
85
|
-
} finally {
|
|
86
|
-
log(`command finished, success = ${commandIsSuccessful}`);
|
|
87
|
-
file && commandIsSuccessful && file.delete();
|
|
88
|
-
render.stopSpin();
|
|
89
|
-
!commandIsSuccessful && process.exit(1);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
const environment = exports.environment = {
|
|
93
|
-
aliases: ['env'],
|
|
94
|
-
action,
|
|
95
|
-
desc: 'Edit an environment with the specified name.',
|
|
96
|
-
args: [{
|
|
97
|
-
name: 'name',
|
|
98
|
-
desc: 'Name of the environment',
|
|
99
|
-
required: true
|
|
100
|
-
}]
|
|
101
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.edit = void 0;
|
|
7
|
-
var _cliKit = require("cli-kit");
|
|
8
|
-
var _environment = require("./environment");
|
|
9
|
-
var _types = require("../../common/types");
|
|
10
|
-
const edit = exports.edit = {
|
|
11
|
-
action: ({
|
|
12
|
-
console
|
|
13
|
-
}) => {
|
|
14
|
-
console.log(`${_cliKit.chalk.red('Error: Required resource not specified.')}\n\n` + `You must specify the type of resource to get.\n` + `See 'axway engage edit -h' for help and examples`);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
},
|
|
17
|
-
commands: {
|
|
18
|
-
environment: _environment.environment
|
|
19
|
-
},
|
|
20
|
-
desc: 'Edit and update resources by using the default editor',
|
|
21
|
-
options: {
|
|
22
|
-
..._types.commonCmdArgsDescription,
|
|
23
|
-
'-o, --output [value]': {
|
|
24
|
-
desc: `Additional output formats. One of: ${_types.OutputTypes.yaml}|${_types.OutputTypes.json}`,
|
|
25
|
-
type: 'string'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|