@dishantlangayan/solace-cloud-cli 0.0.2 → 0.0.3
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 +4 -3
- package/dist/commands/missionctrl/broker/create.js +7 -15
- package/dist/commands/missionctrl/broker/delete.d.ts +5 -3
- package/dist/commands/missionctrl/broker/delete.js +6 -3
- package/dist/commands/missionctrl/broker/display.d.ts +4 -3
- package/dist/commands/missionctrl/broker/display.js +11 -15
- package/dist/commands/missionctrl/broker/list.d.ts +4 -3
- package/dist/commands/missionctrl/broker/list.js +7 -4
- package/dist/commands/missionctrl/broker/opstatus.d.ts +15 -0
- package/dist/commands/missionctrl/broker/opstatus.js +109 -0
- package/dist/commands/platform/env/create.d.ts +4 -3
- package/dist/commands/platform/env/create.js +8 -15
- package/dist/commands/platform/env/delete.d.ts +5 -3
- package/dist/commands/platform/env/delete.js +19 -7
- package/dist/commands/platform/env/display.d.ts +4 -3
- package/dist/commands/platform/env/display.js +12 -17
- package/dist/commands/platform/env/list.d.ts +4 -3
- package/dist/commands/platform/env/list.js +21 -17
- package/dist/commands/platform/env/update.d.ts +4 -3
- package/dist/commands/platform/env/update.js +7 -15
- package/dist/types/broker.d.ts +25 -0
- package/dist/util/internal.d.ts +12 -0
- package/dist/util/internal.js +31 -0
- package/oclif.manifest.json +300 -11
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ $ npm install -g @dishantlangayan/solace-cloud-cli
|
|
|
22
22
|
$ sc COMMAND
|
|
23
23
|
running command...
|
|
24
24
|
$ sc (--version)
|
|
25
|
-
@dishantlangayan/solace-cloud-cli/0.0.
|
|
25
|
+
@dishantlangayan/solace-cloud-cli/0.0.3 darwin-x64 node-v23.10.0
|
|
26
26
|
$ sc --help [COMMAND]
|
|
27
27
|
USAGE
|
|
28
28
|
$ sc COMMAND
|
|
@@ -50,6 +50,7 @@ The following Environment variables are optional:
|
|
|
50
50
|
* [`sc missionctrl broker delete`](#sc-missionctrl-broker-delete)
|
|
51
51
|
* [`sc missionctrl broker display`](#sc-missionctrl-broker-display)
|
|
52
52
|
* [`sc missionctrl broker list`](#sc-missionctrl-broker-list)
|
|
53
|
+
* [`sc missionctrl broker opstatus`](#sc-missionctrl-broker-opstatus)
|
|
53
54
|
* [`sc platform env create`](#sc-platform-env-create)
|
|
54
55
|
* [`sc platform env delete`](#sc-platform-env-delete)
|
|
55
56
|
* [`sc platform env display`](#sc-platform-env-display)
|
|
@@ -92,8 +93,8 @@ Create an event broker service. You must provide a unique name and select a serv
|
|
|
92
93
|
|
|
93
94
|
```
|
|
94
95
|
USAGE
|
|
95
|
-
$ sc missionctrl broker create -d <value> -n <value> -c <value> [
|
|
96
|
-
|
|
96
|
+
$ sc missionctrl broker create -d <value> -n <value> -c <value> [--json] [--log-level debug|warn|error|info|trace] [-e
|
|
97
|
+
<value>] [-l] [-s <value>] [-m <value>] [-r] [-v <value>]
|
|
97
98
|
|
|
98
99
|
FLAGS
|
|
99
100
|
-c, --service-class-id=<value>
|
|
@@ -126,6 +127,11 @@ FLAGS
|
|
|
126
127
|
-v, --version=<value>
|
|
127
128
|
The event broker version. A default version is provided when this is not specified.
|
|
128
129
|
|
|
130
|
+
GLOBAL FLAGS
|
|
131
|
+
--json Format output as json.
|
|
132
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
133
|
+
<options: debug|warn|error|info|trace>
|
|
134
|
+
|
|
129
135
|
DESCRIPTION
|
|
130
136
|
Create an event broker service. You must provide a unique name and select a service class and datacenter. You can
|
|
131
137
|
optionally define other properties for the event broker service.
|
|
@@ -138,7 +144,7 @@ EXAMPLES
|
|
|
138
144
|
$ sc missionctrl broker create --name=MyBrokerName --datacenter-id=eks-ca-central-1a --service-class-id=DEVELOPER
|
|
139
145
|
```
|
|
140
146
|
|
|
141
|
-
_See code: [src/commands/missionctrl/broker/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.
|
|
147
|
+
_See code: [src/commands/missionctrl/broker/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/missionctrl/broker/create.ts)_
|
|
142
148
|
|
|
143
149
|
## `sc missionctrl broker delete`
|
|
144
150
|
|
|
@@ -146,12 +152,17 @@ Delete a service using its unique identifier.
|
|
|
146
152
|
|
|
147
153
|
```
|
|
148
154
|
USAGE
|
|
149
|
-
$ sc missionctrl broker delete [-b <value>] [-n <value>]
|
|
155
|
+
$ sc missionctrl broker delete [--json] [--log-level debug|warn|error|info|trace] [-b <value>] [-n <value>]
|
|
150
156
|
|
|
151
157
|
FLAGS
|
|
152
158
|
-b, --broker-id=<value> Id of the event broker service.
|
|
153
159
|
-n, --name=<value> Name of the event broker service.
|
|
154
160
|
|
|
161
|
+
GLOBAL FLAGS
|
|
162
|
+
--json Format output as json.
|
|
163
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
164
|
+
<options: debug|warn|error|info|trace>
|
|
165
|
+
|
|
155
166
|
DESCRIPTION
|
|
156
167
|
Delete a service using its unique identifier.
|
|
157
168
|
|
|
@@ -165,7 +176,7 @@ EXAMPLES
|
|
|
165
176
|
$ sc missionctrl broker delete --name=MyBrokerName
|
|
166
177
|
```
|
|
167
178
|
|
|
168
|
-
_See code: [src/commands/missionctrl/broker/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.
|
|
179
|
+
_See code: [src/commands/missionctrl/broker/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/missionctrl/broker/delete.ts)_
|
|
169
180
|
|
|
170
181
|
## `sc missionctrl broker display`
|
|
171
182
|
|
|
@@ -173,12 +184,17 @@ Get the details of an event broker service using its identifier or name.
|
|
|
173
184
|
|
|
174
185
|
```
|
|
175
186
|
USAGE
|
|
176
|
-
$ sc missionctrl broker display [-b <value>] [-n <value>]
|
|
187
|
+
$ sc missionctrl broker display [--json] [--log-level debug|warn|error|info|trace] [-b <value>] [-n <value>]
|
|
177
188
|
|
|
178
189
|
FLAGS
|
|
179
190
|
-b, --broker-id=<value> Id of the event broker service.
|
|
180
191
|
-n, --name=<value> Name of the event broker service.
|
|
181
192
|
|
|
193
|
+
GLOBAL FLAGS
|
|
194
|
+
--json Format output as json.
|
|
195
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
196
|
+
<options: debug|warn|error|info|trace>
|
|
197
|
+
|
|
182
198
|
DESCRIPTION
|
|
183
199
|
Get the details of an event broker service using its identifier or name.
|
|
184
200
|
|
|
@@ -191,7 +207,7 @@ EXAMPLES
|
|
|
191
207
|
$ sc missionctrl broker display
|
|
192
208
|
```
|
|
193
209
|
|
|
194
|
-
_See code: [src/commands/missionctrl/broker/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.
|
|
210
|
+
_See code: [src/commands/missionctrl/broker/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/missionctrl/broker/display.ts)_
|
|
195
211
|
|
|
196
212
|
## `sc missionctrl broker list`
|
|
197
213
|
|
|
@@ -199,7 +215,8 @@ Get a listing of event broker services.
|
|
|
199
215
|
|
|
200
216
|
```
|
|
201
217
|
USAGE
|
|
202
|
-
$ sc missionctrl broker list [
|
|
218
|
+
$ sc missionctrl broker list [--json] [--log-level debug|warn|error|info|trace] [-n <value>] [--pageNumber <value>]
|
|
219
|
+
[--pageSize <value>] [--sort <value>]
|
|
203
220
|
|
|
204
221
|
FLAGS
|
|
205
222
|
-n, --name=<value>
|
|
@@ -219,6 +236,11 @@ FLAGS
|
|
|
219
236
|
* attributes-names
|
|
220
237
|
* attributes-names:sort-order
|
|
221
238
|
|
|
239
|
+
GLOBAL FLAGS
|
|
240
|
+
--json Format output as json.
|
|
241
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
242
|
+
<options: debug|warn|error|info|trace>
|
|
243
|
+
|
|
222
244
|
DESCRIPTION
|
|
223
245
|
Get a listing of event broker services.
|
|
224
246
|
|
|
@@ -231,7 +253,41 @@ EXAMPLES
|
|
|
231
253
|
$ sc missionctrl broker list --name=MyBrokerName --pageNumber=1 --pageSize=10 --sort=name:asc
|
|
232
254
|
```
|
|
233
255
|
|
|
234
|
-
_See code: [src/commands/missionctrl/broker/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.
|
|
256
|
+
_See code: [src/commands/missionctrl/broker/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/missionctrl/broker/list.ts)_
|
|
257
|
+
|
|
258
|
+
## `sc missionctrl broker opstatus`
|
|
259
|
+
|
|
260
|
+
Get the status of an operation that being performed on an event broker service.
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
USAGE
|
|
264
|
+
$ sc missionctrl broker opstatus [--json] [--log-level debug|warn|error|info|trace] [-b <value>] [-n <value>] [-o
|
|
265
|
+
<value>] [-p]
|
|
266
|
+
|
|
267
|
+
FLAGS
|
|
268
|
+
-b, --broker-id=<value> Id of the event broker service.
|
|
269
|
+
-n, --name=<value> Name of the event broker service.
|
|
270
|
+
-o, --operation-id=<value> The identifier of the operation being performed on the event broker service.
|
|
271
|
+
-p, --show-progress Displays a status bar of the in-progress operation. The command will wait for completion
|
|
272
|
+
of each step of the operation.
|
|
273
|
+
|
|
274
|
+
GLOBAL FLAGS
|
|
275
|
+
--json Format output as json.
|
|
276
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
277
|
+
<options: debug|warn|error|info|trace>
|
|
278
|
+
|
|
279
|
+
DESCRIPTION
|
|
280
|
+
Get the status of an operation that being performed on an event broker service.
|
|
281
|
+
To get the operation, you provide identifier of the operation and the identifier of the event broker service.
|
|
282
|
+
|
|
283
|
+
Token Permissions: [ mission_control:access or services:get or services:get:self or services:view or
|
|
284
|
+
services:view:self ]
|
|
285
|
+
|
|
286
|
+
EXAMPLES
|
|
287
|
+
$ sc missionctrl broker opstatus
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
_See code: [src/commands/missionctrl/broker/opstatus.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/missionctrl/broker/opstatus.ts)_
|
|
235
291
|
|
|
236
292
|
## `sc platform env create`
|
|
237
293
|
|
|
@@ -239,7 +295,8 @@ Create a new environment.
|
|
|
239
295
|
|
|
240
296
|
```
|
|
241
297
|
USAGE
|
|
242
|
-
$ sc platform env create -n <value> [-d <value>] [--isDefault]
|
|
298
|
+
$ sc platform env create -n <value> [--json] [--log-level debug|warn|error|info|trace] [-d <value>] [--isDefault]
|
|
299
|
+
[--isProduction]
|
|
243
300
|
|
|
244
301
|
FLAGS
|
|
245
302
|
-d, --desc=<value> Description of the environment to create.
|
|
@@ -250,6 +307,11 @@ FLAGS
|
|
|
250
307
|
architecture can be migrated to a new environment with the desired
|
|
251
308
|
environment type instead.
|
|
252
309
|
|
|
310
|
+
GLOBAL FLAGS
|
|
311
|
+
--json Format output as json.
|
|
312
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
313
|
+
<options: debug|warn|error|info|trace>
|
|
314
|
+
|
|
253
315
|
DESCRIPTION
|
|
254
316
|
Create a new environment.
|
|
255
317
|
|
|
@@ -259,7 +321,7 @@ EXAMPLES
|
|
|
259
321
|
$ sc platform env create --name=MyEnvironment --desc="My environment description" --isDefault --isProduction
|
|
260
322
|
```
|
|
261
323
|
|
|
262
|
-
_See code: [src/commands/platform/env/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.
|
|
324
|
+
_See code: [src/commands/platform/env/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/platform/env/create.ts)_
|
|
263
325
|
|
|
264
326
|
## `sc platform env delete`
|
|
265
327
|
|
|
@@ -267,12 +329,17 @@ Delete an environment using either its name or unique identifier. The default en
|
|
|
267
329
|
|
|
268
330
|
```
|
|
269
331
|
USAGE
|
|
270
|
-
$ sc platform env delete [-e <value>] [-n <value>]
|
|
332
|
+
$ sc platform env delete [--json] [--log-level debug|warn|error|info|trace] [-e <value>] [-n <value>]
|
|
271
333
|
|
|
272
334
|
FLAGS
|
|
273
335
|
-e, --env-id=<value> Id of the environment.
|
|
274
336
|
-n, --name=<value> Name of the environment.
|
|
275
337
|
|
|
338
|
+
GLOBAL FLAGS
|
|
339
|
+
--json Format output as json.
|
|
340
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
341
|
+
<options: debug|warn|error|info|trace>
|
|
342
|
+
|
|
276
343
|
DESCRIPTION
|
|
277
344
|
Delete an environment using either its name or unique identifier. The default environment cannot be deleted.
|
|
278
345
|
|
|
@@ -284,7 +351,7 @@ EXAMPLES
|
|
|
284
351
|
$ sc platform env delete --env-id=MyEnvId
|
|
285
352
|
```
|
|
286
353
|
|
|
287
|
-
_See code: [src/commands/platform/env/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.
|
|
354
|
+
_See code: [src/commands/platform/env/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/platform/env/delete.ts)_
|
|
288
355
|
|
|
289
356
|
## `sc platform env display`
|
|
290
357
|
|
|
@@ -292,12 +359,17 @@ Display information about an Environment.
|
|
|
292
359
|
|
|
293
360
|
```
|
|
294
361
|
USAGE
|
|
295
|
-
$ sc platform env display [-e <value>] [-n <value>]
|
|
362
|
+
$ sc platform env display [--json] [--log-level debug|warn|error|info|trace] [-e <value>] [-n <value>]
|
|
296
363
|
|
|
297
364
|
FLAGS
|
|
298
365
|
-e, --env-id=<value> Id of the environment.
|
|
299
366
|
-n, --name=<value> Name of the environment.
|
|
300
367
|
|
|
368
|
+
GLOBAL FLAGS
|
|
369
|
+
--json Format output as json.
|
|
370
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
371
|
+
<options: debug|warn|error|info|trace>
|
|
372
|
+
|
|
301
373
|
DESCRIPTION
|
|
302
374
|
Display information about an Environment.
|
|
303
375
|
|
|
@@ -305,14 +377,13 @@ DESCRIPTION
|
|
|
305
377
|
|
|
306
378
|
Required token permissions: [ environments:view ]
|
|
307
379
|
|
|
308
|
-
|
|
309
380
|
EXAMPLES
|
|
310
381
|
$ sc platform env display --name=MyEnvName
|
|
311
382
|
|
|
312
383
|
$ sc platform env display --env-id=MyEnvId
|
|
313
384
|
```
|
|
314
385
|
|
|
315
|
-
_See code: [src/commands/platform/env/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.
|
|
386
|
+
_See code: [src/commands/platform/env/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/platform/env/display.ts)_
|
|
316
387
|
|
|
317
388
|
## `sc platform env list`
|
|
318
389
|
|
|
@@ -320,14 +391,20 @@ Get a list of all Environments.
|
|
|
320
391
|
|
|
321
392
|
```
|
|
322
393
|
USAGE
|
|
323
|
-
$ sc platform env list [-
|
|
394
|
+
$ sc platform env list [--json] [--log-level debug|warn|error|info|trace] [-n <value>] [-p <value>] [-s <value>]
|
|
395
|
+
[--sort <value>]
|
|
324
396
|
|
|
325
397
|
FLAGS
|
|
326
398
|
-n, --name=<value> Name of the environment to match on.
|
|
327
|
-
|
|
328
|
-
|
|
399
|
+
-p, --pageNumber=<value> The page number to get. Defaults to 10
|
|
400
|
+
-s, --pageSize=<value> The number of environments to get per page. Defaults to 1
|
|
329
401
|
--sort=<value> The query (fieldName:<ASC/DESC>) used to sort the environment list in the response.
|
|
330
402
|
|
|
403
|
+
GLOBAL FLAGS
|
|
404
|
+
--json Format output as json.
|
|
405
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
406
|
+
<options: debug|warn|error|info|trace>
|
|
407
|
+
|
|
331
408
|
DESCRIPTION
|
|
332
409
|
Get a list of all Environments.
|
|
333
410
|
|
|
@@ -339,7 +416,7 @@ EXAMPLES
|
|
|
339
416
|
$ sc platform env list --name=Default --pageNumber=1 --pageSize=10 --sort=name:ASC
|
|
340
417
|
```
|
|
341
418
|
|
|
342
|
-
_See code: [src/commands/platform/env/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.
|
|
419
|
+
_See code: [src/commands/platform/env/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/platform/env/list.ts)_
|
|
343
420
|
|
|
344
421
|
## `sc platform env update`
|
|
345
422
|
|
|
@@ -347,7 +424,8 @@ Modify an environment's attributes
|
|
|
347
424
|
|
|
348
425
|
```
|
|
349
426
|
USAGE
|
|
350
|
-
$ sc platform env update [-d <value>] [-e <value>] [--isDefault] [-n
|
|
427
|
+
$ sc platform env update [--json] [--log-level debug|warn|error|info|trace] [-d <value>] [-e <value>] [--isDefault] [-n
|
|
428
|
+
<value>] [--new-name <value>]
|
|
351
429
|
|
|
352
430
|
FLAGS
|
|
353
431
|
-d, --desc=<value> Description of the environment to update.
|
|
@@ -356,6 +434,11 @@ FLAGS
|
|
|
356
434
|
--isDefault Indicates this is the organization's default environment. The default value is false.
|
|
357
435
|
--new-name=<value> New name of the environment.
|
|
358
436
|
|
|
437
|
+
GLOBAL FLAGS
|
|
438
|
+
--json Format output as json.
|
|
439
|
+
--log-level=<option> [default: info] Specify level for logging.
|
|
440
|
+
<options: debug|warn|error|info|trace>
|
|
441
|
+
|
|
359
442
|
DESCRIPTION
|
|
360
443
|
Modify an environment's attributes
|
|
361
444
|
|
|
@@ -370,7 +453,7 @@ EXAMPLES
|
|
|
370
453
|
$ sc platform env update --env-id=MyEnvId --new-name=MyNewEnvName --desc="My description to update" --isDefault
|
|
371
454
|
```
|
|
372
455
|
|
|
373
|
-
_See code: [src/commands/platform/env/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.
|
|
456
|
+
_See code: [src/commands/platform/env/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.3/src/commands/platform/env/update.ts)_
|
|
374
457
|
|
|
375
458
|
## `sc plugins`
|
|
376
459
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
2
|
+
import { EventBrokerCreateDetail } from '../../../types/broker.js';
|
|
3
|
+
export default class MissionctrlBrokerCreate extends ScCommand<typeof MissionctrlBrokerCreate> {
|
|
3
4
|
static args: {};
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -14,6 +15,6 @@ export default class MissionctrlBrokerCreate extends Command {
|
|
|
14
15
|
'service-class-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
16
|
version: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
17
|
};
|
|
17
|
-
run(): Promise<
|
|
18
|
+
run(): Promise<EventBrokerCreateDetail>;
|
|
18
19
|
private print;
|
|
19
20
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { camelCaseToTitleCase } from '../../../util/internal.js';
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
3
|
+
import { camelCaseToTitleCase, renderKeyValueTable } from '../../../util/internal.js';
|
|
4
4
|
import { ScConnection } from '../../../util/sc-connection.js';
|
|
5
|
-
export default class MissionctrlBrokerCreate extends
|
|
5
|
+
export default class MissionctrlBrokerCreate extends ScCommand {
|
|
6
6
|
static args = {};
|
|
7
7
|
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.
|
|
8
8
|
|
|
@@ -99,22 +99,14 @@ Token Permissions: [ \`services:post\` ]`;
|
|
|
99
99
|
// Display results
|
|
100
100
|
this.log('Event broker service created successfully.');
|
|
101
101
|
this.print(resp.data);
|
|
102
|
+
return resp.data;
|
|
102
103
|
}
|
|
103
104
|
print(broker) {
|
|
104
|
-
this.log();
|
|
105
105
|
const tableRows = [
|
|
106
106
|
['Key', 'Value'],
|
|
107
107
|
...Object.entries(broker).map(([key, value]) => [camelCaseToTitleCase(key), value]),
|
|
108
108
|
];
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
columns: {
|
|
112
|
-
1: { width: 50, wrapWord: true },
|
|
113
|
-
},
|
|
114
|
-
drawHorizontalLine(lineIndex, rowCount) {
|
|
115
|
-
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
this.log(table(tableRows, config));
|
|
109
|
+
this.log();
|
|
110
|
+
this.log(renderKeyValueTable(tableRows));
|
|
119
111
|
}
|
|
120
112
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class MissionctrlBrokerDelete extends
|
|
1
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
2
|
+
export default class MissionctrlBrokerDelete extends ScCommand<typeof MissionctrlBrokerDelete> {
|
|
3
3
|
static args: {};
|
|
4
4
|
static description: string;
|
|
5
5
|
static examples: string[];
|
|
@@ -7,5 +7,7 @@ export default class MissionctrlBrokerDelete extends Command {
|
|
|
7
7
|
'broker-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
};
|
|
10
|
-
run(): Promise<
|
|
10
|
+
run(): Promise<{
|
|
11
|
+
message: string;
|
|
12
|
+
}>;
|
|
11
13
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
2
3
|
import { ScConnection } from '../../../util/sc-connection.js';
|
|
3
|
-
export default class MissionctrlBrokerDelete extends
|
|
4
|
+
export default class MissionctrlBrokerDelete extends ScCommand {
|
|
4
5
|
static args = {};
|
|
5
6
|
static description = `Delete a service using its unique identifier.
|
|
6
7
|
|
|
@@ -47,6 +48,8 @@ Token Permissions: [ \`services:delete\` **or** \`services:delete:self\` **or**
|
|
|
47
48
|
// API call to delete environment by id
|
|
48
49
|
apiUrl += `/${brokerIdToDelete}`;
|
|
49
50
|
await conn.delete(apiUrl);
|
|
50
|
-
|
|
51
|
+
const message = `Event broker service with id '${brokerIdToDelete}' has been deleted successfully.`;
|
|
52
|
+
this.log(message);
|
|
53
|
+
return { message };
|
|
51
54
|
}
|
|
52
55
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
2
|
+
import { EventBrokerServiceDetail } from '../../../types/broker.js';
|
|
3
|
+
export default class MissionctrlBrokerDisplay extends ScCommand<typeof MissionctrlBrokerDisplay> {
|
|
3
4
|
static args: {};
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -7,6 +8,6 @@ export default class MissionctrlBrokerDisplay extends Command {
|
|
|
7
8
|
'broker-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
};
|
|
10
|
-
run(): Promise<
|
|
11
|
+
run(): Promise<EventBrokerServiceDetail[]>;
|
|
11
12
|
private print;
|
|
12
13
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { camelCaseToTitleCase } from '../../../util/internal.js';
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
3
|
+
import { camelCaseToTitleCase, renderKeyValueTable } from '../../../util/internal.js';
|
|
4
4
|
import { ScConnection } from '../../../util/sc-connection.js';
|
|
5
|
-
export default class MissionctrlBrokerDisplay extends
|
|
5
|
+
export default class MissionctrlBrokerDisplay extends ScCommand {
|
|
6
6
|
static args = {};
|
|
7
7
|
static description = `Get the details of an event broker service using its identifier or name.
|
|
8
8
|
|
|
@@ -31,11 +31,13 @@ export default class MissionctrlBrokerDisplay extends Command {
|
|
|
31
31
|
let apiUrl = `/missionControl/eventBrokerServices`;
|
|
32
32
|
// If broker name provided, get all brokers matching provided name
|
|
33
33
|
// If broker id provided, get broker with that id
|
|
34
|
+
let rawResp;
|
|
34
35
|
if (brokerId) {
|
|
35
36
|
// API call to get broker by id
|
|
36
37
|
apiUrl += `/${brokerId}`;
|
|
37
38
|
const resp = await conn.get(apiUrl);
|
|
38
39
|
this.print(resp);
|
|
40
|
+
rawResp = [resp];
|
|
39
41
|
}
|
|
40
42
|
else if (name) {
|
|
41
43
|
// API call to get broker by name
|
|
@@ -44,26 +46,20 @@ export default class MissionctrlBrokerDisplay extends Command {
|
|
|
44
46
|
for (const broker of resp.data) {
|
|
45
47
|
this.print(broker);
|
|
46
48
|
}
|
|
49
|
+
rawResp = resp.data;
|
|
47
50
|
}
|
|
48
51
|
else {
|
|
49
52
|
this.error('Either --broker-id or --name must be provided.');
|
|
50
53
|
}
|
|
54
|
+
// Return raw json if --json flag is set
|
|
55
|
+
return rawResp;
|
|
51
56
|
}
|
|
52
57
|
print(broker) {
|
|
53
|
-
this.log();
|
|
54
58
|
const tableRows = [
|
|
55
59
|
['Key', 'Value'],
|
|
56
60
|
...Object.entries(broker).map(([key, value]) => [camelCaseToTitleCase(key), value]),
|
|
57
61
|
];
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
columns: {
|
|
61
|
-
1: { width: 50, wrapWord: true },
|
|
62
|
-
},
|
|
63
|
-
drawHorizontalLine(lineIndex, rowCount) {
|
|
64
|
-
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
this.log(table(tableRows, config));
|
|
62
|
+
this.log();
|
|
63
|
+
this.log(renderKeyValueTable(tableRows));
|
|
68
64
|
}
|
|
69
65
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
2
|
+
import { EventBrokerServiceDetail } from '../../../types/broker.js';
|
|
3
|
+
export default class MissionctrlBrokerList extends ScCommand<typeof MissionctrlBrokerList> {
|
|
3
4
|
static args: {};
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -9,5 +10,5 @@ export default class MissionctrlBrokerList extends Command {
|
|
|
9
10
|
pageSize: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
sort: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
|
-
run(): Promise<
|
|
13
|
+
run(): Promise<EventBrokerServiceDetail[]>;
|
|
13
14
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
3
|
+
import { renderTable } from '../../../util/internal.js';
|
|
3
4
|
import { ScConnection } from '../../../util/sc-connection.js';
|
|
4
|
-
export default class MissionctrlBrokerList extends
|
|
5
|
+
export default class MissionctrlBrokerList extends ScCommand {
|
|
5
6
|
static args = {};
|
|
6
7
|
static description = `Get a listing of event broker services.
|
|
7
8
|
|
|
@@ -61,6 +62,8 @@ Token Permissions: [ \`mission_control:access\` **or** \`services:get\` **or** \
|
|
|
61
62
|
];
|
|
62
63
|
// Display results as a table
|
|
63
64
|
this.log();
|
|
64
|
-
this.log(
|
|
65
|
+
this.log(renderTable(brokerArray));
|
|
66
|
+
// Return raw json if --json flag is set
|
|
67
|
+
return resp.data;
|
|
65
68
|
}
|
|
66
69
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
2
|
+
import { OperationData } from '../../../types/broker.js';
|
|
3
|
+
export default class MissionctrlBrokerOpstatus extends ScCommand<typeof MissionctrlBrokerOpstatus> {
|
|
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
|
+
'operation-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'show-progress': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<OperationData>;
|
|
14
|
+
private print;
|
|
15
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import cliProgress from 'cli-progress';
|
|
3
|
+
import { ScCommand } from '../../../sc-command.js';
|
|
4
|
+
import { ScConnection } from '../../../util/sc-connection.js';
|
|
5
|
+
import { camelCaseToTitleCase, renderKeyValueTable, sleep } from '../../../util/internal.js';
|
|
6
|
+
export default class MissionctrlBrokerOpstatus extends ScCommand {
|
|
7
|
+
static args = {};
|
|
8
|
+
static description = `Get the status of an operation that being performed on an event broker service.
|
|
9
|
+
To get the operation, you provide identifier of the operation and the identifier of the event broker service.
|
|
10
|
+
|
|
11
|
+
Token Permissions: [ mission_control:access or services:get or services:get:self or services:view or services:view:self ]`;
|
|
12
|
+
static examples = [
|
|
13
|
+
'<%= config.bin %> <%= command.id %>',
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
'broker-id': Flags.string({
|
|
17
|
+
char: 'b',
|
|
18
|
+
description: 'Id of the event broker service.',
|
|
19
|
+
exactlyOne: ['broker-id', 'name'],
|
|
20
|
+
}),
|
|
21
|
+
name: Flags.string({
|
|
22
|
+
char: 'n',
|
|
23
|
+
description: 'Name of the event broker service.',
|
|
24
|
+
exactlyOne: ['broker-id', 'name'],
|
|
25
|
+
}),
|
|
26
|
+
'operation-id': Flags.string({
|
|
27
|
+
char: 'o',
|
|
28
|
+
description: 'The identifier of the operation being performed on the event broker service.'
|
|
29
|
+
}),
|
|
30
|
+
'show-progress': Flags.boolean({
|
|
31
|
+
char: 'p',
|
|
32
|
+
description: 'Displays a status bar of the in-progress operation. The command will wait for completion of each step of the operation.'
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
async run() {
|
|
36
|
+
const { flags } = await this.parse(MissionctrlBrokerOpstatus);
|
|
37
|
+
const name = flags.name ?? '';
|
|
38
|
+
let brokerId = flags['broker-id'] ?? '';
|
|
39
|
+
const operationId = flags['operation-id'] ?? '';
|
|
40
|
+
const showProgress = flags['show-progress'] ?? false;
|
|
41
|
+
const conn = new ScConnection();
|
|
42
|
+
// API url
|
|
43
|
+
let apiUrl = `/missionControl/eventBrokerServices`;
|
|
44
|
+
// If broker name provided, retrieve the broker service id first
|
|
45
|
+
// then retrieve the operation status
|
|
46
|
+
let rawResp;
|
|
47
|
+
if (name) {
|
|
48
|
+
// API call to get broker by name
|
|
49
|
+
apiUrl += `?customAttributes=name=="${name}"`;
|
|
50
|
+
const resp = await conn.get(apiUrl);
|
|
51
|
+
// TODO FUTURE: show status of multiple brokers operations that match the name
|
|
52
|
+
if (resp.data.length > 1) {
|
|
53
|
+
this.error(`Multiple broker services found with: ${name}. Exactly one broker service must match the provided name.`);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
brokerId = resp.data[0]?.id;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// API call to retrieve status of the broker operation
|
|
60
|
+
apiUrl = `/missionControl/eventBrokerServices/${brokerId}/operations/${operationId}`;
|
|
61
|
+
if (showProgress) {
|
|
62
|
+
apiUrl += '?expand=progressLogs';
|
|
63
|
+
}
|
|
64
|
+
let resp = await conn.get(apiUrl);
|
|
65
|
+
this.print(resp.data);
|
|
66
|
+
// Display progress bar for each step included in the progress logs
|
|
67
|
+
// Enable progress bar if set
|
|
68
|
+
if (resp.data.progressLogs && resp.data.progressLogs.length > 0) {
|
|
69
|
+
let progressLogs = resp.data.progressLogs;
|
|
70
|
+
let numSteps = progressLogs.length;
|
|
71
|
+
// Create a new progress bar instance and use shades_classic theme
|
|
72
|
+
const progressBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
|
|
73
|
+
// start the progress bar with a total value of size of the steps and start value of 0
|
|
74
|
+
progressBar.start(numSteps, 0);
|
|
75
|
+
// Update the progress with the steps completed
|
|
76
|
+
let completedNumSteps = 0;
|
|
77
|
+
while (completedNumSteps < numSteps) {
|
|
78
|
+
// Sleep for 5 seconds before making the next API call
|
|
79
|
+
await sleep(5000);
|
|
80
|
+
// Make another API call to get the lastest progress
|
|
81
|
+
resp = await conn.get(apiUrl);
|
|
82
|
+
if (resp.data.progressLogs) {
|
|
83
|
+
progressLogs = resp.data.progressLogs;
|
|
84
|
+
for (const progressLog of progressLogs) {
|
|
85
|
+
if (progressLog.step === 'success') {
|
|
86
|
+
completedNumSteps++;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Update progress bar
|
|
90
|
+
progressBar.update(completedNumSteps);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// stop the progress bar
|
|
97
|
+
progressBar.stop();
|
|
98
|
+
}
|
|
99
|
+
return resp.data;
|
|
100
|
+
}
|
|
101
|
+
print(environment) {
|
|
102
|
+
const tableRows = [
|
|
103
|
+
['Key', 'Value'],
|
|
104
|
+
...Object.entries(environment).map(([key, value]) => [camelCaseToTitleCase(key), value]),
|
|
105
|
+
];
|
|
106
|
+
this.log();
|
|
107
|
+
this.log(renderKeyValueTable(tableRows));
|
|
108
|
+
}
|
|
109
|
+
}
|