auth

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUserAgentExtension

func GetUserAgentExtension() string

func NewAuthorizer

func NewAuthorizer(config *Config, env *azure.Environment) (autorest.Authorizer, error)

func NewCredential

func NewCredential(cfg *Config) (azcore.TokenCredential, error)

NewCredential provides a token credential for msi and service principal auth

Types

type ClientConfig

type ClientConfig struct {
	CloudName               string
	Location                string
	SubscriptionID          string
	ResourceManagerEndpoint string
	Authorizer              autorest.Authorizer
	UserAgent               string
}

ClientConfig contains all essential information to create an Azure client.

type Config

type Config struct {
	Cloud          string `json:"cloud" yaml:"cloud"`
	Location       string `json:"location" yaml:"location"`
	TenantID       string `json:"tenantId" yaml:"tenantId"`
	SubscriptionID string `json:"subscriptionId" yaml:"subscriptionId"`
	ResourceGroup  string `json:"resourceGroup" yaml:"resourceGroup"`
	VMType         string `json:"vmType" yaml:"vmType"`

	// AuthMethod determines how to authorize requests for the Azure
	// cloud. Valid options are "principal" (= the traditional
	// service principle approach) and "cli" (= load az command line
	// config file). The default is "principal".
	AuthMethod string `json:"authMethod" yaml:"authMethod"`

	// Settings for a service principal.
	AADClientID                  string `json:"aadClientId" yaml:"aadClientId"`
	AADClientSecret              string `json:"aadClientSecret" yaml:"aadClientSecret"`
	AADClientCertPath            string `json:"aadClientCertPath" yaml:"aadClientCertPath"`
	AADClientCertPassword        string `json:"aadClientCertPassword" yaml:"aadClientCertPassword"`
	UseCredentialFromEnvironment bool   `json:"useCredentialFromEnvironment" yaml:"useCredentialFromEnvironment"`
	UseManagedIdentityExtension  bool   `json:"useManagedIdentityExtension" yaml:"useManagedIdentityExtension"`
	UserAssignedIdentityID       string `json:"userAssignedIdentityID" yaml:"userAssignedIdentityID"`

	//Configs only for AKS
	ClusterName string `json:"clusterName" yaml:"clusterName"`
	//Config only for AKS
	NodeResourceGroup string `json:"nodeResourceGroup" yaml:"nodeResourceGroup"`
}

Config holds the configuration parsed from the --cloud-config flag

func BuildAzureConfig

func BuildAzureConfig() (*Config, error)

BuildAzureConfig returns a Config object for the Azure clients

func (*Config) BaseVars

func (cfg *Config) BaseVars()

func (*Config) GetAzureClientConfig

func (cfg *Config) GetAzureClientConfig(authorizer autorest.Authorizer, env *azure.Environment) *ClientConfig

func (*Config) PrepareConfig

func (cfg *Config) PrepareConfig() error

func (*Config) TrimSpace

func (cfg *Config) TrimSpace()

TrimSpace removes all leading and trailing white spaces.

Jump to

Keyboard shortcuts

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