README
¶
Azure SDK for Golang
This project provides a Golang package that makes it easy to consume and manage Microsoft Azure Services.
Installation
- Install Golang: https://golang.org/doc/install
- Get Azure SDK package:
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
Documentation
¶
Index ¶
- Constants
- func CheckStringParams(url string) ([]byte, error)
- func ExecuteCommand(command string, input []byte) ([]byte, error)
- func GetPublishSettings() publishSettings
- func ImportPublishSettings(id string, certPath string) error
- func ImportPublishSettingsFile(filePath string) error
- func NewUUID() (string, error)
- func SendAzureDeleteRequest(url string) (string, error)
- func SendAzureGetRequest(url string) ([]byte, error)
- func SendAzurePostRequest(url string, data []byte) (string, error)
- func SendAzureRequest(url string, requestType string, data []byte) (*http.Response, error)
- func WaitAsyncOperation(operationId string) error
- type AzureError
- type Operation
Constants ¶
View Source
const (
ParamNotSpecifiedError = "Parameter %s is not specified."
)
Variables ¶
This section is empty.
Functions ¶
func CheckStringParams ¶
func GetPublishSettings ¶
func GetPublishSettings() publishSettings
func ImportPublishSettings ¶
func SendAzureDeleteRequest ¶
func SendAzureGetRequest ¶
func SendAzureRequest ¶
func WaitAsyncOperation ¶
Types ¶
type AzureError ¶
func (*AzureError) Error ¶
func (e *AzureError) Error() string
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. |
Click to show internal directories.
Click to hide internal directories.