github.com/vmware/govmomi@v0.51.0/cli/importx/ova.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 importx 6 7 import ( 8 "context" 9 "flag" 10 11 "github.com/vmware/govmomi/cli" 12 "github.com/vmware/govmomi/ovf/importer" 13 ) 14 15 type ova struct { 16 *ovfx 17 } 18 19 func init() { 20 cli.Register("import.ova", &ova{&ovfx{}}) 21 } 22 23 func (cmd *ova) Usage() string { 24 return "PATH_TO_OVA" 25 } 26 27 func (cmd *ova) Run(ctx context.Context, f *flag.FlagSet) error { 28 fpath, err := cmd.Prepare(f) 29 if err != nil { 30 return err 31 } 32 33 archive := &importer.TapeArchive{Path: fpath} 34 archive.Client = cmd.Importer.Client 35 36 cmd.Importer.Archive = archive 37 fpath = "*.ovf" 38 39 return cmd.Import(ctx, fpath) 40 }