@@ -127,7 +127,17 @@ var _getCmd = &cobra.Command{
127127 return "" , err
128128 }
129129
130- jobTable , err := getJob (env , args [0 ], args [1 ])
130+ apisRes , err := cluster .GetAPI (MustGetOperatorConfig (envName ), args [0 ])
131+ if err != nil {
132+ return "" , err
133+ }
134+
135+ var jobTable string
136+ if apisRes [0 ].Spec .Kind == userconfig .BatchAPIKind {
137+ jobTable , err = getBatchJob (env , args [0 ], args [1 ])
138+ } else {
139+ jobTable , err = getTaskJob (env , args [0 ], args [1 ])
140+ }
131141 if err != nil {
132142 return "" , err
133143 }
@@ -189,6 +199,8 @@ func getAPIsInAllEnvironments() (string, error) {
189199 var allRealtimeAPIEnvs []string
190200 var allBatchAPIs []schema.APIResponse
191201 var allBatchAPIEnvs []string
202+ var allTaskAPIs []schema.APIResponse
203+ var allTaskAPIEnvs []string
192204 var allTrafficSplitters []schema.APIResponse
193205 var allTrafficSplitterEnvs []string
194206
@@ -219,6 +231,9 @@ func getAPIsInAllEnvironments() (string, error) {
219231 case userconfig .RealtimeAPIKind :
220232 allRealtimeAPIEnvs = append (allRealtimeAPIEnvs , env .Name )
221233 allRealtimeAPIs = append (allRealtimeAPIs , api )
234+ case userconfig .TaskAPIKind :
235+ allTaskAPIEnvs = append (allTaskAPIEnvs , env .Name )
236+ allTaskAPIs = append (allTaskAPIs , api )
222237 case userconfig .TrafficSplitterKind :
223238 allTrafficSplitterEnvs = append (allTrafficSplitterEnvs , env .Name )
224239 allTrafficSplitters = append (allTrafficSplitters , api )
@@ -243,7 +258,7 @@ func getAPIsInAllEnvironments() (string, error) {
243258
244259 out := ""
245260
246- if len (allRealtimeAPIs ) == 0 && len (allBatchAPIs ) == 0 && len (allTrafficSplitters ) == 0 {
261+ if len (allRealtimeAPIs ) == 0 && len (allBatchAPIs ) == 0 && len (allTrafficSplitters ) == 0 && len ( allTaskAPIs ) == 0 {
247262 // check if any environments errorred
248263 if len (errorsMap ) != len (cliConfig .Environments ) {
249264 if len (errorsMap ) == 0 {
@@ -271,20 +286,26 @@ func getAPIsInAllEnvironments() (string, error) {
271286 out += t .MustFormat ()
272287 }
273288
274- if len (allRealtimeAPIs ) > 0 {
275- t := realtimeAPIsTable (allRealtimeAPIs , allRealtimeAPIEnvs )
276-
289+ if len (allTaskAPIs ) > 0 {
290+ t := taskAPIsTable (allTaskAPIs , allTaskAPIEnvs )
277291 if len (allBatchAPIs ) > 0 {
278292 out += "\n "
279293 }
294+ out += t .MustFormat ()
295+ }
280296
297+ if len (allRealtimeAPIs ) > 0 {
298+ t := realtimeAPIsTable (allRealtimeAPIs , allRealtimeAPIEnvs )
299+ if len (allBatchAPIs ) > 0 || len (allTaskAPIs ) > 0 {
300+ out += "\n "
301+ }
281302 out += t .MustFormat ()
282303 }
283304
284305 if len (allTrafficSplitters ) > 0 {
285306 t := trafficSplitterListTable (allTrafficSplitters , allTrafficSplitterEnvs )
286307
287- if len (allRealtimeAPIs ) > 0 || len (allBatchAPIs ) > 0 {
308+ if len (allRealtimeAPIs ) > 0 || len (allBatchAPIs ) > 0 || len ( allTaskAPIs ) > 0 {
288309 out += "\n "
289310 }
290311
@@ -319,20 +340,23 @@ func getAPIsByEnv(env cliconfig.Environment, printEnv bool) (string, error) {
319340
320341 var allRealtimeAPIs []schema.APIResponse
321342 var allBatchAPIs []schema.APIResponse
343+ var allTaskAPIs []schema.APIResponse
322344 var allTrafficSplitters []schema.APIResponse
323345
324346 for _ , api := range apisRes {
325347 switch api .Spec .Kind {
326348 case userconfig .BatchAPIKind :
327349 allBatchAPIs = append (allBatchAPIs , api )
350+ case userconfig .TaskAPIKind :
351+ allTaskAPIs = append (allTaskAPIs , api )
328352 case userconfig .RealtimeAPIKind :
329353 allRealtimeAPIs = append (allRealtimeAPIs , api )
330354 case userconfig .TrafficSplitterKind :
331355 allTrafficSplitters = append (allTrafficSplitters , api )
332356 }
333357 }
334358
335- if len (allRealtimeAPIs ) == 0 && len (allBatchAPIs ) == 0 && len (allTrafficSplitters ) == 0 {
359+ if len (allRealtimeAPIs ) == 0 && len (allBatchAPIs ) == 0 && len (allTaskAPIs ) == 0 && len ( allTrafficSplitters ) == 0 {
336360 return console .Bold ("no apis are deployed" ), nil
337361 }
338362
@@ -350,6 +374,22 @@ func getAPIsByEnv(env cliconfig.Environment, printEnv bool) (string, error) {
350374 out += t .MustFormat ()
351375 }
352376
377+ if len (allTaskAPIs ) > 0 {
378+ envNames := []string {}
379+ for range allTaskAPIs {
380+ envNames = append (envNames , env .Name )
381+ }
382+
383+ t := taskAPIsTable (allTaskAPIs , envNames )
384+ t .FindHeaderByTitle (_titleEnvironment ).Hidden = true
385+
386+ if len (allBatchAPIs ) > 0 {
387+ out += "\n "
388+ }
389+
390+ out += t .MustFormat ()
391+ }
392+
353393 if len (allRealtimeAPIs ) > 0 {
354394 envNames := []string {}
355395 for range allRealtimeAPIs {
@@ -359,7 +399,7 @@ func getAPIsByEnv(env cliconfig.Environment, printEnv bool) (string, error) {
359399 t := realtimeAPIsTable (allRealtimeAPIs , envNames )
360400 t .FindHeaderByTitle (_titleEnvironment ).Hidden = true
361401
362- if len (allBatchAPIs ) > 0 {
402+ if len (allBatchAPIs ) > 0 || len ( allTaskAPIs ) > 0 {
363403 out += "\n "
364404 }
365405
@@ -375,7 +415,7 @@ func getAPIsByEnv(env cliconfig.Environment, printEnv bool) (string, error) {
375415 t := trafficSplitterListTable (allTrafficSplitters , envNames )
376416 t .FindHeaderByTitle (_titleEnvironment ).Hidden = true
377417
378- if len (allBatchAPIs ) > 0 || len (allRealtimeAPIs ) > 0 {
418+ if len (allBatchAPIs ) > 0 || len (allTaskAPIs ) > 0 || len ( allRealtimeAPIs ) > 0 {
379419 out += "\n "
380420 }
381421
@@ -412,6 +452,8 @@ func getAPI(env cliconfig.Environment, apiName string) (string, error) {
412452 return trafficSplitterTable (apiRes , env )
413453 case userconfig .BatchAPIKind :
414454 return batchAPITable (apiRes ), nil
455+ case userconfig .TaskAPIKind :
456+ return taskAPITable (apiRes ), nil
415457 default :
416458 return "" , errors .ErrorUnexpected (fmt .Sprintf ("encountered unexpected kind %s for api %s" , apiRes .Spec .Kind , apiRes .Spec .Name ))
417459 }
0 commit comments