vsphere

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: Apache-2.0 Imports: 26 Imported by: 3

Documentation

Overview

Package vsphere holds utilities for bootstrapping a vSphere API client from the metadata injected by the VSphereSource. Within a receive adapter, users can create a new vSphere SOAP API client with automatic keep-alive:

client, err := vsphere.NewSOAPClient(ctx)

To properly release vSphere API resources, it is recommended to log out when the client is not needed anymore:

defer client.Logout(context.Background())

This is modeled after the Bindings pattern.

Index

Constants

View Source
const (
	VolumeName       = "vsphere-binding"
	DefaultMountPath = "/var/bindings/vsphere" // filepath.Join isn't const.

)

Variables

This section is empty.

Functions

func NewAdapter

func NewAdapter(ctx context.Context, processed adapter.EnvConfigAccessor, ceClient cloudevents.Client) adapter.Adapter

func NewEnvConfig

func NewEnvConfig() adapter.EnvConfigAccessor

func NewRESTClient added in v0.19.0

func NewRESTClient(ctx context.Context) (*rest.Client, error)

NewRESTClient returns a vCenter REST API client with active keep-alive. Use Logout() to release resources and perform a clean logout from vCenter.

func NewSOAPClient added in v0.19.0

func NewSOAPClient(ctx context.Context) (*govmomi.Client, error)

NewSOAPClient returns a vCenter SOAP API client with active keep-alive. Use Logout() to release resources and perform a clean logout from vCenter.

func ReadKey

func ReadKey(key string) (string, error)

ReadKey reads the key from the secret.

Types

type EnvConfig

type EnvConfig struct {
	Insecure   bool   `envconfig:"GOVC_INSECURE" default:"false"`
	Address    string `envconfig:"GOVC_URL" required:"true"`
	SecretPath string `envconfig:"GOVC_SECRET_PATH" default:""`
}

Jump to

Keyboard shortcuts

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