getter

package
v2.9.0-rc3+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: Apache-2.0 Imports: 13 Imported by: 1,005

Documentation

Overview

Package getter provides a generalize tool for fetching data by scheme.

This provides a method by which the plugin system can load arbitrary protocol handlers based upon a URL scheme.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constructor

type Constructor func(URL, CertFile, KeyFile, CAFile string) (Getter, error)

Constructor is the function for every getter which creates a specific instance according to the configuration

type Getter

type Getter interface {
	//Get file content by url string
	Get(url string) (*bytes.Buffer, error)
}

Getter is an interface to support GET to the specified URL.

type HttpGetter

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

HttpGetter is the efault HTTP(/S) backend handler TODO: change the name to HTTPGetter in Helm 3

func NewHTTPGetter

func NewHTTPGetter(URL, CertFile, KeyFile, CAFile string) (*HttpGetter, error)

NewHTTPGetter constructs a valid http/https client as HttpGetter

func (*HttpGetter) Get

func (g *HttpGetter) Get(href string) (*bytes.Buffer, error)

Get performs a Get from repo.Getter and returns the body.

func (*HttpGetter) SetCredentials

func (g *HttpGetter) SetCredentials(username, password string)

SetCredentials sets the credentials for the getter

type Provider

type Provider struct {
	Schemes []string
	New     Constructor
}

Provider represents any getter and the schemes that it supports.

For example, an HTTP provider may provide one getter that handles both 'http' and 'https' schemes.

func ByScheme

func ByScheme(scheme string, settings environment.EnvSettings) (Provider, error)

ByScheme returns a getter for the given scheme.

If the scheme is not supported, this will return an error.

func (Provider) Provides

func (p Provider) Provides(scheme string) bool

Provides returns true if the given scheme is supported by this Provider.

type Providers

type Providers []Provider

Providers is a collection of Provider objects.

func All

func All(settings environment.EnvSettings) Providers

All finds all of the registered getters as a list of Provider instances. Currently the build-in http/https getter and the discovered plugins with downloader notations are collected.

func (Providers) ByScheme

func (p Providers) ByScheme(scheme string) (Constructor, error)

ByScheme returns a Provider that handles the given scheme.

If no provider handles this scheme, this will return an error.

Jump to

Keyboard shortcuts

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