@dishantlangayan/solace-cloud-cli 0.1.0 → 0.2.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 +106 -23
- package/dist/commands/missionctrl/broker/create.d.ts +3 -4
- package/dist/commands/missionctrl/broker/create.js +3 -14
- package/dist/commands/missionctrl/broker/delete.d.ts +3 -4
- package/dist/commands/missionctrl/broker/delete.js +3 -13
- package/dist/commands/missionctrl/broker/display.d.ts +3 -4
- package/dist/commands/missionctrl/broker/display.js +6 -15
- package/dist/commands/missionctrl/broker/list.d.ts +3 -3
- package/dist/commands/missionctrl/broker/list.js +9 -9
- package/dist/commands/missionctrl/broker/opstatus.d.ts +1 -1
- package/dist/commands/missionctrl/broker/opstatus.js +1 -3
- package/dist/commands/missionctrl/broker/state.d.ts +12 -0
- package/dist/commands/missionctrl/broker/state.js +52 -0
- package/dist/commands/missionctrl/broker/update.d.ts +3 -4
- package/dist/commands/missionctrl/broker/update.js +8 -14
- package/dist/commands/platform/env/create.d.ts +3 -4
- package/dist/commands/platform/env/create.js +10 -19
- package/dist/commands/platform/env/delete.d.ts +1 -1
- package/dist/commands/platform/env/delete.js +7 -5
- package/dist/commands/platform/env/display.d.ts +3 -4
- package/dist/commands/platform/env/display.js +14 -26
- package/dist/commands/platform/env/list.d.ts +3 -3
- package/dist/commands/platform/env/list.js +9 -9
- package/dist/commands/platform/env/update.d.ts +3 -4
- package/dist/commands/platform/env/update.js +12 -22
- package/dist/types/broker.d.ts +15 -0
- package/dist/types/environment.d.ts +2 -2
- package/oclif.manifest.json +77 -8
- package/package.json +7 -8
- package/dist/sc-command.d.ts +0 -22
- package/dist/sc-command.js +0 -54
- package/dist/util/internal.d.ts +0 -21
- package/dist/util/internal.js +0 -46
- package/dist/util/json.d.ts +0 -15
- package/dist/util/json.js +0 -19
- package/dist/util/sc-connection.d.ts +0 -13
- package/dist/util/sc-connection.js +0 -52
package/README.md
CHANGED
|
@@ -11,10 +11,28 @@ The Solace Cloud CLI
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
<!-- toc -->
|
|
14
|
+
* [Overview](#overview)
|
|
14
15
|
* [Usage](#usage)
|
|
15
16
|
* [Configuration](#configuration)
|
|
17
|
+
* [Resources](#resources)
|
|
18
|
+
* [Contributing](#contributing)
|
|
19
|
+
* [Authors](#authors)
|
|
20
|
+
* [License](#license)
|
|
16
21
|
* [Commands](#commands)
|
|
17
22
|
<!-- tocstop -->
|
|
23
|
+
# Overview
|
|
24
|
+
<!-- overview -->
|
|
25
|
+
The Solace Cloud CLI is a command line interface that simplifies deployment, configuration, and automation when working with your Solace Cloud org and services.
|
|
26
|
+
|
|
27
|
+
Use it to:
|
|
28
|
+
|
|
29
|
+
* Create and manage Environments
|
|
30
|
+
* Create and manage Mission Control and Event Broker Services
|
|
31
|
+
* Script deployment of Solace Cloud resources in your org
|
|
32
|
+
|
|
33
|
+
The CLI is built using the [oclif framework](https://oclif.io) that allows for plugin based development where users can add and extend the functionality of this CLI. For example, a new command can be added that can create and manage VPN Bridges, which uses the SEMP API to provision the bridges across two Message VPN on the same broker or across two brokers.
|
|
34
|
+
|
|
35
|
+
<!-- overviewstop -->
|
|
18
36
|
# Usage
|
|
19
37
|
<!-- usage -->
|
|
20
38
|
```sh-session
|
|
@@ -22,7 +40,7 @@ $ npm install -g @dishantlangayan/solace-cloud-cli
|
|
|
22
40
|
$ sc COMMAND
|
|
23
41
|
running command...
|
|
24
42
|
$ sc (--version)
|
|
25
|
-
@dishantlangayan/solace-cloud-cli/0.
|
|
43
|
+
@dishantlangayan/solace-cloud-cli/0.2.0 darwin-arm64 node-v24.1.0
|
|
26
44
|
$ sc --help [COMMAND]
|
|
27
45
|
USAGE
|
|
28
46
|
$ sc COMMAND
|
|
@@ -42,7 +60,31 @@ The following Environment variables are optional:
|
|
|
42
60
|
* SC_API_VERSION - The API version of the Solace Cloud REST API. Default is `v2`.
|
|
43
61
|
* SC_BASE_URL - The location of your Solace Home Cloud account determines the base URL you use. Default is `https://api.solace.cloud/`
|
|
44
62
|
|
|
45
|
-
<!--
|
|
63
|
+
<!-- configurationstop -->
|
|
64
|
+
# Resources
|
|
65
|
+
<!-- resources -->
|
|
66
|
+
This is not an officially supported Solace product.
|
|
67
|
+
|
|
68
|
+
For more information try these resources:
|
|
69
|
+
- Ask the [Solace Community](https://solace.community)
|
|
70
|
+
- The Solace Developer Portal website at: https://solace.dev
|
|
71
|
+
|
|
72
|
+
<!-- resourcesstop -->
|
|
73
|
+
# Contributing
|
|
74
|
+
<!-- contributing -->
|
|
75
|
+
Contributions are encouraged! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
|
76
|
+
|
|
77
|
+
<!-- contributingstop -->
|
|
78
|
+
# Authors
|
|
79
|
+
<!-- authors -->
|
|
80
|
+
See the list of [contributors](https://github.com/solacelabs/solace-cloud-cli/graphs/contributors) who participated in this project.
|
|
81
|
+
|
|
82
|
+
<!-- authorsstop -->
|
|
83
|
+
# License
|
|
84
|
+
<!-- license -->
|
|
85
|
+
See the [LICENSE](LICENSE) file for details.
|
|
86
|
+
|
|
87
|
+
<!-- licensestop -->
|
|
46
88
|
# Commands
|
|
47
89
|
<!-- commands -->
|
|
48
90
|
* [`sc help [COMMAND]`](#sc-help-command)
|
|
@@ -51,6 +93,7 @@ The following Environment variables are optional:
|
|
|
51
93
|
* [`sc missionctrl broker display`](#sc-missionctrl-broker-display)
|
|
52
94
|
* [`sc missionctrl broker list`](#sc-missionctrl-broker-list)
|
|
53
95
|
* [`sc missionctrl broker opstatus`](#sc-missionctrl-broker-opstatus)
|
|
96
|
+
* [`sc missionctrl broker state`](#sc-missionctrl-broker-state)
|
|
54
97
|
* [`sc missionctrl broker update`](#sc-missionctrl-broker-update)
|
|
55
98
|
* [`sc platform env create`](#sc-platform-env-create)
|
|
56
99
|
* [`sc platform env delete`](#sc-platform-env-delete)
|
|
@@ -77,7 +120,7 @@ USAGE
|
|
|
77
120
|
$ sc help [COMMAND...] [-n]
|
|
78
121
|
|
|
79
122
|
ARGUMENTS
|
|
80
|
-
COMMAND... Command to show help for.
|
|
123
|
+
[COMMAND...] Command to show help for.
|
|
81
124
|
|
|
82
125
|
FLAGS
|
|
83
126
|
-n, --nested-commands Include all nested commands in the output.
|
|
@@ -145,7 +188,7 @@ EXAMPLES
|
|
|
145
188
|
$ sc missionctrl broker create --name=MyBrokerName --datacenter-id=eks-ca-central-1a --service-class-id=DEVELOPER
|
|
146
189
|
```
|
|
147
190
|
|
|
148
|
-
_See code: [src/commands/missionctrl/broker/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
191
|
+
_See code: [src/commands/missionctrl/broker/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/missionctrl/broker/create.ts)_
|
|
149
192
|
|
|
150
193
|
## `sc missionctrl broker delete`
|
|
151
194
|
|
|
@@ -177,7 +220,7 @@ EXAMPLES
|
|
|
177
220
|
$ sc missionctrl broker delete --name=MyBrokerName
|
|
178
221
|
```
|
|
179
222
|
|
|
180
|
-
_See code: [src/commands/missionctrl/broker/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
223
|
+
_See code: [src/commands/missionctrl/broker/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/missionctrl/broker/delete.ts)_
|
|
181
224
|
|
|
182
225
|
## `sc missionctrl broker display`
|
|
183
226
|
|
|
@@ -208,7 +251,7 @@ EXAMPLES
|
|
|
208
251
|
$ sc missionctrl broker display
|
|
209
252
|
```
|
|
210
253
|
|
|
211
|
-
_See code: [src/commands/missionctrl/broker/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
254
|
+
_See code: [src/commands/missionctrl/broker/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/missionctrl/broker/display.ts)_
|
|
212
255
|
|
|
213
256
|
## `sc missionctrl broker list`
|
|
214
257
|
|
|
@@ -227,7 +270,7 @@ FLAGS
|
|
|
227
270
|
The page number to get. Defaults to 1
|
|
228
271
|
|
|
229
272
|
--pageSize=<value>
|
|
230
|
-
The number of event broker services to return per page. Defaults to
|
|
273
|
+
The number of event broker services to return per page. Defaults to 10
|
|
231
274
|
|
|
232
275
|
--sort=<value>
|
|
233
276
|
Sort the returned event broker services by attribute.
|
|
@@ -251,10 +294,12 @@ DESCRIPTION
|
|
|
251
294
|
**or** `services:view:self` ]
|
|
252
295
|
|
|
253
296
|
EXAMPLES
|
|
297
|
+
$ sc missionctrl broker list
|
|
298
|
+
|
|
254
299
|
$ sc missionctrl broker list --name=MyBrokerName --pageNumber=1 --pageSize=10 --sort=name:asc
|
|
255
300
|
```
|
|
256
301
|
|
|
257
|
-
_See code: [src/commands/missionctrl/broker/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
302
|
+
_See code: [src/commands/missionctrl/broker/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/missionctrl/broker/list.ts)_
|
|
258
303
|
|
|
259
304
|
## `sc missionctrl broker opstatus`
|
|
260
305
|
|
|
@@ -291,7 +336,41 @@ EXAMPLES
|
|
|
291
336
|
$ sc missionctrl broker opstatus -n <broker-name>
|
|
292
337
|
```
|
|
293
338
|
|
|
294
|
-
_See code: [src/commands/missionctrl/broker/opstatus.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
339
|
+
_See code: [src/commands/missionctrl/broker/opstatus.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/missionctrl/broker/opstatus.ts)_
|
|
340
|
+
|
|
341
|
+
## `sc missionctrl broker state`
|
|
342
|
+
|
|
343
|
+
Get the availability state of an event broker service and the name of the active messaging node using the service's unique identifier.
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
USAGE
|
|
347
|
+
$ sc missionctrl broker state [--json] [--log-level debug|warn|error|info|trace] [-b <value>] [-n <value>]
|
|
348
|
+
|
|
349
|
+
FLAGS
|
|
350
|
+
-b, --broker-id=<value> Id of the event broker service.
|
|
351
|
+
-n, --name=<value> Name of the event broker service.
|
|
352
|
+
|
|
353
|
+
GLOBAL FLAGS
|
|
354
|
+
--json Format output as json.
|
|
355
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
356
|
+
<options: debug|warn|error|info|trace>
|
|
357
|
+
|
|
358
|
+
DESCRIPTION
|
|
359
|
+
Get the availability state of an event broker service and the name of the active messaging node using the service's
|
|
360
|
+
unique identifier.
|
|
361
|
+
|
|
362
|
+
Your token must have one of the permissions listed in the Token Permissions.
|
|
363
|
+
|
|
364
|
+
Token Permissions: [ mission_control:access or services:get or services:get:self or services:view or
|
|
365
|
+
services:view:self ]
|
|
366
|
+
|
|
367
|
+
EXAMPLES
|
|
368
|
+
$ sc missionctrl broker state --broker-id=MyBrokerServiceId
|
|
369
|
+
|
|
370
|
+
$ sc missionctrl broker state --name=MyBrokerName
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
_See code: [src/commands/missionctrl/broker/state.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/missionctrl/broker/state.ts)_
|
|
295
374
|
|
|
296
375
|
## `sc missionctrl broker update`
|
|
297
376
|
|
|
@@ -325,9 +404,13 @@ DESCRIPTION
|
|
|
325
404
|
|
|
326
405
|
EXAMPLES
|
|
327
406
|
$ sc missionctrl broker update
|
|
407
|
+
|
|
408
|
+
$ sc missionctrl broker update --broker-id <broker-id> --new-name <new-name>
|
|
409
|
+
|
|
410
|
+
$ sc missionctrl broker update --name <name> --new-name <new-name>
|
|
328
411
|
```
|
|
329
412
|
|
|
330
|
-
_See code: [src/commands/missionctrl/broker/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
413
|
+
_See code: [src/commands/missionctrl/broker/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/missionctrl/broker/update.ts)_
|
|
331
414
|
|
|
332
415
|
## `sc platform env create`
|
|
333
416
|
|
|
@@ -341,8 +424,8 @@ USAGE
|
|
|
341
424
|
FLAGS
|
|
342
425
|
-d, --description=<value> Description of the environment to create.
|
|
343
426
|
-n, --name=<value> (required) Name of the environment to create.
|
|
344
|
-
--isDefault Indicates this is the organization
|
|
345
|
-
--isProduction Indicates this is an organization
|
|
427
|
+
--isDefault Indicates this is the organization's default environment.
|
|
428
|
+
--isProduction Indicates this is an organization's production environment.
|
|
346
429
|
This is an immutable field. If an environment needs to be migrated,
|
|
347
430
|
architecture can be migrated to a new environment with the desired
|
|
348
431
|
environment type instead.
|
|
@@ -358,10 +441,10 @@ DESCRIPTION
|
|
|
358
441
|
Token Permissions: [ environments:edit ]
|
|
359
442
|
|
|
360
443
|
EXAMPLES
|
|
361
|
-
$ sc platform env create --name=MyEnvironment --
|
|
444
|
+
$ sc platform env create --name=MyEnvironment --description="My environment description" --isDefault --isProduction
|
|
362
445
|
```
|
|
363
446
|
|
|
364
|
-
_See code: [src/commands/platform/env/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
447
|
+
_See code: [src/commands/platform/env/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/platform/env/create.ts)_
|
|
365
448
|
|
|
366
449
|
## `sc platform env delete`
|
|
367
450
|
|
|
@@ -391,7 +474,7 @@ EXAMPLES
|
|
|
391
474
|
$ sc platform env delete --env-id=MyEnvId
|
|
392
475
|
```
|
|
393
476
|
|
|
394
|
-
_See code: [src/commands/platform/env/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
477
|
+
_See code: [src/commands/platform/env/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/platform/env/delete.ts)_
|
|
395
478
|
|
|
396
479
|
## `sc platform env display`
|
|
397
480
|
|
|
@@ -423,7 +506,7 @@ EXAMPLES
|
|
|
423
506
|
$ sc platform env display --env-id=MyEnvId
|
|
424
507
|
```
|
|
425
508
|
|
|
426
|
-
_See code: [src/commands/platform/env/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
509
|
+
_See code: [src/commands/platform/env/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/platform/env/display.ts)_
|
|
427
510
|
|
|
428
511
|
## `sc platform env list`
|
|
429
512
|
|
|
@@ -456,7 +539,7 @@ EXAMPLES
|
|
|
456
539
|
$ sc platform env list --name=Default --pageNumber=1 --pageSize=10 --sort=name:ASC
|
|
457
540
|
```
|
|
458
541
|
|
|
459
|
-
_See code: [src/commands/platform/env/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
542
|
+
_See code: [src/commands/platform/env/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/platform/env/list.ts)_
|
|
460
543
|
|
|
461
544
|
## `sc platform env update`
|
|
462
545
|
|
|
@@ -488,12 +571,12 @@ DESCRIPTION
|
|
|
488
571
|
|
|
489
572
|
|
|
490
573
|
EXAMPLES
|
|
491
|
-
$ sc platform env update --name=MyEnvName --new-name=MyNewEnvName --
|
|
574
|
+
$ sc platform env update --name=MyEnvName --new-name=MyNewEnvName --description="My description to update" --isDefault
|
|
492
575
|
|
|
493
|
-
$ sc platform env update --env-id=MyEnvId --new-name=MyNewEnvName --
|
|
576
|
+
$ sc platform env update --env-id=MyEnvId --new-name=MyNewEnvName --description="My description to update" --isDefault
|
|
494
577
|
```
|
|
495
578
|
|
|
496
|
-
_See code: [src/commands/platform/env/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.
|
|
579
|
+
_See code: [src/commands/platform/env/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.2.0/src/commands/platform/env/update.ts)_
|
|
497
580
|
|
|
498
581
|
## `sc plugins`
|
|
499
582
|
|
|
@@ -681,7 +764,7 @@ USAGE
|
|
|
681
764
|
$ sc plugins remove [PLUGIN...] [-h] [-v]
|
|
682
765
|
|
|
683
766
|
ARGUMENTS
|
|
684
|
-
PLUGIN... plugin to uninstall
|
|
767
|
+
[PLUGIN...] plugin to uninstall
|
|
685
768
|
|
|
686
769
|
FLAGS
|
|
687
770
|
-h, --help Show CLI help.
|
|
@@ -722,7 +805,7 @@ USAGE
|
|
|
722
805
|
$ sc plugins uninstall [PLUGIN...] [-h] [-v]
|
|
723
806
|
|
|
724
807
|
ARGUMENTS
|
|
725
|
-
PLUGIN... plugin to uninstall
|
|
808
|
+
[PLUGIN...] plugin to uninstall
|
|
726
809
|
|
|
727
810
|
FLAGS
|
|
728
811
|
-h, --help Show CLI help.
|
|
@@ -750,7 +833,7 @@ USAGE
|
|
|
750
833
|
$ sc plugins unlink [PLUGIN...] [-h] [-v]
|
|
751
834
|
|
|
752
835
|
ARGUMENTS
|
|
753
|
-
PLUGIN... plugin to uninstall
|
|
836
|
+
[PLUGIN...] plugin to uninstall
|
|
754
837
|
|
|
755
838
|
FLAGS
|
|
756
839
|
-h, --help Show CLI help.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ScCommand } from '
|
|
2
|
-
import {
|
|
1
|
+
import { ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { EventBrokerOperationApiResponse } from '../../../types/broker.js';
|
|
3
3
|
export default class MissionctrlBrokerCreate extends ScCommand<typeof MissionctrlBrokerCreate> {
|
|
4
4
|
static args: {};
|
|
5
5
|
static description: string;
|
|
@@ -15,6 +15,5 @@ export default class MissionctrlBrokerCreate extends ScCommand<typeof Missionctr
|
|
|
15
15
|
'service-class-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
16
|
version: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
17
|
};
|
|
18
|
-
run(): Promise<
|
|
19
|
-
private print;
|
|
18
|
+
run(): Promise<EventBrokerOperationApiResponse>;
|
|
20
19
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
|
|
1
2
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import { ScCommand } from '../../../sc-command.js';
|
|
3
|
-
import { camelCaseToTitleCase, renderKeyValueTable } from '../../../util/internal.js';
|
|
4
|
-
import { ScConnection } from '../../../util/sc-connection.js';
|
|
5
3
|
export default class MissionctrlBrokerCreate extends ScCommand {
|
|
6
4
|
static args = {};
|
|
7
5
|
static description = `Create an event broker service. You must provide a unique name and select a service class and datacenter. You can optionally define other properties for the event broker service.
|
|
@@ -99,16 +97,7 @@ Token Permissions: [ \`services:post\` ]`;
|
|
|
99
97
|
// API call
|
|
100
98
|
const resp = await conn.post(apiUrl, body);
|
|
101
99
|
// Display results
|
|
102
|
-
this.log(
|
|
103
|
-
|
|
104
|
-
return resp.data;
|
|
105
|
-
}
|
|
106
|
-
print(broker) {
|
|
107
|
-
const tableRows = [
|
|
108
|
-
['Key', 'Value'],
|
|
109
|
-
...Object.entries(broker).map(([key, value]) => [camelCaseToTitleCase(key), value]),
|
|
110
|
-
];
|
|
111
|
-
this.log();
|
|
112
|
-
this.log(renderKeyValueTable(tableRows));
|
|
100
|
+
this.log(printObjectAsKeyValueTable(resp.data));
|
|
101
|
+
return resp;
|
|
113
102
|
}
|
|
114
103
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ScCommand } from '
|
|
2
|
-
import {
|
|
1
|
+
import { ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { EventBrokerOperationApiResponse } from '../../../types/broker.js';
|
|
3
3
|
export default class MissionctrlBrokerDelete extends ScCommand<typeof MissionctrlBrokerDelete> {
|
|
4
4
|
static args: {};
|
|
5
5
|
static description: string;
|
|
@@ -8,6 +8,5 @@ export default class MissionctrlBrokerDelete extends ScCommand<typeof Missionctr
|
|
|
8
8
|
'broker-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
};
|
|
11
|
-
run(): Promise<
|
|
12
|
-
private print;
|
|
11
|
+
run(): Promise<EventBrokerOperationApiResponse>;
|
|
13
12
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
|
|
1
2
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import { ScCommand } from '../../../sc-command.js';
|
|
3
|
-
import { camelCaseToTitleCase, renderKeyValueTable } from '../../../util/internal.js';
|
|
4
|
-
import { ScConnection } from '../../../util/sc-connection.js';
|
|
5
3
|
export default class MissionctrlBrokerDelete extends ScCommand {
|
|
6
4
|
static args = {};
|
|
7
5
|
static description = `Delete a service using its unique identifier.
|
|
@@ -50,15 +48,7 @@ Token Permissions: [ \`services:delete\` **or** \`services:delete:self\` **or**
|
|
|
50
48
|
apiUrl += `/${brokerIdToDelete}`;
|
|
51
49
|
const resp = await conn.delete(apiUrl);
|
|
52
50
|
// Display results
|
|
53
|
-
this.
|
|
54
|
-
return resp
|
|
55
|
-
}
|
|
56
|
-
print(broker) {
|
|
57
|
-
const tableRows = [
|
|
58
|
-
['Key', 'Value'],
|
|
59
|
-
...Object.entries(broker).map(([key, value]) => [camelCaseToTitleCase(key), value]),
|
|
60
|
-
];
|
|
61
|
-
this.log();
|
|
62
|
-
this.log(renderKeyValueTable(tableRows));
|
|
51
|
+
this.log(printObjectAsKeyValueTable(resp.data));
|
|
52
|
+
return resp;
|
|
63
53
|
}
|
|
64
54
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ScCommand } from '
|
|
2
|
-
import {
|
|
1
|
+
import { ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { EventBrokerApiResponse, EventBrokerListApiResponse } from '../../../types/broker.js';
|
|
3
3
|
export default class MissionctrlBrokerDisplay extends ScCommand<typeof MissionctrlBrokerDisplay> {
|
|
4
4
|
static args: {};
|
|
5
5
|
static description: string;
|
|
@@ -8,6 +8,5 @@ export default class MissionctrlBrokerDisplay extends ScCommand<typeof Missionct
|
|
|
8
8
|
'broker-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
};
|
|
11
|
-
run(): Promise<
|
|
12
|
-
private print;
|
|
11
|
+
run(): Promise<EventBrokerApiResponse | EventBrokerListApiResponse>;
|
|
13
12
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
|
|
1
2
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import { ScCommand } from '../../../sc-command.js';
|
|
3
|
-
import { camelCaseToTitleCase, renderKeyValueTable } from '../../../util/internal.js';
|
|
4
|
-
import { ScConnection } from '../../../util/sc-connection.js';
|
|
5
3
|
export default class MissionctrlBrokerDisplay extends ScCommand {
|
|
6
4
|
static args = {};
|
|
7
5
|
static description = `Get the details of an event broker service using its identifier or name.
|
|
@@ -36,17 +34,18 @@ export default class MissionctrlBrokerDisplay extends ScCommand {
|
|
|
36
34
|
// API call to get broker by id
|
|
37
35
|
apiUrl += `/${brokerId}`;
|
|
38
36
|
const resp = await conn.get(apiUrl);
|
|
39
|
-
this.
|
|
40
|
-
rawResp =
|
|
37
|
+
this.log(printObjectAsKeyValueTable(resp.data));
|
|
38
|
+
rawResp = resp;
|
|
41
39
|
}
|
|
42
40
|
else if (name) {
|
|
43
41
|
// API call to get broker by name
|
|
44
42
|
apiUrl += `?customAttributes=name=="${name}"`;
|
|
45
43
|
const resp = await conn.get(apiUrl);
|
|
44
|
+
// Display all brokers found
|
|
46
45
|
for (const broker of resp.data) {
|
|
47
|
-
this.
|
|
46
|
+
this.log(printObjectAsKeyValueTable(broker));
|
|
48
47
|
}
|
|
49
|
-
rawResp = resp
|
|
48
|
+
rawResp = resp;
|
|
50
49
|
}
|
|
51
50
|
else {
|
|
52
51
|
this.error('Either --broker-id or --name must be provided.');
|
|
@@ -54,12 +53,4 @@ export default class MissionctrlBrokerDisplay extends ScCommand {
|
|
|
54
53
|
// Return raw json if --json flag is set
|
|
55
54
|
return rawResp;
|
|
56
55
|
}
|
|
57
|
-
print(broker) {
|
|
58
|
-
const tableRows = [
|
|
59
|
-
['Key', 'Value'],
|
|
60
|
-
...Object.entries(broker).map(([key, value]) => [camelCaseToTitleCase(key), value]),
|
|
61
|
-
];
|
|
62
|
-
this.log();
|
|
63
|
-
this.log(renderKeyValueTable(tableRows));
|
|
64
|
-
}
|
|
65
56
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ScCommand } from '
|
|
2
|
-
import {
|
|
1
|
+
import { ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { EventBrokerListApiResponse } from '../../../types/broker.js';
|
|
3
3
|
export default class MissionctrlBrokerList extends ScCommand<typeof MissionctrlBrokerList> {
|
|
4
4
|
static args: {};
|
|
5
5
|
static description: string;
|
|
@@ -10,5 +10,5 @@ export default class MissionctrlBrokerList extends ScCommand<typeof MissionctrlB
|
|
|
10
10
|
pageSize: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
sort: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
|
-
run(): Promise<
|
|
13
|
+
run(): Promise<EventBrokerListApiResponse>;
|
|
14
14
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { renderTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
|
|
1
2
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import { ScCommand } from '../../../sc-command.js';
|
|
3
|
-
import { renderTable } from '../../../util/internal.js';
|
|
4
|
-
import { ScConnection } from '../../../util/sc-connection.js';
|
|
5
3
|
export default class MissionctrlBrokerList extends ScCommand {
|
|
6
4
|
static args = {};
|
|
7
5
|
static description = `Get a listing of event broker services.
|
|
@@ -9,17 +7,20 @@ export default class MissionctrlBrokerList extends ScCommand {
|
|
|
9
7
|
Your token must have one of the permissions listed in the Token Permissions.
|
|
10
8
|
|
|
11
9
|
Token Permissions: [ \`mission_control:access\` **or** \`services:get\` **or** \`services:get:self\` **or** \`services:view\` **or** \`services:view:self\` ]`;
|
|
12
|
-
static examples = [
|
|
10
|
+
static examples = [
|
|
11
|
+
'<%= config.bin %> <%= command.id %>',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --name=MyBrokerName --pageNumber=1 --pageSize=10 --sort=name:asc',
|
|
13
|
+
];
|
|
13
14
|
static flags = {
|
|
14
15
|
name: Flags.string({
|
|
15
16
|
char: 'n',
|
|
16
|
-
description: 'Name of the event broker service to match on.'
|
|
17
|
+
description: 'Name of the event broker service to match on.',
|
|
17
18
|
}),
|
|
18
19
|
pageNumber: Flags.integer({
|
|
19
|
-
description: 'The page number to get. Defaults to 1'
|
|
20
|
+
description: 'The page number to get. Defaults to 1',
|
|
20
21
|
}),
|
|
21
22
|
pageSize: Flags.integer({
|
|
22
|
-
description: 'The number of event broker services to return per page. Defaults to
|
|
23
|
+
description: 'The number of event broker services to return per page. Defaults to 10',
|
|
23
24
|
max: 100,
|
|
24
25
|
min: 1,
|
|
25
26
|
}),
|
|
@@ -61,9 +62,8 @@ Token Permissions: [ \`mission_control:access\` **or** \`services:get\` **or** \
|
|
|
61
62
|
]),
|
|
62
63
|
];
|
|
63
64
|
// Display results as a table
|
|
64
|
-
this.log();
|
|
65
65
|
this.log(renderTable(brokerArray));
|
|
66
66
|
// Return raw json if --json flag is set
|
|
67
|
-
return resp
|
|
67
|
+
return resp;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScCommand } from '
|
|
1
|
+
import { ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
2
|
import { EventBrokerOperationDetail } from '../../../types/broker.js';
|
|
3
3
|
export default class MissionctrlBrokerOpstatus extends ScCommand<typeof MissionctrlBrokerOpstatus> {
|
|
4
4
|
static args: {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
import { renderTable, ScCommand, ScConnection, sleep } from '@dishantlangayan/sc-cli-core';
|
|
1
2
|
import { Flags } from '@oclif/core';
|
|
2
3
|
import { MultiBar, Presets } from 'cli-progress';
|
|
3
|
-
import { ScCommand } from '../../../sc-command.js';
|
|
4
|
-
import { renderTable, sleep } from '../../../util/internal.js';
|
|
5
|
-
import { ScConnection } from '../../../util/sc-connection.js';
|
|
6
4
|
export default class MissionctrlBrokerOpstatus extends ScCommand {
|
|
7
5
|
static args = {};
|
|
8
6
|
static description = `Get the status of all operations being performed on an event broker service.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { EventBrokerRedundancyApiResponse } from '../../../types/broker.js';
|
|
3
|
+
export default class MissionctrlBrokerState extends ScCommand<typeof MissionctrlBrokerState> {
|
|
4
|
+
static args: {};
|
|
5
|
+
static description: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static flags: {
|
|
8
|
+
'broker-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<EventBrokerRedundancyApiResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { Flags } from '@oclif/core';
|
|
3
|
+
export default class MissionctrlBrokerState extends ScCommand {
|
|
4
|
+
static args = {};
|
|
5
|
+
static description = `Get the availability state of an event broker service and the name of the active messaging node using the service's unique identifier.
|
|
6
|
+
|
|
7
|
+
Your token must have one of the permissions listed in the Token Permissions.
|
|
8
|
+
|
|
9
|
+
Token Permissions: [ mission_control:access or services:get or services:get:self or services:view or services:view:self ]`;
|
|
10
|
+
static examples = [
|
|
11
|
+
'<%= config.bin %> <%= command.id %> --broker-id=MyBrokerServiceId',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --name=MyBrokerName',
|
|
13
|
+
];
|
|
14
|
+
static flags = {
|
|
15
|
+
'broker-id': Flags.string({
|
|
16
|
+
char: 'b',
|
|
17
|
+
description: 'Id of the event broker service.',
|
|
18
|
+
exactlyOne: ['broker-id', 'name'],
|
|
19
|
+
}),
|
|
20
|
+
name: Flags.string({
|
|
21
|
+
char: 'n',
|
|
22
|
+
description: 'Name of the event broker service.',
|
|
23
|
+
exactlyOne: ['broker-id', 'name'],
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
const { flags } = await this.parse(MissionctrlBrokerState);
|
|
28
|
+
const name = flags.name ?? '';
|
|
29
|
+
let brokerId = flags['broker-id'] ?? '';
|
|
30
|
+
const conn = new ScConnection();
|
|
31
|
+
// API url
|
|
32
|
+
let apiUrl = `/missionControl/eventBrokerServices`;
|
|
33
|
+
if (name) {
|
|
34
|
+
// If broker name provided, get the broker matching provided name. If more than one broker matches, an error will be thrown.
|
|
35
|
+
const resp = await conn.get(`${apiUrl}?customAttributes=name=="${name}"`);
|
|
36
|
+
if (resp.data.length === 0) {
|
|
37
|
+
this.error(`No brokers found with name: ${name}.`);
|
|
38
|
+
}
|
|
39
|
+
else if (resp.data.length > 1) {
|
|
40
|
+
this.error(`Multiple brokers found with name: ${name}. Exactly one event broker service must match the provided name.`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
brokerId = resp.data[0]?.id;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// API call to update broker by id
|
|
47
|
+
apiUrl += `/${brokerId}/brokerState`;
|
|
48
|
+
const resp = await conn.get(apiUrl);
|
|
49
|
+
this.log(printObjectAsKeyValueTable(resp.data));
|
|
50
|
+
return resp;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ScCommand } from '
|
|
2
|
-
import {
|
|
1
|
+
import { ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { EventBrokerOperationApiResponse } from '../../../types/broker.js';
|
|
3
3
|
export default class MissionctrlBrokerUpdate extends ScCommand<typeof MissionctrlBrokerUpdate> {
|
|
4
4
|
static args: {};
|
|
5
5
|
static description: string;
|
|
@@ -10,6 +10,5 @@ export default class MissionctrlBrokerUpdate extends ScCommand<typeof Missionctr
|
|
|
10
10
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
'new-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
|
-
run(): Promise<
|
|
14
|
-
private print;
|
|
13
|
+
run(): Promise<EventBrokerOperationApiResponse>;
|
|
15
14
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { printObjectAsKeyValueTable, ScCommand, ScConnection } from '@dishantlangayan/sc-cli-core';
|
|
1
2
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import { ScCommand } from '../../../sc-command.js';
|
|
3
|
-
import { camelCaseToTitleCase, renderKeyValueTable } from '../../../util/internal.js';
|
|
4
|
-
import { ScConnection } from '../../../util/sc-connection.js';
|
|
5
3
|
export default class MissionctrlBrokerUpdate extends ScCommand {
|
|
6
4
|
static args = {};
|
|
7
5
|
static description = `Update the configuration of an existing event broker service.
|
|
@@ -10,7 +8,11 @@ export default class MissionctrlBrokerUpdate extends ScCommand {
|
|
|
10
8
|
Your token must have one of the permissions listed in the Token Permissions.
|
|
11
9
|
|
|
12
10
|
Token Permissions: [ mission_control:access or services:put ]`;
|
|
13
|
-
static examples = [
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> <%= command.id %>',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> --broker-id <broker-id> --new-name <new-name>',
|
|
14
|
+
'<%= config.bin %> <%= command.id %> --name <name> --new-name <new-name>',
|
|
15
|
+
];
|
|
14
16
|
static flags = {
|
|
15
17
|
'broker-id': Flags.string({
|
|
16
18
|
char: 'b',
|
|
@@ -63,15 +65,7 @@ export default class MissionctrlBrokerUpdate extends ScCommand {
|
|
|
63
65
|
apiUrl += `/${brokerIdToUpdate}`;
|
|
64
66
|
const resp = await conn.patch(apiUrl, body);
|
|
65
67
|
this.log(`Broker with id '${brokerIdToUpdate}' has been updated successfully.`);
|
|
66
|
-
this.
|
|
67
|
-
return resp
|
|
68
|
-
}
|
|
69
|
-
print(broker) {
|
|
70
|
-
const tableRows = [
|
|
71
|
-
['Key', 'Value'],
|
|
72
|
-
...Object.entries(broker).map(([key, value]) => [camelCaseToTitleCase(key), value]),
|
|
73
|
-
];
|
|
74
|
-
this.log();
|
|
75
|
-
this.log(renderKeyValueTable(tableRows));
|
|
68
|
+
this.log(printObjectAsKeyValueTable(resp.data));
|
|
69
|
+
return resp;
|
|
76
70
|
}
|
|
77
71
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ScCommand } from '
|
|
2
|
-
import {
|
|
1
|
+
import { ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { EnvironmentApiResponse } from '../../../types/environment.js';
|
|
3
3
|
export default class PlatformEnvCreate extends ScCommand<typeof PlatformEnvCreate> {
|
|
4
4
|
static args: {};
|
|
5
5
|
static description: string;
|
|
@@ -10,6 +10,5 @@ export default class PlatformEnvCreate extends ScCommand<typeof PlatformEnvCreat
|
|
|
10
10
|
isProduction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
|
-
run(): Promise<
|
|
14
|
-
private print;
|
|
13
|
+
run(): Promise<EnvironmentApiResponse>;
|
|
15
14
|
}
|