@dishantlangayan/solace-cloud-cli 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -52
- package/dist/commands/account/login.js +1 -2
- package/dist/commands/missionctrl/broker/create.d.ts +1 -0
- package/dist/commands/missionctrl/broker/create.js +9 -2
- package/dist/commands/missionctrl/broker/delete.d.ts +2 -0
- package/dist/commands/missionctrl/broker/delete.js +34 -2
- package/dist/commands/missionctrl/broker/display.d.ts +1 -0
- package/dist/commands/missionctrl/broker/display.js +9 -2
- package/dist/commands/missionctrl/broker/list.d.ts +1 -0
- package/dist/commands/missionctrl/broker/list.js +9 -3
- package/dist/commands/missionctrl/broker/opstatus.d.ts +1 -0
- package/dist/commands/missionctrl/broker/opstatus.js +9 -2
- package/dist/commands/missionctrl/broker/state.d.ts +1 -0
- package/dist/commands/missionctrl/broker/state.js +9 -2
- package/dist/commands/missionctrl/broker/update.d.ts +1 -0
- package/dist/commands/missionctrl/broker/update.js +9 -2
- package/dist/commands/platform/env/create.d.ts +1 -0
- package/dist/commands/platform/env/create.js +9 -2
- package/dist/commands/platform/env/delete.d.ts +2 -0
- package/dist/commands/platform/env/delete.js +34 -2
- package/dist/commands/platform/env/display.d.ts +1 -0
- package/dist/commands/platform/env/display.js +9 -2
- package/dist/commands/platform/env/list.d.ts +1 -0
- package/dist/commands/platform/env/list.js +9 -3
- package/dist/commands/platform/env/update.d.ts +1 -0
- package/dist/commands/platform/env/update.js +9 -2
- package/dist/lib/org-utils.js +2 -6
- package/oclif.manifest.json +217 -25
- package/package.json +5 -5
|
@@ -11,16 +11,22 @@ Token Permissions: [ \`mission_control:access\` **or** \`services:get\` **or** \
|
|
|
11
11
|
static examples = [
|
|
12
12
|
'<%= config.bin %> <%= command.id %>',
|
|
13
13
|
'<%= config.bin %> <%= command.id %> --org=my-org',
|
|
14
|
-
'<%= config.bin %> <%= command.id %> --name=MyBrokerName --pageNumber=1 --pageSize=10 --sort=name:asc',
|
|
14
|
+
'<%= config.bin %> <%= command.id %> --alias=my-alias --name=MyBrokerName --pageNumber=1 --pageSize=10 --sort=name:asc',
|
|
15
15
|
];
|
|
16
16
|
static flags = {
|
|
17
|
+
alias: Flags.string({
|
|
18
|
+
char: 'a',
|
|
19
|
+
description: 'Organization alias to use. If not specified, uses the default organization.',
|
|
20
|
+
exclusive: ['org'],
|
|
21
|
+
}),
|
|
17
22
|
name: Flags.string({
|
|
18
23
|
char: 'n',
|
|
19
24
|
description: 'Name of the event broker service to match on.',
|
|
20
25
|
}),
|
|
21
26
|
org: Flags.string({
|
|
22
27
|
char: 'o',
|
|
23
|
-
description: 'Organization ID
|
|
28
|
+
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
29
|
+
exclusive: ['alias'],
|
|
24
30
|
}),
|
|
25
31
|
pageNumber: Flags.integer({
|
|
26
32
|
description: 'The page number to get. Defaults to 1',
|
|
@@ -41,7 +47,7 @@ Token Permissions: [ \`mission_control:access\` **or** \`services:get\` **or** \
|
|
|
41
47
|
};
|
|
42
48
|
async run() {
|
|
43
49
|
const { flags } = await this.parse(MissionctrlBrokerList);
|
|
44
|
-
const conn = await resolveOrgConnection(this, flags.org);
|
|
50
|
+
const conn = await resolveOrgConnection(this, flags.org ?? flags.alias);
|
|
45
51
|
const pageSize = flags.pageSize ?? 10;
|
|
46
52
|
const pageNumber = flags.pageNumber ?? 1;
|
|
47
53
|
// API url
|
|
@@ -5,6 +5,7 @@ export default class MissionctrlBrokerOpstatus extends ScCommand<typeof Missionc
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
+
alias: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
'broker-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
org: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -12,8 +12,14 @@ export default class MissionctrlBrokerOpstatus extends ScCommand {
|
|
|
12
12
|
'<%= config.bin %> <%= command.id %> -b <broker-id>',
|
|
13
13
|
'<%= config.bin %> <%= command.id %> -n <broker-name>',
|
|
14
14
|
'<%= config.bin %> <%= command.id %> --org=my-org -b <broker-id>',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> --alias=my-alias -b <broker-id>',
|
|
15
16
|
];
|
|
16
17
|
static flags = {
|
|
18
|
+
alias: Flags.string({
|
|
19
|
+
char: 'a',
|
|
20
|
+
description: 'Organization alias to use. If not specified, uses the default organization.',
|
|
21
|
+
exclusive: ['org'],
|
|
22
|
+
}),
|
|
17
23
|
'broker-id': Flags.string({
|
|
18
24
|
char: 'b',
|
|
19
25
|
description: 'Id of the event broker service.',
|
|
@@ -26,7 +32,8 @@ export default class MissionctrlBrokerOpstatus extends ScCommand {
|
|
|
26
32
|
}),
|
|
27
33
|
org: Flags.string({
|
|
28
34
|
char: 'o',
|
|
29
|
-
description: 'Organization ID
|
|
35
|
+
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
36
|
+
exclusive: ['alias'],
|
|
30
37
|
}),
|
|
31
38
|
'show-progress': Flags.boolean({
|
|
32
39
|
char: 'p',
|
|
@@ -43,7 +50,7 @@ export default class MissionctrlBrokerOpstatus extends ScCommand {
|
|
|
43
50
|
let brokerId = flags['broker-id'] ?? '';
|
|
44
51
|
const showProgress = flags['show-progress'] ?? false;
|
|
45
52
|
const waitMs = flags['wait-ms'] ?? 5000;
|
|
46
|
-
const conn = await resolveOrgConnection(this, flags.org);
|
|
53
|
+
const conn = await resolveOrgConnection(this, flags.org ?? flags.alias);
|
|
47
54
|
// Base API url
|
|
48
55
|
let apiUrl = `/missionControl/eventBrokerServices`;
|
|
49
56
|
// If broker name provided, retrieve the broker service id first
|
|
@@ -5,6 +5,7 @@ export default class MissionctrlBrokerState extends ScCommand<typeof Missionctrl
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
+
alias: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
'broker-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
org: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -12,8 +12,14 @@ export default class MissionctrlBrokerState extends ScCommand {
|
|
|
12
12
|
'<%= config.bin %> <%= command.id %> --broker-id=MyBrokerServiceId',
|
|
13
13
|
'<%= config.bin %> <%= command.id %> --name=MyBrokerName',
|
|
14
14
|
'<%= config.bin %> <%= command.id %> --org=my-org --broker-id=MyBrokerServiceId',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> --alias=my-alias --name=MyBrokerName',
|
|
15
16
|
];
|
|
16
17
|
static flags = {
|
|
18
|
+
alias: Flags.string({
|
|
19
|
+
char: 'a',
|
|
20
|
+
description: 'Organization alias to use. If not specified, uses the default organization.',
|
|
21
|
+
exclusive: ['org'],
|
|
22
|
+
}),
|
|
17
23
|
'broker-id': Flags.string({
|
|
18
24
|
char: 'b',
|
|
19
25
|
description: 'Id of the event broker service.',
|
|
@@ -26,14 +32,15 @@ export default class MissionctrlBrokerState extends ScCommand {
|
|
|
26
32
|
}),
|
|
27
33
|
org: Flags.string({
|
|
28
34
|
char: 'o',
|
|
29
|
-
description: 'Organization ID
|
|
35
|
+
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
36
|
+
exclusive: ['alias'],
|
|
30
37
|
}),
|
|
31
38
|
};
|
|
32
39
|
async run() {
|
|
33
40
|
const { flags } = await this.parse(MissionctrlBrokerState);
|
|
34
41
|
const name = flags.name ?? '';
|
|
35
42
|
let brokerId = flags['broker-id'] ?? '';
|
|
36
|
-
const conn = await resolveOrgConnection(this, flags.org);
|
|
43
|
+
const conn = await resolveOrgConnection(this, flags.org ?? flags.alias);
|
|
37
44
|
// API url
|
|
38
45
|
let apiUrl = `/missionControl/eventBrokerServices`;
|
|
39
46
|
if (name) {
|
|
@@ -5,6 +5,7 @@ export default class MissionctrlBrokerUpdate extends ScCommand<typeof Missionctr
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
+
alias: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
'broker-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
locked: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -13,8 +13,14 @@ export default class MissionctrlBrokerUpdate extends ScCommand {
|
|
|
13
13
|
'<%= config.bin %> <%= command.id %>',
|
|
14
14
|
'<%= config.bin %> <%= command.id %> --broker-id <broker-id> --new-name <new-name>',
|
|
15
15
|
'<%= config.bin %> <%= command.id %> --org=my-org --name <name> --new-name <new-name>',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> --alias=my-alias --name <name> --new-name <new-name>',
|
|
16
17
|
];
|
|
17
18
|
static flags = {
|
|
19
|
+
alias: Flags.string({
|
|
20
|
+
char: 'a',
|
|
21
|
+
description: 'Organization alias to use. If not specified, uses the default organization.',
|
|
22
|
+
exclusive: ['org'],
|
|
23
|
+
}),
|
|
18
24
|
'broker-id': Flags.string({
|
|
19
25
|
char: 'b',
|
|
20
26
|
description: 'Id of the event broker service.',
|
|
@@ -34,7 +40,8 @@ export default class MissionctrlBrokerUpdate extends ScCommand {
|
|
|
34
40
|
}),
|
|
35
41
|
org: Flags.string({
|
|
36
42
|
char: 'o',
|
|
37
|
-
description: 'Organization ID
|
|
43
|
+
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
44
|
+
exclusive: ['alias'],
|
|
38
45
|
}),
|
|
39
46
|
};
|
|
40
47
|
async run() {
|
|
@@ -49,7 +56,7 @@ export default class MissionctrlBrokerUpdate extends ScCommand {
|
|
|
49
56
|
...(locked && { locked: lockedBoolValue }),
|
|
50
57
|
...(newName && { name: newName }),
|
|
51
58
|
};
|
|
52
|
-
const conn = await resolveOrgConnection(this, flags.org);
|
|
59
|
+
const conn = await resolveOrgConnection(this, flags.org ?? flags.alias);
|
|
53
60
|
// API url
|
|
54
61
|
let apiUrl = `/missionControl/eventBrokerServices`;
|
|
55
62
|
let brokerIdToUpdate = brokerId;
|
|
@@ -5,6 +5,7 @@ export default class PlatformEnvCreate extends ScCommand<typeof PlatformEnvCreat
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
+
alias: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
isDefault: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
isProduction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -9,8 +9,14 @@ export default class PlatformEnvCreate extends ScCommand {
|
|
|
9
9
|
static examples = [
|
|
10
10
|
'<%= config.bin %> <%= command.id %> --name=MyEnvironment',
|
|
11
11
|
'<%= config.bin %> <%= command.id %> --org=my-org --name=MyEnvironment --description="My environment description" --isDefault --isProduction',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --alias=my-alias --name=MyEnvironment --isDefault',
|
|
12
13
|
];
|
|
13
14
|
static flags = {
|
|
15
|
+
alias: Flags.string({
|
|
16
|
+
char: 'a',
|
|
17
|
+
description: 'Organization alias to use. If not specified, uses the default organization.',
|
|
18
|
+
exclusive: ['org'],
|
|
19
|
+
}),
|
|
14
20
|
description: Flags.string({
|
|
15
21
|
char: 'd',
|
|
16
22
|
description: 'Description of the environment to create.',
|
|
@@ -31,7 +37,8 @@ export default class PlatformEnvCreate extends ScCommand {
|
|
|
31
37
|
}),
|
|
32
38
|
org: Flags.string({
|
|
33
39
|
char: 'o',
|
|
34
|
-
description: 'Organization ID
|
|
40
|
+
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
41
|
+
exclusive: ['alias'],
|
|
35
42
|
}),
|
|
36
43
|
};
|
|
37
44
|
async run() {
|
|
@@ -40,7 +47,7 @@ export default class PlatformEnvCreate extends ScCommand {
|
|
|
40
47
|
const desc = flags.description ?? '';
|
|
41
48
|
const isDefault = flags.isDefault ?? false;
|
|
42
49
|
const isProduction = flags.isProduction ?? false;
|
|
43
|
-
const conn = await resolveOrgConnection(this, flags.org);
|
|
50
|
+
const conn = await resolveOrgConnection(this, flags.org ?? flags.alias);
|
|
44
51
|
// API url
|
|
45
52
|
const apiUrl = `/platform/environments`;
|
|
46
53
|
// API body
|
|
@@ -4,8 +4,10 @@ export default class PlatformEnvDelete extends ScCommand<typeof PlatformEnvDelet
|
|
|
4
4
|
static description: string;
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
|
+
alias: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
'env-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>;
|
|
10
|
+
'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
11
|
org: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
12
|
};
|
|
11
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 {
|
|
@@ -10,8 +11,15 @@ export default class PlatformEnvDelete extends ScCommand {
|
|
|
10
11
|
'<%= config.bin %> <%= command.id %> --name=MyEnvName',
|
|
11
12
|
'<%= config.bin %> <%= command.id %> --env-id=MyEnvId',
|
|
12
13
|
'<%= config.bin %> <%= command.id %> --org=my-org --name=MyEnvName',
|
|
14
|
+
'<%= config.bin %> <%= command.id %> --alias=my-alias --name=MyEnvName',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> --env-id=MyEnvId --no-prompt',
|
|
13
16
|
];
|
|
14
17
|
static flags = {
|
|
18
|
+
alias: Flags.string({
|
|
19
|
+
char: 'a',
|
|
20
|
+
description: 'Organization alias to use. If not specified, uses the default organization.',
|
|
21
|
+
exclusive: ['org'],
|
|
22
|
+
}),
|
|
15
23
|
'env-id': Flags.string({
|
|
16
24
|
char: 'e',
|
|
17
25
|
description: 'Id of the environment.',
|
|
@@ -22,16 +30,21 @@ export default class PlatformEnvDelete extends ScCommand {
|
|
|
22
30
|
description: 'Name of the environment.',
|
|
23
31
|
exactlyOne: ['env-id', 'name'],
|
|
24
32
|
}),
|
|
33
|
+
'no-prompt': Flags.boolean({
|
|
34
|
+
default: false,
|
|
35
|
+
description: 'Skip confirmation prompt and assume Yes',
|
|
36
|
+
}),
|
|
25
37
|
org: Flags.string({
|
|
26
38
|
char: 'o',
|
|
27
|
-
description: 'Organization ID
|
|
39
|
+
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
40
|
+
exclusive: ['alias'],
|
|
28
41
|
}),
|
|
29
42
|
};
|
|
30
43
|
async run() {
|
|
31
44
|
const { flags } = await this.parse(PlatformEnvDelete);
|
|
32
45
|
const name = flags.name ?? '';
|
|
33
46
|
const envId = flags['env-id'] ?? '';
|
|
34
|
-
const conn = await resolveOrgConnection(this, flags.org);
|
|
47
|
+
const conn = await resolveOrgConnection(this, flags.org ?? flags.alias);
|
|
35
48
|
// API url
|
|
36
49
|
let apiUrl = `/platform/environments`;
|
|
37
50
|
let envIdToDelete = envId;
|
|
@@ -55,6 +68,25 @@ export default class PlatformEnvDelete extends ScCommand {
|
|
|
55
68
|
this.warn(message);
|
|
56
69
|
}
|
|
57
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
|
+
}
|
|
58
90
|
// API call to delete environment by id
|
|
59
91
|
apiUrl += `/${envIdToDelete}`;
|
|
60
92
|
await conn.delete(apiUrl);
|
|
@@ -5,6 +5,7 @@ export default class PlatformEnvDisplay extends ScCommand<typeof PlatformEnvDisp
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
+
alias: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
'env-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
org: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -12,8 +12,14 @@ export default class PlatformEnvDisplay extends ScCommand {
|
|
|
12
12
|
'<%= config.bin %> <%= command.id %> --name=MyEnvName',
|
|
13
13
|
'<%= config.bin %> <%= command.id %> --env-id=MyEnvId',
|
|
14
14
|
'<%= config.bin %> <%= command.id %> --org=my-org --env-id=MyEnvId',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> --alias=my-alias --name=MyEnvName',
|
|
15
16
|
];
|
|
16
17
|
static flags = {
|
|
18
|
+
alias: Flags.string({
|
|
19
|
+
char: 'a',
|
|
20
|
+
description: 'Organization alias to use. If not specified, uses the default organization.',
|
|
21
|
+
exclusive: ['org'],
|
|
22
|
+
}),
|
|
17
23
|
'env-id': Flags.string({
|
|
18
24
|
char: 'e',
|
|
19
25
|
description: 'Id of the environment.',
|
|
@@ -26,14 +32,15 @@ export default class PlatformEnvDisplay extends ScCommand {
|
|
|
26
32
|
}),
|
|
27
33
|
org: Flags.string({
|
|
28
34
|
char: 'o',
|
|
29
|
-
description: 'Organization ID
|
|
35
|
+
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
36
|
+
exclusive: ['alias'],
|
|
30
37
|
}),
|
|
31
38
|
};
|
|
32
39
|
async run() {
|
|
33
40
|
const { flags } = await this.parse(PlatformEnvDisplay);
|
|
34
41
|
const name = flags.name ?? '';
|
|
35
42
|
const envId = flags['env-id'] ?? '';
|
|
36
|
-
const conn = await resolveOrgConnection(this, flags.org);
|
|
43
|
+
const conn = await resolveOrgConnection(this, flags.org ?? flags.alias);
|
|
37
44
|
// API url
|
|
38
45
|
// If env name provided, get all environments matching provided name
|
|
39
46
|
// If env id provided, get environment with that id
|
|
@@ -5,6 +5,7 @@ export default class PlatformEnvList extends ScCommand<typeof PlatformEnvList> {
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
+
alias: 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
|
org: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
pageNumber: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -9,16 +9,22 @@ export default class PlatformEnvList extends ScCommand {
|
|
|
9
9
|
static examples = [
|
|
10
10
|
'<%= config.bin %> <%= command.id %>',
|
|
11
11
|
'<%= config.bin %> <%= command.id %> --org=my-org',
|
|
12
|
-
'<%= config.bin %> <%= command.id %> --name=Default --pageNumber=1 --pageSize=10 --sort=name:ASC',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --alias=my-alias --name=Default --pageNumber=1 --pageSize=10 --sort=name:ASC',
|
|
13
13
|
];
|
|
14
14
|
static flags = {
|
|
15
|
+
alias: Flags.string({
|
|
16
|
+
char: 'a',
|
|
17
|
+
description: 'Organization alias to use. If not specified, uses the default organization.',
|
|
18
|
+
exclusive: ['org'],
|
|
19
|
+
}),
|
|
15
20
|
name: Flags.string({
|
|
16
21
|
char: 'n',
|
|
17
22
|
description: 'Name of the environment to match on.',
|
|
18
23
|
}),
|
|
19
24
|
org: Flags.string({
|
|
20
25
|
char: 'o',
|
|
21
|
-
description: 'Organization ID
|
|
26
|
+
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
27
|
+
exclusive: ['alias'],
|
|
22
28
|
}),
|
|
23
29
|
pageNumber: Flags.integer({
|
|
24
30
|
char: 'p',
|
|
@@ -36,7 +42,7 @@ export default class PlatformEnvList extends ScCommand {
|
|
|
36
42
|
};
|
|
37
43
|
async run() {
|
|
38
44
|
const { flags } = await this.parse(PlatformEnvList);
|
|
39
|
-
const conn = await resolveOrgConnection(this, flags.org);
|
|
45
|
+
const conn = await resolveOrgConnection(this, flags.org ?? flags.alias);
|
|
40
46
|
const pageSize = flags.pageSize ?? 10;
|
|
41
47
|
const pageNumber = flags.pageNumber ?? 1;
|
|
42
48
|
// API url
|
|
@@ -5,6 +5,7 @@ export default class PlatformEnvUpdate extends ScCommand<typeof PlatformEnvUpdat
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
+
alias: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
'env-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
isDefault: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -13,8 +13,14 @@ export default class PlatformEnvUpdate extends ScCommand {
|
|
|
13
13
|
'<%= config.bin %> <%= command.id %> --name=MyEnvName --new-name=MyNewEnvName',
|
|
14
14
|
'<%= config.bin %> <%= command.id %> --env-id=MyEnvId --new-name=MyNewEnvName --description="My description to update" --isDefault',
|
|
15
15
|
'<%= config.bin %> <%= command.id %> --org=my-org --name=MyEnvName --isDefault',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> --alias=my-alias --name=MyEnvName --new-name=MyNewEnvName',
|
|
16
17
|
];
|
|
17
18
|
static flags = {
|
|
19
|
+
alias: Flags.string({
|
|
20
|
+
char: 'a',
|
|
21
|
+
description: 'Organization alias to use. If not specified, uses the default organization.',
|
|
22
|
+
exclusive: ['org'],
|
|
23
|
+
}),
|
|
18
24
|
description: Flags.string({
|
|
19
25
|
char: 'd',
|
|
20
26
|
description: 'Description of the environment to update.',
|
|
@@ -37,7 +43,8 @@ export default class PlatformEnvUpdate extends ScCommand {
|
|
|
37
43
|
}),
|
|
38
44
|
org: Flags.string({
|
|
39
45
|
char: 'o',
|
|
40
|
-
description: 'Organization ID
|
|
46
|
+
description: 'Organization ID to use. If not specified, uses the default organization or alias if specified.',
|
|
47
|
+
exclusive: ['alias'],
|
|
41
48
|
}),
|
|
42
49
|
};
|
|
43
50
|
async run() {
|
|
@@ -52,7 +59,7 @@ export default class PlatformEnvUpdate extends ScCommand {
|
|
|
52
59
|
...(desc && { description: desc }),
|
|
53
60
|
...(newName && { name: newName }),
|
|
54
61
|
};
|
|
55
|
-
const conn = await resolveOrgConnection(this, flags.org);
|
|
62
|
+
const conn = await resolveOrgConnection(this, flags.org ?? flags.alias);
|
|
56
63
|
// API url
|
|
57
64
|
let apiUrl = `/platform/environments`;
|
|
58
65
|
let envIdToUpdate = envId;
|
package/dist/lib/org-utils.js
CHANGED
|
@@ -30,9 +30,7 @@ export async function resolveOrgConnection(command, orgIdentifier, timeout) {
|
|
|
30
30
|
if (!org) {
|
|
31
31
|
command.error(`Organization '${orgIdentifier}' not found. Run 'sc account:list' to see available organizations.`, { exit: 2 });
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
const connectionIdentifier = org.alias || org.orgId;
|
|
35
|
-
return await orgManager.createConnection(connectionIdentifier, timeout);
|
|
33
|
+
return await orgManager.createConnection(orgIdentifier, timeout);
|
|
36
34
|
}
|
|
37
35
|
// No org specified, try default
|
|
38
36
|
const defaultOrg = await orgManager.getDefaultOrg();
|
|
@@ -45,9 +43,7 @@ export async function resolveOrgConnection(command, orgIdentifier, timeout) {
|
|
|
45
43
|
command.error("No default organization set. Please specify --org flag or set a default with 'sc account:login --set-default'.", { exit: 2 });
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
|
-
|
|
49
|
-
const connectionIdentifier = defaultOrg.alias || defaultOrg.orgId;
|
|
50
|
-
return await orgManager.createConnection(connectionIdentifier, timeout);
|
|
46
|
+
return await orgManager.createConnection(defaultOrg.orgId, timeout);
|
|
51
47
|
}
|
|
52
48
|
catch (error) {
|
|
53
49
|
// Handle OrgManager-specific errors
|