session

package
v0.0.0-...-d88c8b5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Locale = os.Getenv("GOVMOMI_LOCALE")

Locale defaults to "en_US" and can be overridden via this var or the GOVMOMI_LOCALE env var. A value of "_" uses the server locale setting.

Functions

func KeepAlive

func KeepAlive(roundTripper soap.RoundTripper, idleTime time.Duration) soap.RoundTripper

KeepAlive wraps the specified soap.RoundTripper and executes a meaningless API request in the background after the RoundTripper has been idle for the specified amount of idle time. The keep alive process only starts once a user logs in and runs until the user logs out again.

func KeepAliveHandler

func KeepAliveHandler(roundTripper soap.RoundTripper, idleTime time.Duration, handler func(soap.RoundTripper) error) soap.RoundTripper

KeepAliveHandler works as KeepAlive() does, but the handler param can decide how to handle errors. For example, if connectivity to ESX/VC is down long enough for a session to expire, a handler can choose to Login() on a types.NotAuthenticated error. If handler returns non-nil, the keep alive go routine will be stopped.

Types

type Manager

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

func NewManager

func NewManager(client *vim25.Client) *Manager

func (*Manager) AcquireCloneTicket

func (sm *Manager) AcquireCloneTicket(ctx context.Context) (string, error)

func (*Manager) AcquireLocalTicket

func (sm *Manager) AcquireLocalTicket(ctx context.Context, userName string) (*types.SessionManagerLocalTicket, error)

func (*Manager) CloneSession

func (sm *Manager) CloneSession(ctx context.Context, ticket string) error

func (*Manager) Login

func (sm *Manager) Login(ctx context.Context, u *url.Userinfo) error

func (*Manager) LoginByToken

func (sm *Manager) LoginByToken(ctx context.Context) error

func (*Manager) LoginExtensionByCertificate

func (sm *Manager) LoginExtensionByCertificate(ctx context.Context, key string) error

LoginExtensionByCertificate uses the vCenter SDK tunnel to login using a client certificate. The client certificate can be set using the soap.Client.SetCertificate method. See: https://kb.vmware.com/s/article/2004305

func (*Manager) Logout

func (sm *Manager) Logout(ctx context.Context) error

func (Manager) Reference

func (sm Manager) Reference() types.ManagedObjectReference

func (*Manager) SessionIsActive

func (sm *Manager) SessionIsActive(ctx context.Context) (bool, error)

SessionIsActive checks whether the session that was created at login is still valid. This function only works against vCenter.

func (*Manager) SetLocale

func (sm *Manager) SetLocale(ctx context.Context, locale string) error

func (*Manager) TerminateSession

func (sm *Manager) TerminateSession(ctx context.Context, sessionId []string) error

func (*Manager) UserSession

func (sm *Manager) UserSession(ctx context.Context) (*types.UserSession, error)

UserSession retrieves and returns the SessionManager's CurrentSession field. Nil is returned if the session is not authenticated.

Jump to

Keyboard shortcuts

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