flags

package
Version: v0.30.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 41 Imported by: 1,573

Documentation

Overview

Copyright (c) 2015-2016 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.

Index

Constants

View Source
const (
	SearchVirtualMachines = iota + 1
	SearchHosts
	SearchVirtualApps
)

Variables

View Source
var (
	BuildVersion = "v0.0.0" // govc-test requires an (arbitrary) version set
	BuildCommit  string
	BuildDate    string
)

Functions

func ContentLibrary added in v0.23.0

func ContentLibrary(ctx context.Context, c *rest.Client, path string) (*library.Library, error)

ContentLibrary attempts to find a content library with the given path, asserting 1 match of type library.Library.

func ContentLibraryItem added in v0.23.0

func ContentLibraryItem(ctx context.Context, c *rest.Client, path string) (*library.Item, error)

ContentLibraryItem attempts to find a content library with the given path, asserting 1 match of type library.Item.

func ContentLibraryResult added in v0.23.0

func ContentLibraryResult(ctx context.Context, c *rest.Client, kind string, path string) (finder.FindResult, error)

func NewInt32 added in v0.5.0

func NewInt32(v *int32) flag.Value

NewInt32 behaves as flag.IntVar, but using an int32 type.

func NewInt64 added in v0.16.0

func NewInt64(v *int64) flag.Value

NewInt64 behaves as flag.IntVar, but using an int64 type.

func NewOptionalBool added in v0.3.0

func NewOptionalBool(v **bool) flag.Value

NewOptionalBool returns a flag.Value implementation where there is no default value. This avoids sending a default value over the wire as using flag.BoolVar() would.

func NewOptionalInt32 added in v0.15.0

func NewOptionalInt32(v **int32) flag.Value

func NewOptionalInt64 added in v0.16.0

func NewOptionalInt64(v **int64) flag.Value

func ParseVersion

func ParseVersion(s string) (version, error)

Types

type ClientFlag

type ClientFlag struct {
	*DebugFlag

	Session cache.Session
	// contains filtered or unexported fields
}

func NewClientFlag added in v0.3.0

func NewClientFlag(ctx context.Context) (*ClientFlag, context.Context)

func (*ClientFlag) Client

func (flag *ClientFlag) Client() (*vim25.Client, error)

func (*ClientFlag) CnsClient added in v0.25.0

func (flag *ClientFlag) CnsClient() (*cns.Client, error)

func (*ClientFlag) ConfigureTLS added in v0.23.0

func (flag *ClientFlag) ConfigureTLS(sc *soap.Client) error

func (*ClientFlag) Environ added in v0.6.0

func (flag *ClientFlag) Environ(extra bool) []string

Environ returns the govc environment variables for this connection

func (*ClientFlag) KeepAlive added in v0.23.0

func (flag *ClientFlag) KeepAlive(client cache.Client)

func (*ClientFlag) Logout added in v0.8.0

func (flag *ClientFlag) Logout(ctx context.Context) error

func (*ClientFlag) PbmClient added in v0.25.0

func (flag *ClientFlag) PbmClient() (*pbm.Client, error)

func (*ClientFlag) Process

func (flag *ClientFlag) Process(ctx context.Context) error

func (*ClientFlag) ProcessOnce added in v0.3.0

func (c *ClientFlag) ProcessOnce(fn func() error) (err error)

func (*ClientFlag) Register

func (flag *ClientFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*ClientFlag) RegisterOnce added in v0.3.0

func (c *ClientFlag) RegisterOnce(fn func())

func (*ClientFlag) RestClient added in v0.23.0

func (flag *ClientFlag) RestClient() (*rest.Client, error)

func (*ClientFlag) RoundTripper added in v0.25.0

func (flag *ClientFlag) RoundTripper(c *soap.Client) soap.RoundTripper

func (*ClientFlag) Set

func (flag *ClientFlag) Set(s string) error

func (*ClientFlag) SetRootCAs added in v0.10.0

func (flag *ClientFlag) SetRootCAs(c *soap.Client) error

func (*ClientFlag) String

