github.com/vmware/govmomi@v0.51.0/cli/host/autostart/remove.go (about)

     1  // © Broadcom. All Rights Reserved.
     2  // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package autostart
     6  
     7  import (
     8  	"context"
     9  	"flag"
    10  
    11  	"github.com/vmware/govmomi/cli"
    12  	"github.com/vmware/govmomi/vim25/types"
    13  )
    14  
    15  type remove struct {
    16  	*AutostartFlag
    17  }
    18  
    19  func init() {
    20  	cli.Register("host.autostart.remove", &remove{})
    21  }
    22  
    23  func (cmd *remove) Register(ctx context.Context, f *flag.FlagSet) {
    24  	cmd.AutostartFlag, ctx = newAutostartFlag(ctx)
    25  	cmd.AutostartFlag.Register(ctx, f)
    26  }
    27  
    28  func (cmd *remove) Process(ctx context.Context) error {
    29  	if err := cmd.AutostartFlag.Process(ctx); err != nil {
    30  		return err
    31  	}
    32  	return nil
    33  }
    34  
    35  func (cmd *remove) Usage() string {
    36  	return "VM..."
    37  }
    38  
    39  func (cmd *remove) Run(ctx context.Context, f *flag.FlagSet) error {
    40  	var powerInfo = types.AutoStartPowerInfo{
    41  		StartAction:      "none",
    42  		StartDelay:       -1,
    43  		StartOrder:       -1,
    44  		StopAction:       "none",
    45  		StopDelay:        -1,
    46  		WaitForHeartbeat: types.AutoStartWaitHeartbeatSettingSystemDefault,
    47  	}
    48  
    49  	return cmd.ReconfigureVMs(f.Args(), powerInfo)
    50  }