cloudyazure

package module
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 46 Imported by: 0

README

cloudy-azure

Azure implementation of cloudy providers, excluding MS Graph because that is a separate repe

Documentation

Index

Constants

View Source
const (
	CredTypeCli     = "cli"
	CredTypeDevCli  = "devcli"
	CredTypeSecret  = "secret"
	CredTypeCode    = "devicecode"
	CredTypeDefault = "default"
	CredTypeEnv     = "env"
	CredTypeBrowser = "browser"
	CredTypeManaged = "managed"
	CredTypeOther   = "other"
)
View Source
const (
	CloudPublic            = "public"
	CloudUSGovernment      = "usgovernment"
	CloudAzureUSGovernment = "azureusgovernment"
)
View Source
const AzureArmCompute = "azure-arm-compute"
View Source
const AzureCosmosDB = "azure-cosmosdb"

FACTORY --------------------------------

View Source
const AzureCredentialsKey = "azure"
View Source
const DefaultRegion = "usgovvirginia"
View Source
const KeyVaultCachedId = "azure-keyvault-cached"
View Source
const KeyVaultId = "azure-keyvault"
View Source
const (
	MIN_WINDOWS_OS_DISK_SIZE = 200
)

Variables

View Source
var AzureBlob = "azure-blob"
View Source
var AzureFiles = "azure-files"
View Source
var DefaultTransport policy.Transporter

Functions

func AzureGetRequiredEnv added in v0.0.3

func AzureGetRequiredEnv() []string

func ExtractResourceGroupFromID

func ExtractResourceGroupFromID(ctx context.Context, id string) string

func FromCloudyVirtualMachine added in v0.0.16

func FromCloudyVirtualMachine(ctx context.Context, cloudyVM *models.VirtualMachine) armcompute.VirtualMachine

func FromStrPointerMap

func FromStrPointerMap(pointerMap map[string]*string) map[string]string

func GenerateNextName added in v0.0.30

func GenerateNextName(suffixes []string, maxSequences int) (string, error)

func GetAzureClientSecretCredential

func GetAzureClientSecretCredential(azCfg AzureCredentials) (*azidentity.ClientSecretCredential, error)

func GetStorageAccountType

func GetStorageAccountType(ctx context.Context, env *cloudy.Environment, name string) (string, error)

func IsAvailable

func IsAvailable(restrictions []*armcompute.ResourceSKURestrictions) bool

func IsInLocation

func IsInLocation(region string, locations []*string) bool

func LoadEnvironment

func LoadEnvironment(ctx context.Context) (*cloudy.Environment, error)

func LongIdToShortId added in v0.0.25

func LongIdToShortId(longId string) string

func NewAzureCredentials added in v0.0.16

func NewAzureCredentials(azcred *AzureCredentials) (azcore.TokenCredential, error)

func NewAzureVirtualMachineManager added in v0.0.16

func NewAzureVirtualMachineManager(ctx context.Context, credentials *AzureCredentials, config *VirtualMachineManagerConfig) (cloudyvm.VirtualMachineManager, error)

func PolicyFromCloudString added in v0.0.30

func PolicyFromCloudString(cloudName string) cloud.Configuration

func SizeFromResource

func SizeFromResource(ctx context.Context, res *armcompute.ResourceSKU) *cloudyvm.VmSize

func ToCloudyVirtualMachine added in v0.0.16

func ToCloudyVirtualMachine(ctx context.Context, azVM *armcompute.VirtualMachine) *models.VirtualMachine

func ToCloudyVirtualMachineLocation added in v0.0.16

func ToCloudyVirtualMachineLocation(location *string) *models.VirtualMachineLocation

func ToCloudyVirtualMachineSize added in v0.0.16

func ToCloudyVirtualMachineSize(ctx context.Context, resource *armcompute.ResourceSKU) *models.VirtualMachineSize

func ToStrPointerMap

func ToStrPointerMap(stringMap map[string]string) map[string]*string

func UpdateCloudyVirtualMachine added in v0.0.16

func UpdateCloudyVirtualMachine(vm *models.VirtualMachine, responseVirtualMachine armcompute.VirtualMachine) error

func VMAddTag

func VMAddTag(ctx context.Context)

func VMGetPowerState

func VMGetPowerState(vm *armcompute.VirtualMachine) string

Types

type AzureBlobFileShareFactory

type AzureBlobFileShareFactory struct{}

func (*AzureBlobFileShareFactory) Create

func (f *AzureBlobFileShareFactory) Create(cfg interface{}) (storage.FileStorageManager, error)

func (*AzureBlobFileShareFactory) FromEnv

