provider

package
v0.0.0-...-f090fa9 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//CfgFnAPIURL is a config key used as the default URL for resolving the API server - different providers may generate URLs in their own way
	CfgFnAPIURL  = "api-url"
	CfgFnCallURL = "call-url"
	CfgFnToken   = "token"
)

Variables

This section is empty.

Functions

func CanonicalFnAPIUrl

func CanonicalFnAPIUrl(urlStr string) (*url.URL, error)

CanonicalFnAPIUrl canonicalises an *FN_API_URL to a default value

Types

type ConfigSource

type ConfigSource interface {
	GetString(string) string
	GetBool(string) bool
	IsSet(string) bool
}

ConfigSource abstracts loading configuration keys from an underlying configuration system such as Viper

func NewConfigSourceFromMap

func NewConfigSourceFromMap(m map[string]string) ConfigSource

NewConfigSourceFromMap creates a config source from a map of literal string

type NopPassPhraseSource

type NopPassPhraseSource struct{}

NopPassPhraseSource always returns an error when request for a passphrase

func (*NopPassPhraseSource) ChallengeForPassPhrase

func (*NopPassPhraseSource) ChallengeForPassPhrase(id, msg string) (string, error)

type PassPhraseSource

type PassPhraseSource interface {
	//ChallengeForPassPhrase requests a passphrase with a given prompt from the user
	ChallengeForPassPhrase(id, prompt string) (string, error)
}

PassPhraseSource provides a passphrase from an external source (e.g. a user prompt or a terminal)

type Provider

type Provider interface {
	// APIURL returns the current API URL base to use with this provider
	APIURL() *url.URL
	// CallURL returns the default Call URL base to use with this provider
	CallURL(string) (*url.URL, error)
	// WrapCallTransport adds any request signing or auth to an existing round tripper for calls
	WrapCallTransport(http.RoundTripper) http.RoundTripper
	APIClient() *client.Fn
	APIClientv2() *clientv2.Fn
	VersionClient() *version.Client
}

Provider creates API clients for Fn calls adding any required middleware

type ProviderFunc

type ProviderFunc func(config ConfigSource, source PassPhraseSource) (Provider, error)

ProviderFunc constructs a provider

type Providers

type Providers struct {
	Providers map[string]ProviderFunc
}

Providers describes a set of providers

func (*Providers) ProviderFromConfig

func (c *Providers) ProviderFromConfig(id string, source ConfigSource, phraseSource PassPhraseSource) (Provider, error)

ProviderFromConfig returns the provider corresponding to a given identifier populated with configuration from source - if a passphrase is required then it is request from phraseSource

func (*Providers) Register

func (c *Providers) Register(name string, pf ProviderFunc)

Register adds a named provider to a configuration

type TerminalPassPhraseSource

type TerminalPassPhraseSource struct{}

TerminalPassPhraseSource requests a passphrase from the terminal

func (*TerminalPassPhraseSource) ChallengeForPassPhrase

func (*TerminalPassPhraseSource) ChallengeForPassPhrase(id, msg string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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