azure-sdk-for-go

module
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2015 License: Apache-2.0

README

Microsoft Azure SDK for Go

This project provides various Go packages to perform operations on Microsoft Azure REST APIs.

GoDoc Build Status

See list of implemented API clients here.

NOTE: This repository is under heavy ongoing development and is likely to break over time. We currently do not have any releases yet. If you are planning to use the repository, please consider vendoring the packages in your project and update them when a stable tag is out.

Installation

go get -d github.com/Azure/azure-sdk-for-go/management

Usage

Read Godoc of the repository at: http://godoc.org/github.com/Azure/azure-sdk-for-go/

The client currently supports authentication to the Service Management API with certificates or Azure .publishSettings file. You can download the .publishSettings file for your subscriptions here.

Example: Creating a Linux Virtual Machine
package main

import (
	"encoding/base64"
	"fmt"

	"github.com/Azure/azure-sdk-for-go/management"
	"github.com/Azure/azure-sdk-for-go/management/hostedservice"
	"github.com/Azure/azure-sdk-for-go/management/virtualmachine"
	"github.com/Azure/azure-sdk-for-go/management/vmutils"
)

func main() {
	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 := vmutils.NewVMConfiguration(dnsName, vmSize)
	vmutils.ConfigureDeploymentFromPlatformImage(
		&role,
		vmImage,
		fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", storageAccount, dnsName),
		"")
	vmutils.ConfigureForLinux(&role, dnsName, userName, userPassword)
	vmutils.ConfigureWithPublicSSH(&role)

	operationID, err := virtualmachine.NewClient(client).
		CreateDeployment(role, dnsName, virtualmachine.CreateDeploymentOptions{})
	if err != nil {
		panic(err)
	}
	if err := client.WaitForOperation(operationID, nil); err != nil {
		panic(err)
	}
}

License

This project is published under Apache 2.0 License.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/Azure/go-autorest/autorest
Package autorest implements an HTTP request pipeline suitable for use across multiple go-routines and provides the shared routines relied on by AutoRest (see https://github.com/Azure/autorest/) generated Go code.
Package autorest implements an HTTP request pipeline suitable for use across multiple go-routines and provides the shared routines relied on by AutoRest (see https://github.com/Azure/autorest/) generated Go code.
_workspace/src/github.com/Azure/go-autorest/autorest/azure
Package azure provides Azure-specific implementations used with AutoRest.
Package azure provides Azure-specific implementations used with AutoRest.
_workspace/src/github.com/Azure/go-autorest/autorest/date
Package date provides time.Time derivatives that conform to the Swagger.io (https://swagger.io/) defined date formats: Date and DateTime.
Package date provides time.Time derivatives that conform to the Swagger.io (https://swagger.io/) defined date formats: Date and DateTime.
_workspace/src/github.com/Azure/go-autorest/autorest/mocks
Package mocks provides mocks and helpers used in testing.
Package mocks provides mocks and helpers used in testing.
_workspace/src/github.com/Azure/go-autorest/autorest/to
Package to provides helpers to ease working with pointer values of marshalled structures.
Package to provides helpers to ease working with pointer values of marshalled structures.
_workspace/src/golang.org/x/crypto/pkcs12
Package pkcs12 implements some of PKCS#12.
Package pkcs12 implements some of PKCS#12.
_workspace/src/golang.org/x/crypto/pkcs12/internal/rc2
Package rc2 implements the RC2 cipher https://www.ietf.org/rfc/rfc2268.txt http://people.csail.mit.edu/rivest/pubs/KRRR98.pdf This code is licensed under the MIT license.
Package rc2 implements the RC2 cipher https://www.ietf.org/rfc/rfc2268.txt http://people.csail.mit.edu/rivest/pubs/KRRR98.pdf This code is licensed under the MIT license.
_workspace/src/gopkg.in/check.v1
Package check is a rich testing extension for Go's testing package.
Package check is a rich testing extension for Go's testing package.
arm
dns
web
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.
Package management provides the main API client to construct other clients and make requests to the Microsoft Azure Service Management REST API.
Package management provides the main API client to construct other clients and make requests to the Microsoft Azure Service Management REST API.
hostedservice
Package hostedservice provides a client for Hosted Services.
Package hostedservice provides a client for Hosted Services.
location
Package location provides a client for Locations.
Package location provides a client for Locations.
networksecuritygroup
Package networksecuritygroup provides a client for Network Security Groups.
Package networksecuritygroup provides a client for Network Security Groups.
osimage
Package osimage provides a client for Operating System Images.
Package osimage provides a client for Operating System Images.
sql
storageservice
Package storageservice provides a client for Storage Services.
Package storageservice provides a client for Storage Services.
testutils
Package testutils contains some test utilities for the Azure SDK
Package testutils contains some test utilities for the Azure SDK
virtualmachine
Package virtualmachine provides a client for Virtual Machines.
Package virtualmachine provides a client for Virtual Machines.
virtualmachinedisk
Package virtualmachinedisk provides a client for Virtual Machine Disks.
Package virtualmachinedisk provides a client for Virtual Machine Disks.
virtualmachineimage
Package virtualmachineimage provides a client for Virtual Machine Images.
Package virtualmachineimage provides a client for Virtual Machine Images.
virtualnetwork
Package virtualnetwork provides a client for Virtual Networks.
Package virtualnetwork provides a client for Virtual Networks.
vmutils
Package vmutils provides convenience methods for creating Virtual Machine Role configurations.
Package vmutils provides convenience methods for creating Virtual Machine Role configurations.
Package storage provides clients for Microsoft Azure Storage Services.
Package storage provides clients for Microsoft Azure Storage Services.

Jump to

Keyboard shortcuts

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