Documentation
¶
Overview ¶
Package session caches vSphere objects to avoid having to repeatedly make govmomi client calls.
To obtain a Session, call Create with a Config. The config contains the SDK URL (Service) and the desired vSphere resources. Create then connects to Service and stores govmomi objects for each corresponding value in Config. The Session is returned and the user can use the cached govmomi objects in the exported fields of Session instead of directly using a govmomi Client.
Index ¶
- func LimitConcurrency(rt http.RoundTripper, limit int) http.RoundTripper
- type Config
- type RoundTripFunc
- type SDKURLError
- type Session
- func (s *Session) Connect(ctx context.Context) (*Session, error)
- func (s *Session) Create(ctx context.Context) (*Session, error)
- func (s *Session) IsVC() bool
- func (s *Session) IsVSAN(ctx context.Context) bool
- func (s *Session) Populate(ctx context.Context) (*Session, error)
- func (s *Session) SetDatacenter(op trace.Operation, datacenter *object.Datacenter) error
- func (s *Session) Vim25() *vim25.Client
- type SoapClientError
- type UserPassLoginError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LimitConcurrency ¶
func LimitConcurrency(rt http.RoundTripper, limit int) http.RoundTripper
LimitConcurrency limits how many requests can be processed at once
Types ¶
type Config ¶
type Config struct {
// SDK URL or proxy
Service string
// Credentials
User *url.Userinfo
// CloneTicket is used to clone an existing session
CloneTicket string
// Allow insecure connection to Service
Insecure bool
// Target thumbprint
Thumbprint string
// Keep alive duration
Keepalive time.Duration
// User-Agent to identify login sessions (see: govc session.ls)
UserAgent string
ClusterPath string
DatacenterPath string
DatastorePath string
HostPath string
PoolPath string
}
Config contains the configuration used to create a Session.
type RoundTripFunc ¶
RoundTripFunc alias
type SDKURLError ¶
SDKURLError is returned when the soap SDK URL cannot be parsed
func (SDKURLError) Error ¶
func (e SDKURLError) Error() string
type Session ¶
type Session struct {
*govmomi.Client
*Config
Cluster *object.ComputeResource
Datacenter *object.Datacenter
Datastore *object.Datastore
Host *object.HostSystem
Pool *object.ResourcePool
// Default vSphere VMFolder
VMFolder *object.Folder
// Folder where appliance is located
VCHFolder *object.Folder
Finder *find.Finder
DRSEnabled *bool
}
Session caches vSphere objects obtained by querying the SDK.
func (*Session) Connect ¶
Connect establishes the connection for the session but nothing more
func (*Session) Create ¶
Create accepts a Config and returns a Session with the cached vSphere resources.
func (*Session) IsVC ¶
IsVC returns whether the session is backed by VC
func (*Session) IsVSAN ¶
IsVSAN returns whether the datastore used in the session is backed by VSAN
func (*Session) Populate ¶
Populate caches resources on the session object. These resources are based off of the config provided at session creation.
vic specific: The values that end in Path (DataCenterPath, ClusterPath, etc..) are either from the CLI or have been retreived from the appliance extraConfig
func (*Session) SetDatacenter ¶
type SoapClientError ¶
SoapClientError is returned when we're unable to obtain a vim client
func (SoapClientError) Error ¶
func (e SoapClientError) Error() string
Source Files
¶
- errors.go
- session.go