Documentation
¶
Overview ¶
Copyright (c) Microsoft Corporation. Licensed under the MIT License.
Copyright (c) Microsoft Corporation. Licensed under the MIT License.
Copyright (c) Microsoft Corporation. Licensed under the MIT License.
Copyright (c) Microsoft Corporation. Licensed under the MIT License.
Copyright (c) Microsoft Corporation. Licensed under the MIT License.
Index ¶
Constants ¶
const ( ErrorNoSequenceNumber = -10001 ErrorUnparseableSeqNo = -10002 )
const Internal_UnknownError = -9999
Variables ¶
This section is empty.
Functions ¶
func GetGuestAgentEnvironmetVariable ¶
func GetGuestAgentEnvironmetVariable(envVarName GuestAgentEnvVar) (string, error)
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 ErrorWithClarification ¶
func CreateWrappedErrorWithClarification ¶
func CreateWrappedErrorWithClarification(err error, msg string) *ErrorWithClarification
func NewErrorWithClarification ¶
func NewErrorWithClarification(errorCode int, err error) ErrorWithClarification
func NewErrorWithClarificationPtr ¶
func NewErrorWithClarificationPtr(errorCode int, err error) *ErrorWithClarification
func (ErrorWithClarification) Error ¶
func (ewc ErrorWithClarification) Error() string
func (ErrorWithClarification) Unwrap ¶
func (ewc ErrorWithClarification) Unwrap() error
type GuestAgentEnvVar ¶
type GuestAgentEnvVar string
GuestAgentEnvVar represents environment variable names set by the Azure Guest Agent.
const ( // environment variables are declared here // https://github.com/Azure/azure-vmextension-publishing/wiki/2.0-Partner-Guide-Handler-Design-Details#236-summary GuestAgentEnvVarExtensionVersion GuestAgentEnvVar = "AZURE_GUEST_AGENT_EXTENSION_VERSION" GuestAgentEnvVarExtensionFullPath GuestAgentEnvVar = "AZURE_GUEST_AGENT_EXTENSION_PATH" GuestAgentEnvVarConfigSequenceNumber GuestAgentEnvVar = "ConfigSequenceNumber" GuestAgentEnvVarUpdateToVersion GuestAgentEnvVar = "VERSION" GuestAgentEnvVarUpdateFromVersion GuestAgentEnvVar = "AZURE_GUEST_AGENT_UPDATING_FROM_VERSION" GuestAgentEnvVarDisableCmdExitCode GuestAgentEnvVar = "AZURE_GUEST_AGENT_DISABLE_CMD_EXIT_CODE" GuestAgentEnvVarUninstallCmdExitCode GuestAgentEnvVar = "AZURE_GUEST_AGENT_UNINSTALL_CMD_EXIT_CODE" )
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
SupportsResetState bool // True if we should remove all contents of all folder when ResetState 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.
ResetStateCallback CallbackFunc // Called for the ResetState operation. Only set this if the extension wants a callback.
InstallCallback CallbackFunc // Called for the Install operation. Only set this if the extension wants a callback.
UninstallCallback CallbackFunc // Called for the Uninstall operation. Only set this if the extension wants a callback.
CustomStatusFormatter status.StatusMessageFormatter // Provide a function to format the status message. If nil default formatting behavior will be preserved.
LogFileNamePattern string // Default format to use for log files. Expected to be format string with one parameter; Eg: "<name_pattern>%v"
}
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 OperationName ¶
type OperationName string
const ( InstallOperation OperationName = "install" UninstallOperation OperationName = "uninstall" EnableOperation OperationName = "enable" UpdateOperation OperationName = "update" DisableOperation OperationName = "disable" ResetStateOperation OperationName = "resetstate" )
func OperationNameFromString ¶
func OperationNameFromString(operation string) (OperationName, error)
func (OperationName) ToStatusName ¶
func (operationName OperationName) ToStatusName() string
func (OperationName) ToString ¶
func (operationName OperationName) ToString() string
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