azure

package
v0.0.0-...-6054725 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const ProviderName = "azure"

ProviderName of the cloud platform provider

Variables

This section is empty.

Functions

This section is empty.

Types

type Azure

type Azure struct {
	Storage *Storage
	// contains filtered or unexported fields
}

Azure Provider to interact with Azure cloud infrastructure

func NewProvider

func NewProvider() *Azure

NewProvider Azure

func (*Azure) AttachVolume

func (a *Azure) AttachVolume(ctx *lepton.Context, image, name string, attachID int) error

AttachVolume attaches a volume to an instance

func (*Azure) BuildImage

func (a *Azure) BuildImage(ctx *lepton.Context) (string, error)

BuildImage to be upload on Azure

func (*Azure) BuildImageWithPackage

func (a *Azure) BuildImageWithPackage(ctx *lepton.Context, pkgpath string) (string, error)

BuildImageWithPackage to upload on Azure

func (*Azure) CreateImage

func (a *Azure) CreateImage(ctx *lepton.Context, imagePath string) error

CreateImage - Creates image on Azure using nanos images

func (*Azure) CreateInstance

func (a *Azure) CreateInstance(ctx *lepton.Context) error

CreateInstance - Creates instance on azure Platform

func (*Azure) CreateNIC

func (a *Azure) CreateNIC(ctx context.Context, location string, vnetName, subnetName, nsgName, ipName, ipv6Name, nicName string, enableIPForwarding bool, c *types.Config) (nic network.Interface, err error)

CreateNIC creates a new network interface. The Network Security Group is not a required parameter

func (*Azure) CreateNetworkSecurityGroup

func (a *Azure) CreateNetworkSecurityGroup(ctx context.Context, location string, nsgName string, c *types.Config) (nsg *network.SecurityGroup, err error)

CreateNetworkSecurityGroup creates a new network security group with rules set for allowing SSH and HTTPS use

func (*Azure) CreatePublicIP

func (a *Azure) CreatePublicIP(ctx context.Context, location string, ipName string, ipv6 bool) (ip network.PublicIPAddress, err error)

CreatePublicIP creates a new public IP

func (*Azure) CreateSimpleNetworkSecurityGroup

func (a *Azure) CreateSimpleNetworkSecurityGroup(ctx context.Context, location string, nsgName string) (nsg network.SecurityGroup, err error)

CreateSimpleNetworkSecurityGroup creates a new network security group, without rules (rules can be set later)

func (*Azure) CreateSubnetWithNetworkSecurityGroup

func (a *Azure) CreateSubnetWithNetworkSecurityGroup(ctx context.Context, vnetName, subnetName, addressPrefix, nsgName string, c *types.Config) (subnet *network.Subnet, err error)

CreateSubnetWithNetworkSecurityGroup create a subnet referencing a network security group

func (*Azure) CreateVirtualNetwork

func (a *Azure) CreateVirtualNetwork(ctx context.Context, location string, vnetName string, c *types.Config) (vnet *network.VirtualNetwork, err error)

CreateVirtualNetwork creates a virtual network

func (*Azure) CreateVirtualNetworkAndSubnets

func (a *Azure) CreateVirtualNetworkAndSubnets(ctx context.Context, location string, vnetName, subnet1Name, subnet2Name string) (vnet *network.VirtualNetwork, err error)

CreateVirtualNetworkAndSubnets creates a virtual network with two subnets

func (*Azure) CreateVirtualNetworkSubnet

func (a *Azure) CreateVirtualNetworkSubnet(ctx context.Context, vnetName, subnetName string) (subnet *network.Subnet, err error)

CreateVirtualNetworkSubnet creates a subnet in an existing vnet

func (*Azure) CreateVolume

func (a *Azure) CreateVolume(ctx *lepton.Context, name, data, provider string) (lepton.NanosVolume, error)

CreateVolume uploads the volume raw file and creates a disk from it

func (*Azure) CreateZoneRecord

func (a *Azure) CreateZoneRecord(config *types.Config, zoneID string, record *lepton.DNSRecord) error

CreateZoneRecord creates a record in a DNS zone

func (*Azure) CustomizeImage

func (a *Azure) CustomizeImage(ctx *lepton.Context) (string, error)

CustomizeImage returns image path with adaptations needed by cloud provider

func (*Azure) DeleteIP

func (a *Azure) DeleteIP(ctx *lepton.Context, ipConfiguration *network.InterfaceIPConfiguration) error

DeleteIP deletes a ip configuration and tries deleting subnetwork associated

func (*Azure) DeleteImage

func (a *Azure) DeleteImage(ctx *lepton.Context, imagename string) error

DeleteImage deletes image from Azure

func (*Azure) DeleteInstance

func (a *Azure) DeleteInstance(ctx *lepton.Context, instancename string) error

DeleteInstance deletes instance from Azure

func (*Azure) DeleteNIC

func (a *Azure) DeleteNIC(ctx *lepton.Context, nic *network.Interface) error

DeleteNIC deletes network interface controller

func (*Azure) DeleteNetworkSecurityGroup

func (a *Azure) DeleteNetworkSecurityGroup(ctx *lepton.Context, securityGroupID string) error

DeleteNetworkSecurityGroup deletes the security group

func (*Azure) DeleteSubnetwork

func (a *Azure) DeleteSubnetwork(ctx *lepton.Context, subnetID string) error

