@dishantlangayan/solace-cloud-cli 0.4.0 → 0.5.2
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 +1594 -139
- package/dist/commands/missionctrl/broker/delete.d.ts +1 -0
- package/dist/commands/missionctrl/broker/delete.js +25 -0
- package/dist/commands/platform/env/delete.d.ts +1 -0
- package/dist/commands/platform/env/delete.js +25 -0
- package/oclif.manifest.json +301 -287
- package/package.json +6 -5
|
@@ -8,6 +8,7 @@ export default class MissionctrlBrokerDelete extends ScCommand<typeof Missionctr
|
|
|
8
8
|
alias: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
'broker-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
12
|
org: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
};
|
|
13
14
|
run(): Promise<EventBrokerOperationApiResponse>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { printObjectAsKeyValueTable, ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
3
|
import { Flags } from '@oclif/core';
|
|
3
4
|
import { resolveOrgConnection } from '../../../lib/org-utils.js';
|
|
4
5
|
export default class MissionctrlBrokerDelete extends ScCommand {
|
|
@@ -13,6 +14,7 @@ Token Permissions: [ \`services:delete\` **or** \`services:delete:self\` **or**
|
|
|
13
14
|
'<%= config.bin %> <%= command.id %> --name=MyBrokerName',
|
|
14
15
|
'<%= config.bin %> <%= command.id %> --org=my-org --broker-id=MyBrokerId',
|
|
15
16
|
'<%= config.bin %> <%= command.id %> --alias=my-alias --name=MyBrokerName',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> --broker-id=MyBrokerId --no-prompt',
|
|
16
18
|
];
|
|
17
19
|
static flags = {
|
|
18
20
|
alias: Flags.string({
|
|
@@ -30,6 +32,10 @@ Token Permissions: [ \`services:delete\` **or** \`services:delete:self\` **or**
|
|
|
30
32
|
description: 'Name of the event broker service.',
|
|
31
33
|
exactlyOne: ['broker-id', 'name'],
|
|
32
34
|
}),
|
|
35
|
+
'no-prompt': Flags.boolean({
|
|
36
|
+
default: false,
|
|
37
|
+
description: 'Skip confirmation prompt and assume Yes',
|
|
38
|
+
}),
|
|
33
39
|
org: Flags.string({
|
|
34
40
|
char: 'o',
|
|
35
41
|
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
@@ -57,6 +63,25 @@ Token Permissions: [ \`services:delete\` **or** \`services:delete:self\` **or**
|
|
|
57
63
|
brokerIdToDelete = resp.data[0]?.id;
|
|
58
64
|
}
|
|
59
65
|
}
|
|
66
|
+
// Confirm deletion unless --no-prompt flag is set
|
|
67
|
+
if (!flags['no-prompt']) {
|
|
68
|
+
const brokerIdentifier = name || brokerId;
|
|
69
|
+
try {
|
|
70
|
+
const shouldProceed = await confirm({
|
|
71
|
+
default: false,
|
|
72
|
+
message: `Are you sure you want to delete the broker '${brokerIdentifier}'?`,
|
|
73
|
+
});
|
|
74
|
+
if (!shouldProceed) {
|
|
75
|
+
this.log('Deletion cancelled.');
|
|
76
|
+
this.exit(0);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// User cancelled the confirmation (Ctrl+C)
|
|
81
|
+
this.log('Deletion cancelled.');
|
|
82
|
+
this.exit(0);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
60
85
|
// API call to delete environment by id
|
|
61
86
|
apiUrl += `/${brokerIdToDelete}`;
|
|
62
87
|
const resp = await conn.delete(apiUrl);
|
|
@@ -7,6 +7,7 @@ export default class PlatformEnvDelete extends ScCommand<typeof PlatformEnvDelet
|
|
|
7
7
|
alias: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
'env-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
|
+
'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
org: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ScCommand } from '@dishantlangayan/sc-cli-core';
|
|
2
|
+
import { confirm } from '@inquirer/prompts';
|
|
2
3
|
import { Flags } from '@oclif/core';
|
|
3
4
|
import { resolveOrgConnection } from '../../../lib/org-utils.js';
|
|
4
5
|
export default class PlatformEnvDelete extends ScCommand {
|
|
@@ -11,6 +12,7 @@ export default class PlatformEnvDelete extends ScCommand {
|
|
|
11
12
|
'<%= config.bin %> <%= command.id %> --env-id=MyEnvId',
|
|
12
13
|
'<%= config.bin %> <%= command.id %> --org=my-org --name=MyEnvName',
|
|
13
14
|
'<%= config.bin %> <%= command.id %> --alias=my-alias --name=MyEnvName',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> --env-id=MyEnvId --no-prompt',
|
|
14
16
|
];
|
|
15
17
|
static flags = {
|
|
16
18
|
alias: Flags.string({
|
|
@@ -28,6 +30,10 @@ export default class PlatformEnvDelete extends ScCommand {
|
|
|
28
30
|
description: 'Name of the environment.',
|
|
29
31
|
exactlyOne: ['env-id', 'name'],
|
|
30
32
|
}),
|
|
33
|
+
'no-prompt': Flags.boolean({
|
|
34
|
+
default: false,
|
|
35
|
+
description: 'Skip confirmation prompt and assume Yes',
|
|
36
|
+
}),
|
|
31
37
|
org: Flags.string({
|
|
32
38
|
char: 'o',
|
|
33
39
|
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
@@ -62,6 +68,25 @@ export default class PlatformEnvDelete extends ScCommand {
|
|
|
62
68
|
this.warn(message);
|
|
63
69
|
}
|
|
64
70
|
else {
|
|
71
|
+
// Confirm deletion unless --no-prompt flag is set
|
|
72
|
+
if (!flags['no-prompt']) {
|
|
73
|
+
const envIdentifier = name || envId;
|
|
74
|
+
try {
|
|
75
|
+
const shouldProceed = await confirm({
|
|
76
|
+
default: false,
|
|
77
|
+
message: `Are you sure you want to delete the environment '${envIdentifier}'?`,
|
|
78
|
+
});
|
|
79
|
+
if (!shouldProceed) {
|
|
80
|
+
this.log('Deletion cancelled.');
|
|
81
|
+
this.exit(0);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// User cancelled the confirmation (Ctrl+C)
|
|
86
|
+
this.log('Deletion cancelled.');
|
|
87
|
+
this.exit(0);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
65
90
|
// API call to delete environment by id
|
|
66
91
|
apiUrl += `/${envIdToDelete}`;
|
|
67
92
|
await conn.delete(apiUrl);
|