govmomi: github.com/vmware/govmomi/vim25 Index | Files | Directories

package vim25

import "github.com/vmware/govmomi/vim25"

Package vim25 provides a minimal client implementation to use with other packages in the vim25 tree. The code in this package intentionally does not take any dependendies outside the vim25 tree.

The client implementation in this package embeds the soap.Client structure. Additionally, it stores the value of the session's ServiceContent object. This object stores references to a variety of subsystems, such as the root property collector, the session manager, and the search index. The client is fully functional after serialization and deserialization, without the need for additional requests for initialization.

Index

Package Files

client.go doc.go retry.go

func Retry Uses

func Retry(roundTripper soap.RoundTripper, fn RetryFunc) soap.RoundTripper

Retry wraps the specified soap.RoundTripper and invokes the specified RetryFunc. The RetryFunc returns whether or not to retry the call, and if so, how long to wait before retrying. If the result of this function is to not retry, the original error is returned from the RoundTrip function.

type Client Uses

type Client struct {
    *soap.Client

    ServiceContent types.ServiceContent

    // RoundTripper is a separate field such that the client's implementation of
    // the RoundTripper interface can be wrapped by separate implementations for
    // extra functionality (for example, reauthentication on session timeout).
    RoundTripper soap.RoundTripper
}

Client is a tiny wrapper around the vim25/soap Client that stores session specific state (i.e. state that only needs to be retrieved once after the client has been created). This means the client can be reused after serialization without performing additional requests for initialization.

func NewClient Uses

func NewClient(ctx context.Context, rt soap.RoundTripper) (*Client, error)

NewClient creates and returns a new client wirh the ServiceContent field filled in.

func (*Client) IsVC Uses

func (c *Client) IsVC() bool

IsVC returns true if we are connected to a vCenter

func (*Client) MarshalJSON Uses

func (c *Client) MarshalJSON() ([]byte, error)

func (*Client) RoundTrip Uses

func (c *Client) RoundTrip(ctx context.Context, req, res soap.HasFault) error

RoundTrip dispatches to the RoundTripper field.

func (*Client) UnmarshalJSON Uses

func (c *Client) UnmarshalJSON(b []byte) error

func (*Client) Valid Uses

func (c *Client) Valid() bool

Valid returns whether or not the client is valid and ready for use. This should be called after unmarshalling the client.

type RetryFunc Uses

type RetryFunc func(err error) (retry bool, delay time.Duration)

func TemporaryNetworkError Uses

func TemporaryNetworkError(n int) RetryFunc

TemporaryNetworkError returns a RetryFunc that retries up to a maximum of n times, only if the error returned by the RoundTrip function is a temporary network error (for example: a connect timeout).

Directories

PathSynopsis
debug
methods
mo
progress
soap
types
xmlPackage xml implements a simple XML 1.0 parser that understands XML name spaces.

Package vim25 imports 8 packages (graph) and is imported by 42 packages. Updated 2017-07-16. Refresh now. Tools for package owners.