datasource

package
v0.0.0-...-94e4715 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatasourceTypeEC2 = "ec2"
)
View Source
const (
	ErrDatasourceRetrievalTimeout = errors.Error("datasource: timeout during data-source retrieval")
)

Variables

This section is empty.

Functions

func GetProviders

func GetProviders() map[DatasourceType]Provider

func RegisterProvider

func RegisterProvider(p Provider)

Types

type DatasourceType

type DatasourceType string

type Provider

type Provider interface {
	GetType() DatasourceType
	FetchHostname(ctx context.Context) (string, error)
	FetchLocalIPv4(ctx context.Context) (net.IP, error)
	FetchPublicIPv4(ctx context.Context) (net.IP, error)
	FetchMetadata(ctx context.Context) (*metadata.Digest, error)
}

func FindProvider

func FindProvider(providers map[DatasourceType]Provider, timeout time.Duration) (Provider, error)

FindProvider checks the given datasource providers, if it finds an available data source before the specified duration, it returns the provider, else it returns an ErrDatasourceRetrievalTimeout error

Directories

Path Synopsis
ec2

Jump to

Keyboard shortcuts

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