func (flag *ClientFlag) String() string

func (*ClientFlag) WithCancel added in v0.19.0

func (flag *ClientFlag) WithCancel(ctx context.Context, f func(context.Context) error) error

WithCancel calls the given function, returning when complete or canceled via SIGINT.

type ClusterFlag added in v0.17.0

type ClusterFlag struct {
	*DatacenterFlag

	Name string
	// contains filtered or unexported fields
}

func NewClusterFlag added in v0.17.0

func NewClusterFlag(ctx context.Context) (*ClusterFlag, context.Context)

func (*ClusterFlag) Cluster added in v0.17.0

func (*ClusterFlag) ClusterIfSpecified added in v0.17.0

func (f *ClusterFlag) ClusterIfSpecified() (*object.ClusterComputeResource, error)

func (*ClusterFlag) Names added in v0.17.0

func (*ClusterFlag) ObjectList added in v0.17.0

func (f *ClusterFlag) ObjectList(ctx context.Context, kind string, names []string) ([]types.ManagedObjectReference, error)

func (*ClusterFlag) Process added in v0.17.0

func (f *ClusterFlag) Process(ctx context.Context) error

func (*ClusterFlag) ProcessOnce added in v0.17.0

func (c *ClusterFlag) ProcessOnce(fn func() error) (err error)

func (*ClusterFlag) Reconfigure added in v0.17.0

func (*ClusterFlag) Register added in v0.17.0

func (f *ClusterFlag) Register(ctx context.Context, fs *flag.FlagSet)

func (*ClusterFlag) RegisterOnce added in v0.17.0

func (c *ClusterFlag) RegisterOnce(fn func())

func (*ClusterFlag) RegisterPlacement added in v0.22.0

func (f *ClusterFlag) RegisterPlacement(ctx context.Context, fs *flag.FlagSet)

RegisterPlacement registers the -cluster flag without using GOVC_CLUSTER env as the default value, usage is specific to VM placement.

type DatacenterFlag

type DatacenterFlag struct {
	*ClientFlag
	*OutputFlag

	Name string
	// contains filtered or unexported fields
}

func NewDatacenterFlag added in v0.3.0

func NewDatacenterFlag(ctx context.Context) (*DatacenterFlag, context.Context)

func (*DatacenterFlag) Datacenter

func (flag *DatacenterFlag) Datacenter() (*object.Datacenter, error)

func (*DatacenterFlag) DatacenterIfSpecified added in v0.14.0

func (flag *DatacenterFlag) DatacenterIfSpecified() (*object.Datacenter, error)

func (*DatacenterFlag) Finder

func (flag *DatacenterFlag) Finder(all ...bool) (*find.Finder, error)

func (*DatacenterFlag) ManagedObject added in v0.20.0

func (flag *DatacenterFlag) ManagedObject(ctx context.Context, arg string) (types.ManagedObjectReference, error)

func (*DatacenterFlag) ManagedObjects added in v0.3.0

func (flag *DatacenterFlag) ManagedObjects(ctx context.Context, args []string) ([]types.ManagedObjectReference, error)

func (*DatacenterFlag) Process

func (flag *DatacenterFlag) Process(ctx context.Context) error

func (*DatacenterFlag) ProcessOnce added in v0.3.0

func (c *DatacenterFlag) ProcessOnce(fn func() error) (err error)

func (*DatacenterFlag) Register

func (flag *DatacenterFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*DatacenterFlag) RegisterOnce added in v0.3.0

func (c *DatacenterFlag) RegisterOnce(fn func())

type DatastoreFlag

type DatastoreFlag struct {
	*DatacenterFlag

	Name string
	// contains filtered or unexported fields
}

func NewCustomDatastoreFlag added in v0.4.0

func NewCustomDatastoreFlag(ctx context.Context) (*DatastoreFlag, context.Context)

NewCustomDatastoreFlag creates and returns a new DatastoreFlag without trying to retrieve an existing one from the specified context.

func NewDatastoreFlag added in v0.3.0

func NewDatastoreFlag(ctx context.Context) (*DatastoreFlag, context.Context)