func (f *AzureBlobFileShareFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type AzureBlobStorageFactory

type AzureBlobStorageFactory struct{}

func (*AzureBlobStorageFactory) Create

func (f *AzureBlobStorageFactory) Create(cfg interface{}) (storage.ObjectStorageManager, error)

func (*AzureBlobStorageFactory) FromEnv

func (f *AzureBlobStorageFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type AzureCosmosDbDatastore

type AzureCosmosDbDatastore struct {
	DB *Cosmosdb
	// contains filtered or unexported fields
}

func NewAzureCosmosDb

func NewAzureCosmosDb(ctx context.Context, url string, key string, database string, collection string, idField string, pkField string, pkValue string) *AzureCosmosDbDatastore

func (*AzureCosmosDbDatastore) Close

func (*AzureCosmosDbDatastore) Delete

func (az *AzureCosmosDbDatastore) Delete(ctx context.Context, key string) error

func (*AzureCosmosDbDatastore) DeleteAll added in v0.0.16

func (az *AzureCosmosDbDatastore) DeleteAll(ctx context.Context, key []string) error

func (*AzureCosmosDbDatastore) Exists

func (az *AzureCosmosDbDatastore) Exists(ctx context.Context, key string) (bool, error)

func (*AzureCosmosDbDatastore) Get

func (az *AzureCosmosDbDatastore) Get(ctx context.Context, id string) ([]byte, error)

func (*AzureCosmosDbDatastore) GetAll

func (az *AzureCosmosDbDatastore) GetAll(ctx context.Context) ([][]byte, error)

func (*AzureCosmosDbDatastore) OnCreate added in v0.0.16

func (*AzureCosmosDbDatastore) Open

func (az *AzureCosmosDbDatastore) Open(ctx context.Context, config interface{}) error

func (*AzureCosmosDbDatastore) Ping

func (*AzureCosmosDbDatastore) Query

func (az *AzureCosmosDbDatastore) Query(ctx context.Context, query *datastore.SimpleQuery) ([][]byte, error)

func (*AzureCosmosDbDatastore) QueryAndUpdate added in v0.0.16

func (az *AzureCosmosDbDatastore) QueryAndUpdate(ctx context.Context, ds *datastore.SimpleQuery, f func(context.Context, [][]byte) ([][]byte, error)) ([][]byte, error)

func (*AzureCosmosDbDatastore) QueryAsMap added in v0.0.16

func (az *AzureCosmosDbDatastore) QueryAsMap(ctx context.Context, ds *datastore.SimpleQuery) ([]map[string]any, error)

func (*AzureCosmosDbDatastore) QueryTable added in v0.0.16

func (az *AzureCosmosDbDatastore) QueryTable(ctx context.Context, ds *datastore.SimpleQuery) ([][]interface{}, error)

func (*AzureCosmosDbDatastore) Save

func (az *AzureCosmosDbDatastore) Save(ctx context.Context, data []byte, key string) error

Saves an item into the Elastic Search. This item MUST be JSON data. The key is used as the ID for the document and is required to be unique for this index

func (*AzureCosmosDbDatastore) SaveAll added in v0.0.16

func (az *AzureCosmosDbDatastore) SaveAll(ctx context.Context, b [][]byte, s []string) error

type AzureCredentialLoader

type AzureCredentialLoader struct{}

func (*AzureCredentialLoader) ReadFromEnv

func (loader *AzureCredentialLoader) ReadFromEnv(env *cloudy.Environment) interface{}

type AzureCredentials

type AzureCredentials struct {
	Type           string // Can be any type of CredType*
	Region         string // e.g. "usgovvirginia"
	TenantID       string
	ClientID       string
	ClientSecret   string
	ResourceGroup  string
	SubscriptionID string
	Cloud          string // e.g. azureusgovernment
}

func GetAzureCredentialsFromEnv

func GetAzureCredentialsFromEnv(env *cloudy.Environment) AzureCredentials

type AzureFileShareFactory

type AzureFileShareFactory struct{}

func (*AzureFileShareFactory) Create

func (f *AzureFileShareFactory) Create(cfg interface{}) (storage.FileStorageManager, error)

func (*AzureFileShareFactory) FromEnv

func (f *AzureFileShareFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type AzureStorageAccount added in v0.0.16

type AzureStorageAccount struct {
	AzureCredentials

	ServiceURL  string
	UrlSlug     string
	AccountName string
	AccountKey  string
}

type AzureVMController

type AzureVMController struct {
	Vault  *KeyVault
	Client *armcompute.VirtualMachinesClient
	Usage  *armcompute.UsageClient
	Config *AzureVMControllerConfig
	// contains filtered or unexported fields
}

func NewAzureVMController

func NewAzureVMController(ctx context.Context, config *AzureVMControllerConfig) (*AzureVMController, error)

func (*AzureVMController) ConfigureDiskSize

func (vmc *AzureVMController) ConfigureDiskSize(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) (int32, error)

func (*AzureVMController) ConfigureVmOsDiskOsTypeType

func (*AzureVMController) ConfigureVmOsProfile

func (*AzureVMController) CreateNIC

CreateNIC - Creates the Network Interface for the virtual machine. It mimics the terraform code listed below. The elements used by this method are: - VM Name / ID (from vm) - Region (from factory) - Resource Group (from factory) - Subnet ID (from vm)

Once created the NIC has an ID and an IP address that we care about. The VirtualMachineConfiguration input is mutated to add the appropriate information.

 az network nic create \
 	--resource-group go-on-azure  \
	--vnet-name go-on-azure-vmVNET \
	--subnet go-on-azure-vmSubnet \
	--name uvm-gotest-ip
resource "azurerm_network_interface" "main-nic" {
    name                      = join("-", [var.vdi-name, random_string.random.result])
    location                  = data.azurerm_resource_group.main-rg.location
    resource_group_name       = data.azurerm_resource_group.main-rg.name

	ip_configuration {
		name                          = join("-", [var.vdi-name, "IP"])
		subnet_id                     = data.azurerm_subnet.main-subnet.id
		private_ip_address_allocation = "Dynamic"
    }
}

NOT WORKING YET

func (*AzureVMController) CreateNSG

data "azurerm_network_security_group" "vdi-security-group" {
    name = var.vdi-nsg
    resource_group_name = data.azurerm_resource_group.main-rg.name
}

func (*AzureVMController) CreateVirtualMachine

func (vmc *AzureVMController) CreateVirtualMachine(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) error

CreateVirtualMachine

resource "azurerm_linux_virtual_machine" "main-vm" {
    name                    = var.vdi-name
    computer_name           = var.vdi-name
    admin_username          = "salt"
    resource_group_name     = var.app-rg-name
    location                = var.def-location
    size                    = var.vdi-size
    source_image_id         = "/subscriptions/${var.subscription-id}/resourceGroups/${var.app-rg-name}/providers/Microsoft.Compute/galleries/${var.source-image-gallery-name}/images/${var.source-image}/versions/${var.source-image-version}"
    network_interface_ids   = [
        azurerm_network_interface.main-nic.id,
    ]

    admin_ssh_key {
        username = "salt"
        public_key = file("${path.module}/vdi-terraform_id_rsa.pub")
    }

    os_disk {
        caching              = "ReadWrite"
        storage_account_type = "Standard_LRS"
    }

    tags = {
        Application            = "SKYBORG"
        "Functional Area "     = "VDI"
        "User Principle Name"  = var.user-principle-name
    }
}

func (*AzureVMController) DeleteNIC

func (vmc *AzureVMController) DeleteNIC(ctx context.Context, vmId string, nicName string) error

func (*AzureVMController) DeleteVM

func (*AzureVMController) DeleteVMOSDisk

func (*AzureVMController) FindBestSubnet

func (vmc *AzureVMController) FindBestSubnet(ctx context.Context, availableSubnets []string) (string, error)

Finds the best subnet based on IP availabilty

func (*AzureVMController) GetAvailableIPS

func (vmc *AzureVMController) GetAvailableIPS(ctx context.Context, subnet string) (int, error)

Finds the best subnet based on IP availabilty

func (*AzureVMController) GetLatestImageVersion

func (vmc *AzureVMController) GetLatestImageVersion(ctx context.Context, imageName string) (string, error)

func (*AzureVMController) GetLimits

func (*AzureVMController) GetNIC

Find NIC if it already exists

func (*AzureVMController) GetNSG

func (*AzureVMController) GetVM

Find VM if it already exists

func (*AzureVMController) GetVMSize

func (vmc *AzureVMController) GetVMSize(ctx context.Context, size string) (*cloudyvm.VmSize, error)

func (*AzureVMController) GetVMSizes

func (vmc *AzureVMController) GetVMSizes(ctx context.Context) (map[string]*cloudyvm.VmSize, error)

func (*AzureVMController) GetVmOsDisk

func (*AzureVMController) ListAll

func (*AzureVMController) ListWithTag

func (vmc *AzureVMController) ListWithTag(ctx context.Context, tag string) ([]*cloudyvm.VirtualMachineStatus, error)

func (*AzureVMController) SetState

func (*AzureVMController) Start

func (vmc *AzureVMController) Start(ctx context.Context, vmName string, wait bool) error

func (*AzureVMController) Status

func (*AzureVMController) Stop

func (vmc *AzureVMController) Stop(ctx context.Context, vmName string, wait bool) error

func (*AzureVMController) Terminate

func (vmc *AzureVMController) Terminate(ctx context.Context, vmName string, wait bool) error

func (*AzureVMController) ValidateConfiguration

func (vmc *AzureVMController) ValidateConfiguration(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) error

type AzureVMControllerConfig

type AzureVMControllerConfig struct {
	AzureCredentials
	SubscriptionID string
	ResourceGroup  string

	// ??
	NetworkResourceGroup            string // From Environment Variable
	SourceImageGalleryResourceGroup string
	SourceImageGalleryName          string   // From Environment Variable
	Vnet                            string   // From Environment Variable
	AvailableSubnets                []string // From Environment Variable
	NetworkSecurityGroupName        string   // From Environment Variable
	NetworkSecurityGroupID          string   // From Environment Variable
	// SaltCmd                         string   // From Environment Variable
	VaultURL string

	DomainControllerOverride string
	DomainControllers        []*string // From Environment Variable

	LogBody bool
}

type AzureVMControllerFactory

type AzureVMControllerFactory struct{}

func (*AzureVMControllerFactory) Create

func (f *AzureVMControllerFactory) Create(cfg interface{}) (cloudyvm.VMController, error)

func (*AzureVMControllerFactory) FromEnv

func (f *AzureVMControllerFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type AzureVirtualDesktopConfig

type AzureVirtualDesktopConfig struct {
	AvdUsersGroupId string
	DomainName      string
	DomainUser      string
	DomainPass      string
}

type AzureVirtualDesktopManager added in v0.0.30

type AzureVirtualDesktopManager struct {
	// contains filtered or unexported fields
}

func NewAzureVirtualDesktopManager added in v0.0.30

func NewAzureVirtualDesktopManager(ctx context.Context, credentials *AzureCredentials, config *AzureVirtualDesktopConfig) (*AzureVirtualDesktopManager, error)

func (*AzureVirtualDesktopManager) AssignGroupToDesktopAppGroup added in v0.0.30

func (avd *AzureVirtualDesktopManager) AssignGroupToDesktopAppGroup(ctx context.Context, desktopAppGroupName string) error

func (*AzureVirtualDesktopManager) AssignRoleToUser added in v0.0.30

func (avd *AzureVirtualDesktopManager) AssignRoleToUser(ctx context.Context, rgName string, roleid string, upn string) error

func (*AzureVirtualDesktopManager) AssignSessionHost added in v0.0.30

func (avd *AzureVirtualDesktopManager) AssignSessionHost(ctx context.Context, rgName string, hpName string, shName string, userobjectid string) error

Assigns a User to a session host

func (*AzureVirtualDesktopManager) CanAssignUserToHostPool added in v0.0.30

func (avd *AzureVirtualDesktopManager) CanAssignUserToHostPool(ctx context.Context, rgName, hostPoolName, userName string) (bool, error)

CanAssignUserToHostPool checks if the specified user is already assigned to a session host in the given host pool.

func (*AzureVirtualDesktopManager) Configure added in v0.0.30

func (avd *AzureVirtualDesktopManager) Configure(ctx context.Context) error

func (*AzureVirtualDesktopManager) CreateApplicationGroup added in v0.0.30

func (avd *AzureVirtualDesktopManager) CreateApplicationGroup(ctx context.Context, rgName, suffix string) (*armdesktopvirtualization.ApplicationGroup, error)

CreateApplicationGroup creates an application group for the given host pool.

func (*AzureVirtualDesktopManager) CreateHostPool added in v0.0.30

func (avd *AzureVirtualDesktopManager) CreateHostPool(ctx context.Context, rgName, suffix string) (*armdesktopvirtualization.HostPool, error)

CreateHostPool creates a new host pool.

func (*AzureVirtualDesktopManager) CreateWorkspace added in v0.0.30

func (avd *AzureVirtualDesktopManager) CreateWorkspace(ctx context.Context, rgName, suffix, appGroupName string) (*armdesktopvirtualization.Workspace, error)

CreateWorkspace creates a new workspace for the given host pool.

func (*AzureVirtualDesktopManager) DeleteSessionHost added in v0.0.30

func (avd *AzureVirtualDesktopManager) DeleteSessionHost(ctx context.Context, rgName string, hpname string, sessionhost string) error

func (*AzureVirtualDesktopManager) DeleteUserSession added in v0.0.30

func (avd *AzureVirtualDesktopManager) DeleteUserSession(ctx context.Context, rgName string, hpname string, sessionHost string, upn string) error

func (*AzureVirtualDesktopManager) DisconnecteUserSession added in v0.0.30

func (avd *AzureVirtualDesktopManager) DisconnecteUserSession(ctx context.Context, rgName string, hpname string, sessionHost string, upn string) error

func (*AzureVirtualDesktopManager) FindFirstAvailableHostPool added in v0.0.30

func (avd *AzureVirtualDesktopManager) FindFirstAvailableHostPool(ctx context.Context, rgName string, upn string) (*armdesktopvirtualization.HostPool, error)

func (*AzureVirtualDesktopManager) FindSessionHostByVMNameInHostPool added in v0.0.30

func (avd *AzureVirtualDesktopManager) FindSessionHostByVMNameInHostPool(ctx context.Context, rgName string, hostPoolName string, vmID string) (*armdesktopvirtualization.SessionHost, error)

Searches for a session host with a name that contains the VMs ID

func (*AzureVirtualDesktopManager) GetAllDesktopApplications added in v0.0.30

func (avd *AzureVirtualDesktopManager) GetAllDesktopApplications(ctx context.Context, rgName string) ([]string, error)

func (*AzureVirtualDesktopManager) GetDesktopApplicationGroupFromHostpool added in v0.0.30

func (avd *AzureVirtualDesktopManager) GetDesktopApplicationGroupFromHostpool(ctx context.Context, rgName string, hpName string) (*armdesktopvirtualization.ApplicationGroup, error)

Given a Host Pool, finds the Desktop Application Group linked to it

func (*AzureVirtualDesktopManager) GetDesktopApplicationObjectIDFromAppGroup added in v0.0.30

func (avd *AzureVirtualDesktopManager) GetDesktopApplicationObjectIDFromAppGroup(ctx context.Context, rgName string, appGroup *armdesktopvirtualization.ApplicationGroup) (string, error)

func (*AzureVirtualDesktopManager) GetRegistrationScript added in v0.0.30

func (avd *AzureVirtualDesktopManager) GetRegistrationScript(ctx context.Context, vm *models.VirtualMachine, registrationToken string) (*string, error)

func (*AzureVirtualDesktopManager) GetWorkspaceByName added in v0.0.30

func (avd *AzureVirtualDesktopManager) GetWorkspaceByName(ctx context.Context, rgName string, workspaceName string) (*armdesktopvirtualization.Workspace, error)

func (*AzureVirtualDesktopManager) PostRegister added in v0.0.30

After registering, the user must then be assigned to the new session host

func (*AzureVirtualDesktopManager) PreRegister added in v0.0.30

func (avd *AzureVirtualDesktopManager) PreRegister(ctx context.Context, vm *models.VirtualMachine) (hostPoolName, token *string, err error)

Prior to VM registration, this process generates a token for a given host pool. This token will later be used in the registration process to join the VM to the host pool The user is also assigned to the related desktop application group.

func (*AzureVirtualDesktopManager) RetrieveRegistrationToken added in v0.0.30

func (avd *AzureVirtualDesktopManager) RetrieveRegistrationToken(ctx context.Context, rgName string, hpname string) (*string, error)

func (*AzureVirtualDesktopManager) WaitForSessionHost added in v0.0.30

func (avd *AzureVirtualDesktopManager) WaitForSessionHost(ctx context.Context, rgName, hpName, vmID string, timeout time.Duration) (*armdesktopvirtualization.SessionHost, error)

WaitForSessionHost waits for a VM to appear as a session host in a specified host pool and ensures its status is 'Available'.

type AzureVirtualMachineManager added in v0.0.16

type AzureVirtualMachineManager struct {
	LogBody bool
	// contains filtered or unexported fields
}

func (*AzureVirtualMachineManager) Configure added in v0.0.16

func (vmm *AzureVirtualMachineManager) Configure(ctx context.Context) error

func (*AzureVirtualMachineManager) Create added in v0.0.16

func (*AzureVirtualMachineManager) CreateNic added in v0.0.16

func (*AzureVirtualMachineManager) Deallocate added in v0.0.16

func (vmm *AzureVirtualMachineManager) Deallocate(ctx context.Context, vmName string) error

func (*AzureVirtualMachineManager) Delete added in v0.0.16

func (vmm *AzureVirtualMachineManager) Delete(ctx context.Context, vmId string) error

func (*AzureVirtualMachineManager) DeleteDisk added in v0.0.16

func (vmm *AzureVirtualMachineManager) DeleteDisk(ctx context.Context, diskName string) error

func (*AzureVirtualMachineManager) DeleteNic added in v0.0.16

func (*AzureVirtualMachineManager) DeleteNics added in v0.0.16

func (*AzureVirtualMachineManager) GetAll added in v0.0.16

func (vmm *AzureVirtualMachineManager) GetAll(ctx context.Context, filter string, attrs []string, includeState bool) (*[]models.VirtualMachine, error)

Queries Azure for the details of all VMs.

If includeState is true, this will also retrieve the state of the VMs (running, stopped, etc.)
If includeState is false, vm.State will be an empty string

func (*AzureVirtualMachineManager) GetAllDisks added in v0.0.16

func (*AzureVirtualMachineManager) GetAllNics added in v0.0.16

func (*AzureVirtualMachineManager) GetAllSizes added in v0.0.18

func (*AzureVirtualMachineManager) GetAllVmDisks added in v0.0.16

func (vmm *AzureVirtualMachineManager) GetAllVmDisks(ctx context.Context, vmId string) ([]*models.VirtualMachineDisk, error)

func (*AzureVirtualMachineManager) GetById added in v0.0.16

func (vmm *AzureVirtualMachineManager) GetById(ctx context.Context, id string, includeState bool) (*models.VirtualMachine, error)

Queries Azure for the details of a single VM.

If includeState is true, this will also retrieve the state of the VM (running, stopped, etc.)
If includeState is false, vm.State will be an empty string

func (*AzureVirtualMachineManager) GetLatestImageVersion added in v0.0.16

func (vmm *AzureVirtualMachineManager) GetLatestImageVersion(ctx context.Context, imageName string) (string, error)

This function was unused in v1 It would need the config to have the source image gallery name in it

func (*AzureVirtualMachineManager) GetNics added in v0.0.16

func (*AzureVirtualMachineManager) GetOsDisk added in v0.0.16

func (*AzureVirtualMachineManager) GetSizesForTemplate added in v0.0.18

func (vmm *AzureVirtualMachineManager) GetSizesForTemplate(ctx context.Context, template models.VirtualMachineTemplate) (
	matches map[string]*models.VirtualMachineSize,
	worse map[string]*models.VirtualMachineSize,
	better map[string]*models.VirtualMachineSize,
	err error)

func (*AzureVirtualMachineManager) GetSizesWithUsage added in v0.0.18

func (vmm *AzureVirtualMachineManager) GetSizesWithUsage(ctx context.Context) (map[string]*models.VirtualMachineSize, error)

func (*AzureVirtualMachineManager) GetUsage added in v0.0.16

func (*AzureVirtualMachineManager) RunCommand added in v0.0.30

func (vmm *AzureVirtualMachineManager) RunCommand(ctx context.Context, vmId string, script string) error

func (*AzureVirtualMachineManager) RunPowershell added in v0.0.30

func (vmm *AzureVirtualMachineManager) RunPowershell(ctx context.Context, vmID, script string) error

func (*AzureVirtualMachineManager) Start added in v0.0.16

func (vmm *AzureVirtualMachineManager) Start(ctx context.Context, vmName string) error

func (*AzureVirtualMachineManager) Stop added in v0.0.16

func (vmm *AzureVirtualMachineManager) Stop(ctx context.Context, vmName string) error

func (*AzureVirtualMachineManager) Update added in v0.0.16

type BlobContainerShare

type BlobContainerShare struct {
	Account string
	// AccountKey string
	// UrlSlug    string
	Client *azblob.Client
}

THe BlobContainerShare provides file shares based on the Azure Blob Storage

func NewBlobContainerShare

func NewBlobContainerShare(ctx context.Context, account string, accountKey string, urlslug string) (*BlobContainerShare, error)

func NewBlobContainerShare2 added in v0.0.16

func NewBlobContainerShare2(ctx context.Context, acct *AzureStorageAccount) (*BlobContainerShare, error)

func (*BlobContainerShare) Create

func (bfs *BlobContainerShare) Create(ctx context.Context, key string, tags map[string]string) (*storage.FileShare, error)

func (*BlobContainerShare) Delete

func (bfs *BlobContainerShare) Delete(ctx context.Context, key string) error

func (*BlobContainerShare) Exists

func (bfs *BlobContainerShare) Exists(ctx context.Context, key string) (bool, error)

func (*BlobContainerShare) Get

func (*BlobContainerShare) List

type BlobFileShare

type BlobFileShare struct {
	Client *armstorage.FileSharesClient
	// Credentials        AzureCredentials
	SubscriptionID     string
	ResourceGroupName  string
	StorageAccountName string
}

THe BlobFileShare provides file shares based on the Azure Blob Storage

func NewAzureFileShare added in v0.0.16

func NewAzureFileShare(ctx context.Context, acct *AzureStorageAccount) (*BlobFileShare, error)

func (*BlobFileShare) Create

func (bfs *BlobFileShare) Create(ctx context.Context, key string, tags map[string]string) (*storage.FileShare, error)

func (*BlobFileShare) Delete

func (bfs *BlobFileShare) Delete(ctx context.Context, key string) error

func (*BlobFileShare) Exists

func (bfs *BlobFileShare) Exists(ctx context.Context, key string) (bool, error)

func (*BlobFileShare) Get

func (bfs *BlobFileShare) Get(ctx context.Context, key string) (*storage.FileShare, error)

func (*BlobFileShare) List

func (bfs *BlobFileShare) List(ctx context.Context) ([]*storage.FileShare, error)

type BlobStorage

type BlobStorage struct {
	Account    string
	AccountKey string
	Container  string
	UrlSlug    string
	Client     *container.Client
}

Object Storage

func NewBlobContainer

func NewBlobContainer(ctx context.Context, account string, accountKey string, container string, urlslug string) (*BlobStorage, error)

func NewBlobContainerFrom

func NewBlobContainerFrom(ctx context.Context, client *container.Client) *BlobStorage

func (*BlobStorage) Delete

func (b *BlobStorage) Delete(ctx context.Context, key string) error

func (*BlobStorage) Download

func (b *BlobStorage) Download(ctx context.Context, key string) (io.ReadCloser, error)

func (*BlobStorage) Exists

func (b *BlobStorage) Exists(ctx context.Context, key string) (bool, error)

func (*BlobStorage) GenDownloadURL added in v0.0.16

func (b *BlobStorage) GenDownloadURL(ctx context.Context, key string) (string, error)

func (*BlobStorage) GenUploadURL added in v0.0.16

func (b *BlobStorage) GenUploadURL(ctx context.Context, key string) (string, error)

func (*BlobStorage) List

func (*BlobStorage) ListNative

func (b *BlobStorage) ListNative(ctx context.Context, prefix string) ([]*container.BlobItem, []*container.BlobPrefix, error)

func (*BlobStorage) TagsToMap

func (b *BlobStorage) TagsToMap(tags *container.BlobTags) map[string]string

func (*BlobStorage) ToStoredObject

func (b *BlobStorage) ToStoredObject(item *container.BlobItem) *storage.StoredObject

func (*BlobStorage) UpdateMetadata added in v0.0.5

func (b *BlobStorage) UpdateMetadata(ctx context.Context, key string, tags map[string]string) error

func (*BlobStorage) Upload

func (b *BlobStorage) Upload(ctx context.Context, key string, data io.Reader, tags map[string]string) error

type BlobStorageAccount

type BlobStorageAccount struct {
	Account string
	// AccountKey string
	// UrlSlug    string
	Client *azblob.Client
}

ObjectStorageManager {

func NewBlobStorageAccount

func NewBlobStorageAccount(ctx context.Context, account string, accountKey string, urlslug string) (*BlobStorageAccount, error)

func NewBlobStorageAccount2 added in v0.0.16

func NewBlobStorageAccount2(ctx context.Context, acct *AzureStorageAccount) (*BlobStorageAccount, error)

func (*BlobStorageAccount) Create

func (sa *BlobStorageAccount) Create(ctx context.Context, key string, openToPublic bool, tags map[string]string) (storage.ObjectStorage, error)

func (*BlobStorageAccount) Delete

func (sa *BlobStorageAccount) Delete(ctx context.Context, key string) error

func (*BlobStorageAccount) Exists

func (sa *BlobStorageAccount) Exists(ctx context.Context, key string) (bool, error)

func (*BlobStorageAccount) Get

func (*BlobStorageAccount) GetBlobContainer

func (sa *BlobStorageAccount) GetBlobContainer(ctx context.Context, name string) (*storage.StorageArea, error)

func (*BlobStorageAccount) GetItem

func (sa *BlobStorageAccount) GetItem(ctx context.Context, key string) (*storage.StorageArea, error)

func (*BlobStorageAccount) List

type CosmosDBFactory added in v0.0.16

type CosmosDBFactory struct {
	// contains filtered or unexported fields
}

func (*CosmosDBFactory) Create added in v0.0.16

func (c *CosmosDBFactory) Create(cfg interface{}) (datastore.UntypedJsonDataStoreFactory, error)

func (*CosmosDBFactory) CreateJsonDatastore added in v0.0.16

func (c *CosmosDBFactory) CreateJsonDatastore(ctx context.Context, typename string, prefix string, idField string) datastore.UntypedJsonDataStore

func (*CosmosDBFactory) FromEnv added in v0.0.16

func (c *CosmosDBFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type CosmosDbQueryConverter added in v0.0.16

type CosmosDbQueryConverter struct {
	// contains filtered or unexported fields
}

func (*CosmosDbQueryConverter) Convert added in v0.0.16

func (qc *CosmosDbQueryConverter) Convert(c *datastore.SimpleQuery, table string) string

func (*CosmosDbQueryConverter) ConvertASort added in v0.0.16

func (qc *CosmosDbQueryConverter) ConvertASort(c *datastore.SortBy) string

func (*CosmosDbQueryConverter) ConvertCondition added in v0.0.16

func (*CosmosDbQueryConverter) ConvertConditionGroup added in v0.0.16

func (qc *CosmosDbQueryConverter) ConvertConditionGroup(cg *datastore.SimpleQueryConditionGroup) string

func (*CosmosDbQueryConverter) ConvertSelect added in v0.0.16

func (qc *CosmosDbQueryConverter) ConvertSelect(c *datastore.SimpleQuery, table string) string

func (*CosmosDbQueryConverter) ConvertSort added in v0.0.16

func (qc *CosmosDbQueryConverter) ConvertSort(sortbys []*datastore.SortBy) string

func (*CosmosDbQueryConverter) ToColumnName added in v0.0.16

func (qc *CosmosDbQueryConverter) ToColumnName(name string) string

type CosmosFactoryConfig added in v0.0.16

type CosmosFactoryConfig struct {
	URL      string
	Key      string
	Creds    *AzureCredentials
	Database string
}

type CosmosObject

type CosmosObject struct {
	Item interface{}
}

type Cosmosdb

type Cosmosdb struct {
	Database  string
	Container string
	// contains filtered or unexported fields
}

func NewCosmosdb

func NewCosmosdb(ctx context.Context, db string, coll string, key string, endpoint string, idField string, partitionKeyField string, partitionKey string) (*Cosmosdb, error)

func (*Cosmosdb) Add

func (c *Cosmosdb) Add(ctx context.Context, id string, data []byte) error

Create user

func (*Cosmosdb) AddPK added in v0.0.16

func (c *Cosmosdb) AddPK(data []byte) ([]byte, error)

func (*Cosmosdb) CreateOpen added in v0.0.16

func (c *Cosmosdb) CreateOpen(ctx context.Context, onCollectionCreate func(ctx context.Context, c *Cosmosdb) error) error

func (*Cosmosdb) Exists

func (c *Cosmosdb) Exists(ctx context.Context, id string) (bool, error)

Get user by given id

func (*Cosmosdb) GetAll

func (c *Cosmosdb) GetAll(ctx context.Context) ([][]byte, error)

Get user by given id

func (*Cosmosdb) GetRaw

func (c *Cosmosdb) GetRaw(ctx context.Context, id string) ([]byte, error)

Get user by given id

func (*Cosmosdb) Healthy added in v0.0.16

func (c *Cosmosdb) Healthy(ctx context.Context) error

func (*Cosmosdb) IsStatusCodeNotFound added in v0.0.16

func (c *Cosmosdb) IsStatusCodeNotFound(err error) bool

func (*Cosmosdb) QueryAll added in v0.0.16

func (c *Cosmosdb) QueryAll(ctx context.Context, query string) ([][]byte, error)

func (*Cosmosdb) Remove

func (c *Cosmosdb) Remove(ctx context.Context, id string) error

func (*Cosmosdb) Replace added in v0.0.16

func (c *Cosmosdb) Replace(ctx context.Context, id string, data []byte) error

Update or insert

func (*Cosmosdb) Upsert

func (c *Cosmosdb) Upsert(ctx context.Context, id string, data []byte) error

Update or insert

type KeyVault

type KeyVault struct {
	AzureCredentials
	VaultURL string
	Client   *azsecrets.Client
}

func NewKeyVault

func NewKeyVault(ctx context.Context, vaultURL string, credentials AzureCredentials) (*KeyVault, error)

func NewKeyVaultFromEnv added in v0.0.3

func NewKeyVaultFromEnv(env *cloudy.Environment) (*KeyVault, error)

func (*KeyVault) Configure

func (k *KeyVault) Configure(ctx context.Context) error

func (*KeyVault) DeleteSecret

func (k *KeyVault) DeleteSecret(ctx context.Context, key string) error

func (*KeyVault) GetAllSecrets added in v0.0.16

func (k *KeyVault) GetAllSecrets(ctx context.Context) (map[string]string, error)

func (*KeyVault) GetSecret

func (k *KeyVault) GetSecret(ctx context.Context, key string) (string, error)

func (*KeyVault) GetSecretBinary

func (k *KeyVault) GetSecretBinary(ctx context.Context, key string) ([]byte, error)

func (*KeyVault) IsConflictErr

func (k *KeyVault) IsConflictErr(err error) bool

func (*KeyVault) IsNotFound

func (k *KeyVault) IsNotFound(err error) bool

func (*KeyVault) SaveSecret

func (k *KeyVault) SaveSecret(ctx context.Context, key string, data string) error

SaveSecret saves the secret in key vault. There are a few funny things that can happen here.

func (*KeyVault) SaveSecretBinary

func (k *KeyVault) SaveSecretBinary(ctx context.Context, key string, secret []byte) error

type KeyVaultConfig

type KeyVaultConfig struct {
	AzureCredentials
	VaultURL string `cloudyenv:"AZ_VAULT_URL"`
}

type KeyVaultEnvironment

type KeyVaultEnvironment struct {
	Vault  *KeyVault
	Prefix string
}

func NewKeyVaultEnvironmentService

func NewKeyVaultEnvironmentService(ctx context.Context, vaultURL string, credentials AzureCredentials, prefix string) (*KeyVaultEnvironment, error)

func (*KeyVaultEnvironment) Get

func (kve *KeyVaultEnvironment) Get(name string) (string, error)

func (*KeyVaultEnvironment) SaveAll

func (kve *KeyVaultEnvironment) SaveAll(ctx context.Context, items map[string]string) error

type KeyVaultEnvironmentCachedFactory

type KeyVaultEnvironmentCachedFactory struct{}

func (*KeyVaultEnvironmentCachedFactory) Create

func (c *KeyVaultEnvironmentCachedFactory) Create(cfg interface{}) (cloudy.EnvironmentService, error)

func (*KeyVaultEnvironmentCachedFactory) FromEnv

func (c *KeyVaultEnvironmentCachedFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type KeyVaultEnvironmentConfig

type KeyVaultEnvironmentConfig struct {
	AzureCredentials
	VaultURL string
	Prefix   string
}

type KeyVaultEnvironmentFactory

type KeyVaultEnvironmentFactory struct{}

func (*KeyVaultEnvironmentFactory) Create

func (c *KeyVaultEnvironmentFactory) Create(cfg interface{}) (cloudy.EnvironmentService, error)

func (*KeyVaultEnvironmentFactory) FromEnv

func (c *KeyVaultEnvironmentFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type KeyVaultFactory

type KeyVaultFactory struct{}

func (*KeyVaultFactory) Create

func (c *KeyVaultFactory) Create(cfg interface{}) (secrets.SecretProvider, error)

func (*KeyVaultFactory) FromEnv

func (c *KeyVaultFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

func (*KeyVaultFactory) ListRequiredEnv added in v0.0.3

func (c *KeyVaultFactory) ListRequiredEnv(env *cloudy.Environment) []string

type KeyVaultKvConfig added in v0.0.16

type KeyVaultKvConfig struct {
	AzureCredentials
	VaultURL string
	Prefix   string
}

type KeyVaultKvStore added in v0.0.16

type KeyVaultKvStore struct {
	Vault  *KeyVault
	Prefix string
}

func NewAzureKeyVault added in v0.0.16

func NewAzureKeyVault(ctx context.Context, cfg *KeyVaultKvConfig) (*KeyVaultKvStore, error)

func NewKeyVaultKvStoreService added in v0.0.16

func NewKeyVaultKvStoreService(ctx context.Context, vaultURL string, credentials AzureCredentials, prefix string) (*KeyVaultKvStore, error)

func (*KeyVaultKvStore) Delete added in v0.0.16

func (kve *KeyVaultKvStore) Delete(key string) error

func (*KeyVaultKvStore) Get added in v0.0.16

func (kve *KeyVaultKvStore) Get(key string) (string, error)

func (*KeyVaultKvStore) GetAll added in v0.0.16

func (kve *KeyVaultKvStore) GetAll() (map[string]string, error)

func (*KeyVaultKvStore) GetSecure added in v0.0.16

func (kve *KeyVaultKvStore) GetSecure(key string) (strfmt.Password, error)

func (*KeyVaultKvStore) Set added in v0.0.16

func (kve *KeyVaultKvStore) Set(key string, value string) error

func (*KeyVaultKvStore) SetMany added in v0.0.16

func (kve *KeyVaultKvStore) SetMany(items map[string]string) error

func (*KeyVaultKvStore) SetSecure added in v0.0.16

func (kve *KeyVaultKvStore) SetSecure(key string, value strfmt.Password) error

type ScoredVMSize added in v0.0.18

type ScoredVMSize struct {
	Score float64
	Size  *models.VirtualMachineSize
}

type VirtualMachineManagerConfig added in v0.0.16

type VirtualMachineManagerConfig struct {
	DomainControllers []*string

	SubnetIds []string

	VnetId string
}

Jump to

Keyboard shortcuts

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