DeleteSubnetwork deletes subnetwork if there is no other device using it Also deletes virtual network if the deleted subnetwork was the only one associated under it

func (*Azure) DeleteVolume

func (a *Azure) DeleteVolume(ctx *lepton.Context, name string) error

DeleteVolume deletes an existing volume

func (*Azure) DeleteZoneRecordIfExists

func (a *Azure) DeleteZoneRecordIfExists(config *types.Config, zoneID string, recordName string) error

DeleteZoneRecordIfExists deletes a record from a DNS zone if it exists

func (*Azure) DetachVolume

func (a *Azure) DetachVolume(ctx *lepton.Context, image, name string) error

DetachVolume detachs a volume from an instance

func (*Azure) Environment

func (a *Azure) Environment() *azure.Environment

Environment returns an `azure.Environment{...}` for the current cloud.

func (*Azure) FindOrCreateZoneIDByName

func (a *Azure) FindOrCreateZoneIDByName(config *types.Config, dnsName string) (string, error)

FindOrCreateZoneIDByName searches for a DNS zone with the name passed by argument and if it doesn't exist it creates one

func (*Azure) GetAllVolumes

func (a *Azure) GetAllVolumes(ctx *lepton.Context) (*[]lepton.NanosVolume, error)

GetAllVolumes returns all volumes in NanosVolume format

func (*Azure) GetImages

func (a *Azure) GetImages(ctx *lepton.Context) ([]lepton.CloudImage, error)

GetImages return all images for azure

func (*Azure) GetInstanceByName

func (a *Azure) GetInstanceByName(ctx *lepton.Context, name string) (vm *lepton.CloudInstance, err error)

GetInstanceByName returns instance with given name

func (*Azure) GetInstanceLogs

func (a *Azure) GetInstanceLogs(ctx *lepton.Context, instancename string) (string, error)

GetInstanceLogs gets instance related logs

func (*Azure) GetInstances

func (a *Azure) GetInstances(ctx *lepton.Context) (cinstances []lepton.CloudInstance, err error)

GetInstances return all instances on Azure

func (*Azure) GetNetworkSecurityGroup

func (a *Azure) GetNetworkSecurityGroup(ctx context.Context, nsgName string) (sg *network.SecurityGroup, err error)

GetNetworkSecurityGroup returns an existing network security group

func (*Azure) GetPublicIP

func (a *Azure) GetPublicIP(ctx context.Context, ipName string) (ip network.PublicIPAddress, err error)

GetPublicIP returns an existing public IP

func (*Azure) GetResourceManagementAuthorizer

func (a *Azure) GetResourceManagementAuthorizer() (autorest.Authorizer, error)

GetResourceManagementAuthorizer returns an autorest authorizer.

func (*Azure) GetStorage

func (a *Azure) GetStorage() lepton.Storage

GetStorage returns storage interface for cloud provider

func (*Azure) GetVM

func (a *Azure) GetVM(ctx context.Context, vmName string) (vm compute.VirtualMachine, err error)

GetVM gets the specified VM info

func (*Azure) GetVPC

func (a *Azure) GetVPC(vnetName string) (vnet *network.VirtualNetwork, err error)

GetVPC finds the virtual network by id

func (*Azure) GetVirtualNetworkSubnet

func (a *Azure) GetVirtualNetworkSubnet(ctx context.Context, vnetName string, subnetName string) (subnet *network.Subnet, err error)

GetVirtualNetworkSubnet returns an existing subnet from a virtual network

func (*Azure) Initialize

func (a *Azure) Initialize(config *types.ProviderConfig) error

Initialize Azure related things

func (*Azure) ListImages

func (a *Azure) ListImages(ctx *lepton.Context) error

ListImages lists images on azure

func (*Azure) ListInstances

func (a *Azure) ListInstances(ctx *lepton.Context) error

ListInstances lists instances on Azure

func (*Azure) PrintInstanceLogs

func (a *Azure) PrintInstanceLogs(ctx *lepton.Context, instancename string, watch bool) error

PrintInstanceLogs writes instance logs to console

func (*Azure) RebootInstance

func (a *Azure) RebootInstance(ctx *lepton.Context, instanceName string) error

RebootInstance reboots the instance. prob use the below?

func (*Azure) ResizeImage

func (a *Azure) ResizeImage(ctx *lepton.Context, imagename string, hbytes string) error

ResizeImage is not supported on azure.

func (*Azure) RestartVM

func (a *Azure) RestartVM(ctx context.Context, vmName string) (osr autorest.Response, err error)

RestartVM restarts the selected VM

func (*Azure) StartInstance

func (a *Azure) StartInstance(ctx *lepton.Context, instancename string) error

StartInstance starts an instance in Azure

func (*Azure) StopInstance

func (a *Azure) StopInstance(ctx *lepton.Context, instancename string) error

StopInstance deletes instance from Azure

func (*Azure) SyncImage

func (a *Azure) SyncImage(config *types.Config, target lepton.Provider, image string) error

SyncImage syncs image from provider to another provider

type Storage

type Storage struct{}

Storage provides Azure storage related operations

func (*Storage) CopyToBucket

func (az *Storage) CopyToBucket(config *types.Config, imgPath string) error

CopyToBucket copies archive to bucket

func (*Storage) DeleteFromBucket

func (az *Storage) DeleteFromBucket(config *types.Config, key string) error

DeleteFromBucket deletes key from config's bucket

Jump to

Keyboard shortcuts

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