registry

package
v0.0.0-...-4b98c26 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Proxy

func Proxy(req *http.Request, registries []*url.URL, cache CacheControl) (*http.Response, error)

Proxy will proxy the given request to the registries in sequence and return the response as io.ReadCloser when finding a registry returning a HTTP 200OK response.

func ProxyMaintenance

func ProxyMaintenance(registries []*url.URL) ([]json.RawMessage, error)

ProxyMaintenance will proxy the given request to the registries to fetch all the apps in maintenance.

Types

type Application

type Application struct {
	Slug                 string             `json:"slug"`
	Type                 string             `json:"type"`
	MaintenanceActivated bool               `json:"maintenance_activated,omitempty"`
	MaintenanceOptions   MaintenanceOptions `json:"maintenance_options"`
}

An Application describe an application on the registry

func GetApplication

func GetApplication(slug string, registries []*url.URL) (*Application, error)

GetApplication returns an application from his slug

type AppsPaginated

type AppsPaginated struct {
	Apps     []map[string]interface{} `json:"data"`
	PageInfo PageInfo                 `json:"meta"`
}

AppsPaginated is a struct for listing apps manifest from the registry, with pagination.

func ProxyList

func ProxyList(req *http.Request, registries []*url.URL) (*AppsPaginated, error)

ProxyList will proxy the given request to the registries by aggregating the results along the way. It should be used for list endpoints.

type CacheControl

type CacheControl int

CacheControl defines whether or not to use caching for the request made to the registries.

const (
	// WithCache specify caching
	WithCache CacheControl = iota
	// NoCache disables any caching
	NoCache
)

type MaintenanceOptions

type MaintenanceOptions struct {
	FlagInfraMaintenance   bool `json:"flag_infra_maintenance"`
	FlagShortMaintenance   bool `json:"flag_short_maintenance"`
	FlagDisallowManualExec bool `json:"flag_disallow_manual_exec"`
}

A MaintenanceOptions defines options about a maintenance

type PageInfo

type PageInfo struct {
	Count      int    `json:"count"`
	NextCursor string `json:"next_cursor,omitempty"`
}

PageInfo is the metadata for pagination.

type Version

type Version struct {
	Slug      string          `json:"slug"`
	Version   string          `json:"version"`
	URL       string          `json:"url"`
	Sha256    string          `json:"sha256"`
	CreatedAt time.Time       `json:"created_at"`
	Size      string          `json:"size"`
	Manifest  json.RawMessage `json:"manifest"`
	TarPrefix string          `json:"tar_prefix"`
}

A Version describes a specific release of an application.

func GetLatestVersion

func GetLatestVersion(slug, channel string, registries []*url.URL) (*Version, error)

GetLatestVersion returns the latest version available from the list of registries by resolving them in sequence using the specified application slug and channel name.

func GetVersion

func GetVersion(slug, version string, registries []*url.URL) (*Version, error)

GetVersion returns a specific version from a slug name

Jump to

Keyboard shortcuts

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