func (*DatastoreFlag) Args added in v0.16.0

func (f *DatastoreFlag) Args(args []string) []object.DatastorePath

func (*DatastoreFlag) Datastore

func (f *DatastoreFlag) Datastore() (*object.Datastore, error)

func (*DatastoreFlag) DatastoreIfSpecified added in v0.12.1

func (flag *DatastoreFlag) DatastoreIfSpecified() (*object.Datastore, error)

func (*DatastoreFlag) DatastorePath

func (f *DatastoreFlag) DatastorePath(name string) (string, error)

func (*DatastoreFlag) IsSet added in v0.24.0

func (flag *DatastoreFlag) IsSet() bool

func (*DatastoreFlag) Process

func (f *DatastoreFlag) Process(ctx context.Context) error

func (*DatastoreFlag) ProcessOnce added in v0.3.0

func (c *DatastoreFlag) ProcessOnce(fn func() error) (err error)

func (*DatastoreFlag) Register

func (f *DatastoreFlag) Register(ctx context.Context, fs *flag.FlagSet)

func (*DatastoreFlag) RegisterOnce added in v0.3.0

func (c *DatastoreFlag) RegisterOnce(fn func())

func (*DatastoreFlag) Stat

func (f *DatastoreFlag) Stat(ctx context.Context, file string) (types.BaseFileInfo, error)

type DebugFlag

type DebugFlag struct {
	// contains filtered or unexported fields
}

func NewDebugFlag added in v0.3.0

func NewDebugFlag(ctx context.Context) (*DebugFlag, context.Context)

func (*DebugFlag) Process

func (flag *DebugFlag) Process(ctx context.Context) error

func (*DebugFlag) ProcessOnce added in v0.3.0

func (c *DebugFlag) ProcessOnce(fn func() error) (err error)

func (*DebugFlag) Register

func (flag *DebugFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*DebugFlag) RegisterOnce added in v0.3.0

func (c *DebugFlag) RegisterOnce(fn func())

func (*DebugFlag) Verbose added in v0.25.0

func (flag *DebugFlag) Verbose() bool

type EmptyFlag

type EmptyFlag struct{}

func (*EmptyFlag) Process

func (flag *EmptyFlag) Process(ctx context.Context) error

func (*EmptyFlag) Register

func (flag *EmptyFlag) Register(ctx context.Context, f *flag.FlagSet)

type FolderFlag added in v0.5.0

type FolderFlag struct {
	*DatacenterFlag
	// contains filtered or unexported fields
}

func NewFolderFlag added in v0.5.0

func NewFolderFlag(ctx context.Context) (*FolderFlag, context.Context)

func (*FolderFlag) Folder added in v0.5.0

func (flag *FolderFlag) Folder() (*object.Folder, error)

func (*FolderFlag) FolderIfSpecified added in v0.23.0

func (flag *FolderFlag) FolderIfSpecified() (*object.Folder, error)

func (*FolderFlag) FolderOrDefault added in v0.10.0

func (flag *FolderFlag) FolderOrDefault(kind string) (*object.Folder, error)

func (*FolderFlag) IsSet added in v0.24.0

func (flag *FolderFlag) IsSet() bool

func (*FolderFlag) Process added in v0.5.0

func (flag *FolderFlag) Process(ctx context.Context) error

func (*FolderFlag) ProcessOnce added in v0.5.0

func (c *FolderFlag) ProcessOnce(fn func() error) (err error)

func (*FolderFlag) Register added in v0.5.0

func (flag *FolderFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*FolderFlag) RegisterOnce added in v0.5.0

func (c *FolderFlag) RegisterOnce(fn func())

type HostConnectFlag added in v0.3.0

type HostConnectFlag struct {
	types.HostConnectSpec
	// contains filtered or unexported fields
}

func NewHostConnectFlag added in v0.3.0

func NewHostConnectFlag(ctx context.Context) (*HostConnectFlag, context.Context)

func (*HostConnectFlag) Fault added in v0.10.0

