azureSdkForGo

package
v0.0.0-...-4b07065 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2014 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

README

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

Documentation

Index

Constants

View Source
const (
	ParamNotSpecifiedError = "Parameter %s is not specified."
)

Variables

This section is empty.

Functions

func CheckStringParams

func CheckStringParams(url string) ([]byte, error)

func ExecuteCommand

func ExecuteCommand(command string, input []byte) ([]byte, error)

func GetPublishSettings

func GetPublishSettings() publishSettings

func ImportPublishSettings

func ImportPublishSettings(id string, certPath string) error

func ImportPublishSettingsFile

func ImportPublishSettingsFile(filePath string) error

func NewUUID

func NewUUID() (string, error)

NewUUID generates a random UUID according to RFC 4122

func SendAzureDeleteRequest

func SendAzureDeleteRequest(url string) (string, error)

func SendAzureGetRequest

func SendAzureGetRequest(url string) ([]byte, error)

func SendAzurePostRequest

func SendAzurePostRequest(url string, data []byte) (string, error)

func SendAzureRequest

func SendAzureRequest(url string, requestType string, data []byte) (*http.Response, error)

func WaitAsyncOperation

func WaitAsyncOperation(operationId string) error

Types

type AzureError

type AzureError struct {
	XMLName xml.Name `xml:"Error"`
	Code    string
	Message string
}

func (*AzureError) Error

func (e *AzureError) Error() string

type Operation

type Operation struct {
	XMLName        xml.Name `xml:"Operation"`
	ID             string
	Status         string
	HttpStatusCode string
	Error          AzureError
}

func GetOperationStatus

func GetOperationStatus(operationId string) (*Operation, error)

Directories

Path Synopsis
clients
core
http
Package http provides HTTP client and server implementations.
Package http provides HTTP client and server implementations.
http/cgi
Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.
Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.
http/cookiejar
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
http/fcgi
Package fcgi implements the FastCGI protocol.
Package fcgi implements the FastCGI protocol.
http/httptest
Package httptest provides utilities for HTTP testing.
Package httptest provides utilities for HTTP testing.
http/httputil
Package httputil provides HTTP utility functions, complementing the more common ones in the net/http package.
Package httputil provides HTTP utility functions, complementing the more common ones in the net/http package.
http/pprof
Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
tls
Package tls partially implements TLS 1.2, as specified in RFC 5246.
Package tls partially implements TLS 1.2, as specified in RFC 5246.

Jump to

Keyboard shortcuts

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