@@ -100,7 +100,8 @@ func WrapCall(call ControlCall) RunFunc {
100100
101101
102102func GetInfo (cxt context.Context , rpc * coconut.RpcClient , cmd * cobra.Command , args []string , o io.Writer ) (err error ) {
103- response , err := rpc .GetFrameworkInfo (cxt , & pb.GetFrameworkInfoRequest {}, grpc.EmptyCallOption {})
103+ var response * pb.GetFrameworkInfoReply
104+ response , err = rpc .GetFrameworkInfo (cxt , & pb.GetFrameworkInfoRequest {}, grpc.EmptyCallOption {})
104105 if err != nil {
105106 return
106107 }
@@ -123,7 +124,8 @@ func Teardown(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Command, a
123124
124125
125126func GetEnvironments (cxt context.Context , rpc * coconut.RpcClient , cmd * cobra.Command , args []string , o io.Writer ) (err error ) {
126- response , err := rpc .GetEnvironments (cxt , & pb.GetEnvironmentsRequest {}, grpc.EmptyCallOption {})
127+ var response * pb.GetEnvironmentsReply
128+ response , err = rpc .GetEnvironments (cxt , & pb.GetEnvironmentsRequest {}, grpc.EmptyCallOption {})
127129 if err != nil {
128130 return
129131 }
@@ -193,7 +195,8 @@ func ShowEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Com
193195 return
194196 }
195197
196- response , err := rpc .GetEnvironment (cxt , & pb.GetEnvironmentRequest {Id : args [0 ]}, grpc.EmptyCallOption {})
198+ var response * pb.GetEnvironmentReply
199+ response , err = rpc .GetEnvironment (cxt , & pb.GetEnvironmentRequest {Id : args [0 ]}, grpc.EmptyCallOption {})
197200 if err != nil {
198201 return
199202 }
@@ -237,10 +240,10 @@ func ControlEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.
237240 return
238241 }
239242
240- response , err := rpc .ControlEnvironment (cxt , & pb.ControlEnvironmentRequest {Id : args [0 ], Type : pb .ControlEnvironmentRequest_Optype (pb .ControlEnvironmentRequest_Optype_value [event ])}, grpc.EmptyCallOption {})
243+ var response * pb.ControlEnvironmentReply
244+ response , err = rpc .ControlEnvironment (cxt , & pb.ControlEnvironmentRequest {Id : args [0 ], Type : pb .ControlEnvironmentRequest_Optype (pb .ControlEnvironmentRequest_Optype_value [event ])}, grpc.EmptyCallOption {})
241245 if err != nil {
242246 return
243-
244247 }
245248
246249 fmt .Fprintln (o , "transition complete" )
@@ -295,7 +298,8 @@ func ModifyEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.C
295298 }
296299
297300 // Check current state first
298- envResponse , err := rpc .GetEnvironment (cxt , & pb.GetEnvironmentRequest {Id : envId }, grpc.EmptyCallOption {})
301+ var envResponse * pb.GetEnvironmentReply
302+ envResponse , err = rpc .GetEnvironment (cxt , & pb.GetEnvironmentRequest {Id : envId }, grpc.EmptyCallOption {})
299303 if err != nil {
300304 return
301305 }
@@ -308,7 +312,8 @@ func ModifyEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.C
308312 }
309313
310314 // Do the request
311- response , err := rpc .ModifyEnvironment (cxt , & pb.ModifyEnvironmentRequest {
315+ var response * pb.ModifyEnvironmentReply
316+ response , err = rpc .ModifyEnvironment (cxt , & pb.ModifyEnvironmentRequest {
312317 Id : envId ,
313318 Operations : ops ,
314319 ReconfigureAll : reconfigure ,
@@ -341,7 +346,8 @@ func DestroyEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.
341346 envId := args [0 ]
342347
343348 // Check current state first
344- envResponse , err := rpc .GetEnvironment (cxt , & pb.GetEnvironmentRequest {Id : envId }, grpc.EmptyCallOption {})
349+ var envResponse * pb.GetEnvironmentReply
350+ envResponse , err = rpc .GetEnvironment (cxt , & pb.GetEnvironmentRequest {Id : envId }, grpc.EmptyCallOption {})
345351 if err != nil {
346352 return
347353 }
@@ -365,7 +371,8 @@ func DestroyEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.
365371
366372
367373func GetTasks (cxt context.Context , rpc * coconut.RpcClient , cmd * cobra.Command , args []string , o io.Writer ) (err error ) {
368- response , err := rpc .GetTasks (cxt , & pb.GetTasksRequest {}, grpc.EmptyCallOption {})
374+ var response * pb.GetTasksReply
375+ response , err = rpc .GetTasks (cxt , & pb.GetTasksRequest {}, grpc.EmptyCallOption {})
369376 if err != nil {
370377 return
371378 }
@@ -400,7 +407,8 @@ func QueryRoles(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Command,
400407 envId := args [0 ]
401408 queryPath := args [1 ]
402409
403- response , err := rpc .GetRoles (cxt , & pb.GetRolesRequest {EnvId : envId , PathSpec : queryPath }, grpc.EmptyCallOption {})
410+ var response * pb.GetRolesReply
411+ response , err = rpc .GetRoles (cxt , & pb.GetRolesRequest {EnvId : envId , PathSpec : queryPath }, grpc.EmptyCallOption {})
404412 if err != nil {
405413 return
406414 }
@@ -421,5 +429,29 @@ func QueryRoles(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Command,
421429 }
422430 }
423431
432+ return nil
433+ }
434+
435+ func ListWorkflowTemplates (cxt context.Context , rpc * coconut.RpcClient , cmd * cobra.Command , args []string , o io.Writer ) (err error ) {
436+ if len (args ) != 0 {
437+ err = errors .New (fmt .Sprintf ("accepts no arg(s), received %d" , len (args )))
438+ return
439+ }
440+
441+ var response * pb.GetWorkflowTemplatesReply
442+ response , err = rpc .GetWorkflowTemplates (cxt , & pb.GetWorkflowTemplatesRequest {}, grpc.EmptyCallOption {})
443+ if err != nil {
444+ return
445+ }
446+
447+ templates := response .GetWorkflowTemplates ()
448+ if len (templates ) == 0 {
449+ fmt .Fprintln (o , "no templates found" )
450+ } else {
451+ fmt .Fprintln (o , "available templates in loaded configuration:" )
452+ for _ , tmpl := range templates {
453+ fmt .Fprintln (o , "\t " + tmpl )
454+ }
455+ }
424456 return nil
425457}
0 commit comments