config

package
v0.0.0-...-788a008 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigAsMap

func GetConfigAsMap() (map[string]interface{}, error)

GetConfigAsMap will reads the config into a string map array

Types

type Config

type Config struct {
	CurrentContext string     `mapstructure:"current-context"`
	Contexts       []*Context `mapstructure:"contexts"`
	Users          []*User    `mapstructure:"users"`
}

Config contains the data from the configuration file

func GetConfig

func GetConfig() (*Config, error)

GetConfig reads the entire config file

type Context

type Context struct {
	Name            string       `mapstructure:"name"`
	TenantID        string       `mapstructure:"tenantId"`
	Endpoint        string       `mapstructure:"endpoint,omitempty"`
	ClientID        string       `mapstructure:"clientId,omitempty"`
	CertificateData string       `mapstructure:"certificate-data,omitempty"`
	SubscriptionID  string       `mapstructure:"subscriptionId"`
	Resource        string       `mapstructure:"resource"`
	Tokens          []adal.Token `mapstructure:"tokens"`
}

Context contains a complete Azure configuration spec

func GetAllContexts

func GetAllContexts() ([]*Context, error)

GetAllContexts retrieves all available contexts

func GetContext

func GetContext(name string) (*Context, error)

GetContext retrieves a context by name

func GetCurrentContext

func GetCurrentContext() (*Context, error)

GetCurrentContext retrieves all available contexts

func (*Context) SaveToken

func (cxt *Context) SaveToken(t adal.Token) error

SaveToken persists a token for a given context

type User

type User struct {
	Name            string `mapstructure:"name"`
	TenantID        string `mapstructure:"tenantId"`
	CertificateData string `mapstructure:"certificate-data,omitempty"`
	ClientID        string `mapstructure:"clientId,omitempty"`
	Endpoint        string `mapstructure:"endpoint,omitempty"`
}

User contains the data for a given identity

Jump to

Keyboard shortcuts

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