func (flag *HostConnectFlag) Fault(err error) error

Fault checks if error is SSLVerifyFault, including the thumbprint if so

func (*HostConnectFlag) Process added in v0.3.0

func (flag *HostConnectFlag) Process(ctx context.Context) error

func (*HostConnectFlag) ProcessOnce added in v0.3.0

func (c *HostConnectFlag) ProcessOnce(fn func() error) (err error)

func (*HostConnectFlag) Register added in v0.3.0

func (flag *HostConnectFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*HostConnectFlag) RegisterOnce added in v0.3.0

func (c *HostConnectFlag) RegisterOnce(fn func())

func (*HostConnectFlag) Spec added in v0.10.0

Spec attempts to fill in SslThumbprint if empty. First checks GOVC_TLS_KNOWN_HOSTS, if not found and noverify=true then use object.HostCertificateInfo to get the thumbprint.

type HostSystemFlag

type HostSystemFlag struct {
	*ClientFlag
	*DatacenterFlag
	*SearchFlag
	// contains filtered or unexported fields
}

func NewHostSystemFlag added in v0.3.0

func NewHostSystemFlag(ctx context.Context) (*HostSystemFlag, context.Context)

func (*HostSystemFlag) HostNetworkSystem

func (flag *HostSystemFlag) HostNetworkSystem() (*object.HostNetworkSystem, error)

func (*HostSystemFlag) HostSystem

func (flag *HostSystemFlag) HostSystem() (*object.HostSystem, error)

func (*HostSystemFlag) HostSystemIfSpecified

func (flag *HostSystemFlag) HostSystemIfSpecified() (*object.HostSystem, error)

func (*HostSystemFlag) Process

func (flag *HostSystemFlag) Process(ctx context.Context) error

func (*HostSystemFlag) ProcessOnce added in v0.3.0

func (c *HostSystemFlag) ProcessOnce(fn func() error) (err error)

func (*HostSystemFlag) Register

func (flag *HostSystemFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*HostSystemFlag) RegisterOnce added in v0.3.0

func (c *HostSystemFlag) RegisterOnce(fn func())

type NetworkFlag

type NetworkFlag struct {
	*DatacenterFlag
	// contains filtered or unexported fields
}

func NewNetworkFlag

func NewNetworkFlag(ctx context.Context) (*NetworkFlag, context.Context)

func (*NetworkFlag) Change added in v0.17.0

func (flag *NetworkFlag) Change(device types.BaseVirtualDevice, update types.BaseVirtualDevice)

Change applies update backing and hardware address changes to the given network device.

func (*NetworkFlag) Device

func (flag *NetworkFlag) Device() (types.BaseVirtualDevice, error)

func (*NetworkFlag) IsSet added in v0.5.0

func (flag *NetworkFlag) IsSet() bool

func (*NetworkFlag) Network

func (flag *NetworkFlag) Network() (object.NetworkReference, error)

func (*NetworkFlag) Process

func (flag *NetworkFlag) Process(ctx context.Context) error

func (*NetworkFlag) ProcessOnce added in v0.3.0

func (c *NetworkFlag) ProcessOnce(fn func() error) (err error)

func (*NetworkFlag) Register

func (flag *NetworkFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*NetworkFlag) RegisterOnce added in v0.3.0

func (c *NetworkFlag) RegisterOnce(fn func())

func (*NetworkFlag) Set

func (flag *NetworkFlag) Set(name string) error

func (*NetworkFlag) String

func (flag *NetworkFlag) String() string

type OutputFlag

type OutputFlag struct {
	JSON bool
	XML  bool
	TTY  bool
	Dump bool
	Out  io.Writer
	// contains filtered or unexported fields
}

func NewOutputFlag added in v0.3.0

func NewOutputFlag(ctx context.Context) (*OutputFlag, context.Context)

func (*OutputFlag) All added in v0.16.0

func (flag *OutputFlag) All() bool

func (*OutputFlag) Log

func (flag *OutputFlag) Log(s string) (int, error)

