fetchers

package
v0.0.0-...-cf68769 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SecuritySourceBackground is used when security is set from the compute instance level
	SecuritySourceBackground = "background"
	// SecuritySourceFile is used when security is set by JWT config from a JSON file
	SecuritySourceFile = "file"
)

Variables

This section is empty.

Functions

func InitFetchers

func InitFetchers(cfg *config.Config)

InitFetchers initializes fetchers from config

Types

type AzureStorageFetcher

type AzureStorageFetcher struct {
	// contains filtered or unexported fields
}

AzureStorageFetcher implements Fetcher interface for Azure Storage blobs

func NewAzureStorageFetcher

func NewAzureStorageFetcher(accountName, accountKey, containerName string) *AzureStorageFetcher

NewAzureStorageFetcher creates a new Azure Storage fetcher instance

func (*AzureStorageFetcher) Fetch

func (f *AzureStorageFetcher) Fetch(ctx context.Context, path string) (io.ReadCloser, error)

Fetch downloads a blob from Azure Storage

type CloudflareR2Fetcher

type CloudflareR2Fetcher struct {
	Name        string
	FetcherType string
	// contains filtered or unexported fields
}

CloudflareR2Fetcher implements Fetcher interface for Cloudflare R2

func NewCloudflareR2Fetcher

func NewCloudflareR2Fetcher(cfg map[string]interface{}) *CloudflareR2Fetcher

NewCloudflareR2Fetcher creates a new Cloudflare R2 fetcher instance

func (*CloudflareR2Fetcher) Fetch

func (f *CloudflareR2Fetcher) Fetch(c echo.Context, fileURL string) (io.Reader, string, error)

Fetch downloads an object from Cloudflare R2

func (*CloudflareR2Fetcher) GetFetcherType

func (fetcher *CloudflareR2Fetcher) GetFetcherType() string

GetFetcherType returns the type of this fetcher to be used in the 'type' properties when defining fetchers

func (*CloudflareR2Fetcher) GetName

func (fetcher *CloudflareR2Fetcher) GetName() string

GetName returns the name assigned to this fetcher that can be used in the 'paths' section

type DigitalOceanSpacesFetcher

type DigitalOceanSpacesFetcher struct {
	Name string
	// contains filtered or unexported fields
}

DigitalOceanSpacesFetcher implements Fetcher interface for DigitalOcean Spaces

func NewDigitalOceanSpacesFetcher

func NewDigitalOceanSpacesFetcher(cfg map[string]interface{}) *DigitalOceanSpacesFetcher

NewDigitalOceanSpacesFetcher creates a new DigitalOcean Spaces fetcher instance

func (*DigitalOceanSpacesFetcher) Fetch

func (f *DigitalOceanSpacesFetcher) Fetch(c echo.Context, path string) (io.Reader, string, error)

Fetch downloads an object from DigitalOcean Spaces

func (*DigitalOceanSpacesFetcher) GetFetcherType

func (f *DigitalOceanSpacesFetcher) GetFetcherType() string

GetFetcherType returns the type of this fetcher

func (*DigitalOceanSpacesFetcher) GetName

func (f *DigitalOceanSpacesFetcher) GetName() string

GetName returns the name assigned to this fetcher

type Fetcher

type Fetcher interface {
	GetName() string
	GetFetcherType() string
	Fetch(ctx echo.Context, url string) (responseBody io.Reader, contentType string, err error)
}

Fetcher interface handles fetching content from different sources

func GetFetcherByName

func GetFetcherByName(name string) Fetcher

GetFetcherByName returns a fetcher by its configured name

func GetFetcherByPath

func GetFetcherByPath(path string) Fetcher

GetFetcherByPath returns the fetcher specified by its path

func GetFetcherByType

func GetFetcherByType(fetcherType string) Fetcher

GetFetcherByType returns the fetcher specified by its type

type GoogleStroageFetcher

type GoogleStroageFetcher struct {
	Name        string
	FetcherType string
	Bucket      string
	Path        string

	ProjectID              string
	SecuritySource         string
	ServiceAccountJSONFile string
}

