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
- Variables
- func NewAdapter(ctx context.Context, processed adapter.EnvConfigAccessor, ...) adapter.Adapter
- func NewEnvConfig() adapter.EnvConfigAccessor
- func NewRESTClient(ctx context.Context) (*rest.Client, error)
- func NewSOAPClient(ctx context.Context) (*govmomi.Client, error)
- func ReadKey(key string) (string, error)
- type CheckpointConfig
- type EnvConfig
Constants ¶
const ( // replay history from this time by default CheckpointDefaultAge = 5 * time.Minute // create checkpoint every frequency but only on changes CheckpointDefaultPeriod = 10 * time.Second )
const ( VolumeName = "vsphere-binding" DefaultMountPath = "/var/bindings/vsphere" // filepath.Join isn't const. )
Variables ¶
var (
ErrInvalidInterval = errors.New("invalid checkpoint time interval")
)
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
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
NewSOAPClient returns a vCenter SOAP API client with active keep-alive. Use Logout() to release resources and perform a clean logout from vCenter.
Types ¶
type CheckpointConfig ¶ added in v0.21.0
type CheckpointConfig struct { // max replay window MaxAge time.Duration `json:"maxAge"` // create checkpoints at given frequency Period time.Duration `json:"period"` }
CheckpointConfig influences the checkpoint behavior. It configures the maximum age of the replay (look-back) window when starting the event stream and the period of saving the checkpoint
func (*CheckpointConfig) MarshalJSON ¶ added in v0.21.0
func (c *CheckpointConfig) MarshalJSON() ([]byte, error)
MarshalJSON defines custom marshalling logic to support human-readable time input on the checkpoint configuration, e.g. "10m" or "1h".
func (*CheckpointConfig) UnmarshalJSON ¶ added in v0.21.0
func (c *CheckpointConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON defines custom marshalling logic to support human-readable time input on the checkpoint configuration, e.g. "10m" or "1h". Using numbers without time suffix as input will fail encoding/decoding.