github.com/vmware/govmomi@v0.51.0/cli/host/portgroup/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 portgroup 6 7 import ( 8 "context" 9 "flag" 10 11 "github.com/vmware/govmomi/cli" 12 "github.com/vmware/govmomi/cli/flags" 13 ) 14 15 type remove struct { 16 *flags.HostSystemFlag 17 } 18 19 func init() { 20 cli.Register("host.portgroup.remove", &remove{}) 21 } 22 23 func (cmd *remove) Register(ctx context.Context, f *flag.FlagSet) { 24 cmd.HostSystemFlag, ctx = flags.NewHostSystemFlag(ctx) 25 cmd.HostSystemFlag.Register(ctx, f) 26 } 27 28 func (cmd *remove) Description() string { 29 return `Remove portgroup from HOST. 30 31 Examples: 32 govc host.portgroup.remove bridge` 33 } 34 35 func (cmd *remove) Usage() string { 36 return "NAME" 37 } 38 39 func (cmd *remove) Process(ctx context.Context) error { 40 if err := cmd.HostSystemFlag.Process(ctx); err != nil { 41 return err 42 } 43 return nil 44 } 45 46 func (cmd *remove) Run(ctx context.Context, f *flag.FlagSet) error { 47 ns, err := cmd.HostNetworkSystem() 48 if err != nil { 49 return err 50 } 51 52 return ns.RemovePortGroup(ctx, f.Arg(0)) 53 }