vmextension

package
v0.0.0-...-d0a9a3c Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackFunc

type CallbackFunc func(ext *VMExtension) error

CallbackFunc is used for a non-Enable operation callback

type EnableCallbackFunc

type EnableCallbackFunc func(ext *VMExtension) (string, error)

EnableCallbackFunc is used for Enable operation callbacks

type InitializationInfo

type InitializationInfo struct {
	Name                string             // The name of the extension, without the Linux or Windows suffix
	Version             string             // The version of the extension
	SupportsDisable     bool               // True if we should automatically disable the extension if Disable is called
	RequiresSeqNoChange bool               // True if Enable will only execute if the sequence number changes
	InstallExitCode     int                // Exit code to use for the install case
	OtherExitCode       int                // Exit code to use for all other cases
	EnableCallback      EnableCallbackFunc // Called for the enable operation
	DisableCallback     CallbackFunc       // Called for the disable operation. Only set this if the extension wants a callback.
	UpdateCallback      CallbackFunc       // Called for the update operation. If nil, then update is not supported.
}

InitializationInfo is passed by the extension to specify how the framework should run

func GetInitializationInfo

func GetInitializationInfo(name string, version string, requiresSeqNoChange bool, enableCallback EnableCallbackFunc) (*InitializationInfo, error)

GetInitializationInfo returns a new InitializationInfo object

type VMExtension

type VMExtension struct {
	Name                       string                                    // The name of the extension. This will contain 'Windows' or 'Linux'
	Version                    string                                    // The version of the extension
	GetRequestedSequenceNumber func() (uint, error)                      // Function to get the requested sequence number to run
	CurrentSequenceNumber      *uint                                     // The last run sequence number, null means no existing sequence number was found
	HandlerEnv                 *handlerenv.HandlerEnvironment            // Contains information about the folders necessary for the extension
	GetSettings                func() (*settings.HandlerSettings, error) // Function to get settings passed to the extension
	ExtensionEvents            *extensionevents.ExtensionEventManager    // Allows extensions to raise events
	ExtensionLogger            *logging.ExtensionLogger                  // Automatically logs to the log directory
	// contains filtered or unexported fields
}

VMExtension is an abstraction for standard extension operations in an OS agnostic manner

func GetVMExtension

func GetVMExtension(initInfo *InitializationInfo) (ext *VMExtension, _ error)

GetVMExtension returns a new VMExtension object

func GetVMExtensionForTesting

func GetVMExtensionForTesting(initInfo *InitializationInfo, manager environmentmanager.IGetVMExtensionEnvironmentManager) (ext *VMExtension, _ error)

GetVMExtensionForTesting mocks out the environment part of the VM extension for use with your extension

func (*VMExtension) Do

func (ve *VMExtension) Do()

Do is the main worker method of the extension and determines which operation to run, if necessary

Jump to

Keyboard shortcuts

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