govmomi

package module
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

README

Build Status Go Report Card

govmomi

A Go library for interacting with VMware vSphere APIs (ESXi and/or vCenter).

In addition to the vSphere API client, this repository includes:

  • govc - vSphere CLI

  • vcsim - vSphere API mock framework

  • toolbox - VM guest tools framework

Compatibility

This library is built for and tested against ESXi and vCenter 6.0, 6.5 and 6.7.

It may work with versions 5.5 and 5.1, but neither are officially supported.

Documentation

The APIs exposed by this library very closely follow the API described in the VMware vSphere API Reference Documentation. Refer to this document to become familiar with the upstream API.

The code in the govmomi package is a wrapper for the code that is generated from the vSphere API description. It primarily provides convenience functions for working with the vSphere API. See godoc.org for documentation.

Installation

go get -u github.com/vmware/govmomi

Discussion

Contributors and users are encouraged to collaborate using GitHub issues and/or Slack. Access to Slack requires a VMware {code} membership.

Status

Changes to the API are subject to semantic versioning.

Refer to the CHANGELOG for version to version changes.

Projects using govmomi

License

govmomi is available under the Apache 2 license.

Documentation

Overview

This package is the root package of the govmomi library.

The library is structured as follows:

Package vim25

The minimal usable functionality is available through the vim25 package. It contains subpackages that contain generated types, managed objects, and all available methods. The vim25 package is entirely independent of the other packages in the govmomi tree -- it has no dependencies on its peers.

The vim25 package itself contains a client structure that is passed around throughout the entire library. It abstracts a session and its immutable state. See the vim25 package for more information.

Package session

The session package contains an abstraction for the session manager that allows a user to login and logout. It also provides access to the current session (i.e. to determine if the user is in fact logged in)

Package object

The object package contains wrappers for a selection of managed objects. The constructors of these objects all take a *vim25.Client, which they pass along to derived objects, if applicable.

Package govc

The govc package contains the govc CLI. The code in this tree is not intended to be used as a library. Any functionality that govc contains that _could_ be used as a library function but isn't, _should_ live in a root level package.

Other packages

Other packages, such as "event", "guest", or "license", provide wrappers for the respective subsystems. They are typically not needed in normal workflows so are kept outside the object package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*vim25.Client

	SessionManager *session.Manager
}

func NewClient

func NewClient(ctx context.Context, u *url.URL, insecure bool) (*Client, error)

NewClient creates a new client from a URL. The client authenticates with the server with username/password before returning if the URL contains user information.

func (*Client) IsVC added in v0.4.0

func (c *Client) IsVC() bool

IsVC returns true if we are connected to a vCenter

func (*Client) Login

func (c *Client) Login(ctx context.Context, u *url.Userinfo) error

Login dispatches to the SessionManager.

func (*Client) Logout

func (c *Client) Logout(ctx context.Context) error

Logout dispatches to the SessionManager.

func (*Client) PropertyCollector

func (c *Client) PropertyCollector() *property.Collector

PropertyCollector returns the session's default property collector.

func (*Client) Retrieve

func (c *Client) Retrieve(ctx context.Context, objs []types.ManagedObjectReference, p []string, dst interface{}) error

Retrieve dispatches to the Retrieve function on the default property collector.

func (*Client) RetrieveOne

func (c *Client) RetrieveOne(ctx context.Context, obj types.ManagedObjectReference, p []string, dst interface{}) error

RetrieveOne dispatches to the Retrieve function on the default property collector.

func (*Client) Wait

Wait dispatches to property.Wait.

Directories

Path Synopsis
Package find implements inventory listing and searching.
Package find implements inventory listing and searching.
cli
dvs
env
ls
vm
Package ovf provides functionality to unmarshal and inspect the structure of an OVF file.
Package ovf provides functionality to unmarshal and inspect the structure of an OVF file.
pbm
Package simulator is a mock framework for the vSphere API.
Package simulator is a mock framework for the vSphere API.
esx
Package esx contains SOAP responses from an ESX server, captured using `govc ...
Package esx contains SOAP responses from an ESX server, captured using `govc ...
vpx
Package vpx contains SOAP responses from a vCenter server, captured using `govc ...
Package vpx contains SOAP responses from a vCenter server, captured using `govc ...
sts
Package test contains functions that implement common functionality between tests.
Package test contains functions that implement common functionality between tests.
vix
Package vapi provides access to vSphere Automation APIs that are not available in the SOAP API, such as tagging and the content library.
Package vapi provides access to vSphere Automation APIs that are not available in the SOAP API, such as tagging and the content library.
Package vim25 provides a minimal client implementation to use with other packages in the vim25 tree.
Package vim25 provides a minimal client implementation to use with other packages in the vim25 tree.
mo
xml
Package xml implements a simple XML 1.0 parser that understands XML name spaces.
Package xml implements a simple XML 1.0 parser that understands XML name spaces.
Package vslm provides access to the vSphere Storage Lifecycle Management service.
Package vslm provides access to the vSphere Storage Lifecycle Management service.

Jump to

Keyboard shortcuts

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