docs/vendor/github.com/MSOpenTech/azure-sdk-for-go
Olivier Gambier c9117af080 Move to vendor
As we walk away from 1.4, godep no longer requires to have stuff into workspace and we no longer need the symlink.

Signed-off-by: Olivier Gambier <olivier@docker.com>
2015-11-03 21:14:39 -08:00
..
clients Move to vendor 2015-11-03 21:14:39 -08:00
core Move to vendor 2015-11-03 21:14:39 -08:00
LICENSE-2.0.txt Move to vendor 2015-11-03 21:14:39 -08:00
README.md Move to vendor 2015-11-03 21:14:39 -08:00
common.go Move to vendor 2015-11-03 21:14:39 -08:00
publishSettings.go Move to vendor 2015-11-03 21:14:39 -08:00

README.md

Azure SDK for Golang

This project provides a Golang package that makes it easy to consume and manage Microsoft Azure Services.

Installation

go get github.com/MSOpenTech/azure-sdk-for-go
  • Install:
go install github.com/MSOpenTech/azure-sdk-for-go

Usage

Create linux VM:

package main

import (
    "fmt"
    "os"
    
    azure "github.com/MSOpenTech/azure-sdk-for-go"
    "github.com/MSOpenTech/azure-sdk-for-go/clients/vmClient"
)

func main() {
    dnsName := "test-vm-from-go"
    location := "West US"
    vmSize := "Small"
    vmImage := "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140724-en-us-30GB"
    userName := "testuser"
    userPassword := "Test123"
    sshCert := ""
    sshPort := 22
    
    err := azure.ImportPublishSettings(SUBSCRIPTION_ID, SUBSCRIPTION_CERTIFICATE)
    if err != nil {
    	fmt.Println(err)
    	os.Exit(1)
    }
    
    vmConfig, err := vmClient.CreateAzureVMConfiguration(dnsName, vmSize, vmImage, location)
    if err != nil {
    	fmt.Println(err)
    	os.Exit(1)
    }
    
    vmConfig, err = vmClient.AddAzureLinuxProvisioningConfig(vmConfig, userName, userPassword, sshCert, sshPort)
    if err != nil {
    	fmt.Println(err)
    	os.Exit(1)
    }
    
    err = vmClient.CreateAzureVM(vmConfig, dnsName, location)
    if err != nil {
    	fmt.Println(err)
    	os.Exit(1)
    }
}

License

Apache 2.0