Documentation ¶
Overview ¶
Package vmutils provides convenience methods for creating Virtual Machine Role configurations.
Example ¶
dnsName := "test-vm-from-go" storageAccount := "mystorageaccount" location := "West US" vmSize := "Small" vmImage := "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140724-en-us-30GB" userName := "testuser" userPassword := "Test123" client, err := management.ClientFromPublishSettingsFile("path/to/downloaded.publishsettings", "") if err != nil { panic(err) } // create hosted service if err := hostedservice.NewClient(client).CreateHostedService(hostedservice.CreateHostedServiceParameters{ ServiceName: dnsName, Location: location, Label: base64.StdEncoding.EncodeToString([]byte(dnsName))}); err != nil { panic(err) } // create virtual machine role := NewVMConfiguration(dnsName, vmSize) ConfigureDeploymentFromPlatformImage( &role, vmImage, fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", storageAccount, dnsName), "") ConfigureForLinux(&role, dnsName, userName, userPassword) ConfigureWithPublicSSH(&role) operationID, err := virtualmachine.NewClient(client). CreateDeployment(role, dnsName, virtualmachine.CreateDeploymentOptions{}) if err != nil { panic(err) } err = client.WaitForOperation(operationID, nil) if err != nil { panic(err) }
Output:
Index ¶
- func AddAzureDockerVMExtensionConfiguration(role *vm.Role, dockerPort int, version string) error
- func AddAzureVMExtensionConfiguration(role *vm.Role, name, publisher, version, referenceName, state string, ...) error
- func ConfigureDeploymentFromExistingOSDisk(role *vm.Role, osDiskName, label string) error
- func ConfigureDeploymentFromPlatformImage(role *vm.Role, imageName string, mediaLink string, label string) error
- func ConfigureDeploymentFromPublishedVMImage(role *vm.Role, vmImageName string, mediaLocation string, ...) error
- func ConfigureDeploymentFromRemoteImage(role *vm.Role, remoteImageSourceURL string, os string, newDiskName string, ...) error
- func ConfigureDeploymentFromUserVMImage(role *vm.Role, vmImageName string) error
- func ConfigureForLinux(role *vm.Role, hostname, user, password string, ...) error
- func ConfigureForWindows(role *vm.Role, hostname, user, password string, enableAutomaticUpdates bool, ...) error
- func ConfigureWinRMListener(role *vm.Role, protocol vm.WinRMProtocol, certificateThumbprint string) error
- func ConfigureWinRMOverHTTP(role *vm.Role) error
- func ConfigureWinRMOverHTTPS(role *vm.Role, certificateThumbprint string) error
- func ConfigureWindowsToJoinDomain(role *vm.Role, username, password, domainToJoin, machineOU string) error
- func ConfigureWithExistingDataDisk(role *vm.Role, diskName string, cachingType vmdisk.HostCachingType) error
- func ConfigureWithExternalPort(role *vm.Role, name string, localport, externalport int, ...) error
- func ConfigureWithNewDataDisk(role *vm.Role, label, destinationVhdStorageURL string, sizeInGB int, ...) error
- func ConfigureWithPublicPowerShell(role *vm.Role) error
- func ConfigureWithPublicRDP(role *vm.Role) error
- func ConfigureWithPublicSSH(role *vm.Role) error
- func ConfigureWithSecurityGroup(role *vm.Role, networkSecurityGroup string) error
- func ConfigureWithSubnet(role *vm.Role, subnet string) error
- func ConfigureWithVhdDataDisk(role *vm.Role, sourceVhdStorageURL string, cachingType vmdisk.HostCachingType) error
- func IsRoleSizeAvailableInLocation(managementclient management.Client, location, roleSizeName string) (bool, error)
- func IsRoleSizeValid(vmclient vm.VirtualMachineClient, roleSizeName string) (bool, error)
- func NewVMConfiguration(name string, roleSize string) vm.Role
- func WaitForDeploymentInstanceStatus(client management.Client, cloudServiceName, deploymentName string, ...) error
- func WaitForDeploymentPowerState(client management.Client, cloudServiceName, deploymentName string, ...) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAzureDockerVMExtensionConfiguration ¶
AddAzureDockerVMExtensionConfiguration adds the DockerExtension to the role configuratioon and opens a port "dockerPort" TODO(ahmetalpbalkan) Deprecate this and move to 'docker-machine' codebase.
func ConfigureDeploymentFromExistingOSDisk ¶
ConfigureDeploymentFromExistingOSDisk configures VM Role to deploy from an existing disk. 'label' is optional.
func ConfigureDeploymentFromPlatformImage ¶
func ConfigureDeploymentFromPlatformImage( role *vm.Role, imageName string, mediaLink string, label string) error
ConfigureDeploymentFromPlatformImage configures VM Role to deploy from a platform image. See osimage package for methods to retrieve a list of the available platform images. "label" is optional.
func ConfigureDeploymentFromPublishedVMImage ¶
func ConfigureDeploymentFromPublishedVMImage( role *vm.Role, vmImageName string, mediaLocation string, provisionGuestAgent bool) error
ConfigureDeploymentFromPublishedVMImage configures VM Role to deploy from a published (public) VM image.
func ConfigureDeploymentFromRemoteImage ¶
func ConfigureDeploymentFromRemoteImage( role *vm.Role, remoteImageSourceURL string, os string, newDiskName string, destinationVhdStorageURL string, label string) error
ConfigureDeploymentFromRemoteImage configures VM Role to deploy from a remote image source. "remoteImageSourceURL" can be any publically accessible URL to a VHD file, including but not limited to a SAS Azure Storage blob url. "os" needs to be either "Linux" or "Windows". "label" is optional.
func ConfigureDeploymentFromUserVMImage ¶
ConfigureDeploymentFromUserVMImage configures VM Role to deploy from a previously captured (user generated) VM image.
func ConfigureForLinux ¶
func ConfigureForLinux(role *vm.Role, hostname, user, password string, sshPubkeyCertificateThumbprint ...string) error
ConfigureForLinux adds configuration for when deploying a generalized Linux image. If "password" is left empty, SSH password security will be disabled by default. Certificates with SSH public keys should already be uploaded to the cloud service where the VM will be deployed and referenced here only by their thumbprint.
func ConfigureForWindows ¶
func ConfigureForWindows(role *vm.Role, hostname, user, password string, enableAutomaticUpdates bool, timeZone string) error
ConfigureForWindows adds configuration for when deploying a generalized Windows image. timeZone can be left empty. For a complete list of supported time zone entries, you can either refer to the values listed in the registry entry "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones" or you can use the tzutil command-line tool to list the valid time.
func ConfigureWinRMListener ¶
func ConfigureWinRMOverHTTP ¶
func ConfigureWinRMOverHTTPS ¶
func ConfigureWindowsToJoinDomain ¶
func ConfigureWindowsToJoinDomain(role *vm.Role, username, password, domainToJoin, machineOU string) error
ConfigureWindowsToJoinDomain adds configuration to join a new Windows vm to a domain. "username" must be in UPN form (user@domain.com), "machineOU" can be left empty
func ConfigureWithExistingDataDisk ¶
func ConfigureWithExistingDataDisk(role *vm.Role, diskName string, cachingType vmdisk.HostCachingType) error
ConfigureWithExistingDataDisk adds configuration for an existing data disk
func ConfigureWithExternalPort ¶
func ConfigureWithExternalPort(role *vm.Role, name string, localport, externalport int, protocol vm.InputEndpointProtocol) error
ConfigureWithExternalPort adds a new InputEndpoint to the Role, exposing a port externally
func ConfigureWithNewDataDisk ¶
func ConfigureWithNewDataDisk(role *vm.Role, label, destinationVhdStorageURL string, sizeInGB int, cachingType vmdisk.HostCachingType) error
ConfigureWithNewDataDisk adds configuration for a new (empty) data disk
func ConfigureWithPublicPowerShell ¶
ConfigureWithPublicPowerShell adds configuration exposing port 5986 externally
func ConfigureWithPublicRDP ¶
ConfigureWithPublicRDP adds configuration exposing port 3389 externally
func ConfigureWithPublicSSH ¶
ConfigureWithPublicSSH adds configuration exposing port 22 externally
func ConfigureWithSecurityGroup ¶
ConfigureWithSecurityGroup associates the Role with a specific network security group
func ConfigureWithSubnet ¶
ConfigureWithSubnet associates the Role with a specific subnet
func ConfigureWithVhdDataDisk ¶
func ConfigureWithVhdDataDisk(role *vm.Role, sourceVhdStorageURL string, cachingType vmdisk.HostCachingType) error
ConfigureWithVhdDataDisk adds configuration for adding a vhd in a storage account as a data disk
func IsRoleSizeAvailableInLocation ¶
func IsRoleSizeAvailableInLocation(managementclient management.Client, location, roleSizeName string) (bool, error)
IsRoleSizeAvailableInLocation retrieves all available sizes in the specified location and returns whether that the provided roleSizeName is part of that list.
func IsRoleSizeValid ¶
func IsRoleSizeValid(vmclient vm.VirtualMachineClient, roleSizeName string) (bool, error)
IsRoleSizeValid retrieves the available rolesizes using vmclient.GetRoleSizeList() and returns whether that the provided roleSizeName is part of that list
func NewVMConfiguration ¶
NewVMConfiguration creates configuration for a new virtual machine Role.
func WaitForDeploymentInstanceStatus ¶
func WaitForDeploymentInstanceStatus(client management.Client, cloudServiceName, deploymentName string, desiredInstanceStatus vm.InstanceStatus) error
WaitForDeploymentInstanceStatus blocks until all role instances in deployment reach desired InstanceStatus.
func WaitForDeploymentPowerState ¶
func WaitForDeploymentPowerState(client management.Client, cloudServiceName, deploymentName string, desiredPowerstate vm.PowerState) error
WaitForDeploymentPowerState blocks until all role instances in deployment reach desired power state.
Types ¶
This section is empty.