Log outputs the specified string, prefixed with the current time. A newline is not automatically added. If the specified string starts with a '\r', the current line is cleared first.

func (*OutputFlag) Process

func (flag *OutputFlag) Process(ctx context.Context) error

func (*OutputFlag) ProcessOnce added in v0.3.0

func (c *OutputFlag) ProcessOnce(fn func() error) (err error)

func (*OutputFlag) ProgressLogger

func (flag *OutputFlag) ProgressLogger(prefix string) *progressLogger

func (*OutputFlag) Register

func (flag *OutputFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*OutputFlag) RegisterOnce added in v0.3.0

func (c *OutputFlag) RegisterOnce(fn func())

func (*OutputFlag) Write

func (flag *OutputFlag) Write(b []byte) (int, error)

func (*OutputFlag) WriteError added in v0.23.0

func (flag *OutputFlag) WriteError(err error) bool

func (*OutputFlag) WriteResult

func (flag *OutputFlag) WriteResult(result OutputWriter) error

func (*OutputFlag) WriteString

func (flag *OutputFlag) WriteString(s string) (int, error)

type OutputWriter

type OutputWriter interface {
	Write(io.Writer) error
}

type ResourceAllocationFlag added in v0.17.0

type ResourceAllocationFlag struct {
	ExpandableReservation bool
	// contains filtered or unexported fields
}

func NewResourceAllocationFlag added in v0.17.0

func NewResourceAllocationFlag(cpu, mem *types.ResourceAllocationInfo) *ResourceAllocationFlag

func (*ResourceAllocationFlag) Process added in v0.17.0

func (s *ResourceAllocationFlag) Process(ctx context.Context) error

func (*ResourceAllocationFlag) Register added in v0.17.0

func (r *ResourceAllocationFlag) Register(ctx context.Context, f *flag.FlagSet)

type ResourcePoolFlag

type ResourcePoolFlag struct {
	*DatacenterFlag
	// contains filtered or unexported fields
}

func NewResourcePoolFlag added in v0.3.0

func NewResourcePoolFlag(ctx context.Context) (*ResourcePoolFlag, context.Context)

func (*ResourcePoolFlag) IsSet added in v0.24.0

func (flag *ResourcePoolFlag) IsSet() bool

func (*ResourcePoolFlag) Process

func (flag *ResourcePoolFlag) Process(ctx context.Context) error

func (*ResourcePoolFlag) ProcessOnce added in v0.3.0

func (c *ResourcePoolFlag) ProcessOnce(fn func() error) (err error)

func (*ResourcePoolFlag) Register

func (flag *ResourcePoolFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*ResourcePoolFlag) RegisterOnce added in v0.3.0

func (c *ResourcePoolFlag) RegisterOnce(fn func())

func (*ResourcePoolFlag) ResourcePool

func (flag *ResourcePoolFlag) ResourcePool() (*object.ResourcePool, error)

func (*ResourcePoolFlag) ResourcePoolIfSpecified added in v0.9.0

func (flag *ResourcePoolFlag) ResourcePoolIfSpecified() (*object.ResourcePool, error)

type SearchFlag

type SearchFlag struct {
	*ClientFlag
	*DatacenterFlag
	// contains filtered or unexported fields
}

func NewSearchFlag

func NewSearchFlag(ctx context.Context, t int) (*SearchFlag, context.Context)

func (*SearchFlag) HostSystem

func (flag *SearchFlag) HostSystem() (*object.HostSystem, error)

func (*SearchFlag) HostSystems

func (flag *SearchFlag) HostSystems(args []string) ([]*object.HostSystem, error)

func (*SearchFlag) IsSet

func (flag *SearchFlag) IsSet() bool

func (*SearchFlag) Process

func (flag *SearchFlag) Process(ctx context.Context) error

func (*SearchFlag) ProcessOnce added in v0.3.0

func (c *SearchFlag) ProcessOnce(fn func() error) (err error)

func (*SearchFlag) Register

func (flag *SearchFlag) Register(ctx context.Context, fs *flag.FlagSet)

func (*SearchFlag) RegisterOnce added in v0.3.0

