provider

package
v0.8.10 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 18

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"
	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

func GetRequestID

func GetRequestID(ctx context.Context) string

GetRequestID returns the request-id from the context

func WithRequestID

func WithRequestID(ctx context.Context, requestID string) context.Context

WithRequestID sets the request-id value within the context

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 FnResourceType

type FnResourceType string
const (
	ApplicationResourceType FnResourceType = "app"
	FunctionResourceType    FnResourceType = "function"
	TriggerResourceType     FnResourceType = "trigger"
)

func (FnResourceType) String

func (t FnResourceType) String() 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 {
	APIClientv2() *clientv2.Fn
	// APIURL returns the current API URL base to use with this provider
	APIURL() *url.URL
	// Returns a list of resource types that are not supported by this provider
	UnavailableResources() []FnResourceType
	VersionClient() *version.Client
	// WrapCallTransport adds any request signing or auth to an existing round tripper for calls
	WrapCallTransport(http.RoundTripper) http.RoundTripper
}

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
shim/client
Package client is a generated GoMock package.
Package client is a generated GoMock package.

Jump to

Keyboard shortcuts

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