File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed
Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change 1+ import { Command , Flags } from '@oclif/core'
2+
3+ import { getDisco } from '../../config.js'
4+ import { request } from '../../auth-request.js'
5+
6+ export default class ScaleGet extends Command {
7+ static override args = { }
8+
9+ static strict = false
10+
11+ static override description = 'get current scale (number of replicas) for all services of a project'
12+
13+ static override examples = [
14+ '<%= config.bin %> <%= command.id %> --project mysite' ,
15+ ]
16+
17+ static override flags = {
18+ project : Flags . string ( { required : true } ) ,
19+ disco : Flags . string ( { required : false } ) ,
20+ }
21+
22+ public async run ( ) : Promise < void > {
23+ const { flags} = await this . parse ( ScaleGet )
24+ const discoConfig = getDisco ( flags . disco || null )
25+ const url = `https://${ discoConfig . host } /api/projects/${ flags . project } /scale`
26+
27+ const res = await request ( { method : 'GET' , url, discoConfig} )
28+ const respBody = ( await res . json ( ) ) as { services : { name : string ; scale : number } [ ] }
29+ for ( const service of respBody . services ) {
30+ this . log ( `${ service . name } =${ service . scale } ` )
31+ }
32+ }
33+ }
Original file line number Diff line number Diff line change 11import { Args , Command , Flags } from '@oclif/core'
22
3- import { getDisco } from '../config.js'
4- import { request } from '../auth-request.js'
3+ import { getDisco } from '../../ config.js'
4+ import { request } from '../../ auth-request.js'
55
6- export default class Scale extends Command {
6+ export default class ScaleSet extends Command {
77 static override args = {
88 services : Args . string ( {
99 description : 'service or services to scale and number of replicas, e.g. web=3' ,
@@ -26,7 +26,7 @@ export default class Scale extends Command {
2626 }
2727
2828 public async run ( ) : Promise < void > {
29- const { argv, flags} = await this . parse ( Scale )
29+ const { argv, flags} = await this . parse ( ScaleSet )
3030 const discoConfig = getDisco ( flags . disco || null )
3131 const url = `https://${ discoConfig . host } /api/projects/${ flags . project } /scale`
3232 const reqBody = { services : { } } as Record < string , Record < string , number > >
You can’t perform that action at this time.
0 commit comments