func (c *SearchFlag) RegisterOnce(fn func())

func (*SearchFlag) VirtualApp added in v0.3.0

func (flag *SearchFlag) VirtualApp() (*object.VirtualApp, error)

func (*SearchFlag) VirtualApps added in v0.3.0

func (flag *SearchFlag) VirtualApps(args []string) ([]*object.VirtualApp, error)

func (*SearchFlag) VirtualMachine

func (flag *SearchFlag) VirtualMachine() (*object.VirtualMachine, error)

func (*SearchFlag) VirtualMachines

func (flag *SearchFlag) VirtualMachines(args []string) ([]*object.VirtualMachine, error)

type StoragePodFlag added in v0.4.0

type StoragePodFlag struct {
	*DatacenterFlag

	Name string
	// contains filtered or unexported fields
}

func NewStoragePodFlag added in v0.4.0

func NewStoragePodFlag(ctx context.Context) (*StoragePodFlag, context.Context)

func (*StoragePodFlag) Isset added in v0.4.0

func (f *StoragePodFlag) Isset() bool

func (*StoragePodFlag) Process added in v0.4.0

func (f *StoragePodFlag) Process(ctx context.Context) error

func (*StoragePodFlag) ProcessOnce added in v0.4.0

func (c *StoragePodFlag) ProcessOnce(fn func() error) (err error)

func (*StoragePodFlag) Register added in v0.4.0

func (f *StoragePodFlag) Register(ctx context.Context, fs *flag.FlagSet)

func (*StoragePodFlag) RegisterOnce added in v0.4.0

func (c *StoragePodFlag) RegisterOnce(fn func())

func (*StoragePodFlag) StoragePod added in v0.4.0

func (f *StoragePodFlag) StoragePod() (*object.StoragePod, error)

type StringList added in v0.22.0

type StringList []string

func (*StringList) Set added in v0.22.0

func (l *StringList) Set(value string) error

func (*StringList) String added in v0.22.0

func (l *StringList) String() string

type VirtualAppFlag added in v0.3.0

type VirtualAppFlag struct {
	*DatacenterFlag
	*SearchFlag
	// contains filtered or unexported fields
}

func NewVirtualAppFlag added in v0.3.0

func NewVirtualAppFlag(ctx context.Context) (*VirtualAppFlag, context.Context)

func (*VirtualAppFlag) Process added in v0.3.0

func (flag *VirtualAppFlag) Process(ctx context.Context) error

func (*VirtualAppFlag) ProcessOnce added in v0.3.0

func (c *VirtualAppFlag) ProcessOnce(fn func() error) (err error)

func (*VirtualAppFlag) Register added in v0.3.0

func (flag *VirtualAppFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*VirtualAppFlag) RegisterOnce added in v0.3.0

func (c *VirtualAppFlag) RegisterOnce(fn func())

func (*VirtualAppFlag) VirtualApp added in v0.3.0

func (flag *VirtualAppFlag) VirtualApp() (*object.VirtualApp, error)

type VirtualMachineFlag

type VirtualMachineFlag struct {
	*ClientFlag
	*DatacenterFlag
	*SearchFlag
	// contains filtered or unexported fields
}

func NewVirtualMachineFlag added in v0.3.0

func NewVirtualMachineFlag(ctx context.Context) (*VirtualMachineFlag, context.Context)

func (*VirtualMachineFlag) Process

func (flag *VirtualMachineFlag) Process(ctx context.Context) error

func (*VirtualMachineFlag) ProcessOnce added in v0.3.0

func (c *VirtualMachineFlag) ProcessOnce(fn func() error) (err error)

func (*VirtualMachineFlag) Register

func (flag *VirtualMachineFlag) Register(ctx context.Context, f *flag.FlagSet)

func (*VirtualMachineFlag) RegisterOnce added in v0.3.0

func (c *VirtualMachineFlag) RegisterOnce(fn func())

func (*VirtualMachineFlag) VirtualMachine

func (flag *VirtualMachineFlag) VirtualMachine() (*object.VirtualMachine, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL