azure

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AzureImdsUrl         = "http://169.254.169.254/metadata/instance/compute?api-version=2021-01-01"
	AzureUserDataImdsUrl = "http://169.254.169.254/metadata/instance/compute/userData?api-version=2021-01-01&format=text"
)

Variables

This section is empty.

Functions

func GetUserData

func GetUserData(ctx context.Context, url string) ([]byte, error)

Method to retrieve userData from the instance metadata service and return it as a string

func IsAzure

func IsAzure(ctx context.Context) bool

Method to check if the VM is running on Azure by checking if the Azure IMDS endpoint is reachable Set Metadata:true header to confirm that the VM is running on Azure If the VM is running on Azure, return true

func NewAzureClient

func NewAzureClient(config Config) (azcore.TokenCredential, error)

func NewProvider

func NewProvider(config *Config) (provider.Provider, error)

Types

type Config

type Config struct {
	SubscriptionId       string
	ClientId             string
	ClientSecret         string
	TenantId             string
	ResourceGroupName    string
	Zone                 string
	Region               string
	SubnetId             string
	SecurityGroupName    string
	SecurityGroupId      string
	Size                 string
	ImageId              string
	SSHKeyPath           string
	SSHUserName          string
	DisableCVM           bool
	InstanceSizes        instanceSizes
	InstanceSizeSpecList []provider.InstanceTypeSpec
	Tags                 provider.KeyValueFlag
	DisableCloudConfig   bool
	// Disabled by default, we want to do measured boot.
	// Secure boot brings no additional security.
	EnableSecureBoot bool
}

func (Config) Redact

func (c Config) Redact() Config

type Manager

type Manager struct{}

func (*Manager) GetConfig

func (_ *Manager) GetConfig() (config *Config)

func (*Manager) LoadEnv

func (_ *Manager) LoadEnv()

func (*Manager) NewProvider

func (_ *Manager) NewProvider() (provider.Provider, error)

func (*Manager) ParseCmd

func (_ *Manager) ParseCmd(flags *flag.FlagSet)

Jump to

Keyboard shortcuts

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