api

package
v0.0.0-...-891de71 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultGeneratorCode specifies the source generator of the cluster template.
	DefaultGeneratorCode = "acc-vm-engine"
	// DefaultVnet specifies default vnet address space
	DefaultVnet = "10.1.16.0/24"
	// DefaultSubnet specifies default subnet
	DefaultSubnet = "10.1.16.0/24"
)
View Source
const (
	Linux   OSType = "Linux"
	Windows OSType = "Windows"

	Ubuntu1804                   OSName = "Ubuntu18.04"
	Ubuntu2004                   OSName = "Ubuntu20.04"
	Windows10                    OSName = "Windows10"
	WindowsServer2016            OSName = "WindowsServer2016"
	WindowsServer2019            OSName = "WindowsServer2019"
	Windows10SecuredCore         OSName = "Windows10-SecuredCore"
	WindowsServer2016SecuredCore OSName = "WindowsServer2016-SecuredCore"
	WindowsServer2019SecuredCore OSName = "WindowsServer2019-SecuredCore"
)

Variables

This section is empty.

Functions

func GetOsDiskTypes

func GetOsDiskTypes(vmconf VMConfigurator) string

GetOsDiskTypes returns allowed and default OS disk types

func GetVMSizes

func GetVMSizes(vmconf VMConfigurator) string

GetVMSizes returns allowed and default sizes for VM

Types

type APIModel

type APIModel struct {
	VMCategory VMCategory  `json:"vm_category"`
	Properties *Properties `json:"properties,omitempty"`

	VMConfigurator VMConfigurator
}

APIModel complies with the ARM model of resource definition in a JSON template.

type Apiloader

type Apiloader struct {
}

Apiloader represents the object that loads api model

func (*Apiloader) LoadVM

func (a *Apiloader) LoadVM(contents []byte, validate, isUpdate bool, sshPubKeys []string) (*APIModel, error)

LoadVM loads and validates an API Model

func (*Apiloader) LoadVMFromFile

func (a *Apiloader) LoadVMFromFile(jsonFile string, validate, isUpdate bool, sshPubKeys []string) (*APIModel, error)

LoadVMFromFile loads an API Model from a JSON file

func (*Apiloader) SerializeVM

func (a *Apiloader) SerializeVM(vm *APIModel) ([]byte, error)

SerializeVM takes an unversioned container service and returns the bytes

type DiagnosticsProfile

type DiagnosticsProfile struct {
	Enabled             bool   `json:"true"`
	StorageAccountName  string `json:"storageAccountName"`
	IsNewStorageAccount bool   `json:"isNewStorageAccount"`
}

DiagnosticsProfile contains settings to on/off boot diagnostics collection in RD Host

type LinuxProfile

type LinuxProfile struct {
	AuthenticationType string       `json:"authentication_type" validate:"required"`
	AdminUsername      string       `json:"admin_username" validate:"required"`
	AdminPasswordOrKey string       `json:"admin_password_or_key"`
	SSHPubKeys         []*PublicKey `json:"ssh_public_keys"`
}

LinuxProfile represents the linux parameters passed to the cluster

type OSImage

type OSImage struct {
	URL       string `json:"url,omitempty"`
	Publisher string `json:"publisher"`
	Offer     string `json:"offer"`
	SKU       string `json:"sku"`
	Version   string `json:"version,omitempty"`
}

OSImage represents OS Image from Azure Image Gallery

type OSImageName

type OSImageName string

OSImageName represents pre-set OS image name

type OSName

type OSName string

OSName represents pre-set OS name

type OSType

type OSType string

OSType represents OS type

type Properties

type Properties struct {
	VnetProfile        *VnetProfile        `json:"vnet_rofile"`
	VMProfile          *VMProfile          `json:"vm_profile"`
	LinuxProfile       *LinuxProfile       `json:"linux_profile,omitempty"`
	WindowsProfile     *WindowsProfile     `json:"windows_profile,omitempty"`
	DiagnosticsProfile *DiagnosticsProfile `json:"diagnostics_profile,omitempty"`
}

