esx

package
v0.48.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

func NewCommand

func NewCommand(args []string) *Command

func (*Command) Argument

func (*Command) Method

func (c *Command) Method() string

func (*Command) Moid

func (c *Command) Moid() string

func (*Command) Name

func (c *Command) Name() string

func (*Command) Namespace

func (c *Command) Namespace() string

func (*Command) Parse

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 NewExecutor(ctx context.Context, c *vim25.Client, host mo.Reference) (*Executor, error)

func (*Executor) Client

func (e *Executor) Client() *vim25.Client

func (*Executor) CommandInfo

func (e *Executor) CommandInfo(ctx context.Context, ns string) (*CommandInfo, error)

func (*Executor) CommandInfoMethod

func (e *Executor) CommandInfoMethod(ctx context.Context, c *Command) (*CommandInfoMethod, error)

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 (*Executor) Run

func (e *Executor) Run(ctx context.Context, args []string) (*Response, error)
Example
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

type Fault struct {
	Message string `json:"message"`
	Detail  string `json:"detail"`
}

func (Fault) Error

func (f Fault) Error() string

func (Fault) MessageDetail

func (f Fault) MessageDetail() string

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 NewGuestInfo(c *vim25.Client) *GuestInfo

func (*GuestInfo) IpAddress

func (g *GuestInfo) IpAddress(ctx context.Context, vm mo.Reference) (string, error)

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 (r *Response) MarshalXML(e *xml.Encoder, _ xml.StartElement) error

func (*Response) Type

func (r *Response) Type(start xml.StartElement) string

func (*Response) UnmarshalXML

func (r *Response) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Values

type Values map[string][]string

func (Values) MarshalXML

func (s Values) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (Values) UnmarshalXML

func (v Values) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (Values) Value

func (v Values) Value(name string) string

Jump to

Keyboard shortcuts

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