server

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchivistaService

type ArchivistaService struct {
	Ctx context.Context // context for the service
	Cfg *config.Config  // configuration for the service (if none it uses environment variables)
	// contains filtered or unexported fields
}

ArchivistaService is the implementation of the Archivista service

func (*ArchivistaService) GetFileStoreCh

func (a *ArchivistaService) GetFileStoreCh() <-chan error

GetFileStoreCh returns the file store channel

func (*ArchivistaService) GetSQLStoreCh

func (a *ArchivistaService) GetSQLStoreCh() <-chan error

GetSQLStoreCh returns the SQL store channel

func (*ArchivistaService) Setup

func (a *ArchivistaService) Setup() (*Server, error)

Setup Archivista Service

type Getter

type Getter interface {
	Get(context.Context, string) (io.ReadCloser, error)
}

type Option

type Option func(*Server)

func WithArtifactStore

func WithArtifactStore(wds artifactstore.Store) Option

func WithEntSqlClient

func WithEntSqlClient(sqlClient *ent.Client) Option

func WithMetadataStore

func WithMetadataStore(metadataStore Storer) Option

func WithObjectStore

func WithObjectStore(objectStore StorerGetter) Option

func WithPublishers added in v0.6.0

func WithPublishers(pub []publisherstore.Publisher) Option

type Server

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

func New

func New(cfg *config.Config, opts ...Option) (Server, error)

func (*Server) AllArtifactsHandler

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

@Summary List all Artifacts @Description retrieves details about all available Artifacts @Produce json @Success 200 {object} map[string]artifactstore.Artifact @Failure 500 {object} string @Failure 400 {object} string @Tags Artifacts @Router /v1/artifacts [get]

func (*Server) ArtifactAllVersionsHandler

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

@Summary List Artifact Versions @Description retrieves details about all available versions of a specified artifact @Produce json @Param name path string true "artifact name" @Success 200 {object} map[string]artifactstore.Version @Failure 500 {object} string @Failure 400 {object} string @Tags Artifacts @Router /v1/artifacts/{name} [get]

func (*Server) ArtifactVersionHandler

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

@Summary Artifact Version Details @Description retrieves details about a specified version of an artifact @Produce json @Param name path string true "artifact name" @Param version path string true "version of artifact" @Success 200 {object} artifactstore.Version @Failure 500 {objecpec} string @Failure 404 {object} nil @Failure 400 {object} string @Tags Artifacts @Router /v1/artifacts/{name}/{version} [get]

func (*Server) Download

func (s *Server) Download(ctx context.Context, gitoid string) (io.ReadCloser, error)

@Summary Download @Description download an attestation @Produce json @Param gitoid path string true "gitoid" @Success 200 {object} dsse.Envelope @Failure 500 {object} string @Failure 404 {object} nil @Failure 400 {object} string @Tags attestation @Router /v1/download/{gitoid} [get]

func (*Server) DownloadArtifactHandler

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

@Summary Download Artifact @Description downloads a specified distribution of an artifact @Produce octet-stream @Param name path string true "name of artifact" @Param version path string true "version of artifact to download" @Param distribution path string true "distribution of artifact to download" @Success 200 {file} octet-stream @Failure 500 {object} string @Failure 404 {object} nil @Failure 400 {object} string @Tags Artifacts @Router /v1/download/artifact/{name}/{version}/{distribution} [get]

func (*Server) DownloadHandler

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

@Summary Download @Description download an attestation @Produce json @Param gitoid path string true "gitoid" @Success 200 {object} dsse.Envelope @Failure 500 {object} string @Failure 404 {object} nil @Failure 400 {object} string @Deprecated @Router /download/{gitoid} [get]

func (*Server) Query

func (s *Server) Query(sqlclient *ent.Client) *handler.Server

@Summary Query GraphQL @Description GraphQL query @Produce json @Success 200 {object} archivista.Resolver @Tags graphql @Router /v1/query [post]

func (*Server) Router

func (s *Server) Router() *mux.Router

@title Archivista API @description Archivista API @version v1 @contact.name Archivista Contributors @contact.url https://github.com/in-toto/archivista/issues/new @license Apache 2 @license.url https://opensource.org/licenses/Apache-2 InitRoutes initializes the HTTP API routes for the server

func (*Server) Upload

func (s *Server) Upload(ctx context.Context, r io.Reader) (api.UploadResponse, error)

@Summary Upload @Description stores an attestation @Produce json @Success 200 {object} api.StoreResponse @Tags attestation @Router /v1/upload [post]

func (*Server) UploadHandler

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

@Summary Upload @Description stores an attestation @Produce json @Success 200 {object} api.StoreResponse @Router /upload [post] @Deprecated

type Service

type Service interface {
	Setup() (Server, error)
	GetConfig() *config.Config
	GetFileStoreCh() chan error
	GetSQLStoreCh() chan error
}

Service is the interface for the Archivista service

type Storer

type Storer interface {
	Store(context.Context, string, []byte) error
}

type StorerGetter

type StorerGetter interface {
	Storer
	Getter
}

Jump to

Keyboard shortcuts

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