helpers

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptAgreement

func AcceptAgreement(ctx context.Context, mktPlaceAgreementAccess *armmarketplaceordering.MarketplaceAgreementsClient, purchasePlan armcompute.PurchasePlan, existingAgreement armmarketplaceordering.AgreementTerms) (err error)

AcceptAgreement updates the agreementTerms as accepted. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func CreateNIC

func CreateNIC(ctx context.Context, nicAccess *armnetwork.InterfacesClient, resourceGroup string, nicParams armnetwork.Interface, nicName string) (nic *armnetwork.Interface, err error)

CreateNIC creates a NIC given the resourceGroup, nic name and NIC creation parameters. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func CreateVirtualMachine

func CreateVirtualMachine(ctx context.Context, vmAccess *armcompute.VirtualMachinesClient, resourceGroup string, vmCreationParams armcompute.VirtualMachine) (vm *armcompute.VirtualMachine, err error)

CreateVirtualMachine creates a Virtual Machine given a resourceGroup and virtual machine creation parameters. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func DeleteDisk

func DeleteDisk(ctx context.Context, client *armcompute.DisksClient, resourceGroup, diskName string) (err error)

DeleteDisk deletes disk for passed in resourceGroup and diskName. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func DeleteNIC

func DeleteNIC(ctx context.Context, client *armnetwork.InterfacesClient, resourceGroup, nicName string) (err error)

DeleteNIC deletes the NIC identified by a resourceGroup and nicName. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func DeleteVirtualMachine

func DeleteVirtualMachine(ctx context.Context, vmAccess *armcompute.VirtualMachinesClient, resourceGroup, vmName string) (err error)

DeleteVirtualMachine deletes the Virtual Machine with the give name and belonging to the passed in resource group. If cascade delete is set for associated NICs and Disks then these resources will also be deleted along with the VM. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func GetAgreementTerms

func GetAgreementTerms(ctx context.Context, mktPlaceAgreementAccess *armmarketplaceordering.MarketplaceAgreementsClient, purchasePlan armcompute.PurchasePlan) (agreementTerms *armmarketplaceordering.AgreementTerms, err error)

GetAgreementTerms fetches the agreement terms for the purchase plan. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func GetNIC

func GetNIC(ctx context.Context, client *armnetwork.InterfacesClient, resourceGroup, nicName string) (nic *armnetwork.Interface, err error)

GetNIC fetches a NIC identified by resourceGroup and nic name. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func GetSubnet

func GetSubnet(ctx context.Context, subnetAccess *armnetwork.SubnetsClient, resourceGroup, virtualNetworkName, subnetName string) (subnet *armnetwork.Subnet, err error)

GetSubnet fetches a Subnet resource given a resourceGroup, virtualNetworkName and subnetName. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func GetVMImage

func GetVMImage(ctx context.Context, vmImagesAccess *armcompute.VirtualMachineImagesClient, location string, imageRef armcompute.ImageReference) (vmImage *armcompute.VirtualMachineImage, err error)

GetVMImage fetches the VM Image given a location and image reference. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func GetVirtualMachine

func GetVirtualMachine(ctx context.Context, vmClient *armcompute.VirtualMachinesClient, resourceGroup, vmName string) (vm *armcompute.VirtualMachine, err error)

GetVirtualMachine gets a VirtualMachine for the given vm name and resource group. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func QueryAndMap

func QueryAndMap[T any](ctx context.Context, client *armresourcegraph.Client, subscriptionID string, mapperFn MapperFn[T], queryTemplate string, templateArgs ...any) (results []T, err error)

QueryAndMap fires a resource graph KUSTO query constructing it from queryTemplate and templateArgs. The result of the query are then mapped using a mapperFn and the result or an error is returned. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func ResourceGroupExists

func ResourceGroupExists(ctx context.Context, client *armresources.ResourceGroupsClient, resourceGroup string) (exists bool, err error)

ResourceGroupExists checks if the given resourceGroup exists. NOTE: All calls to this Azure API are instrumented as prometheus metric.

func SetCascadeDeleteForNICsAndDisks

func SetCascadeDeleteForNICsAndDisks(ctx context.Context, vmClient *armcompute.VirtualMachinesClient, resourceGroup string, vmName string, vmUpdateParams *armcompute.VirtualMachineUpdate) (err error)

SetCascadeDeleteForNICsAndDisks sets cascade deletion for NICs and Disks (OSDisk and DataDisks) associated to passed virtual machine. NOTE: All calls to this Azure API are instrumented as prometheus metric.

Types

type MapperFn

type MapperFn[T any] func(map[string]interface{}) *T

MapperFn maps a row of result (represented as map[string]interface{}) to any type T.

Jump to

Keyboard shortcuts

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