GoogleStroageFetcher fetches content from http/https sources

URL Format used: gs://bucketName/path/file

func NewGoogleStroageFetcher

func NewGoogleStroageFetcher(cfg map[string]interface{}) *GoogleStroageFetcher

NewGoogleStroageFetcher creates a new fetcher that support Google Storage buckets

func (*GoogleStroageFetcher) Fetch

func (fetcher *GoogleStroageFetcher) Fetch(c echo.Context, url string) (io.Reader, string, error)

Fetch returns content from the local machine

func (*GoogleStroageFetcher) GetFetcherType

func (fetcher *GoogleStroageFetcher) GetFetcherType() string

GetFetcherType returns the type of this fetcher to be used in the 'type' properties when defining fetchers

func (*GoogleStroageFetcher) GetName

func (fetcher *GoogleStroageFetcher) GetName() string

GetName returns the name assigned to this fetcher that can be used in the 'paths' section

type HTTPFetcher

type HTTPFetcher struct {
	Name        string
	FetcherType string

	UserName string
	Password string

	Secure        bool
	RestrictHosts []string
	RestrictPaths []string
}

HTTPFetcher fetches content from http/https sources

func NewHTTPFetcher

func NewHTTPFetcher(cfg map[string]interface{}) *HTTPFetcher

NewHTTPFetcher creates a new fetcher that support http/https

func (*HTTPFetcher) Fetch

func (fetcher *HTTPFetcher) Fetch(c echo.Context, url string) (io.Reader, string, error)

Fetch returns content from http/https sources

func (*HTTPFetcher) GetFetcherType

func (fetcher *HTTPFetcher) GetFetcherType() string

GetFetcherType returns the type of this fetcher to be used in the 'type' properties when defining fetchers

func (*HTTPFetcher) GetName

func (fetcher *HTTPFetcher) GetName() string

GetName returns the name assigned to this fetcher that can be used in the 'paths' section

type LocalFetcher

type LocalFetcher struct {
	Name        string
	FetcherType string

	Path string
}

LocalFetcher fetches content from http/https sources

func NewLocalFetcher

func NewLocalFetcher(cfg map[string]interface{}) *LocalFetcher

NewLocalFetcher creates a new fetcher that support http/https

func (*LocalFetcher) Fetch

func (fetcher *LocalFetcher) Fetch(c echo.Context, url string) (io.Reader, string, error)

Fetch returns content from the local machine

func (*LocalFetcher) GetFetcherType

func (fetcher *LocalFetcher) GetFetcherType() string

GetFetcherType returns the type of this fetcher to be used in the 'type' properties when defining fetchers

func (*LocalFetcher) GetName

func (fetcher *LocalFetcher) GetName() string

GetName returns the name assigned to this fetcher that can be used in the 'paths' section

type S3Fetcher

type S3Fetcher struct {
	Name            string
	FetcherType     string
	Region          string
	AccessKeyID     string
	SecretAccessKey string
}

S3Fetcher fetches content from an s3 bucket

func NewS3Fetcher

func NewS3Fetcher(cfg map[string]interface{}) *S3Fetcher

NewS3Fetcher creates a new fetcher that support s3 bucket

func (*S3Fetcher) Fetch

func (fetcher *S3Fetcher) Fetch(c echo.Context, fileURL string) (io.Reader, string, error)

Fetch returns content from the local machine

It supports the following S3 URL format: - path style: s3://s3-aws-region.amazonaws.com/bucket/path/file - path style without region: s3://s3.amazonaws.com/bucket/path/file - default region must be configured in the configuration The bucket and path will be extracted from the URL.

If you are accessing an S3 file that is accessible via anonymous direct HTTP/S consider using the http fetcher.

func (*S3Fetcher) GetFetcherType

func (fetcher *S3Fetcher) GetFetcherType() string

GetFetcherType returns the type of this fetcher to be used in the 'type' properties when defining fetchers

func (*S3Fetcher) GetName

func (fetcher *S3Fetcher) GetName() string

GetName returns the name assigned to this fetcher that can be used in the 'paths' section

Jump to

Keyboard shortcuts

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