@@ -81,6 +81,18 @@ var instancesDelete = cli.Command{
8181 HideHelpCommand : true ,
8282}
8383
84+ var instancesExecuteCommand = cli.Command {
85+ Name : "execute-command" ,
86+ Usage : "Upgrades to WebSocket for bidirectional streaming for shell access." ,
87+ Flags : []cli.Flag {
88+ & cli.StringFlag {
89+ Name : "id" ,
90+ },
91+ },
92+ Action : handleInstancesExecuteCommand ,
93+ HideHelpCommand : true ,
94+ }
95+
8496var instancesPutInStandby = cli.Command {
8597 Name : "put-in-standby" ,
8698 Usage : "Put instance in standby (pause, snapshot, delete VMM)" ,
@@ -226,6 +238,23 @@ func handleInstancesDelete(ctx context.Context, cmd *cli.Command) error {
226238 )
227239}
228240
241+ func handleInstancesExecuteCommand (ctx context.Context , cmd * cli.Command ) error {
242+ client := hypeman .NewClient (getDefaultRequestOptions (cmd )... )
243+ unusedArgs := cmd .Args ().Slice ()
244+ if ! cmd .IsSet ("id" ) && len (unusedArgs ) > 0 {
245+ cmd .Set ("id" , unusedArgs [0 ])
246+ unusedArgs = unusedArgs [1 :]
247+ }
248+ if len (unusedArgs ) > 0 {
249+ return fmt .Errorf ("Unexpected extra arguments: %v" , unusedArgs )
250+ }
251+ return client .Instances .ExecuteCommand (
252+ ctx ,
253+ cmd .Value ("id" ).(string ),
254+ option .WithMiddleware (debugMiddleware (cmd .Bool ("debug" ))),
255+ )
256+ }
257+
229258func handleInstancesPutInStandby (ctx context.Context , cmd * cli.Command ) error {
230259 client := hypeman .NewClient (getDefaultRequestOptions (cmd )... )
231260 unusedArgs := cmd .Args ().Slice ()
0 commit comments