azure

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	User            *User  `json:"user"`
	TenantID        string `json:"tenantId" envconfig:"TENANT_ID" required:"true"`
	SubscriptionID  string `json:"id" envconfig:"SUBSCRIPTION_ID" required:"true"`
	ResourceGroup   ResourceGroup
	Deployment      Deployment
	StorageAccount  *StorageAccount
	TimeoutCommands bool
}

Account represents an Azure account

func NewAccount

func NewAccount() (*Account, error)

NewAccount will parse env vars and return a new account struct

func (*Account) CreateDeployment

func (a *Account) CreateDeployment(name string, e *engine.Engine) error

CreateDeployment will deploy a cluster to a given resource group using the template and parameters on disk

func (*Account) CreateGroup

func (a *Account) CreateGroup(name, location string) error

CreateGroup will create a resource group in a given location --tags "type=${RESOURCE_GROUP_TAG_TYPE:-}" "now=$(date +%s)" "job=${JOB_BASE_NAME:-}" "buildno=${BUILD_NUM:-}"

func (*Account) CreateSubnet

func (a *Account) CreateSubnet(vnet, subnetName, subnetPrefix string) error

CreateSubnet will create a subnet in a vnet in a resource group

func (*Account) CreateVnet

func (a *Account) CreateVnet(vnet, addressPrefixes string) error

CreateVnet will create a vnet in a resource group

func (*Account) DeleteGroup

func (a *Account) DeleteGroup(name string, wait bool) error

DeleteGroup deletes a given resource group by name

func (*Account) FetchActivityLog

func (a *Account) FetchActivityLog(rg string) (string, error)

FetchActivityLog gets all the failures from the activity log for the provided resource group.

func (*Account) GetHosts

func (a *Account) GetHosts(name string) ([]VM, error)

GetHosts will get a list of vms in the resource group

func (*Account) IsClusterExpired

func (a *Account) IsClusterExpired(d time.Duration) bool

IsClusterExpired will return true if a deployment was created more than t nanoseconds ago, or if timestamp is not found

func (*Account) Login

func (a *Account) Login() error

Login will login to a given subscription

func (*Account) SetResourceGroup

func (a *Account) SetResourceGroup(name string) error

SetResourceGroup will set the account resource group

func (*Account) SetSubscription

func (a *Account) SetSubscription() error

SetSubscription will call az account set --subscription for the given Account

func (*Account) UpdateRouteTables

func (a *Account) UpdateRouteTables(subnet, vnet string) error

UpdateRouteTables is used to updated a vnet with the appropriate route tables

type Deployment

type Deployment struct {
	Name              string // Name of the deployment
	TemplateDirectory string // engine.GeneratedDefinitionPath
}

Deployment represents a deployment of an acs cluster

type ResourceGroup

type ResourceGroup struct {
	Name     string            `json:"name"`
	Location string            `json:"location"`
	Tags     map[string]string `json:"tags"`
}

ResourceGroup represents a collection of azure resources

type RouteTable

type RouteTable struct {
	ID                string `json:"id"`
	Location          string `json:"location"`
	Name              string `json:"name"`
	ProvisioningState string `json:"provisioningState"`
	ResourceGroup     string `json:"resourceGroup"`
}

RouteTable holds information from running az network route-table list

type Storage

type Storage interface {
	CreateStorageAccount() error
	SetConnectionString() error
	CreateFileShare(name string) error
	UploadFiles(source, destination string) error
	DownloadFiles(source, destination string) error
	DeleteFiles(source string) error
}

Storage provides access to StorageAccount objects

type StorageAccount

type StorageAccount struct {
	Name             string
	ConnectionString string `json:"connectionString"`
	ResourceGroup    ResourceGroup
	TimeoutCommands  bool
}

StorageAccount represents an azure storage account

func (*StorageAccount) CreateFileShare

func (sa *StorageAccount) CreateFileShare(name string) error

CreateFileShare will create a file share in a storage account if it doesn't already exist

func (*StorageAccount) CreateStorageAccount

func (sa *StorageAccount) CreateStorageAccount() error

CreateStorageAccount will create a new Azure Storage Account

func (*StorageAccount) DeleteFiles

func (sa *StorageAccount) DeleteFiles(source string) error

DeleteFiles deletes files from an Azure storage file share

func (*StorageAccount) DownloadFiles

func (sa *StorageAccount) DownloadFiles(source, destination string) error

DownloadFiles will download the output directory from storage

func (*StorageAccount) SetConnectionString

func (sa *StorageAccount) SetConnectionString() error

SetConnectionString will set the storage account connection string

func (*StorageAccount) UploadFiles

func (sa *StorageAccount) UploadFiles(source, destination string) error

UploadFiles will upload the output directory to storage

type User

type User struct {
	ID     string `json:"name" envconfig:"CLIENT_ID" required:"true"`
	Secret string `envconfig:"CLIENT_SECRET" required:"true"`
	Type   string `json:"type"`
}

User represents the user currently logged into an Account

type VM

type VM struct {
	Name string `json:"name"`
}

VM represents an azure vm

Jump to

Keyboard shortcuts

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