Skip to content

Commit 3d6bb37

Browse files
General code formatting updates
1 parent e93e4c4 commit 3d6bb37

File tree

9 files changed

+100
-65
lines changed

9 files changed

+100
-65
lines changed

src/commands/missionctrl/broker/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class MissionctrlBrokerCreate extends Command {
1212
Your token must have one of the permissions listed in the Token Permissions.
1313
1414
Token Permissions: [ \`services:post\` ]`
15-
static override examples = ['<%= config.bin %> <%= command.id %> --datacenter-id=MyDatacenterId --name=MyBrokerName --service-class-id=DEVELOPER']
15+
static override examples = ['<%= config.bin %> <%= command.id %> --name=MyBrokerName --datacenter-id=eks-ca-central-1a --service-class-id=DEVELOPER']
1616
static override flags = {
1717
'datacenter-id': Flags.string({
1818
char: 'd',

src/commands/missionctrl/broker/delete.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {Command, Flags} from '@oclif/core'
1+
import { Command, Flags } from '@oclif/core'
22

3-
import {EventBrokerListApiResponse} from '../../../types/broker.js'
4-
import {ScConnection} from '../../../util/sc-connection.js'
3+
import { EventBrokerListApiResponse } from '../../../types/broker.js'
4+
import { ScConnection } from '../../../util/sc-connection.js'
55

66
export default class MissionctrlBrokerDelete extends Command {
77
static override args = {}
@@ -15,13 +15,11 @@ Token Permissions: [ \`services:delete\` **or** \`services:delete:self\` **or**
1515
'<%= config.bin %> <%= command.id %> --name=MyBrokerName',
1616
]
1717
static override flags = {
18-
// flag for getting environment by id (-e, --env-id)
1918
'broker-id': Flags.string({
2019
char: 'b',
2120
description: 'Id of the event broker service.',
2221
exactlyOne: ['broker-id', 'name'],
2322
}),
24-
// flag for getting environment by name (-n, --name=VALUE)
2523
name: Flags.string({
2624
char: 'n',
2725
description: 'Name of the event broker service.',
@@ -30,7 +28,7 @@ Token Permissions: [ \`services:delete\` **or** \`services:delete:self\` **or**
3028
}
3129

3230
public async run(): Promise<void> {
33-
const {flags} = await this.parse(MissionctrlBrokerDelete)
31+
const { flags } = await this.parse(MissionctrlBrokerDelete)
3432

3533
const name = flags.name ?? ''
3634
const brokerId = flags['broker-id'] ?? ''

src/commands/missionctrl/broker/display.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {Command, Flags} from '@oclif/core'
2-
import {table} from 'table'
1+
import { Command, Flags } from '@oclif/core'
2+
import { table } from 'table'
33

4-
import {EventBrokerListApiResponse, EventBrokerServiceDetail} from '../../../types/broker.js'
5-
import {camelCaseToTitleCase} from '../../../util/internal.js'
6-
import {ScConnection} from '../../../util/sc-connection.js'
4+
import { EventBrokerListApiResponse, EventBrokerServiceDetail } from '../../../types/broker.js'
5+
import { camelCaseToTitleCase } from '../../../util/internal.js'
6+
import { ScConnection } from '../../../util/sc-connection.js'
77

88
export default class MissionctrlBrokerDisplay extends Command {
99
static override args = {}
@@ -27,7 +27,7 @@ export default class MissionctrlBrokerDisplay extends Command {
2727
}
2828

2929
public async run(): Promise<void> {
30-
const {flags} = await this.parse(MissionctrlBrokerDisplay)
30+
const { flags } = await this.parse(MissionctrlBrokerDisplay)
3131

3232
const name = flags.name ?? ''
3333
const brokerId = flags['broker-id'] ?? ''
@@ -66,7 +66,7 @@ export default class MissionctrlBrokerDisplay extends Command {
6666
// Table config
6767
const config = {
6868
columns: {
69-
1: {width: 50, wrapWord: true},
69+
1: { width: 50, wrapWord: true },
7070
},
7171
drawHorizontalLine(lineIndex: number, rowCount: number) {
7272
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount

src/commands/missionctrl/broker/list.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {Command, Flags} from '@oclif/core'
2-
import {table} from 'table'
1+
import { Command, Flags } from '@oclif/core'
2+
import { table } from 'table'
33

4-
import {EventBrokerListApiResponse, EventBrokerServiceDetail} from '../../../types/broker.js'
5-
import {ScConnection} from '../../../util/sc-connection.js'
4+
import { EventBrokerListApiResponse, EventBrokerServiceDetail } from '../../../types/broker.js'
5+
import { ScConnection } from '../../../util/sc-connection.js'
66

77
export default class MissionctrlBrokerList extends Command {
88
static override args = {}
@@ -13,17 +13,18 @@ Your token must have one of the permissions listed in the Token Permissions.
1313
Token Permissions: [ \`mission_control:access\` **or** \`services:get\` **or** \`services:get:self\` **or** \`services:view\` **or** \`services:view:self\` ]`
1414
static override examples = ['<%= config.bin %> <%= command.id %> --name=MyBrokerName --pageNumber=1 --pageSize=10 --sort=name:asc']
1515
static override flags = {
16-
// flag with a value (-n, --name=VALUE)
17-
name: Flags.string({char: 'n', description: 'Name of the event broker service to match on.'}),
18-
// pageNumber (--pageNumber=VALUE)
19-
pageNumber: Flags.integer({description: 'The page number to get. Defaults to 1'}),
20-
// pageSize (--pageSize=VALUE)
16+
name: Flags.string({
17+
char: 'n',
18+
description: 'Name of the event broker service to match on.'
19+
}),
20+
pageNumber: Flags.integer({
21+
description: 'The page number to get. Defaults to 1'
22+
}),
2123
pageSize: Flags.integer({
2224
description: 'The number of event broker services to return per page. Defaults to 100',
2325
max: 100,
2426
min: 1,
2527
}),
26-
// sort (--sort=VALUE)
2728
sort: Flags.string({
2829
description: `Sort the returned event broker services by attribute.
2930
@@ -35,7 +36,7 @@ Token Permissions: [ \`mission_control:access\` **or** \`services:get\` **or** \
3536
}
3637

3738
public async run(): Promise<void> {
38-
const {flags} = await this.parse(MissionctrlBrokerList)
39+
const { flags } = await this.parse(MissionctrlBrokerList)
3940

4041
const conn = new ScConnection()
4142

src/commands/platform/env/create.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {Command, Flags} from '@oclif/core'
2-
import {table} from 'table'
1+
import { Command, Flags } from '@oclif/core'
2+
import { table } from 'table'
33

4-
import {Environment, EnvironmentDetail} from '../../../types/environment.js'
5-
import {camelCaseToTitleCase} from '../../../util/internal.js'
6-
import {ScConnection} from '../../../util/sc-connection.js'
4+
import { Environment, EnvironmentDetail } from '../../../types/environment.js'
5+
import { camelCaseToTitleCase } from '../../../util/internal.js'
6+
import { ScConnection } from '../../../util/sc-connection.js'
77

88
export default class PlatformEnvCreate extends Command {
99
static override args = {}
@@ -12,28 +12,36 @@ export default class PlatformEnvCreate extends Command {
1212
Token Permissions: [ environments:edit ]`
1313
static override examples = ['<%= config.bin %> <%= command.id %> --name=MyEnvironment --desc="My environment description" --isDefault --isProduction']
1414
static override flags = {
15-
desc: Flags.string({char: 'd', description: 'Description of the environment to create.'}),
16-
// flag with no value (--isDefault)
17-
isDefault: Flags.boolean({description: 'Indicates this is the organization’s default environment.'}),
15+
desc: Flags.string({
16+
char: 'd',
17+
description: 'Description of the environment to create.'
18+
}),
19+
isDefault: Flags.boolean({
20+
description: 'Indicates this is the organization’s default environment.'
21+
}),
1822
isProduction: Flags.boolean({
1923
description: `Indicates this is an organization’s production environment.
2024
This is an immutable field. If an environment needs to be migrated,
2125
architecture can be migrated to a new environment with the desired
2226
environment type instead.`,
2327
}),
24-
// flag with a value (-n, --name=VALUE)
25-
name: Flags.string({char: 'n', description: 'Name of the environment to create.', required: true}),
28+
name: Flags.string({
29+
char: 'n',
30+
description: 'Name of the environment to create.',
31+
required: true
32+
}),
2633
}
2734

2835
public async run(): Promise<void> {
29-
const {flags} = await this.parse(PlatformEnvCreate)
36+
const { flags } = await this.parse(PlatformEnvCreate)
3037

3138
const name = flags.name ?? ''
3239
const desc = flags.desc ?? ''
3340
const isDefault = flags.isDefault ?? false
3441
const isProduction = flags.isProduction ?? false
3542

3643
const conn = new ScConnection()
44+
3745
// API url
3846
const apiUrl: string = `/platform/environments`
3947
// API body
@@ -43,8 +51,10 @@ export default class PlatformEnvCreate extends Command {
4351
isProduction,
4452
name,
4553
}
54+
4655
// API call
4756
const resp = await conn.post<EnvironmentDetail>(apiUrl, body)
57+
4858
// Display results
4959
this.log('Environment created successfully.')
5060
this.print(resp.data)
@@ -60,7 +70,7 @@ export default class PlatformEnvCreate extends Command {
6070
// Table config
6171
const config = {
6272
columns: {
63-
1: {width: 50, wrapWord: true},
73+
1: { width: 50, wrapWord: true },
6474
},
6575
drawHorizontalLine(lineIndex: number, rowCount: number) {
6676
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount

src/commands/platform/env/delete.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {Command, Flags} from '@oclif/core'
1+
import { Command, Flags } from '@oclif/core'
22

33
import { EnvironmentApiResponse } from '../../../types/environment.js'
4-
import {ScConnection} from '../../../util/sc-connection.js'
4+
import { ScConnection } from '../../../util/sc-connection.js'
55

66
export default class PlatformEnvDelete extends Command {
77
static override args = {}
@@ -10,14 +10,20 @@ export default class PlatformEnvDelete extends Command {
1010
Token Permissions: [ environments:edit ]`
1111
static override examples = ['<%= config.bin %> <%= command.id %> --name=MyEnvName', '<%= config.bin %> <%= command.id %> --env-id=MyEnvId']
1212
static override flags = {
13-
// flag for getting environment by id (-e, --env-id)
14-
'env-id': Flags.string({char: 'e', description: 'Id of the environment.', exactlyOne: ['env-id', 'name']}),
15-
// flag for getting environment by name (-n, --name=VALUE)
16-
name: Flags.string({char: 'n', description: 'Name of the environment.', exactlyOne: ['env-id', 'name']}),
13+
'env-id': Flags.string({
14+
char: 'e',
15+
description: 'Id of the environment.',
16+
exactlyOne: ['env-id', 'name']
17+
}),
18+
name: Flags.string({
19+
char: 'n',
20+
description: 'Name of the environment.',
21+
exactlyOne: ['env-id', 'name']
22+
}),
1723
}
1824

1925
public async run(): Promise<void> {
20-
const {flags} = await this.parse(PlatformEnvDelete)
26+
const { flags } = await this.parse(PlatformEnvDelete)
2127

2228
const name = flags.name ?? ''
2329
const envId = flags['env-id'] ?? ''
@@ -34,7 +40,7 @@ export default class PlatformEnvDelete extends Command {
3440
// API call to get environment by name
3541
const getEnvApiUrl = `${apiUrl}?name=${name}`
3642
const resp = await conn.get<EnvironmentApiResponse>(getEnvApiUrl)
37-
if( resp.data.length > 1) {
43+
if (resp.data.length > 1) {
3844
this.error(`Multiple environments found with: ${name}. Exactly one environment must match the provided name.`)
3945
} else {
4046
envIdToDelete = resp.data[0]?.id

src/commands/platform/env/display.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ export default class PlatformEnvDisplay extends Command {
1515
`
1616
static override examples = ['<%= config.bin %> <%= command.id %> --name=MyEnvName', '<%= config.bin %> <%= command.id %> --env-id=MyEnvId']
1717
static override flags = {
18-
// flag for getting environment by id (-e, --env-id)
19-
'env-id': Flags.string({ char: 'e', description: 'Id of the environment.', exactlyOne: ['env-id', 'name'] }),
20-
// flag for getting environment by name (-n, --name=VALUE)
21-
name: Flags.string({ char: 'n', description: 'Name of the environment.', exactlyOne: ['env-id', 'name'] }),
18+
'env-id': Flags.string({
19+
char: 'e',
20+
description: 'Id of the environment.',
21+
exactlyOne: ['env-id', 'name']
22+
}),
23+
name: Flags.string({
24+
char: 'n',
25+
description: 'Name of the environment.',
26+
exactlyOne: ['env-id', 'name']
27+
}),
2228
}
2329

2430
public async run(): Promise<void> {

src/commands/platform/env/list.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {Command, Flags} from '@oclif/core'
2-
import {table} from 'table'
1+
import { Command, Flags } from '@oclif/core'
2+
import { table } from 'table'
33

44
// import {ScCommand} from '../../../sc-command.js'
5-
import {Environment, EnvironmentApiResponse} from '../../../types/environment.js'
6-
import {ScConnection} from '../../../util/sc-connection.js'
5+
import { Environment, EnvironmentApiResponse } from '../../../types/environment.js'
6+
import { ScConnection } from '../../../util/sc-connection.js'
77

88
export default class PlatformEnvList extends Command {
99
static override args = {}
@@ -13,9 +13,9 @@ export default class PlatformEnvList extends Command {
1313
static override examples = ['<%= config.bin %> <%= command.id %>', '<%= config.bin %> <%= command.id %> --name=Default --pageNumber=1 --pageSize=10 --sort=name:ASC']
1414
static override flags = {
1515
// flag with a value (-n, --name=VALUE)
16-
name: Flags.string({char: 'n', description: 'Name of the environment to match on.'}),
16+
name: Flags.string({ char: 'n', description: 'Name of the environment to match on.' }),
1717
// pageNumber (--pageNumber=VALUE)
18-
pageNumber: Flags.integer({description: 'The page number to get. Defaults to 10'}),
18+
pageNumber: Flags.integer({ description: 'The page number to get. Defaults to 10' }),
1919
// pageSize (--pageSize=VALUE)
2020
pageSize: Flags.integer({
2121
description: 'The number of environments to get per page. Defaults to 1',
@@ -29,15 +29,15 @@ export default class PlatformEnvList extends Command {
2929
}
3030

3131
public async run(): Promise<void> {
32-
const {flags} = await this.parse(PlatformEnvList)
32+
const { flags } = await this.parse(PlatformEnvList)
3333

3434
const conn = new ScConnection()
3535

3636
const pageSize = flags.pageSize ?? 10
3737
const pageNumber = flags.pageNumber ?? 1
3838

3939
// API url
40-
let apiUrl: string = `/platform/environments?pageSize=${pageSize}&pageNumber=${pageNumber}`
40+
let apiUrl: string = `/platform/environments?pageSize=${pageSize}&pageNumber=${pageNumber}`
4141
if (flags.sort) {
4242
apiUrl += `&sort=${flags.sort}`
4343
}
@@ -57,7 +57,7 @@ export default class PlatformEnvList extends Command {
5757
// Display results as a table
5858
const config = {
5959
columns: {
60-
4: {width: 50, wrapWord: true},
60+
4: { width: 50, wrapWord: true },
6161
},
6262
}
6363
this.log()

src/commands/platform/env/update.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,25 @@ export default class PlatformEnvUpdate extends Command {
1818
'<%= config.bin %> <%= command.id %> --env-id=MyEnvId --new-name=MyNewEnvName --desc="My description to update" --isDefault'
1919
]
2020
static override flags = {
21-
desc: Flags.string({ char: 'd', description: 'Description of the environment to update.' }),
22-
'env-id': Flags.string({ char: 'e', description: 'Id of the environment.', exactlyOne: ['env-id', 'name'] }),
23-
isDefault: Flags.boolean({ description: `Indicates this is the organization's default environment. The default value is false.` }),
24-
name: Flags.string({ char: 'n', description: 'Current name of the environment.', exactlyOne: ['env-id', 'name'] }),
25-
'new-name': Flags.string({ description: 'New name of the environment.' }),
21+
desc: Flags.string({
22+
char: 'd',
23+
description: 'Description of the environment to update.'
24+
}),
25+
'env-id': Flags.string({
26+
char: 'e',
27+
description: 'Id of the environment.',
28+
exactlyOne: ['env-id', 'name']
29+
}),
30+
isDefault: Flags.boolean({
31+
description: `Indicates this is the organization's default environment. The default value is false.`
32+
}),
33+
name: Flags.string({
34+
char: 'n', description: 'Current name of the environment.',
35+
exactlyOne: ['env-id', 'name']
36+
}),
37+
'new-name': Flags.string({
38+
description: 'New name of the environment.'
39+
}),
2640
}
2741

2842
public async run(): Promise<void> {
@@ -36,8 +50,8 @@ export default class PlatformEnvUpdate extends Command {
3650
// API body
3751
const body = {
3852
...(flags.isDefault && { isDefault: flags.isDefault }),
39-
...(desc && { description: desc}),
40-
...(newName && { name: newName}),
53+
...(desc && { description: desc }),
54+
...(newName && { name: newName }),
4155
}
4256

4357
const conn = new ScConnection()

0 commit comments

Comments
 (0)