@dishantlangayan/solace-cloud-cli 0.0.1 → 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 CHANGED
@@ -12,6 +12,7 @@ The Solace Cloud CLI
12
12
 
13
13
  <!-- toc -->
14
14
  * [Usage](#usage)
15
+ * [Configuration](#configuration)
15
16
  * [Commands](#commands)
16
17
  <!-- tocstop -->
17
18
  # Usage
@@ -21,13 +22,27 @@ $ npm install -g @dishantlangayan/solace-cloud-cli
21
22
  $ sc COMMAND
22
23
  running command...
23
24
  $ sc (--version)
24
- @dishantlangayan/solace-cloud-cli/0.0.1 darwin-x64 node-v23.10.0
25
+ @dishantlangayan/solace-cloud-cli/0.0.3 darwin-x64 node-v23.10.0
25
26
  $ sc --help [COMMAND]
26
27
  USAGE
27
28
  $ sc COMMAND
28
29
  ...
29
30
  ```
30
31
  <!-- usagestop -->
32
+ # Configuration
33
+ <!-- configuration -->
34
+ To use any commands you will need to configure an Access Token in Solace Cloud Console with the appropriate permissions first. The access token can be set using the follow Environment Variable:
35
+
36
+ ```
37
+ SC_ACCESS_TOKEN=<Your access token>
38
+ ```
39
+
40
+ The following Environment variables are optional:
41
+
42
+ * SC_API_VERSION - The API version of the Solace Cloud REST API. Default is `v2`.
43
+ * SC_BASE_URL - The location of your Solace Home Cloud account determines the base URL you use. Default is `https://api.solace.cloud/`
44
+
45
+ <!-- configurationtop -->
31
46
  # Commands
32
47
  <!-- commands -->
33
48
  * [`sc help [COMMAND]`](#sc-help-command)
@@ -35,6 +50,7 @@ USAGE
35
50
  * [`sc missionctrl broker delete`](#sc-missionctrl-broker-delete)
36
51
  * [`sc missionctrl broker display`](#sc-missionctrl-broker-display)
37
52
  * [`sc missionctrl broker list`](#sc-missionctrl-broker-list)
53
+ * [`sc missionctrl broker opstatus`](#sc-missionctrl-broker-opstatus)
38
54
  * [`sc platform env create`](#sc-platform-env-create)
39
55
  * [`sc platform env delete`](#sc-platform-env-delete)
40
56
  * [`sc platform env display`](#sc-platform-env-display)
@@ -77,22 +93,44 @@ Create an event broker service. You must provide a unique name and select a serv
77
93
 
78
94
  ```
79
95
  USAGE
80
- $ sc missionctrl broker create -d <value> -n <value> -c <value> [-e <value>] [-l] [-s <value>] [-m <value>] [-v
81
- <value>]
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>]
82
98
 
83
99
  FLAGS
84
- -c, --service-class-id=<value> (required) Supported service classes.
85
- -d, --datacenter-id=<value> (required) The identifier of the datacenter.
86
- -e, --env-name=<value> The name of the environment environment where you want to create the service. If no
87
- name is provided, the service will be created in the default environment.
88
- -l, --locked Indicates if you can delete the event broker service after creating it. The default
89
- value is false.
90
- -m, --msg-vpn-name=<value> The message VPN name. A default message VPN name is provided when this is not
91
- specified.
92
- -n, --name=<value> (required) Name of the event broker service to create.
93
- -s, --max-spool-usage=<value> The message spool size, in gigabytes (GB). A default message spool size is provided if
94
- this is not specified.
95
- -v, --version=<value> The event broker version. A default version is provided when this is not specified.
100
+ -c, --service-class-id=<value>
101
+ (required) Supported service classes.
102
+
103
+ -d, --datacenter-id=<value>
104
+ (required) The identifier of the datacenter.
105
+
106
+ -e, --env-name=<value>
107
+ The name of the environment environment where you want to create the service.
108
+ You can only specify an environment identifier when creating services in a Public Region.
109
+ You cannot specify an environment identifier when creating a service in a Dedicated Region.
110
+ If no name is provided, the service will be created in the default environment.
111
+
112
+ -l, --locked
113
+ Indicates if you can delete the event broker service after creating it. The default value is false.
114
+
115
+ -m, --msg-vpn-name=<value>
116
+ The message VPN name. A default message VPN name is provided when this is not specified.
117
+
118
+ -n, --name=<value>
119
+ (required) Name of the event broker service to create.
120
+
121
+ -r, --redundancy-group-ssl-enabled
122
+ Enable or disable SSL for the redundancy group (for mate-link encryption). The default value is false (disabled)
123
+
124
+ -s, --max-spool-usage=<value>
125
+ The message spool size, in gigabytes (GB). A default message spool size is provided if this is not specified.
126
+
127
+ -v, --version=<value>
128
+ The event broker version. A default version is provided when this is not specified.
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>
96
134
 
97
135
  DESCRIPTION
98
136
  Create an event broker service. You must provide a unique name and select a service class and datacenter. You can
@@ -103,10 +141,10 @@ DESCRIPTION
103
141
  Token Permissions: [ `services:post` ]
104
142
 
105
143
  EXAMPLES
106
- $ sc missionctrl broker create --datacenter-id=MyDatacenterId --name=MyBrokerName --service-class-id=DEVELOPER
144
+ $ sc missionctrl broker create --name=MyBrokerName --datacenter-id=eks-ca-central-1a --service-class-id=DEVELOPER
107
145
  ```
108
146
 
109
- _See code: [src/commands/missionctrl/broker/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.1/src/commands/missionctrl/broker/create.ts)_
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)_
110
148
 
111
149
  ## `sc missionctrl broker delete`
112
150
 
@@ -114,12 +152,17 @@ Delete a service using its unique identifier.
114
152
 
115
153
  ```
116
154
  USAGE
117
- $ 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>]
118
156
 
119
157
  FLAGS
120
158
  -b, --broker-id=<value> Id of the event broker service.
121
159
  -n, --name=<value> Name of the event broker service.
122
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
+
123
166
  DESCRIPTION
124
167
  Delete a service using its unique identifier.
125
168
 
@@ -133,7 +176,7 @@ EXAMPLES
133
176
  $ sc missionctrl broker delete --name=MyBrokerName
134
177
  ```
135
178
 
136
- _See code: [src/commands/missionctrl/broker/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.1/src/commands/missionctrl/broker/delete.ts)_
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)_
137
180
 
138
181
  ## `sc missionctrl broker display`
139
182
 
@@ -141,12 +184,17 @@ Get the details of an event broker service using its identifier or name.
141
184
 
142
185
  ```
143
186
  USAGE
144
- $ 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>]
145
188
 
146
189
  FLAGS
147
190
  -b, --broker-id=<value> Id of the event broker service.
148
191
  -n, --name=<value> Name of the event broker service.
149
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
+
150
198
  DESCRIPTION
151
199
  Get the details of an event broker service using its identifier or name.
152
200
 
@@ -159,7 +207,7 @@ EXAMPLES
159
207
  $ sc missionctrl broker display
160
208
  ```
161
209
 
162
- _See code: [src/commands/missionctrl/broker/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.1/src/commands/missionctrl/broker/display.ts)_
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)_
163
211
 
164
212
  ## `sc missionctrl broker list`
165
213
 
@@ -167,7 +215,8 @@ Get a listing of event broker services.
167
215
 
168
216
  ```
169
217
  USAGE
170
- $ sc missionctrl broker list [-n <value>] [--pageNumber <value>] [--pageSize <value>] [--sort <value>]
218
+ $ sc missionctrl broker list [--json] [--log-level debug|warn|error|info|trace] [-n <value>] [--pageNumber <value>]
219
+ [--pageSize <value>] [--sort <value>]
171
220
 
172
221
  FLAGS
173
222
  -n, --name=<value>
@@ -187,6 +236,11 @@ FLAGS
187
236
  * attributes-names
188
237
  * attributes-names:sort-order
189
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
+
190
244
  DESCRIPTION
191
245
  Get a listing of event broker services.
192
246
 
@@ -199,7 +253,41 @@ EXAMPLES
199
253
  $ sc missionctrl broker list --name=MyBrokerName --pageNumber=1 --pageSize=10 --sort=name:asc
200
254
  ```
201
255
 
202
- _See code: [src/commands/missionctrl/broker/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.1/src/commands/missionctrl/broker/list.ts)_
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)_
203
291
 
204
292
  ## `sc platform env create`
205
293
 
@@ -207,7 +295,8 @@ Create a new environment.
207
295
 
208
296
  ```
209
297
  USAGE
210
- $ sc platform env create -n <value> [-d <value>] [--isDefault] [--isProduction]
298
+ $ sc platform env create -n <value> [--json] [--log-level debug|warn|error|info|trace] [-d <value>] [--isDefault]
299
+ [--isProduction]
211
300
 
212
301
  FLAGS
213
302
  -d, --desc=<value> Description of the environment to create.
@@ -218,6 +307,11 @@ FLAGS
218
307
  architecture can be migrated to a new environment with the desired
219
308
  environment type instead.
220
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
+
221
315
  DESCRIPTION
222
316
  Create a new environment.
223
317
 
@@ -227,7 +321,7 @@ EXAMPLES
227
321
  $ sc platform env create --name=MyEnvironment --desc="My environment description" --isDefault --isProduction
228
322
  ```
229
323
 
230
- _See code: [src/commands/platform/env/create.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.1/src/commands/platform/env/create.ts)_
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)_
231
325
 
232
326
  ## `sc platform env delete`
233
327
 
@@ -235,12 +329,17 @@ Delete an environment using either its name or unique identifier. The default en
235
329
 
236
330
  ```
237
331
  USAGE
238
- $ 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>]
239
333
 
240
334
  FLAGS
241
335
  -e, --env-id=<value> Id of the environment.
242
336
  -n, --name=<value> Name of the environment.
243
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
+
244
343
  DESCRIPTION
245
344
  Delete an environment using either its name or unique identifier. The default environment cannot be deleted.
246
345
 
@@ -252,7 +351,7 @@ EXAMPLES
252
351
  $ sc platform env delete --env-id=MyEnvId
253
352
  ```
254
353
 
255
- _See code: [src/commands/platform/env/delete.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.1/src/commands/platform/env/delete.ts)_
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)_
256
355
 
257
356
  ## `sc platform env display`
258
357
 
@@ -260,12 +359,17 @@ Display information about an Environment.
260
359
 
261
360
  ```
262
361
  USAGE
263
- $ 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>]
264
363
 
265
364
  FLAGS
266
365
  -e, --env-id=<value> Id of the environment.
267
366
  -n, --name=<value> Name of the environment.
268
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
+
269
373
  DESCRIPTION
270
374
  Display information about an Environment.
271
375
 
@@ -273,14 +377,13 @@ DESCRIPTION
273
377
 
274
378
  Required token permissions: [ environments:view ]
275
379
 
276
-
277
380
  EXAMPLES
278
381
  $ sc platform env display --name=MyEnvName
279
382
 
280
383
  $ sc platform env display --env-id=MyEnvId
281
384
  ```
282
385
 
283
- _See code: [src/commands/platform/env/display.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.1/src/commands/platform/env/display.ts)_
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)_
284
387
 
285
388
  ## `sc platform env list`
286
389
 
@@ -288,13 +391,13 @@ Get a list of all Environments.
288
391
 
289
392
  ```
290
393
  USAGE
291
- $ sc platform env list [--json] [--log-level debug|warn|error|info|trace] [-n <value>] [--pageNumber <value>]
292
- [--pageSize <value>] [--sort <value>]
394
+ $ sc platform env list [--json] [--log-level debug|warn|error|info|trace] [-n <value>] [-p <value>] [-s <value>]
395
+ [--sort <value>]
293
396
 
294
397
  FLAGS
295
398
  -n, --name=<value> Name of the environment to match on.
296
- --pageNumber=<value> The page number to get. Defaults to 10
297
- --pageSize=<value> The number of environments to get per page. Defaults to 1
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
298
401
  --sort=<value> The query (fieldName:<ASC/DESC>) used to sort the environment list in the response.
299
402
 
300
403
  GLOBAL FLAGS
@@ -313,7 +416,7 @@ EXAMPLES
313
416
  $ sc platform env list --name=Default --pageNumber=1 --pageSize=10 --sort=name:ASC
314
417
  ```
315
418
 
316
- _See code: [src/commands/platform/env/list.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.1/src/commands/platform/env/list.ts)_
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)_
317
420
 
318
421
  ## `sc platform env update`
319
422
 
@@ -321,7 +424,8 @@ Modify an environment's attributes
321
424
 
322
425
  ```
323
426
  USAGE
324
- $ sc platform env update [-d <value>] [-e <value>] [--isDefault] [-n <value>] [--new-name <value>]
427
+ $ sc platform env update [--json] [--log-level debug|warn|error|info|trace] [-d <value>] [-e <value>] [--isDefault] [-n
428
+ <value>] [--new-name <value>]
325
429
 
326
430
  FLAGS
327
431
  -d, --desc=<value> Description of the environment to update.
@@ -330,6 +434,11 @@ FLAGS
330
434
  --isDefault Indicates this is the organization's default environment. The default value is false.
331
435
  --new-name=<value> New name of the environment.
332
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
+
333
442
  DESCRIPTION
334
443
  Modify an environment's attributes
335
444
 
@@ -344,7 +453,7 @@ EXAMPLES
344
453
  $ sc platform env update --env-id=MyEnvId --new-name=MyNewEnvName --desc="My description to update" --isDefault
345
454
  ```
346
455
 
347
- _See code: [src/commands/platform/env/update.ts](https://github.com/dishantlangayan/solace-cloud-cli/blob/v0.0.1/src/commands/platform/env/update.ts)_
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)_
348
457
 
349
458
  ## `sc plugins`
350
459
 
@@ -1,5 +1,6 @@
1
- import { Command } from '@oclif/core';
2
- export default class MissionctrlBrokerCreate extends Command {
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[];
@@ -10,9 +11,10 @@ export default class MissionctrlBrokerCreate extends Command {
10
11
  'max-spool-usage': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  'msg-vpn-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
13
  name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'redundancy-group-ssl-enabled': import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
15
  'service-class-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
16
  version: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
17
  };
16
- run(): Promise<void>;
18
+ run(): Promise<EventBrokerCreateDetail>;
17
19
  private print;
18
20
  }
@@ -1,15 +1,15 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import { table } from 'table';
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 Command {
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
 
9
9
  Your token must have one of the permissions listed in the Token Permissions.
10
10
 
11
11
  Token Permissions: [ \`services:post\` ]`;
12
- static examples = ['<%= config.bin %> <%= command.id %> --datacenter-id=MyDatacenterId --name=MyBrokerName --service-class-id=DEVELOPER'];
12
+ static examples = ['<%= config.bin %> <%= command.id %> --name=MyBrokerName --datacenter-id=eks-ca-central-1a --service-class-id=DEVELOPER'];
13
13
  static flags = {
14
14
  'datacenter-id': Flags.string({
15
15
  char: 'd',
@@ -18,7 +18,10 @@ Token Permissions: [ \`services:post\` ]`;
18
18
  }),
19
19
  'env-name': Flags.string({
20
20
  char: 'e',
21
- description: 'The name of the environment environment where you want to create the service. If no name is provided, the service will be created in the default environment.',
21
+ description: `The name of the environment environment where you want to create the service.
22
+ You can only specify an environment identifier when creating services in a Public Region.
23
+ You cannot specify an environment identifier when creating a service in a Dedicated Region.
24
+ If no name is provided, the service will be created in the default environment.`,
22
25
  }),
23
26
  locked: Flags.boolean({
24
27
  char: 'l',
@@ -33,7 +36,16 @@ Token Permissions: [ \`services:post\` ]`;
33
36
  char: 'm',
34
37
  description: 'The message VPN name. A default message VPN name is provided when this is not specified.',
35
38
  }),
36
- name: Flags.string({ char: 'n', description: 'Name of the event broker service to create.', required: true }),
39
+ name: Flags.string({
40
+ char: 'n',
41
+ description: 'Name of the event broker service to create.',
42
+ required: true
43
+ }),
44
+ 'redundancy-group-ssl-enabled': Flags.boolean({
45
+ char: 'r',
46
+ default: false,
47
+ description: 'Enable or disable SSL for the redundancy group (for mate-link encryption). The default value is false (disabled)',
48
+ }),
37
49
  'service-class-id': Flags.string({
38
50
  char: 'c',
39
51
  description: 'Supported service classes.',
@@ -47,14 +59,15 @@ Token Permissions: [ \`services:post\` ]`;
47
59
  async run() {
48
60
  const { flags } = await this.parse(MissionctrlBrokerCreate);
49
61
  const datacenterId = flags['datacenter-id'] ?? '';
50
- let envName = flags['env-name'] ?? '';
62
+ const envName = flags['env-name'] ?? '';
51
63
  const locked = flags.locked ?? false;
52
- // const maxSpoolUsage = flags['max-spool-usage'] ?? ''
53
- // const msgVpnName = flags['msg-vpn-name'] ?? ''
64
+ const maxSpoolUsage = flags['max-spool-usage'] ?? '';
65
+ const msgVpnName = flags['msg-vpn-name'] ?? '';
54
66
  const name = flags.name ?? '';
55
- const redundancyGroupSslEnabled = false; // This flag is not defined yet, but it is used in the API body
67
+ const redundancyGroupSslEnabled = flags['redundancy-group-ssl-enabled'];
56
68
  const serviceClassId = flags['service-class-id'] ?? 'DEVELOPER';
57
- // const version = flags.version ?? ''
69
+ const eventBrokerVersion = flags.version ?? '';
70
+ let envId = '';
58
71
  const conn = new ScConnection();
59
72
  // API url
60
73
  const apiUrl = `/missionControl/eventBrokerServices`;
@@ -66,17 +79,17 @@ Token Permissions: [ \`services:post\` ]`;
66
79
  this.error(`Multiple environments found with: ${name}. Exactly one environment must match the provided name.`);
67
80
  }
68
81
  else {
69
- envName = envResp.data[0]?.id;
82
+ envId = envResp.data[0]?.id;
70
83
  }
71
84
  }
72
85
  // API body
73
86
  const body = {
74
- datacenterId,
75
- envName,
76
- // eventBrokerVersion: version,
87
+ ...(datacenterId && { datacenterId }),
88
+ ...(envId) && { environmentId: envId },
89
+ ...(eventBrokerVersion && { eventBrokerVersion }),
77
90
  locked,
78
- // maxSpoolUsage,
79
- // msgVpnName,
91
+ ...(maxSpoolUsage && { maxSpoolUsage }),
92
+ ...(msgVpnName && { msgVpnName }),
80
93
  name,
81
94
  redundancyGroupSslEnabled,
82
95
  serviceClassId,
@@ -86,22 +99,14 @@ Token Permissions: [ \`services:post\` ]`;
86
99
  // Display results
87
100
  this.log('Event broker service created successfully.');
88
101
  this.print(resp.data);
102
+ return resp.data;
89
103
  }
90
104
  print(broker) {
91
- this.log();
92
105
  const tableRows = [
93
106
  ['Key', 'Value'],
94
107
  ...Object.entries(broker).map(([key, value]) => [camelCaseToTitleCase(key), value]),
95
108
  ];
96
- // Table config
97
- const config = {
98
- columns: {
99
- 1: { width: 50, wrapWord: true },
100
- },
101
- drawHorizontalLine(lineIndex, rowCount) {
102
- return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
103
- },
104
- };
105
- this.log(table(tableRows, config));
109
+ this.log();
110
+ this.log(renderKeyValueTable(tableRows));
106
111
  }
107
112
  }
@@ -1,5 +1,5 @@
1
- import { Command } from '@oclif/core';
2
- export default class MissionctrlBrokerDelete extends Command {
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<void>;
10
+ run(): Promise<{
11
+ message: string;
12
+ }>;
11
13
  }
@@ -1,6 +1,7 @@
1
- import { Command, Flags } from '@oclif/core';
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 Command {
4
+ export default class MissionctrlBrokerDelete extends ScCommand {
4
5
  static args = {};
5
6
  static description = `Delete a service using its unique identifier.
6
7
 
@@ -12,13 +13,11 @@ Token Permissions: [ \`services:delete\` **or** \`services:delete:self\` **or**
12
13
  '<%= config.bin %> <%= command.id %> --name=MyBrokerName',
13
14
  ];
14
15
  static flags = {
15
- // flag for getting environment by id (-e, --env-id)
16
16
  'broker-id': Flags.string({
17
17
  char: 'b',
18
18
  description: 'Id of the event broker service.',
19
19
  exactlyOne: ['broker-id', 'name'],
20
20
  }),
21
- // flag for getting environment by name (-n, --name=VALUE)
22
21
  name: Flags.string({
23
22
  char: 'n',
24
23
  description: 'Name of the event broker service.',
@@ -49,6 +48,8 @@ Token Permissions: [ \`services:delete\` **or** \`services:delete:self\` **or**
49
48
  // API call to delete environment by id
50
49
  apiUrl += `/${brokerIdToDelete}`;
51
50
  await conn.delete(apiUrl);
52
- this.log(`Event broker service with id '${brokerIdToDelete}' has been deleted successfully.`);
51
+ const message = `Event broker service with id '${brokerIdToDelete}' has been deleted successfully.`;
52
+ this.log(message);
53
+ return { message };
53
54
  }
54
55
  }
@@ -1,5 +1,6 @@
1
- import { Command } from '@oclif/core';
2
- export default class MissionctrlBrokerDisplay extends Command {
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<void>;
11
+ run(): Promise<EventBrokerServiceDetail[]>;
11
12
  private print;
12
13
  }
@@ -1,8 +1,8 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import { table } from 'table';
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 Command {
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
- // Table config
59
- const config = {
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
  }