@axway/axway-central-cli 2.3.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -52
- package/dist/commands/apply/index.js +10 -4
- package/dist/commands/config/set.js +12 -7
- package/dist/commands/create/agentResource.js +6 -2
- package/dist/commands/create/environment.js +13 -16
- package/dist/commands/create/index.js +11 -5
- package/dist/commands/create/serviceAccount.js +5 -43
- package/dist/commands/delete/index.js +30 -10
- package/dist/commands/edit/environment.js +17 -18
- package/dist/commands/get/index.js +7 -2
- package/dist/commands/install/agents.js +17 -4
- package/dist/commands/install/helpers/inputs.js +19 -8
- package/dist/commands/install/helpers/templates/istioTemplates.js +6 -0
- package/dist/commands/install/platform.js +9 -12
- package/dist/commands/proxies/create.js +2 -0
- package/dist/commands/proxies/index.js +1 -0
- package/dist/commands/proxies/promote.js +2 -0
- package/dist/common/ApiCentralClient.js +11 -7
- package/dist/common/ApiServerClient.js +24 -19
- package/dist/common/CliConfigManager.js +22 -2
- package/dist/common/CoreConfigController.js +65 -42
- package/dist/common/PlatformClient.js +9 -5
- package/dist/common/Renderer.js +6 -6
- package/dist/common/dataService.js +2 -2
- package/dist/common/errorHandler.js +2 -5
- package/dist/common/types.js +3 -5
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ Log in to the [Axway Amplify Platform](https://www.axway.com/en/products/amplify
|
|
|
97
97
|
```bash
|
|
98
98
|
# If using a regular account
|
|
99
99
|
axway auth login
|
|
100
|
-
# If using a service
|
|
100
|
+
# If using a service account
|
|
101
101
|
axway auth login --client-id <Service Account Client ID> --secret-file <Private Key>
|
|
102
102
|
```
|
|
103
103
|
|
|
@@ -121,14 +121,15 @@ USAGE: axway central <command> [options]
|
|
|
121
121
|
Manage APIs, services and publish to the Unified Catalog
|
|
122
122
|
|
|
123
123
|
Axway CENTRAL COMMANDS:
|
|
124
|
-
apply
|
|
125
|
-
completion
|
|
126
|
-
config
|
|
127
|
-
create
|
|
128
|
-
delete
|
|
129
|
-
edit
|
|
130
|
-
get
|
|
131
|
-
|
|
124
|
+
apply Update resources from a file
|
|
125
|
+
completion Output shell completion code
|
|
126
|
+
config Configure Central CLI settings
|
|
127
|
+
create Create one or more resources from a file or stdin
|
|
128
|
+
delete Delete resources
|
|
129
|
+
edit Edit and update resources by using the default editor
|
|
130
|
+
get List one or more resources
|
|
131
|
+
install Install additional platform resources
|
|
132
|
+
proxies Manage API proxies
|
|
132
133
|
```
|
|
133
134
|
|
|
134
135
|
# Commands reference:
|
|
@@ -162,23 +163,17 @@ You can always override current region setting in every command by adding option
|
|
|
162
163
|
axway central get environments --region=EU
|
|
163
164
|
```
|
|
164
165
|
|
|
165
|
-
###
|
|
166
|
+
### Account configuration
|
|
166
167
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
Axway Central CLI allows you to provide `--client-id` with every command you run.
|
|
168
|
+
In general, it is not needed to manipulate the `account` configuration. CLI should be able to detect the current default account. However, if you want to use a specific account Axway Central CLI allows you to provide `--account` with every command you run to override your `auth.defaultAccount` config in Axway CLI (you can check its value by running `axway config list` or `axway config get auth.defaultAccount`):
|
|
170
169
|
|
|
171
170
|
```bash
|
|
172
|
-
axway central get environments --
|
|
171
|
+
axway central get environments --account=<Desired account name>
|
|
172
|
+
# for example:
|
|
173
|
+
axway central get environments --account=amplify-cli:johndoe@axway.com
|
|
173
174
|
```
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
axway central config set --clientId=<Service Account Client ID>
|
|
179
|
-
# run commands without --client-id param
|
|
180
|
-
axway central get environments
|
|
181
|
-
```
|
|
176
|
+
You can also achieve same goal by running `axway config set auth.defaultAccount <desired account name>` command when needed. Keep in mind that this value is set automatically when you login to the platform using CLI.
|
|
182
177
|
|
|
183
178
|
### Extensions:
|
|
184
179
|
|
|
@@ -386,9 +381,9 @@ webhooks webh Webhook true
|
|
|
386
381
|
|
|
387
382
|
You can fetch resources by Resource, by Short Name, or by the specific Resource Name.
|
|
388
383
|
|
|
389
|
-
You can "simple filter" resources by title, tag, and attribute. These simple filters can be used independently or in combination(logical AND), i.e. you can filter by title AND tag AND attribute. However, they only support -singular- filters: you can only filter by
|
|
384
|
+
You can "simple filter" resources by title, tag, and attribute. These simple filters can be used independently or in combination(logical AND), i.e. you can filter by title AND tag AND attribute. However, they only support -singular- filters: you can only filter by _one_ tag, _one_ title, _one_ attribute at a time.
|
|
390
385
|
|
|
391
|
-
For more complex filtering and fetching(e.g. using logical OR, or filterieng by
|
|
386
|
+
For more complex filtering and fetching(e.g. using logical OR, or filterieng by _multiple_ tags, titles, attributes, and other filters), you can also query for resources that match [RSQL-formatted](https://github.com/jirutka/rsql-parser#grammar-and-semantic) query parameters you pass in. See the linked documentation for examples of RSQL query syntax, and the "get examples" below for sample usage.
|
|
392
387
|
|
|
393
388
|
Note: Using the --query flag will override any --title, --tag or --attribute flags you use.
|
|
394
389
|
|
|
@@ -405,7 +400,7 @@ GET ARGUMENTS:
|
|
|
405
400
|
GET OPTIONS:
|
|
406
401
|
--attribute [key=value] Attribute in key=value pair format to filter by
|
|
407
402
|
--no-cache Do not use cache when communicating with the server
|
|
408
|
-
--
|
|
403
|
+
--account [value] Override your default account config
|
|
409
404
|
-o, --output [value] Additional output formats. One of: yaml | json
|
|
410
405
|
-q, --query [RSQL query] RSQL-formatted query to search for filters that match specific parameters
|
|
411
406
|
--region [value] Override your region config
|
|
@@ -461,13 +456,16 @@ USAGE: axway central create <command> [options]
|
|
|
461
456
|
Create one or more resources from a file or stdin
|
|
462
457
|
|
|
463
458
|
CREATE COMMANDS:
|
|
464
|
-
|
|
465
|
-
|
|
459
|
+
agent-resource Create an agent resource
|
|
460
|
+
environment Create an environment with the specified name
|
|
466
461
|
|
|
467
462
|
CREATE OPTIONS:
|
|
468
|
-
--
|
|
469
|
-
-
|
|
470
|
-
-
|
|
463
|
+
--account [value] Override your default account config
|
|
464
|
+
--no-cache Do not use cache when communicating with the server
|
|
465
|
+
-f, --file [path] Filename to use to create the resource
|
|
466
|
+
-o, --output [value] Additional output formats. One of: yaml | json
|
|
467
|
+
--region [value] Override your region config
|
|
468
|
+
-y, --yes Automatically reply "yes" to any command prompts.
|
|
471
469
|
```
|
|
472
470
|
|
|
473
471
|
### create: multiple resources from a file
|
|
@@ -489,9 +487,12 @@ ENVIRONMENT ARGUMENTS:
|
|
|
489
487
|
name Name of new environment
|
|
490
488
|
|
|
491
489
|
CREATE OPTIONS:
|
|
492
|
-
--
|
|
493
|
-
-
|
|
494
|
-
-
|
|
490
|
+
--account [value] Override your default account config
|
|
491
|
+
--no-cache Do not use cache when communicating with the server
|
|
492
|
+
-f, --file [path] Filename to use to create the resource
|
|
493
|
+
-o, --output [value] Additional output formats. One of: yaml | json
|
|
494
|
+
--region [value] Override your region config
|
|
495
|
+
-y, --yes Automatically reply "yes" to any command prompts.
|
|
495
496
|
```
|
|
496
497
|
|
|
497
498
|
### create examples
|
|
@@ -503,8 +504,6 @@ axway central create env newenv
|
|
|
503
504
|
axway central create environment newenv -o yaml
|
|
504
505
|
# create multiple resources from file
|
|
505
506
|
axway central create -f ./some/folder/resources.yaml
|
|
506
|
-
# create a service account(DOSA)
|
|
507
|
-
axway central create service-account
|
|
508
507
|
# create an agent resource
|
|
509
508
|
axway central create agent-resource
|
|
510
509
|
```
|
|
@@ -523,9 +522,12 @@ USAGE: axway central apply [options]
|
|
|
523
522
|
Update resources from a file
|
|
524
523
|
|
|
525
524
|
APPLY OPTIONS:
|
|
526
|
-
--
|
|
527
|
-
-
|
|
528
|
-
-
|
|
525
|
+
--account [value] Override your default account config
|
|
526
|
+
--no-cache Do not use cache when communicating with the server
|
|
527
|
+
-f, --file [path] Filename to use to create or update the resources. One of: yaml | json
|
|
528
|
+
-o, --output [value] Additional output formats. One of: yaml | json
|
|
529
|
+
--region [value] Override your region config
|
|
530
|
+
-y, --yes Automatically reply "yes" to any command prompts.
|
|
529
531
|
```
|
|
530
532
|
|
|
531
533
|
### apply examples
|
|
@@ -572,13 +574,13 @@ DELETE ARGUMENTS:
|
|
|
572
574
|
args... Command arguments, run "axway central delete" to see the examples
|
|
573
575
|
|
|
574
576
|
DELETE OPTIONS:
|
|
575
|
-
--
|
|
576
|
-
--
|
|
577
|
-
-f, --file [path]
|
|
578
|
-
--region [value]
|
|
579
|
-
-s, --scope [name] or [kind/name]
|
|
580
|
-
--wait
|
|
581
|
-
-y, --yes
|
|
577
|
+
--account [value] Override your default account config
|
|
578
|
+
--no-cache Do not use cache when communicating with the server
|
|
579
|
+
-f, --file [path] Filename to use to delete the resource.
|
|
580
|
+
--region [value] Override your region config
|
|
581
|
+
-s, --scope [name] or [kind/name] Scope name or kind/name for scoped resources.
|
|
582
|
+
--wait Wait for the resources to be completely deleted.
|
|
583
|
+
-y, --yes Automatically reply "yes" to any command prompts.
|
|
582
584
|
```
|
|
583
585
|
|
|
584
586
|
### delete examples
|
|
@@ -609,8 +611,10 @@ EDIT COMMANDS:
|
|
|
609
611
|
environment Edit an environment with the specified name.
|
|
610
612
|
|
|
611
613
|
EDIT OPTIONS:
|
|
612
|
-
--
|
|
613
|
-
-
|
|
614
|
+
--account [value] Override your default account config
|
|
615
|
+
--no-cache Do not use cache when communicating with the server
|
|
616
|
+
-o, --output [value] Additional output formats. One of: yaml|json
|
|
617
|
+
--region [value] Override your region config
|
|
614
618
|
```
|
|
615
619
|
|
|
616
620
|
### edit: resource by name
|
|
@@ -626,8 +630,10 @@ ENVIRONMENT ARGUMENTS:
|
|
|
626
630
|
name Name of the environment
|
|
627
631
|
|
|
628
632
|
EDIT OPTIONS:
|
|
629
|
-
--
|
|
630
|
-
-
|
|
633
|
+
--account [value] Override your default account config
|
|
634
|
+
--no-cache Do not use cache when communicating with the server
|
|
635
|
+
-o, --output [value] Additional output formats. One of: yaml|json
|
|
636
|
+
--region [value] Override your region config
|
|
631
637
|
```
|
|
632
638
|
|
|
633
639
|
### edit examples
|
|
@@ -653,8 +659,9 @@ INSTALL ARGUMENTS:
|
|
|
653
659
|
args... Command arguments, run "axway central install" to see the examples
|
|
654
660
|
|
|
655
661
|
INSTALL OPTIONS:
|
|
656
|
-
--
|
|
657
|
-
--
|
|
662
|
+
--account [value] Override your default account config
|
|
663
|
+
--no-cache Do not use cache when communicating with the server
|
|
664
|
+
--region [value] Override your region config
|
|
658
665
|
```
|
|
659
666
|
|
|
660
667
|
### install: agents configuration
|
|
@@ -665,8 +672,9 @@ USAGE: axway central install agents [options]
|
|
|
665
672
|
Amplify API Gateway / Amazon API Gateway / Azure API Gateway / Istio
|
|
666
673
|
|
|
667
674
|
INSTALL OPTIONS:
|
|
668
|
-
--
|
|
669
|
-
--
|
|
675
|
+
--account [value] Override your default account config
|
|
676
|
+
--no-cache Do not use cache when communicating with the server
|
|
677
|
+
--region [value] Override your region config
|
|
670
678
|
```
|
|
671
679
|
|
|
672
680
|
### install examples
|
|
@@ -33,7 +33,7 @@ const action = async ({
|
|
|
33
33
|
}) => {
|
|
34
34
|
const {
|
|
35
35
|
baseUrl,
|
|
36
|
-
|
|
36
|
+
account,
|
|
37
37
|
file,
|
|
38
38
|
output,
|
|
39
39
|
region,
|
|
@@ -58,8 +58,13 @@ const action = async ({
|
|
|
58
58
|
error: []
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
const render = new _Renderer.default(console, output);
|
|
62
|
-
const client = new _ApiServerClient.ApiServerClient(
|
|
61
|
+
const render = new _Renderer.default(console, output).startSpin('Creating or updating resource(s)');
|
|
62
|
+
const client = new _ApiServerClient.ApiServerClient({
|
|
63
|
+
baseUrl,
|
|
64
|
+
region,
|
|
65
|
+
useCache: cache,
|
|
66
|
+
account
|
|
67
|
+
});
|
|
63
68
|
const defsManager = new _DefinitionsManager.DefinitionsManager(client);
|
|
64
69
|
log(`executing api calls`);
|
|
65
70
|
|
|
@@ -72,14 +77,15 @@ const action = async ({
|
|
|
72
77
|
} = await (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
|
|
73
78
|
|
|
74
79
|
if (!yes && isMissingName) {
|
|
80
|
+
render.stopSpin();
|
|
75
81
|
if ((await (0, _basicPrompts.askList)({
|
|
76
82
|
msg: `As your file contains resources with missing logical names, their logical names will be autogenerated. \nRun ${_chalk.default.cyan('axway central 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?`,
|
|
77
83
|
choices: _types.YesNoChoices,
|
|
78
84
|
default: _types.YesNo.Yes
|
|
79
85
|
})) === _types.YesNo.No) process.exit(1);
|
|
86
|
+
render.startSpin('Creating or updating resource(s)');
|
|
80
87
|
}
|
|
81
88
|
|
|
82
|
-
render.startSpin('Creating or updating resource(s)');
|
|
83
89
|
const sortedKindsMap = defsManager.getSortedKindsMap();
|
|
84
90
|
results = await client.bulkCreateOrUpdate(docs, sortedKindsMap);
|
|
85
91
|
render.bulkCreateOrUpdateResult(results, 'has successfully been created.', 'has successfully been updated.', 'was created with an autogenerated logical name.');
|
|
@@ -34,7 +34,12 @@ const action = async ({
|
|
|
34
34
|
|
|
35
35
|
if (!isValidRootConfig && !isValidExtension) {
|
|
36
36
|
log((0, _cliKit.chalk)`{magenta Allowed central config values weren't provided. Exiting...}`);
|
|
37
|
-
|
|
37
|
+
throw Error(` Allowed central config values weren't provided`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (argv.clientId) {
|
|
41
|
+
log(`Unsupported values received`);
|
|
42
|
+
throw Error(`"client-id" configuration is no longer supported, please check the latest docs for updated examples.`);
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
try {
|
|
@@ -45,11 +50,6 @@ const action = async ({
|
|
|
45
50
|
(0, _set.default)(config, argv.name, argv.value);
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
if (argv.clientId) {
|
|
49
|
-
log(`Writing ${_types.ConfigTypes.CLIENT_ID}`);
|
|
50
|
-
config[_types.ConfigTypes.CLIENT_ID] = argv.clientId;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
53
|
if (argv.baseUrl) {
|
|
54
54
|
log(`Writing ${_types.ConfigTypes.BASE_URL}`);
|
|
55
55
|
config[_types.ConfigTypes.BASE_URL] = argv.baseUrl;
|
|
@@ -107,7 +107,12 @@ const setCommand = {
|
|
|
107
107
|
action,
|
|
108
108
|
desc: 'Set Central CLI settings',
|
|
109
109
|
options: {
|
|
110
|
-
|
|
110
|
+
// TODO: client-id is no longer supported keeping for some time for validation purposes
|
|
111
|
+
// config rework is going to happen: https://jira.axway.com/browse/APIGOV-19737
|
|
112
|
+
'--client-id [value]': {
|
|
113
|
+
hidden: true,
|
|
114
|
+
descr: "Set your DevOps account's client ID"
|
|
115
|
+
},
|
|
111
116
|
'--region [value]': 'Set your region, one of: US or EU (US region is used by default if nothing set).',
|
|
112
117
|
'--base-url [value]': {
|
|
113
118
|
hidden: true
|
|
@@ -33,7 +33,7 @@ const action = async ({
|
|
|
33
33
|
}) => {
|
|
34
34
|
const {
|
|
35
35
|
baseUrl,
|
|
36
|
-
|
|
36
|
+
account,
|
|
37
37
|
region
|
|
38
38
|
} = argv;
|
|
39
39
|
const render = new _Renderer.default(console);
|
|
@@ -51,7 +51,11 @@ const action = async ({
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
try {
|
|
54
|
-
const apiServerClient = new _ApiServerClient.ApiServerClient(
|
|
54
|
+
const apiServerClient = new _ApiServerClient.ApiServerClient({
|
|
55
|
+
baseUrl,
|
|
56
|
+
account,
|
|
57
|
+
region
|
|
58
|
+
});
|
|
55
59
|
const defsManager = await new _DefinitionsManager.DefinitionsManager(apiServerClient).init(); // Agent resource Type
|
|
56
60
|
|
|
57
61
|
parameters.agentType = await askAgentType();
|
|
@@ -5,15 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.environment = void 0;
|
|
7
7
|
|
|
8
|
-
var _cliKit = require("cli-kit");
|
|
9
|
-
|
|
10
8
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
11
9
|
|
|
12
|
-
var _ora = _interopRequireDefault(require("ora"));
|
|
13
|
-
|
|
14
10
|
var _dataService = require("../../common/dataService");
|
|
15
11
|
|
|
16
|
-
var
|
|
12
|
+
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
17
13
|
|
|
18
14
|
var _resultsRenderers = require("../../common/resultsRenderers");
|
|
19
15
|
|
|
@@ -29,21 +25,19 @@ const action = async ({
|
|
|
29
25
|
}) => {
|
|
30
26
|
const {
|
|
31
27
|
baseUrl,
|
|
32
|
-
|
|
28
|
+
account,
|
|
33
29
|
name,
|
|
34
30
|
output,
|
|
35
31
|
region
|
|
36
32
|
} = argv;
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
text: 'Creating an environment'
|
|
40
|
-
}).start();
|
|
33
|
+
const render = new _Renderer.default(console, output).startSpin('Creating an environment');
|
|
34
|
+
let commandIsSuccessful = true;
|
|
41
35
|
|
|
42
36
|
try {
|
|
43
37
|
// send post request
|
|
44
38
|
const service = await (0, _dataService.dataService)({
|
|
45
39
|
baseUrl,
|
|
46
|
-
|
|
40
|
+
account,
|
|
47
41
|
region
|
|
48
42
|
});
|
|
49
43
|
const response = await service.post('/management/v1alpha1/environments', {
|
|
@@ -51,14 +45,17 @@ const action = async ({
|
|
|
51
45
|
spec: {}
|
|
52
46
|
}); // render response
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
render.success(`"environment/${name}" has successfully been created.`, true);
|
|
55
49
|
output && (0, _resultsRenderers.renderResponse)(console, response, output);
|
|
56
50
|
} catch (e) {
|
|
57
|
-
log('command error', e);
|
|
58
|
-
|
|
51
|
+
log('command error', e); // handleErrors(console, e, spinner);
|
|
52
|
+
|
|
53
|
+
render.anyError(e);
|
|
54
|
+
commandIsSuccessful = false;
|
|
59
55
|
} finally {
|
|
60
|
-
log(
|
|
61
|
-
|
|
56
|
+
log(`command finished, success = ${commandIsSuccessful}`);
|
|
57
|
+
render.stopSpin();
|
|
58
|
+
!commandIsSuccessful && process.exit(1);
|
|
62
59
|
}
|
|
63
60
|
};
|
|
64
61
|
|
|
@@ -39,7 +39,7 @@ const action = async ({
|
|
|
39
39
|
}) => {
|
|
40
40
|
const {
|
|
41
41
|
baseUrl,
|
|
42
|
-
|
|
42
|
+
account,
|
|
43
43
|
file,
|
|
44
44
|
output,
|
|
45
45
|
region,
|
|
@@ -50,7 +50,7 @@ const action = async ({
|
|
|
50
50
|
// cli-kit is also enforcing it on sub-commands
|
|
51
51
|
|
|
52
52
|
log(`verifying args`);
|
|
53
|
-
if (!file) throw new Error('To create
|
|
53
|
+
if (!file) throw new Error('To create resources from a file, please provide -f, --file [path] option');
|
|
54
54
|
log(`verifying file: ${file}`);
|
|
55
55
|
(0, _utils.verifyFile)(file);
|
|
56
56
|
let results = {
|
|
@@ -58,9 +58,14 @@ const action = async ({
|
|
|
58
58
|
error: [],
|
|
59
59
|
warning: []
|
|
60
60
|
};
|
|
61
|
-
const
|
|
61
|
+
const render = new _Renderer.default(console, output).startSpin('Creating resource(s)');
|
|
62
|
+
const client = new _ApiServerClient.ApiServerClient({
|
|
63
|
+
baseUrl,
|
|
64
|
+
account,
|
|
65
|
+
region,
|
|
66
|
+
useCache: cache
|
|
67
|
+
});
|
|
62
68
|
const defsManager = new _DefinitionsManager.DefinitionsManager(client);
|
|
63
|
-
const render = new _Renderer.default(console, output);
|
|
64
69
|
log(`executing api calls`);
|
|
65
70
|
|
|
66
71
|
try {
|
|
@@ -72,14 +77,15 @@ const action = async ({
|
|
|
72
77
|
} = await (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
|
|
73
78
|
|
|
74
79
|
if (!yes && isMissingName) {
|
|
80
|
+
render.stopSpin();
|
|
75
81
|
if ((await (0, _basicPrompts.askList)({
|
|
76
82
|
msg: `As your file contains resources with missing logical names, their logical names will be autogenerated. \nRun ${_chalk.default.cyan('axway central 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?`,
|
|
77
83
|
choices: _types.YesNoChoices,
|
|
78
84
|
default: _types.YesNo.Yes
|
|
79
85
|
})) === _types.YesNo.No) process.exit(1);
|
|
86
|
+
render.startSpin('Creating resource(s)');
|
|
80
87
|
}
|
|
81
88
|
|
|
82
|
-
render.startSpin('Creating resource(s)');
|
|
83
89
|
const sortedKindsMap = defsManager.getSortedKindsMap();
|
|
84
90
|
results = await client.bulkCreate(docs, sortedKindsMap);
|
|
85
91
|
render.bulkResult(results, 'has successfully been created.');
|
|
@@ -5,53 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.serviceAccount = void 0;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _ApiCentralClient = require("../../common/ApiCentralClient");
|
|
11
|
-
|
|
12
|
-
var _bashCommands = require("../../common/bashCommands");
|
|
13
|
-
|
|
14
|
-
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
15
|
-
|
|
16
|
-
var _helpers = require("../install/helpers");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
log
|
|
22
|
-
} = (0, _snooplogg.default)('central: create: service-account');
|
|
23
|
-
|
|
24
|
-
const action = async ({
|
|
25
|
-
argv,
|
|
26
|
-
console
|
|
27
|
-
}) => {
|
|
28
|
-
const {
|
|
29
|
-
baseUrl,
|
|
30
|
-
clientId,
|
|
31
|
-
region
|
|
32
|
-
} = argv;
|
|
33
|
-
const render = new _Renderer.default(console);
|
|
34
|
-
let isCmdError = false;
|
|
35
|
-
const apiCentralClient = new _ApiCentralClient.ApiCentralClient(baseUrl, clientId, region);
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
await (0, _bashCommands.isOpenSslInstalled)();
|
|
39
|
-
const dosaName = await (0, _helpers.askServiceAccountName)();
|
|
40
|
-
await (0, _helpers.createDosaAndCerts)(apiCentralClient, dosaName);
|
|
41
|
-
} catch (e) {
|
|
42
|
-
log('command error', e);
|
|
43
|
-
render.anyError(e);
|
|
44
|
-
isCmdError = true;
|
|
45
|
-
} finally {
|
|
46
|
-
log('command finished, error = ', isCmdError);
|
|
47
|
-
if (isCmdError) process.exit(1);
|
|
48
|
-
process.exit(0);
|
|
49
|
-
}
|
|
8
|
+
const action = async ({}) => {
|
|
9
|
+
throw new Error('Creating a service account via "central" is no longer supported. ' + 'Use the "axway" CLI instead. ' + 'Example: "axway service-account create [options]"');
|
|
50
10
|
};
|
|
51
11
|
|
|
52
12
|
const serviceAccount = {
|
|
53
13
|
aliases: ['service account', 'service-account', 'serviceaccount'],
|
|
54
14
|
action,
|
|
55
|
-
desc: 'Create a service account'
|
|
15
|
+
desc: 'Create a service account',
|
|
16
|
+
hidden: true // Hide this command line option since it's no longer supported.
|
|
17
|
+
|
|
56
18
|
};
|
|
57
19
|
exports.serviceAccount = serviceAccount;
|
|
@@ -33,7 +33,7 @@ const action = async ({
|
|
|
33
33
|
}) => {
|
|
34
34
|
const {
|
|
35
35
|
baseUrl,
|
|
36
|
-
|
|
36
|
+
account,
|
|
37
37
|
file,
|
|
38
38
|
wait,
|
|
39
39
|
args,
|
|
@@ -50,7 +50,12 @@ const action = async ({
|
|
|
50
50
|
error: []
|
|
51
51
|
};
|
|
52
52
|
const render = new _Renderer.default(console);
|
|
53
|
-
const client = new _ApiServerClient.ApiServerClient(
|
|
53
|
+
const client = new _ApiServerClient.ApiServerClient({
|
|
54
|
+
baseUrl,
|
|
55
|
+
account,
|
|
56
|
+
region,
|
|
57
|
+
useCache: cache
|
|
58
|
+
});
|
|
54
59
|
const defsManager = new _DefinitionsManager.DefinitionsManager(client);
|
|
55
60
|
|
|
56
61
|
if (file && args.length) {
|
|
@@ -101,14 +106,29 @@ ${defsManager.getDefsTableForHelpMsg()}`);
|
|
|
101
106
|
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;
|
|
102
107
|
}); // this should never happen, the filtering logic is probably invalid if true
|
|
103
108
|
|
|
104
|
-
if (!matchingDefs.length) throw Error(`can't find matching resource definitions.`); //
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
if (!matchingDefs.length) throw Error(`can't find matching resource definitions.`); // Ask user if it's okay to delete unless the "--yes" option is set.
|
|
110
|
+
// Note: Only prompt if it ends up deleting multiple associated resources.
|
|
111
|
+
|
|
112
|
+
if (!yes) {
|
|
113
|
+
let result = _types.YesNo.Yes;
|
|
114
|
+
|
|
115
|
+
if (!scope) {
|
|
116
|
+
result = await (0, _basicPrompts.askList)({
|
|
117
|
+
msg: 'Deleting this will delete all resources under its scope. Are you sure you want to do this?',
|
|
118
|
+
choices: _types.YesNoChoices,
|
|
119
|
+
default: _types.YesNo.No
|
|
120
|
+
});
|
|
121
|
+
} else if (matchingDefs.length > 1) {
|
|
122
|
+
result = await (0, _basicPrompts.askList)({
|
|
123
|
+
msg: 'The resource may exist in many scopes, and multiple entities might be deleted. Do you want to continue?',
|
|
124
|
+
choices: _types.YesNoChoices,
|
|
125
|
+
default: _types.YesNo.No
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (result === _types.YesNo.No) {
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
112
132
|
}
|
|
113
133
|
|
|
114
134
|
render.startSpin(`Deleting resources${wait ? ' and waiting for them to be deleted' : ''}`);
|
|
@@ -9,16 +9,14 @@ var _cliKit = require("cli-kit");
|
|
|
9
9
|
|
|
10
10
|
var _snooplogg = _interopRequireDefault(require("snooplogg"));
|
|
11
11
|
|
|
12
|
-
var _ora = _interopRequireDefault(require("ora"));
|
|
13
|
-
|
|
14
|
-
var _TmpFile = _interopRequireDefault(require("../../common/TmpFile"));
|
|
15
|
-
|
|
16
12
|
var _dataService = require("../../common/dataService");
|
|
17
13
|
|
|
18
|
-
var
|
|
14
|
+
var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
|
|
19
15
|
|
|
20
16
|
var _resultsRenderers = require("../../common/resultsRenderers");
|
|
21
17
|
|
|
18
|
+
var _TmpFile = _interopRequireDefault(require("../../common/TmpFile"));
|
|
19
|
+
|
|
22
20
|
var _utils = require("../../common/utils");
|
|
23
21
|
|
|
24
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -33,28 +31,26 @@ const action = async ({
|
|
|
33
31
|
}) => {
|
|
34
32
|
const {
|
|
35
33
|
baseUrl,
|
|
36
|
-
|
|
34
|
+
account,
|
|
37
35
|
name,
|
|
38
36
|
output,
|
|
39
37
|
region
|
|
40
38
|
} = argv;
|
|
41
39
|
log(`editing ${name} env`);
|
|
42
40
|
let file;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
text: `Fetching details of "environment/${name}".`
|
|
46
|
-
}).start();
|
|
41
|
+
let commandIsSuccessful = true;
|
|
42
|
+
const render = new _Renderer.default(console, output).startSpin(`Fetching details of "environment/${name}".`);
|
|
47
43
|
|
|
48
44
|
try {
|
|
49
45
|
const service = await (0, _dataService.dataService)({
|
|
50
46
|
baseUrl,
|
|
51
|
-
|
|
47
|
+
account,
|
|
52
48
|
region
|
|
53
49
|
});
|
|
54
50
|
let response = await service.get(`/management/v1alpha1/environments/${name}`);
|
|
55
51
|
file = new _TmpFile.default(response); // stop spinner or it will interfere stdio of editor
|
|
56
52
|
|
|
57
|
-
|
|
53
|
+
render.stopSpin();
|
|
58
54
|
const {
|
|
59
55
|
isUpdated
|
|
60
56
|
} = await file.edit();
|
|
@@ -63,22 +59,25 @@ const action = async ({
|
|
|
63
59
|
// intentionally taking just first doc even if user will provide more in the same file while editing.
|
|
64
60
|
const doc = (0, _utils.LEGACY_loadAndVerifySpecs)(file.path)[0];
|
|
65
61
|
response = await service.put(`/management/v1alpha1/environments/${name}`, doc);
|
|
66
|
-
|
|
62
|
+
render.success((0, _cliKit.chalk)`{greenBright "environment/${name}" has successfully been edited.}`); // render result if output flag has been provided
|
|
67
63
|
|
|
68
64
|
output && (0, _resultsRenderers.renderResponse)(console, response, output);
|
|
69
65
|
} else {
|
|
70
66
|
log('no changes has been made to file');
|
|
71
|
-
|
|
67
|
+
render.error('Edit cancelled, no changes made.');
|
|
72
68
|
file.delete();
|
|
69
|
+
commandIsSuccessful = false;
|
|
73
70
|
}
|
|
74
71
|
} catch (e) {
|
|
75
72
|
log('command error', e);
|
|
76
73
|
file && console.log(`A copy of your changes has been stored to "${file.path}".`);
|
|
77
|
-
|
|
74
|
+
render.anyError(e);
|
|
75
|
+
commandIsSuccessful = false;
|
|
78
76
|
} finally {
|
|
79
|
-
log(
|
|
80
|
-
file && file.delete();
|
|
81
|
-
|
|
77
|
+
log(`command finished, success = ${commandIsSuccessful}`);
|
|
78
|
+
file && commandIsSuccessful && file.delete();
|
|
79
|
+
render.stopSpin();
|
|
80
|
+
!commandIsSuccessful && process.exit(1);
|
|
82
81
|
}
|
|
83
82
|
};
|
|
84
83
|
|