github.com/vmware/govmomi@v0.51.0/cli/cluster/group/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 group 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 *InfoFlag 17 } 18 19 func init() { 20 cli.Register("cluster.group.remove", &remove{}) 21 } 22 23 func (cmd *remove) Register(ctx context.Context, f *flag.FlagSet) { 24 cmd.InfoFlag, ctx = NewInfoFlag(ctx) 25 cmd.InfoFlag.Register(ctx, f) 26 } 27 28 func (cmd *remove) Process(ctx context.Context) error { 29 if cmd.name == "" { 30 return flag.ErrHelp 31 } 32 return cmd.InfoFlag.Process(ctx) 33 } 34 35 func (cmd *remove) Description() string { 36 return `Remove cluster group. 37 38 Examples: 39 govc cluster.group.remove -cluster my_cluster -name my_group` 40 } 41 42 func (cmd *remove) Run(ctx context.Context, f *flag.FlagSet) error { 43 update := types.ArrayUpdateSpec{ 44 Operation: types.ArrayUpdateOperationRemove, 45 RemoveKey: cmd.name, 46 } 47 48 return cmd.Apply(ctx, update, nil) 49 }