provider

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultProvider

func NewDefaultProvider() interface{}

a NULL provider that does nothing but prevents NPEs in case someone forgets to actually initializa a 'real' platform provider

Types

type AuthenticationProvider

type AuthenticationProvider interface {
	// Send an account challenge to confirm the account
	AccountChallengeNotification(context.Context, string, string) error
	// Send the new token
	ProvideAuthorizationToken(context.Context, string, string, string) error
	// Options returns the provider configuration
	Options() *AuthenticationProviderConfig
}

type AuthenticationProviderConfig

type AuthenticationProviderConfig struct {
	Scope                    string
	Endpoint                 string
	AuthenticationExpiration int
	AuthorizationExpiration  int
}

type ErrorReportingProvider

type ErrorReportingProvider interface {
	ReportError(error)
}

type GenericProvider

type GenericProvider interface {
	Close() error
}

type HttpContextProvider

type HttpContextProvider interface {
	NewHttpContext(*http.Request) context.Context
}

type HttpMethod

type HttpMethod int
const (
	HttpMethodGet HttpMethod = iota
	HttpMethodPost
	HttpMethodPut
	HttpMethodDelete
)

type HttpTask

type HttpTask struct {
	Method  HttpMethod
	Request string
	Token   string
	Payload interface{}
}

type HttpTaskProvider

type HttpTaskProvider interface {
	CreateHttpTask(context.Context, HttpTask) error
}

type InstanceProviderFunc

type InstanceProviderFunc func() interface{}

type LoggingProvider

type LoggingProvider interface {
	Log(string, ...string)
	LogWithLevel(Severity, string, ...string)
}

LoggingProvider defines a generic logging provider

type MetricsProvider

type MetricsProvider interface {
	Meter(ctx context.Context, metric string, args ...string)
}

type ProviderConfig

type ProviderConfig struct {
	ID   string
	Type ProviderType
	Impl InstanceProviderFunc
}

func WithProvider

func WithProvider(ID string, providerType ProviderType, impl InstanceProviderFunc) ProviderConfig

WithProvider returns a populated ProviderConfig struct.

type ProviderType

type ProviderType int
const (
	TypeLogger ProviderType = iota
	TypeErrorReporter
	TypeHttpContext
	TypeTask
	TypeMetrics
	TypeAuthentication
)

func (ProviderType) String

func (l ProviderType) String() string

Returns the name of a provider type

type Severity

type Severity int
const (
	LevelInfo Severity = iota
	LevelWarn
	LevelError
	LevelDebug
)

Jump to

Keyboard shortcuts

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