remote

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHTTPClient

func CreateHTTPClient(config *core.Remote) (*http.Client, error)

CreateHTTPClient creates a httpClient for the given remote settings

Types

type DoguVersionPrinter

type DoguVersionPrinter struct {
	//Remote contains a remote dogu registry reference thath provides dogus and their versions.
	Remote Registry
}

DoguVersionPrinter provides methods for printing available dogu versions.

func (*DoguVersionPrinter) PrintDoguListInDefaultFormat

func (dvp *DoguVersionPrinter) PrintDoguListInDefaultFormat() error

PrintDoguListInDefaultFormat prints all dogus and their latest version in tabular format.

func (*DoguVersionPrinter) PrintForAllDogus

func (dvp *DoguVersionPrinter) PrintForAllDogus(limit int) error

PrintForAllDogus prints versions for all available dogus (up to the given limit). The limit must be zero (0) or a positive integer whereas zero (0) will print all available versions. Otherwise a number of version up to the given limit can be printed.

func (*DoguVersionPrinter) PrintForSingleDogu

func (dvp *DoguVersionPrinter) PrintForSingleDogu(dogu *core.Dogu, limit int) error

PrintForSingleDogu prints versions for the given dogu (up to the given limit). The limit must be zero (0) or a positive integer whereas zero (0) will print all available versions. Otherwise a number of version up to the given limit can be printed.

type FormatURLSchema

type FormatURLSchema struct {
	Endpoint            string
	CreateFormat        string
	GetFormat           string
	GetVersionFormat    string
	GetAllFormat        string
	GetVersionsOfFormat string
}

FormatURLSchema allows the definition of the url schema with string formats. Each format gets the base url plus the the function arguments as format parameters.

func (*FormatURLSchema) Create

func (schema *FormatURLSchema) Create(name string) string

Create returns the url for pushing dogu.json files to the backend

func (*FormatURLSchema) Get

func (schema *FormatURLSchema) Get(name string) string

Get returns the url for the latest version of the dogu

func (*FormatURLSchema) GetAll

func (schema *FormatURLSchema) GetAll() string

GetAll returns the url for fetching all dogu descriptors

func (*FormatURLSchema) GetVersion

func (schema *FormatURLSchema) GetVersion(name string, version string) string

GetVersion returns the url for one specific version of the dogu.json

func (*FormatURLSchema) GetVersionsOf

func (schema *FormatURLSchema) GetVersionsOf(name string) string

GetVersionsOf returns the url for fetching all versions of a dogu

type Registry

type Registry interface {
	// Create the dogu on the remote server.
	Create(dogu *core.Dogu) error
	// Get returns the detail about a dogu from the remote server.
	Get(name string) (*core.Dogu, error)
	// GetVersion returns a version specific detail about the dogu. Name is mandatory. Version is optional; if no version
	// is given then the newest version will be returned.
	GetVersion(name, version string) (*core.Dogu, error)
	// GetAll returns all dogus from the remote server.
	GetAll() ([]*core.Dogu, error)
	// GetVersionsOf return all versions of a dogu.
	GetVersionsOf(name string) ([]core.Version, error)
	// SetUseCache disables or enables the caching for the remote registry.
	SetUseCache(useCache bool)
	// Delete removes a specific dogu descriptor from the dogu registry.
	Delete(dogu *core.Dogu) error
}

Registry is able to manage the remote dogu registry.

func New

func New(remoteConfig *core.Remote, credentials *core.Credentials) (Registry, error)

New creates a new remote registry

func NewMockRegistry

func NewMockRegistry() Registry

NewMockRegistry return a mock implementation of the remote registry and should be used for testing purposes only

type URLSchema

type URLSchema interface {
	// Create returns the url for pushing dogu.json files to the backend
	Create(name string) string
	// Get returns the url for the latest version of the dogu
	Get(name string) string
	// GetVersion returns the url for one specific version of the dogu.json
	GetVersion(name string, version string) string
	// GetAll returns the url for fetching all dogu descriptors
	GetAll() string
	// GetVersionsOf returns the url for fetching all versions of a dogu
	GetVersionsOf(name string) string
}

URLSchema creates the url for the remote backend

func NewDefaultURLSchema

func NewDefaultURLSchema(endpoint string) URLSchema

NewDefaultURLSchema returns the url schema of the active backend.

func NewIndexURLSchema

func NewIndexURLSchema(endpoint string) URLSchema

NewIndexURLSchema returns the url schema which is required if the dogu descriptors are mirrored to a webserver.

func NewURLSchemaByName

func NewURLSchemaByName(name string, endpoint string) URLSchema

NewURLSchemaByName returns the url schema for the given name or nil if no url schema exists with this name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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