plugin

package
v7.0.0-beta.23+incompa... Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client that can be used to make HTTP requests to plugin repositories.

func NewClient

func NewClient(config Config) *Client

NewClient returns a new plugin Client.

func (*Client) DownloadPlugin

func (client *Client) DownloadPlugin(pluginURL string, path string, proxyReader ProxyReader) error

func (*Client) GetPluginRepository

func (client *Client) GetPluginRepository(repositoryURL string) (PluginRepository, error)

func (*Client) WrapConnection

func (client *Client) WrapConnection(wrapper ConnectionWrapper)

WrapConnection wraps the current Client connection in the wrapper.

type Config

type Config struct {
	// AppName is the name of the application/process using the client.
	AppName string

	// AppVersion is the version of the application/process using the client.
	AppVersion string

	// DialTimeout is the DNS lookup timeout for the client. If not set, it is
	// infinite.
	DialTimeout time.Duration

	// SkipSSLValidation controls whether a client verifies the server's
	// certificate chain and host name. If SkipSSLValidation is true, TLS accepts
	// any certificate presented by the server and any host name in that
	// certificate for *all* client requests going forward.
	//
	// In this mode, TLS is susceptible to man-in-the-middle attacks. This should
	// be used only for testing.
	SkipSSLValidation bool
}

Config allows the Client to be configured

type Connection

type Connection interface {
	Make(request *http.Request, passedResponse *Response, proxyReader ProxyReader) error
}

Connection creates and executes http requests

type ConnectionWrapper

type ConnectionWrapper interface {
	Connection
	Wrap(innerconnection Connection) Connection
}

ConnectionWrapper can wrap a given connection allowing the wrapper to modify all requests going in and out of the given connection.

type Plugin

type Plugin struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Version     string         `json:"version"`
	Binaries    []PluginBinary `json:"binaries"`
}

type PluginBinary

type PluginBinary struct {
	Platform string `json:"platform"`
	URL      string `json:"url"`
	Checksum string `json:"checksum"`
}

type PluginConnection

type PluginConnection struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

PluginConnection represents a connection to a plugin repo.

func NewConnection

func NewConnection(skipSSLValidation bool, dialTimeout time.Duration) *PluginConnection

NewConnection returns a new PluginConnection

func (*PluginConnection) Make

func (connection *PluginConnection) Make(request *http.Request, passedResponse *Response, proxyReader ProxyReader) error

Make performs the request and parses the response.

type PluginRepository

type PluginRepository struct {
	Plugins []Plugin `json:"plugins"`
}

PluginRepository represents a plugin repository

type ProxyReader

type ProxyReader interface {
	Wrap(io.Reader) io.ReadCloser
	Start(int64)
	Finish()
}

type Response

type Response struct {
	// Result represents the type that is expected in the
	// response JSON.
	Result interface{}

	// RawResponse represents the response body.
	RawResponse []byte

	// HTTPResponse represents the HTTP response object.
	HTTPResponse *http.Response
}

Response represents a plugin response object.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
wrapperfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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