rest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: ISC Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelsService

type ModelsService interface {
	ArchiveByLabel(ctx context.Context, id app.ServableID, label string) (*app.Archive, error)
	ArchiveByVersion(ctx context.Context, id app.ServableID, version int64) (*app.Archive, error)
	GetConfigStream(ctx context.Context, team, project string) ([]byte, error)

	ListModels(ctx context.Context, params app.QueryParameters) ([]*app.ModelData, error)
	ListModelsByProject(ctx context.Context, team, project string) ([]*app.ModelData, error)
	ListModelsByName(ctx context.Context, id app.ServableID) ([]*app.ModelData, error)
	ReloadModels(ctx context.Context, team, project string, skipConfigWithoutLabels bool) ([]app.ReloadResponse, error)
	UploadModel(ctx context.Context, model app.ServableID, file io.Reader, label ...string) (*app.ModelID, error)

	RemoveByLabel(ctx context.Context, id app.ServableID, label string) error
	RemoveByVersion(ctx context.Context, id app.ServableID, version int64) error
	RemoveModelLabel(ctx context.Context, id app.ServableID, label string) error

	Revert(ctx context.Context, id app.ServableID) (*app.LabelChanged, error)
	SetLabel(ctx context.Context, model app.ModelID) (*app.LabelChanged, error)
}

ModelsService is the interface that ...

type ModulesService

type ModulesService interface {
	GetArchiveByVersion(ctx context.Context, id app.ServableID, version int64) (*app.Archive, error)
	ListModules(ctx context.Context, params app.QueryParameters) ([]*app.ModuleData, error)
	ListModulesByName(ctx context.Context, id app.ServableID) ([]*app.ModuleData, error)
	ListModulesByProject(ctx context.Context, team, project string) ([]*app.ModuleData, error)
	UploadModule(ctx context.Context, module app.ServableID, file io.Reader) (*app.ModuleID, error)
	RemoveByVersion(ctx context.Context, module app.ServableID, version int64) error
}

ModulesService is the interface that ...

type REST

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

REST represents restful API methods

func NewREST

func NewREST(modelsSrv ModelsService, modulesSrv ModulesService, listenPort, version string) *REST

NewREST returns new instance of REST struct

func (*REST) Mount

func (rest *REST) Mount()

Mount mounts each restful endpoints into router

type URLParams

type URLParams struct {
	Team            string `validate:"required,max=32,min=1"`
	Project         string `validate:"required,max=32,min=1"`
	Name            string `validate:"omitempty,max=32,min=1"`
	Version         int64  `validate:"omitempty,gte=1,lte=999"`
	Label           string `validate:"omitempty,max=32,min=1"`
	Status          string `validate:"omitempty,max=32,min=1"`
	SkipShortConfig bool   `validate:"omitempty"`
}

URLParams is dedicated struct to hold parameters given in URL

func (*URLParams) QueryParameters

func (p *URLParams) QueryParameters() app.QueryParameters

QueryParameters returns a QueryParameters struct based on current URLParams

func (*URLParams) ServableID

func (p *URLParams) ServableID() app.ServableID

ServableID returns a ServableID struct based on current URLParams

type UploadModelResponse

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

UploadModelResponse holds such of information like modelID or response code that are returned after uploading a model

type UploadModuleResponse

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

UploadModuleResponse holds such of information like moduleID or response code that are returned after uploading a module

Jump to

Keyboard shortcuts

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