client

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVimClient

func NewVimClient(
	ctx context.Context,
	config Config) (*vim25.Client, *session.Manager, error)

NewVimClient creates a new vim25 client which is configured to use a custom keepalive handler function.

func RestKeepAliveHandlerFn

func RestKeepAliveHandlerFn(
	ctx context.Context,
	c *rest.Client,
	userInfo *url.Userinfo) func() error

RestKeepAliveHandlerFn returns a keepalive handler function suitable for use with the REST handler. Similar to the SOAP handler, we customize the handler here so we can re-login the client in case the REST session expires due to connectivity issues.

func SoapKeepAliveHandlerFn

func SoapKeepAliveHandlerFn(
	ctx context.Context,
	sc *soap.Client,
	sm *session.Manager,
	userInfo *url.Userinfo) func() error

SoapKeepAliveHandlerFn returns a keepalive handler function suitable for use with the SOAP handler. In case the connectivity to VC is down long enough, the session expires. Further attempts to use the client yield NotAuthenticated fault. This handler ensures that we re-login the client in those scenarios.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, config Config) (*Client, error)

NewClient returns a new client.

func (*Client) Config

func (c *Client) Config() Config

func (*Client) Datacenter

func (c *Client) Datacenter() *object.Datacenter

func (*Client) Finder

func (c *Client) Finder() *find.Finder

func (*Client) Logout

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

func (*Client) RestClient

func (c *Client) RestClient() *rest.Client

func (*Client) VimClient

func (c *Client) VimClient() *vim25.Client

type Config

type Config struct {
	Host       string
	Port       string
	Username   string
	Password   string
	CAFilePath string
	Insecure   bool
	Datacenter string
}

Jump to

Keyboard shortcuts

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