client

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MPL-2.0, MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCloudEnvironmentName = "Public"

Variables

This section is empty.

Functions

func NewCertOAuthTokenProvider

func NewCertOAuthTokenProvider(env azure.Environment, clientID, clientCertPath, tenantID string) (oAuthTokenProvider, error)

func NewDeviceFlowOAuthTokenProvider

func NewDeviceFlowOAuthTokenProvider(env azure.Environment, say func(string), tenantID string) oAuthTokenProvider

func NewJWTOAuthTokenProvider

func NewJWTOAuthTokenProvider(env azure.Environment, clientID, clientJWT, tenantID string) oAuthTokenProvider

func NewMSIOAuthTokenProvider

func NewMSIOAuthTokenProvider(env azure.Environment) oAuthTokenProvider

func NewSecretOAuthTokenProvider

func NewSecretOAuthTokenProvider(env azure.Environment, clientID, clientSecret, tenantID string) oAuthTokenProvider

Types

type Config

type Config struct {
	// One of Public, China, Germany, or
	// USGovernment. Defaults to Public. Long forms such as
	// USGovernmentCloud and AzureUSGovernmentCloud are also supported.
	CloudEnvironmentName string `mapstructure:"cloud_environment_name" required:"false"`
	CloudEnvironment     *azure.Environment

	// The application ID of the AAD Service Principal.
	// Requires either `client_secret`, `client_cert_path` or `client_jwt` to be set as well.
	ClientID string `mapstructure:"client_id"`
	// A password/secret registered for the AAD SP.
	ClientSecret string `mapstructure:"client_secret"`
	// The path to a certificate that will be used to authenticate as the specified AAD SP.
	ClientCertPath string `mapstructure:"client_cert_path"`
	// A JWT bearer token for client auth (RFC 7523, Sec. 2.2) that will be used
	// to authenticate the AAD SP. Provides more control over token the expiration
	// when using certificate authentication than when using `client_cert_path`.
	ClientJWT string `mapstructure:"client_jwt"`
	// The object ID for the AAD SP. Optional, will be derived from the oAuth token if left empty.
	ObjectID string `mapstructure:"object_id"`

	// The Active Directory tenant identifier with which your `client_id` and
	// `subscription_id` are associated. If not specified, `tenant_id` will be
	// looked up using `subscription_id`.
	TenantID string `mapstructure:"tenant_id" required:"false"`
	// The subscription to use.
	SubscriptionID string `mapstructure:"subscription_id"`
	// contains filtered or unexported fields
}

Config allows for various ways to authenticate Azure clients. When `client_id` and `subscription_id` are specified, Packer will use the specified Azure Active Directoty (AAD) Service Principal (SP). If only `subscription_id` is specified, Packer will try to interactively log on the current user (tokens will be cached). If none of these options are specified, Packer will attempt to use the Managed Identity and subscription of the VM that Packer is running on. This will only work if Packer is running on an Azure VM.

func (*Config) FillParameters

func (c *Config) FillParameters() error

FillParameters capture the user intent from the supplied parameter set in authType, retrieves the TenantID and CloudEnvironment if not specified. The SubscriptionID is also retrieved in case MSI auth is requested.

func (Config) GetServicePrincipalTokens

func (c Config) GetServicePrincipalTokens(
	say func(string)) (
	servicePrincipalToken *adal.ServicePrincipalToken,
	servicePrincipalTokenVault *adal.ServicePrincipalToken,
	err error)

func (*Config) SetDefaultValues

func (c *Config) SetDefaultValues() error

func (Config) UseMSI

func (c Config) UseMSI() bool

func (Config) Validate

func (c Config) Validate(errs *packer.MultiError)

Jump to

Keyboard shortcuts

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