Skip to content

Commit

Permalink
govc: Move govc commands into app pkg
Browse files Browse the repository at this point in the history
This patch refactors the `govc` command so all of its actual logic
and commands are located in the root GoVmomi module under the `app`
package. The `govc` package may still be used to build, install,
and test `govc`, but this change allows others to import the pieces
of `govc` without being beholden to the `govc` module's Golang
version.

Signed-off-by: akutz <akutz@vmware.com>

BREAKING: All packages `./govc/*` (except `./govc/test`) have been
relocated under the `./app` package.
  • Loading branch information
akutz committed Nov 8, 2024
1 parent 8f2493a commit f1860fd
Show file tree
Hide file tree
Showing 474 changed files with 956 additions and 922 deletions.
4 changes: 2 additions & 2 deletions govc/about/cert.go → app/about/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"net/http"
"os"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/vim25/soap"
)
Expand Down
4 changes: 2 additions & 2 deletions govc/about/command.go → app/about/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"io"
"text/tabwriter"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vim25/soap"
"github.com/vmware/govmomi/vim25/types"
)
Expand Down
4 changes: 2 additions & 2 deletions govc/alarm/create.go → app/alarm/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"fmt"

"github.com/vmware/govmomi/alarm"
"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/mo"
"github.com/vmware/govmomi/vim25/types"
Expand Down
4 changes: 2 additions & 2 deletions govc/alarm/info.go → app/alarm/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"text/tabwriter"

"github.com/vmware/govmomi/alarm"
"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vim25/mo"
)

Expand Down
4 changes: 2 additions & 2 deletions govc/alarm/rm.go → app/alarm/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"flag"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vim25/methods"
"github.com/vmware/govmomi/vim25/types"
)
Expand Down
4 changes: 2 additions & 2 deletions govc/alarm/state.go → app/alarm/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"time"

"github.com/vmware/govmomi/alarm"
"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vim25/types"
)

Expand Down
135 changes: 135 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
Copyright (c) 2014-2024 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package app

