-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.ts
53 lines (46 loc) · 1.74 KB
/
list.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import {ux} from '@oclif/core'
import {printFormattedJSON} from '../../utils/display.js'
import {getCredentialsForDeployment} from '../../api/credentials.js'
import {
commonApiRelatedArgs,
commonUniversalBrokerArgs,
commonUniversalBrokerDeploymentId,
getCommonIds,
} from '../../common/args.js'
import {BaseCommand} from '../../base-command.js'
export default class Credentials extends BaseCommand<typeof Credentials> {
public static enableJsonFlag = true
static args = {
...commonUniversalBrokerArgs(),
...commonUniversalBrokerDeploymentId(true),
...commonApiRelatedArgs,
}
static description = 'Universal Broker Deployments - List operation'
static examples = [
`[with exported TENANT_ID,INSTALL_ID]`,
`<%= config.bin %> <%= command.id %> DEPLOYMENT_ID`,
`[inline TENANT_ID,INSTALL_ID]`,
`<%= config.bin %> <%= command.id %> TENANT_ID INSTALL_ID DEPLOYMENT_ID`,
]
// static flags = {
// from: Flags.string({char: 'f', description: 'Who is saying hello', required: true}),
// }
async run(): Promise<string> {
this.log('\n' + ux.colorize('red', Credentials.description))
const {args} = await this.parse(Credentials)
const {tenantId, installId} = getCommonIds(args)
const credentials = await getCredentialsForDeployment(tenantId, installId, args.deploymentId!)
const credentialsList = credentials.data
this.log(
ux.colorize(
'cyan',
`Getting Universal Broker Credentials for Deployment ${args.deploymentId}, Tenant ${tenantId}, Install ${installId}`,
),
)
for (const credential of credentialsList) {
this.log(printFormattedJSON(credential))
}
this.log(`Total = ${credentialsList.length}`)
return JSON.stringify(credentialsList)
}
}