package esx
import "github.com/vmware/govmomi/cli/esx"
Index ¶
- type Command
- func NewCommand(args []string) *Command
- func (c *Command) Argument(name string, args ...string) internal.ReflectManagedMethodExecuterSoapArgument
- func (c *Command) Method() string
- func (c *Command) Moid() string
- func (c *Command) Name() string
- func (c *Command) Namespace() string
- func (c *Command) Parse(params []CommandInfoParam) ([]internal.ReflectManagedMethodExecuterSoapArgument, error)
- type CommandInfo
- type CommandInfoHint
- type CommandInfoHints
- type CommandInfoItem
- type CommandInfoMethod
- type CommandInfoParam
- type Executor
- func NewExecutor(ctx context.Context, c *vim25.Client, host mo.Reference) (*Executor, error)
- func (e *Executor) Client() *vim25.Client
- func (e *Executor) CommandInfo(ctx context.Context, ns string) (*CommandInfo, error)
- func (e *Executor) CommandInfoMethod(ctx context.Context, c *Command) (*CommandInfoMethod, error)
- func (e *Executor) DynamicTypeManager() types.ManagedObjectReference
- func (e *Executor) Execute(ctx context.Context, req *internal.ExecuteSoapRequest, res interface{}) error
- func (x *Executor) GetFirewallInfo(ctx context.Context) (*FirewallInfo, error)
- func (e *Executor) NewRequest(ctx context.Context, args []string) (*internal.ExecuteSoapRequest, *CommandInfoMethod, error)
- func (e *Executor) Run(ctx context.Context, args []string) (*Response, error)
- type Fault
- type FirewallInfo
- type GuestInfo
- func NewGuestInfo(c *vim25.Client) *GuestInfo
- func (g *GuestInfo) IpAddress(ctx context.Context, vm mo.Reference) (string, error)
- type Response
- func (r *Response) MarshalXML(e *xml.Encoder, _ xml.StartElement) error
- func (r *Response) Type(start xml.StartElement) string
- func (r *Response) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type Values
Examples ¶
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func (*Command) Argument ¶
func (c *Command) Argument(name string, args ...string) internal.ReflectManagedMethodExecuterSoapArgument
func (*Command) Method ¶
func (*Command) Moid ¶
func (*Command) Name ¶
func (*Command) Namespace ¶
func (*Command) Parse ¶
func (c *Command) Parse(params []CommandInfoParam) ([]internal.ReflectManagedMethodExecuterSoapArgument, error)
Parse generates a flag.FlagSet based on the given []CommandInfoParam and returns arguments for use with methods.ExecuteSoap
type CommandInfo ¶
type CommandInfo struct { CommandInfoItem Method []CommandInfoMethod `xml:"method" json:"method"` }
type CommandInfoHint ¶
type CommandInfoHint struct { Key string `xml:"key" json:"key"` Value string `xml:"value" json:"value"` }
type CommandInfoHints ¶
type CommandInfoHints []CommandInfoHint
func (CommandInfoHints) Fields ¶
func (h CommandInfoHints) Fields() []string
func (CommandInfoHints) Formatter ¶
func (h CommandInfoHints) Formatter() string
type CommandInfoItem ¶
type CommandInfoItem struct { Name string `xml:"name" json:"name"` DisplayName string `xml:"displayName" json:"displayName"` Help string `xml:"help" json:"help"` }
type CommandInfoMethod ¶
type CommandInfoMethod struct { CommandInfoItem Param []CommandInfoParam `xml:"param" json:"param"` Hints CommandInfoHints `xml:"hints" json:"hints"` }
type CommandInfoParam ¶
type CommandInfoParam struct { CommandInfoItem Aliases []string `xml:"aliases" json:"aliases"` Flag bool `xml:"flag" json:"flag"` }
type Executor ¶
type Executor struct { Trace func(*internal.ExecuteSoapRequest, *internal.ExecuteSoapResponse) // contains filtered or unexported fields }
func NewExecutor ¶
func (*Executor) Client ¶
func (*Executor) CommandInfo ¶
func (*Executor) CommandInfoMethod ¶
func (*Executor) DynamicTypeManager ¶
func (e *Executor) DynamicTypeManager() types.ManagedObjectReference
func (*Executor) Execute ¶
func (e *Executor) Execute(ctx context.Context, req *internal.ExecuteSoapRequest, res interface{}) error
func (*Executor) GetFirewallInfo ¶
func (x *Executor) GetFirewallInfo(ctx context.Context) (*FirewallInfo, error)
GetFirewallInfo via 'esxcli network firewall get' The HostFirewallSystem type does not expose this data. This helper can be useful in particular to determine if the firewall is enabled or disabled.
func (*Executor) NewRequest ¶
func (e *Executor) NewRequest(ctx context.Context, args []string) (*internal.ExecuteSoapRequest, *CommandInfoMethod, error)
func (*Executor) Run ¶
Example¶
Code:play
package main import ( "context" "fmt" "github.com/vmware/govmomi/cli/esx" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/simulator" "github.com/vmware/govmomi/vim25" ) func main() { simulator.Run(func(ctx context.Context, c *vim25.Client) error { host, err := find.NewFinder(c).HostSystem(ctx, "DC0_H0") if err != nil { return err } x, err := esx.NewExecutor(ctx, c, host) if err != nil { return err } res, err := x.Run(ctx, []string{"software", "vib", "list"}) if err != nil { return err } for _, vib := range res.Values { fmt.Println(vib.Value("Name")) } return nil }) }
Output:
esx-ui intelgpio
type Fault ¶
func (Fault) Error ¶
func (Fault) MessageDetail ¶
type FirewallInfo ¶
type FirewallInfo struct { Loaded bool `json:"loaded"` Enabled bool `json:"enabled"` DefaultAction string `json:"defaultAction"` }
type GuestInfo ¶
type GuestInfo struct {
// contains filtered or unexported fields
}
func NewGuestInfo ¶
func (*GuestInfo) IpAddress ¶
IpAddress attempts to find the guest IP address using esxcli. ESX hosts must be configured with the /Net/GuestIPHack enabled. For example: $ govc host.esxcli -- system settings advanced set -o /Net/GuestIPHack -i 1
type Response ¶
type Response struct { Info *CommandInfoMethod `json:"info"` Values []Values `json:"values"` String string `json:"string"` Kind string `json:"-"` }
func (*Response) MarshalXML ¶
func (*Response) Type ¶
func (r *Response) Type(start xml.StartElement) string
func (*Response) UnmarshalXML ¶
type Values ¶
func (Values) MarshalXML ¶
func (Values) UnmarshalXML ¶
func (Values) Value ¶
Source Files ¶
command.go executor.go firewall_info.go guest_info.go response.go
- Version
- v0.48.1 (latest)
- Published
- Feb 11, 2025
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 2 months ago –
Tools for package owners.