import (
_ "github.com/vmware/govmomi/app/about"
_ "github.com/vmware/govmomi/app/alarm"
"github.com/vmware/govmomi/app/cli"
_ "github.com/vmware/govmomi/app/cluster"
_ "github.com/vmware/govmomi/app/cluster/draft"
_ "github.com/vmware/govmomi/app/cluster/draft/baseimage"
_ "github.com/vmware/govmomi/app/cluster/draft/component"
_ "github.com/vmware/govmomi/app/cluster/group"
_ "github.com/vmware/govmomi/app/cluster/module"
_ "github.com/vmware/govmomi/app/cluster/override"
_ "github.com/vmware/govmomi/app/cluster/rule"
_ "github.com/vmware/govmomi/app/cluster/vlcm"
_ "github.com/vmware/govmomi/app/datacenter"
_ "github.com/vmware/govmomi/app/datastore"
_ "github.com/vmware/govmomi/app/datastore/cluster"
_ "github.com/vmware/govmomi/app/datastore/disk"
_ "github.com/vmware/govmomi/app/datastore/maintenance"
_ "github.com/vmware/govmomi/app/datastore/vsan"
_ "github.com/vmware/govmomi/app/device"
_ "github.com/vmware/govmomi/app/device/cdrom"
_ "github.com/vmware/govmomi/app/device/clock"
_ "github.com/vmware/govmomi/app/device/floppy"
_ "github.com/vmware/govmomi/app/device/model"
_ "github.com/vmware/govmomi/app/device/pci"
_ "github.com/vmware/govmomi/app/device/scsi"
_ "github.com/vmware/govmomi/app/device/serial"
_ "github.com/vmware/govmomi/app/device/usb"
_ "github.com/vmware/govmomi/app/disk"
_ "github.com/vmware/govmomi/app/disk/snapshot"
_ "github.com/vmware/govmomi/app/dvs"
_ "github.com/vmware/govmomi/app/dvs/portgroup"
_ "github.com/vmware/govmomi/app/env"
_ "github.com/vmware/govmomi/app/events"
_ "github.com/vmware/govmomi/app/export"
_ "github.com/vmware/govmomi/app/extension"
_ "github.com/vmware/govmomi/app/fields"
_ "github.com/vmware/govmomi/app/folder"
_ "github.com/vmware/govmomi/app/host"
_ "github.com/vmware/govmomi/app/host/account"
_ "github.com/vmware/govmomi/app/host/autostart"
_ "github.com/vmware/govmomi/app/host/cert"
_ "github.com/vmware/govmomi/app/host/date"
_ "github.com/vmware/govmomi/app/host/esxcli"
_ "github.com/vmware/govmomi/app/host/firewall"
_ "github.com/vmware/govmomi/app/host/maintenance"
_ "github.com/vmware/govmomi/app/host/option"
_ "github.com/vmware/govmomi/app/host/portgroup"
_ "github.com/vmware/govmomi/app/host/service"
_ "github.com/vmware/govmomi/app/host/storage"
_ "github.com/vmware/govmomi/app/host/tpm"
_ "github.com/vmware/govmomi/app/host/vnic"
_ "github.com/vmware/govmomi/app/host/vswitch"
_ "github.com/vmware/govmomi/app/importx"
_ "github.com/vmware/govmomi/app/kms"
_ "github.com/vmware/govmomi/app/kms/key"
_ "github.com/vmware/govmomi/app/library"
_ "github.com/vmware/govmomi/app/library/policy"
_ "github.com/vmware/govmomi/app/library/session"
_ "github.com/vmware/govmomi/app/library/subscriber"
_ "github.com/vmware/govmomi/app/library/trust"
_ "github.com/vmware/govmomi/app/license"
_ "github.com/vmware/govmomi/app/logs"
_ "github.com/vmware/govmomi/app/ls"
_ "github.com/vmware/govmomi/app/metric"
_ "github.com/vmware/govmomi/app/metric/interval"
_ "github.com/vmware/govmomi/app/namespace"
_ "github.com/vmware/govmomi/app/namespace/cluster"
_ "github.com/vmware/govmomi/app/namespace/service"
_ "github.com/vmware/govmomi/app/namespace/vmclass"
_ "github.com/vmware/govmomi/app/object"
_ "github.com/vmware/govmomi/app/option"
_ "github.com/vmware/govmomi/app/permissions"
_ "github.com/vmware/govmomi/app/pool"
_ "github.com/vmware/govmomi/app/role"
_ "github.com/vmware/govmomi/app/session"
_ "github.com/vmware/govmomi/app/sso/group"
_ "github.com/vmware/govmomi/app/sso/idp"
_ "github.com/vmware/govmomi/app/sso/lpp"
_ "github.com/vmware/govmomi/app/sso/service"
_ "github.com/vmware/govmomi/app/sso/user"
_ "github.com/vmware/govmomi/app/storage/policy"
_ "github.com/vmware/govmomi/app/tags"
_ "github.com/vmware/govmomi/app/tags/association"
_ "github.com/vmware/govmomi/app/tags/category"
_ "github.com/vmware/govmomi/app/task"
_ "github.com/vmware/govmomi/app/vapp"
_ "github.com/vmware/govmomi/app/vcsa/access/consolecli"
_ "github.com/vmware/govmomi/app/vcsa/access/dcui"
_ "github.com/vmware/govmomi/app/vcsa/access/shell"
_ "github.com/vmware/govmomi/app/vcsa/access/ssh"
_ "github.com/vmware/govmomi/app/vcsa/log"
_ "github.com/vmware/govmomi/app/vcsa/proxy"
_ "github.com/vmware/govmomi/app/vcsa/shutdown"
_ "github.com/vmware/govmomi/app/version"
_ "github.com/vmware/govmomi/app/vlcm/depot/content/baseimages"
_ "github.com/vmware/govmomi/app/vlcm/depot/offline"
_ "github.com/vmware/govmomi/app/vm"
_ "github.com/vmware/govmomi/app/vm/check"
_ "github.com/vmware/govmomi/app/vm/dataset"
_ "github.com/vmware/govmomi/app/vm/dataset/entry"
_ "github.com/vmware/govmomi/app/vm/disk"
_ "github.com/vmware/govmomi/app/vm/guest"
_ "github.com/vmware/govmomi/app/vm/network"
_ "github.com/vmware/govmomi/app/vm/option"
_ "github.com/vmware/govmomi/app/vm/rdm"
_ "github.com/vmware/govmomi/app/vm/snapshot"
_ "github.com/vmware/govmomi/app/vm/target"
_ "github.com/vmware/govmomi/app/volume"
_ "github.com/vmware/govmomi/app/volume/snapshot"
_ "github.com/vmware/govmomi/app/vsan"
)

// Run executes the application.
func Run(args []string) int {
return cli.Run(args)
}
6 changes: 3 additions & 3 deletions govc/main_test.go → app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package main
package app_test

import (
"context"
"flag"
"testing"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/app/cli"
)

func TestMain(t *testing.T) {
func TestApp(t *testing.T) {
// Execute flag registration for every command to verify there are no
// commands with flag name collisions
for _, cmd := range cli.Commands() {
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions govc/cluster/add.go → app/cluster/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"flag"
"fmt"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/object"
)

Expand Down
4 changes: 2 additions & 2 deletions govc/cluster/change.go → app/cluster/change.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"flag"
"strings"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vim25/types"
)

Expand Down
4 changes: 2 additions & 2 deletions govc/cluster/create.go → app/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"flag"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vim25/types"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"flag"
"io"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"flag"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
4 changes: 2 additions & 2 deletions govc/cluster/draft/commit.go → app/cluster/draft/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"flag"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/cis/tasks"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"flag"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"flag"
"io"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"flag"
"io"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"flag"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
4 changes: 2 additions & 2 deletions govc/cluster/draft/create.go → app/cluster/draft/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"flag"
"io"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
4 changes: 2 additions & 2 deletions govc/cluster/draft/info.go → app/cluster/draft/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"flag"
"io"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
4 changes: 2 additions & 2 deletions govc/cluster/draft/ls.go → app/cluster/draft/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"io"
"strings"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
4 changes: 2 additions & 2 deletions govc/cluster/draft/rm.go → app/cluster/draft/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"flag"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/govc/flags"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/app/flags"
"github.com/vmware/govmomi/vapi/esx/settings/clusters"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"flag"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/vim25/types"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"flag"

"github.com/vmware/govmomi/govc/cli"
"github.com/vmware/govmomi/app/cli"
"github.com/vmware/govmomi/vim25/types"
)

Expand Down
Loading

0 comments on commit f1860fd

Please sign in to comment.