@axway/axway-central-cli 2.3.0-rc.4 → 2.5.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/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(DOSA) account
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 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
- proxies Manage API proxies
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
- ### Client id configuration
166
+ ### Account configuration
166
167
 
167
- **_Note: Only required for service accounts._**
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 --clientId=<Service Account Client ID>
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
- Preferred: save your DevOps account clientId for future operations.
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,11 +381,11 @@ 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 filter resources by title, tag, and attribute (see examples below).
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, 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 "get examples" below.
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
- Using the --query flag will override any --title, --tag or --attribute flags you use.
388
+ Note: Using the --query flag will override any --title, --tag or --attribute flags you use.
394
389
 
395
390
  ### get usage
396
391
 
@@ -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
- --client-id [value] Override your DevOps account's client ID
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
- environment Create an environment with the specified name
465
- service-account Create a service account
459
+ agent-resource Create an agent resource
460
+ environment Create an environment with the specified name
466
461
 
467
462
  CREATE OPTIONS:
468
- --client-id=<value> Override your DevOps account's client ID
469
- -f,--file=<path> Filename to use to create the resource
470
- -o,--output=<value> Additional output formats. One of: yaml|json
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
- --client-id=<value> Override your DevOps account's client ID
493
- -f,--file=<path> Filename to use to create the resource
494
- -o,--output=<value> Additional output formats. One of: yaml|json
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
- --client-id=<value> Override your DevOps account's client ID
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
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
- --no-cache Do not use cache when communicating with the server
576
- --client-id [value] Override your DevOps account's client ID
577
- -f, --file [path] Filename to use to delete the resource.
578
- --region [value] Override your region config
579
- -s, --scope [name] or [kind/name] Scope name or kind/name for scoped resources.
580
- --wait Wait for the resources to be completely deleted.
581
- -y, --yes Automatically reply "yes" to any command prompts.
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
- --client-id=<value> Override your DevOps account's client ID
613
- -o,--output=<value> Additional output formats. One of: yaml|json
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
- --client-id=<value> Override your DevOps account's client ID
630
- -o,--output=<value> Additional output formats. One of: yaml|json
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
- --client-id=<value> Override your DevOps account's client ID
657
- --region=<value> Override your region config
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
- --client-id=<value> Override your DevOps account's client ID
669
- --region=<value> Override your region config
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
@@ -5,10 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.apply = void 0;
7
7
 
8
+ var _chalk = _interopRequireDefault(require("chalk"));
9
+
8
10
  var _snooplogg = _interopRequireDefault(require("snooplogg"));
9
11
 
10
12
  var _ApiServerClient = require("../../common/ApiServerClient");
11
13
 
14
+ var _basicPrompts = require("../../common/basicPrompts");
15
+
12
16
  var _DefinitionsManager = require("../../common/DefinitionsManager");
13
17
 
14
18
  var _Renderer = _interopRequireDefault(require("../../common/Renderer"));
