restserver

package
v0.0.0-...-ede9753 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: AGPL-3.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	HeaderBobExists = "Bob-Exists"
)

Variables

View Source
var (
	ErrServerAlreadyStarted  = fmt.Errorf("Server already started")
	ErrTooManyListenConfigs  = fmt.Errorf("Only http or unix config can be set, not both")
	ErrInvalidBase64Encoding = fmt.Errorf("Invalid base64 encoding")

	ErrUnauthorized     = fmt.Errorf("Unauthorized")
	ErrServerNotStarted = fmt.Errorf("Server not started yet")

	ErrInvalidProjectID = fmt.Errorf("Project ID is not in valid format")
)
View Source
var (
	DefaultUploadDir = filepath.Join(os.TempDir(), "./upload")
)

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Authenticate(ctx echo.Context) (err error)
}

type Option

type Option func(s *S)

func WithArtifactService

func WithArtifactService(srv application.Application) Option

func WithAuthenticator

func WithAuthenticator(authn Authenticator) Option

func WithHost

func WithHost(hostname, port string) Option

func WithUploadDir

func WithUploadDir(uploadPath string) Option

type S

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

func New

func New(opts ...Option) (s *S, err error)

func (*S) Address

func (s *S) Address() string

Address the server adderss (host&port) without the protocol http/https

func (*S) CreateProject

func (s *S) CreateProject(ctx echo.Context) (err error)

Create a new project by name. also adds the hashes after the creation of project (POST /api/project)

func (*S) DeleteProject

func (s *S) DeleteProject(ctx echo.Context, projectId string) (err error)

Delete a project by id. (DELETE /api/project/{project_id})

func (*S) DeleteProjectArtifact

func (s *S) DeleteProjectArtifact(ctx echo.Context, projectName, artifactId string) (err error)

DeleteProjectArtifact deletes a project artifact (DELETE /api/project/{projectName}/artifact/{artifactId})

func (*S) GetHealth

func (s *S) GetHealth(ctx echo.Context) error

func (*S) GetProject

func (s *S) GetProject(ctx echo.Context, projectId string) (err error)

Returns a single project by id. (GET /api/project/{project_id})

func (*S) GetProjectArtifact

func (s *S) GetProjectArtifact(ctx echo.Context, projectName, artifactId string) (err error)

GetProjectArtifact returns specific project artifact (GET /api/project/{projectName}/artifact/{artifactId})

func (*S) GetProjectArtifacts

func (s *S) GetProjectArtifacts(ctx echo.Context, projectName string) (err error)

GetProjectArtifacts returns a list of all the artifacts of a project (GET /api/project/{projectName}/artifacts)

func (*S) GetProjects

func (s *S) GetProjects(ctx echo.Context) (err error)

Returns a list of projects with name and ID, without hashes. (GET /api/projects)

func (*S) ProjectArtifactExists

func (s *S) ProjectArtifactExists(ctx echo.Context, projectName, artifactId string) (err error)

ProjectArtifactExists returns http.StatusConflict if artifact exists under a project, else http.StatusOK. (HEAD /api/project/{projectName}/artifact/{artifactId})

func (*S) ProjectExists

func (s *S) ProjectExists(ctx echo.Context, projectId string) (err error)

func (*S) Start

func (s *S) Start() (err error)

Start the server. Can be called only once.

func (*S) Stop

func (s *S) Stop() (err error)

Stop the server from the outside

func (*S) UploadArtifact

func (s *S) UploadArtifact(ctx echo.Context, projectName string) (err error)

UploadArtifact creates a new artifact inside a project (POST /api/project/{projectName}/artifacts

Directories

Path Synopsis
Package generated provides primitives to interact with the openapi HTTP API.
Package generated provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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