Properties represents the ACS cluster definition

func (*Properties) Validate

func (p *Properties) Validate(vmconf VMConfigurator, isUpdate bool) error

Validate implements APIObject

type PublicKey

type PublicKey struct {
	KeyData string `json:"key_data"`
}

PublicKey contains puvlic SSH key

type SecurityProfile

type SecurityProfile struct {
	SecureBoot string `json:"secure_boot_enabled,omitempty"`
	VTPM       string `json:"vtpm_enabled,omitempty"`
}

SecurityProfile represents VM security profile

type SecurityType

type SecurityType string

OSImageName represents pre-set OS image name

type VMCategory

type VMCategory string

VMCategory represents VM category

const (
	// TVM VM category
	TVM VMCategory = "TVM"
	// CVM VM category
	CVM VMCategory = "CVM"
)

type VMConfigurator

type VMConfigurator interface {
	DefaultVMName() string
	OSImage() *OSImage
	OSImageName() string
	SecurityType() string
	DefaultOsDiskType() string
	AllowedOsDiskTypes() []string
	AllowedVMSizes() []string
	DefaultVMSize() string
}

VMConfigurator manages VM specific configuration

func NewCVMConfigurator

func NewCVMConfigurator() (VMConfigurator, error)

NewCVMConfigurator returns VMConfigurator for CVM

func NewTVMConfigurator

func NewTVMConfigurator(osName OSName) (VMConfigurator, error)

NewTVMConfigurator creates VMConfigurator for TVM

type VMProfile

type VMProfile struct {
	Name             string           `json:"name"`
	OSImageName      OSImageName      `json:"os_image_name,omitempty"`
	OSName           OSName           `json:"os_name,omitempty"`
	OSDiskType       string           `json:"os_disk_type"`
	OSImage          *OSImage         `json:"os_image,omitempty"`
	DiskSizesGB      []int            `json:"disk_sizes_gb,omitempty"`
	VMSize           string           `json:"vm_size"`
	Ports            []int            `json:"ports,omitempty" validate:"dive,min=1,max=65535"`
	HasDNSName       bool             `json:"has_dns_name"`
	SecurityProfile  *SecurityProfile `json:"security_profile,omitempty"`
	SecurityType     SecurityType     `json:"security_type,omitempty"`
	TipNodeSessionID string           `json:"tip_node_session_id,omitempty"`
	ClusterName      string           `json:"cluster_name,omitempty"`
}

VMProfile represents the definition of a VM

func (*VMProfile) HasAzureGalleryImage

func (h *VMProfile) HasAzureGalleryImage() bool

HasAzureGalleryImage returns true if Azure Image Gallery is used

func (*VMProfile) HasCustomOsImage

func (h *VMProfile) HasCustomOsImage() bool

HasCustomOsImage returns true if there is a custom OS image url specified

func (*VMProfile) HasDisks

func (h *VMProfile) HasDisks() bool

HasDisks returns true if the customer specified disks

type VnetProfile

type VnetProfile struct {
	VnetResourceGroup  string `json:"vnetResourceGroup,omitempty"`
	VirtualNetworkName string `json:"virtualNetworkName,omitempty"`
	VnetAddress        string `json:"vnetAddress,omitempty"`
	SubnetName         string `json:"subnetName,omitempty"`
	SubnetAddress      string `json:"subnetAddress,omitempty"`
}

VnetProfile represents the definition of a vnet

func (*VnetProfile) IsCustomVNET

func (p *VnetProfile) IsCustomVNET() bool

IsCustomVNET returns true if the customer brought their own VNET

type WindowsProfile

type WindowsProfile struct {
	AdminUsername      string `json:"admin_username" validate:"required"`
	AdminPasswordOrKey string `json:"admin_password_or_key" validate:"required"`
}

WindowsProfile represents the windows parameters passed to the cluster

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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