@@ -29,11 +33,12 @@ const action = async ({
29
33
  }) => {
30
34
  const {
31
35
  baseUrl,
32
- clientId,
36
+ account,
33
37
  file,
34
38
  output,
35
39
  region,
36
- cache
40
+ cache,
41
+ yes
37
42
  } = argv;
38
43
  let isCmdError = false; // need to verify args here since if "-f" is required
39
44
  // cli-kit is also enforcing it on sub-commands
@@ -45,7 +50,8 @@ const action = async ({
45
50
  let results = {
46
51
  created: {
47
52
  success: [],
48
- error: []
53
+ error: [],
54
+ warning: []
49
55
  },
50
56
  updated: {
51
57
  success: [],
@@ -53,24 +59,43 @@ const action = async ({
53
59
  }
54
60
  };
55
61
  const render = new _Renderer.default(console, output).startSpin('Creating or updating resource(s)');
56
- const client = new _ApiServerClient.ApiServerClient(baseUrl, clientId, region, cache);
62
+ const client = new _ApiServerClient.ApiServerClient({
63
+ baseUrl,
64
+ region,
65
+ useCache: cache,
66
+ account
67
+ });
57
68
  const defsManager = new _DefinitionsManager.DefinitionsManager(client);
58
69
  log(`executing api calls`);
59
70
 
60
71
  try {
61
72
  await defsManager.init();
62
73
  log(`loading and verifying specs`);
63
- const docs = (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
74
+ const {
75
+ docs,
76
+ isMissingName
77
+ } = await (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
78
+
79
+ if (!yes && isMissingName) {
80
+ render.stopSpin();
81
+ if ((await (0, _basicPrompts.askList)({
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?`,
83
+ choices: _types.YesNoChoices,
84
+ default: _types.YesNo.Yes
85
+ })) === _types.YesNo.No) process.exit(1);
86
+ render.startSpin('Creating or updating resource(s)');
87
+ }
88
+
64
89
  const sortedKindsMap = defsManager.getSortedKindsMap();
65
90
  results = await client.bulkCreateOrUpdate(docs, sortedKindsMap);
66
- render.bulkCreateOrUpdateResult(results, 'has successfully been created.', 'has successfully been updated.');
91
+ render.bulkCreateOrUpdateResult(results, 'has successfully been created.', 'has successfully been updated.', 'was created with an autogenerated logical name.');
67
92
  isCmdError = results.created.error.length > 0 || results.updated.error.length > 0;
68
93
  } catch (e) {
69
94
  log('command error', e);
70
95
  isCmdError = true; // if some calls completed, rendering the result
71
96
 
72
97
  if (results.created.success.length || results.updated.success.length) {
73
- render.bulkCreateOrUpdateResult(results, 'has successfully been created.', 'has successfully been updated.');
98
+ render.bulkCreateOrUpdateResult(results, 'has successfully been created.', 'has successfully been updated.', 'was created with an autogenerated logical name.');
74
99
  }
75
100
 
76
101
  render.anyError(e);
@@ -92,7 +117,8 @@ const apply = {
92
117
  '-f, --file [path]': {
93
118
  desc: `Filename to use to create or update the resources. One of: yaml | json`,
94
119
  type: 'string'
95
- }
120
+ },
121
+ '-y, --yes': 'Automatically reply "yes" to any command prompts.'
96
122
  }
97
123
  };
98
124
  exports.apply = apply;
@@ -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
- return;
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
- '--client-id [value]': "Set your DevOps account's client ID",
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
- clientId,
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(baseUrl, clientId, region);
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 _errorHandler = require("../../common/errorHandler");
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
- clientId,
28
+ account,
33
29
  name,
34
30
  output,
35
31
  region
36
32
  } = argv;
37
- const spinner = process.env['DEBUG'] || !!output ? null : (0, _ora.default)({
38
- spinner: 'dots3',
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
- clientId,
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
- spinner && spinner.succeed((0, _cliKit.chalk)`{greenBright "environment/${name}" has successfully been created.}`);
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
- (0, _errorHandler.handleErrors)(console, e, spinner);
51
+ log('command error', e); // handleErrors(console, e, spinner);
52
+
53
+ render.anyError(e);
54
+ commandIsSuccessful = false;
59
55
  } finally {
60
- log('command successful');
61
- spinner && spinner.stop();
56
+ log(`command finished, success = ${commandIsSuccessful}`);
57
+ render.stopSpin();
58
+ !commandIsSuccessful && process.exit(1);
62
59
  }
63
60
  };
64
61
 
@@ -23,6 +23,10 @@ var _serviceAccount = require("./serviceAccount");
23
23
 
24
24
  var _agentResource = require("./agentResource");
25
25
 
26
+ var _basicPrompts = require("../../common/basicPrompts");
27
+
28
+ var _chalk = _interopRequireDefault(require("chalk"));
29
+
26
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
31
 
28
32
  const {
@@ -35,32 +39,53 @@ const action = async ({
35
39
  }) => {
36
40
  const {
37
41
  baseUrl,
38
- clientId,
42
+ account,
39
43
  file,
40
44
  output,
41
45
  region,
42
- cache
46
+ cache,
47
+ yes
43
48
  } = argv;
44
49
  let commandIsSuccessful = false; // need to verify args here since if "-f" is required
45
50
  // cli-kit is also enforcing it on sub-commands
46
51
 
47
52
  log(`verifying args`);
48
- if (!file) throw new Error('To create an environment from a file, please provide -f, --file [path] option');
53
+ if (!file) throw new Error('To create resources from a file, please provide -f, --file [path] option');
49
54
  log(`verifying file: ${file}`);
50
55
  (0, _utils.verifyFile)(file);
51
56
  let results = {
52
57
  success: [],
53
- error: []
58
+ error: [],
59
+ warning: []
54
60
  };
55
61
  const render = new _Renderer.default(console, output).startSpin('Creating resource(s)');
56
- const client = new _ApiServerClient.ApiServerClient(baseUrl, clientId, region, cache);
62
+ const client = new _ApiServerClient.ApiServerClient({
63
+ baseUrl,
64
+ account,
65
+ region,
66
+ useCache: cache
67
+ });
57
68
  const defsManager = new _DefinitionsManager.DefinitionsManager(client);
58
69
  log(`executing api calls`);
59
70
 
60
71
  try {
61
72
  await defsManager.init();
62
73
  log(`loading and verifying specs`);
63
- const docs = (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
74
+ const {
75
+ docs,
76
+ isMissingName
77
+ } = await (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
78
+
79
+ if (!yes && isMissingName) {
80
+ render.stopSpin();
81
+ if ((await (0, _basicPrompts.askList)({
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?`,
83
+ choices: _types.YesNoChoices,
84
+ default: _types.YesNo.Yes
85
+ })) === _types.YesNo.No) process.exit(1);
86
+ render.startSpin('Creating resource(s)');
87
+ }
88
+
64
89
  const sortedKindsMap = defsManager.getSortedKindsMap();
65
90
  results = await client.bulkCreate(docs, sortedKindsMap);
66
91
  render.bulkResult(results, 'has successfully been created.');
@@ -94,7 +119,8 @@ const create = {
94
119
  '-f, --file [path]': {
95
120
  desc: `Filename to use to create the resource`,
96
121
  type: 'string'
97
- }
122
+ },
123
+ '-y, --yes': 'Automatically reply "yes" to any command prompts.'
98
124
  }
99
125
  };
100
126
  exports.create = create;
@@ -5,53 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.serviceAccount = void 0;
7
7
 
8
- var _snooplogg = _interopRequireDefault(require("snooplogg"));
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
- clientId,
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(baseUrl, clientId, region, cache);
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.`); // Prompt the confirmation if action will be executed on multiple resources
105
-
106
- if (!yes && matchingDefs.length > 1) {
107
- if ((await (0, _basicPrompts.askList)({
108
- msg: 'The resource may exist in many scopes, and multiple entities might be deleted. Do you want to continue?',
109
- choices: _types.YesNoChoices,
110
- default: _types.YesNo.Yes
111
- })) === _types.YesNo.No) process.exit(1);
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' : ''}`);
@@ -133,7 +153,9 @@ ${defsManager.getDefsTableForHelpMsg()}`);
133
153
  log(`executing api calls in bulk delete mode`);
134
154
  log(`verifying file: ${file}`);
135
155
  (0, _utils.verifyFile)(file);
136
- const docs = (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
156
+ const {
157
+ docs
158
+ } = await (0, _utils.loadAndVerifySpecs)(file, defsManager.getAllKindsList());
137
159
  bulkResults = await client.bulkDelete(docs, defsManager.getSortedKindsMap(), wait);
138
160
  render.bulkResult(bulkResults, 'has successfully been deleted.');
139
161
  isCmdError = !!bulkResults.error.length;