webpack

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

View Source
const CurrentVersion = "pack/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	roundtrip.Client
}

func NewAuthenticatedClient

func NewAuthenticatedClient(addr, username, password string, params ...roundtrip.ClientParam) (*Client, error)

NewAuthenticatedClient returns client authenticated as a user with given password

func NewBearerClient

func NewBearerClient(addr, token string, params ...roundtrip.ClientParam) (*Client, error)

NewBearerClient returns a new client that user bearer token for authentication

func NewClient

func NewClient(addr string, params ...roundtrip.ClientParam) (*Client, error)

func (*Client) CreatePackage

func (c *Client) CreatePackage(loc loc.Locator, data io.Reader, options ...pack.PackageOption) (*pack.PackageEnvelope, error)

func (*Client) Delete

func (c *Client) Delete(u string) (*roundtrip.Response, error)

Delete issues http Delete Request to the server

func (*Client) DeleteExpired

func (c *Client) DeleteExpired() error

func (*Client) DeletePackage

func (c *Client) DeletePackage(locator loc.Locator) error

func (*Client) DeleteRepository

func (c *Client) DeleteRepository(repository string) error

func (*Client) Get

func (c *Client) Get(u string, params url.Values) (*roundtrip.Response, error)

Get issues http GET request to the server

func (*Client) GetPackages

func (c *Client) GetPackages(repository string) ([]pack.PackageEnvelope, error)

func (*Client) GetRepositories

func (c *Client) GetRepositories() ([]string, error)

func (*Client) GetRepository

func (c *Client) GetRepository(repository string) (storage.Repository, error)

func (*Client) PackageDownloadURL

func (c *Client) PackageDownloadURL(loc loc.Locator) string

func (*Client) PortalURL

func (c *Client) PortalURL() string

func (*Client) PostForm

func (c *Client) PostForm(
	endpoint string,
	vals url.Values,
	files ...roundtrip.File) (*roundtrip.Response, error)

PostForm is a generic method that issues http POST request to the server

func (*Client) ReadPackage

func (c *Client) ReadPackage(loc loc.Locator) (*pack.PackageEnvelope, io.ReadCloser, error)

func (*Client) ReadPackageEnvelope

func (c *Client) ReadPackageEnvelope(loc loc.Locator) (*pack.PackageEnvelope, error)

func (*Client) UpdatePackageLabels

func (c *Client) UpdatePackageLabels(loc loc.Locator, addLabels map[string]string, removeLabels []string) error

UpdatePackageLabels updates package's labels

func (*Client) UpsertPackage

func (c *Client) UpsertPackage(loc loc.Locator, data io.Reader, options ...pack.PackageOption) (*pack.PackageEnvelope, error)

func (*Client) UpsertRepository

func (c *Client) UpsertRepository(repository string, expires time.Time) error

type Config

type Config struct {
	// Packages provides access to the package service.
	Packages pack.PackageService
	// Users provides access to the users service.
	Users users.Identity
	// Authenticator is used to authenticate requests.
	Authenticator users.Authenticator
}

Config defines package service web handler configuration.

func (*Config) CheckAndSetDefaults

func (c *Config) CheckAndSetDefaults() error

CheckAndSetDefaults validates the request and sets some defaults.

type Server

type Server struct {
	httprouter.Router
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(cfg Config) (*Server, error)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP lets the authentication middleware serve the request before passing it through to the router.

Jump to

Keyboard shortcuts

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