apiv1

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RepositoryRegex = "^(artifacts/static/[a-z0-9]+(?:[/._-][a-z0-9]+)*)$"
	URLPath         = "/artifacts/static/api/v1"
)

Variables

This section is empty.

Functions

func MakeEndpointOfDeleteRepository

func MakeEndpointOfDeleteRepository(s Static) endpoint.Endpoint

MakeEndpointOfDeleteRepository creates the endpoint for s.DeleteRepository.

func MakeEndpointOfGetRepositoryFileByName

func MakeEndpointOfGetRepositoryFileByName(s Static) endpoint.Endpoint

MakeEndpointOfGetRepositoryFileByName creates the endpoint for s.GetRepositoryFileByName.

func MakeEndpointOfGetRepositoryFileByTag

func MakeEndpointOfGetRepositoryFileByTag(s Static) endpoint.Endpoint

MakeEndpointOfGetRepositoryFileByTag creates the endpoint for s.GetRepositoryFileByTag.

func MakeEndpointOfListRepositoryFiles

func MakeEndpointOfListRepositoryFiles(s Static) endpoint.Endpoint

MakeEndpointOfListRepositoryFiles creates the endpoint for s.ListRepositoryFiles.

func MakeEndpointOfListRepositoryLogs

func MakeEndpointOfListRepositoryLogs(s Static) endpoint.Endpoint

MakeEndpointOfListRepositoryLogs creates the endpoint for s.ListRepositoryLogs.

func MakeEndpointOfRemoveRepositoryFile

func MakeEndpointOfRemoveRepositoryFile(s Static) endpoint.Endpoint

MakeEndpointOfRemoveRepositoryFile creates the endpoint for s.RemoveRepositoryFile.

func NewHTTPRouter

func NewHTTPRouter(svc Static, codecs httpcodec.Codecs, opts ...httpoption.Option) chi.Router

func OASv2APIDoc

func OASv2APIDoc(schema oas2.Schema) string

func RepositoryMatch added in v0.0.12

func RepositoryMatch(repository string) bool

func ValidateDeleteRepositoryRequest

func ValidateDeleteRepositoryRequest(newSchema func(*DeleteRepositoryRequest) validating.Schema) httpoption.Validator

ValidateDeleteRepositoryRequest creates a validator for DeleteRepositoryRequest.

func ValidateGetRepositoryFileByNameRequest

func ValidateGetRepositoryFileByNameRequest(newSchema func(*GetRepositoryFileByNameRequest) validating.Schema) httpoption.Validator

ValidateGetRepositoryFileByNameRequest creates a validator for GetRepositoryFileByNameRequest.

func ValidateGetRepositoryFileByTagRequest

func ValidateGetRepositoryFileByTagRequest(newSchema func(*GetRepositoryFileByTagRequest) validating.Schema) httpoption.Validator

ValidateGetRepositoryFileByTagRequest creates a validator for GetRepositoryFileByTagRequest.

func ValidateListRepositoryFilesRequest

func ValidateListRepositoryFilesRequest(newSchema func(*ListRepositoryFilesRequest) validating.Schema) httpoption.Validator

ValidateListRepositoryFilesRequest creates a validator for ListRepositoryFilesRequest.

func ValidateListRepositoryLogsRequest

func ValidateListRepositoryLogsRequest(newSchema func(*ListRepositoryLogsRequest) validating.Schema) httpoption.Validator

ValidateListRepositoryLogsRequest creates a validator for ListRepositoryLogsRequest.

func ValidateRemoveRepositoryFileRequest

func ValidateRemoveRepositoryFileRequest(newSchema func(*RemoveRepositoryFileRequest) validating.Schema) httpoption.Validator

ValidateRemoveRepositoryFileRequest creates a validator for RemoveRepositoryFileRequest.

Types

type DeleteRepositoryRequest

type DeleteRepositoryRequest struct {
	Repository string `json:"repository"`
}

type DeleteRepositoryResponse

type DeleteRepositoryResponse struct {
	Err error `json:"-"`
}

func (*DeleteRepositoryResponse) Body

func (r *DeleteRepositoryResponse) Body() interface{}

func (*DeleteRepositoryResponse) Failed

func (r *DeleteRepositoryResponse) Failed() error

Failed implements endpoint.Failer.

type GetRepositoryFileByNameRequest

type GetRepositoryFileByNameRequest struct {
	Repository string `json:"repository"`
	Name       string `json:"name"`
}

type GetRepositoryFileByNameResponse

type GetRepositoryFileByNameResponse struct {
	RepositoryFile *RepositoryFile `json:"repository_file"`
	Err            error           `json:"-"`
}

func (*GetRepositoryFileByNameResponse) Body

func (r *GetRepositoryFileByNameResponse) Body() interface{}

func (*GetRepositoryFileByNameResponse) Failed

Failed implements endpoint.Failer.

type GetRepositoryFileByTagRequest

type GetRepositoryFileByTagRequest struct {
	Repository string `json:"repository"`
	Tag        string `json:"tag"`
}

type GetRepositoryFileByTagResponse

type GetRepositoryFileByTagResponse struct {
	RepositoryFile *RepositoryFile `json:"repository_file"`
	Err            error           `json:"-"`
}

func (*GetRepositoryFileByTagResponse) Body

func (r *GetRepositoryFileByTagResponse) Body() interface{}

func (*GetRepositoryFileByTagResponse) Failed

Failed implements endpoint.Failer.

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient(codecs httpcodec.Codecs, httpClient *http.Client, baseURL string) (*HTTPClient, error)

func (*HTTPClient) DeleteRepository

func (c *HTTPClient) DeleteRepository(ctx context.Context, repository string) (err error)

func (*HTTPClient) GetRepositoryFileByName

func (c *HTTPClient) GetRepositoryFileByName(ctx context.Context, repository string, name string) (repositoryFile *RepositoryFile, err error)

func (*HTTPClient) GetRepositoryFileByTag

func (c *HTTPClient) GetRepositoryFileByTag(ctx context.Context, repository string, tag string) (repositoryFile *RepositoryFile, err error)

func (*HTTPClient) ListRepositoryFiles

func (c *HTTPClient) ListRepositoryFiles(ctx context.Context, repository string, page *Page) (repositoryFiles []*RepositoryFile, err error)

func (*HTTPClient) ListRepositoryLogs

func (c *HTTPClient) ListRepositoryLogs(ctx context.Context, repository string, page *Page) (logs []RepositoryLog, err error)

func (*HTTPClient) RemoveRepositoryFile

func (c *HTTPClient) RemoveRepositoryFile(ctx context.Context, repository string, tag string) (err error)

type ListRepositoryFilesRequest

type ListRepositoryFilesRequest struct {
	Repository string `json:"repository"`
	Page       *Page  `json:"page"`
}

type ListRepositoryFilesResponse

type ListRepositoryFilesResponse struct {
	RepositoryFiles []*RepositoryFile `json:"repository_files"`
	Err             error             `json:"-"`
}

func (*ListRepositoryFilesResponse) Body

func (r *ListRepositoryFilesResponse) Body() interface{}

func (*ListRepositoryFilesResponse) Failed

func (r *ListRepositoryFilesResponse) Failed() error

Failed implements endpoint.Failer.

type ListRepositoryLogsRequest

type ListRepositoryLogsRequest struct {
	Repository string `json:"repository"`
	Page       *Page  `json:"page"`
}

type ListRepositoryLogsResponse

type ListRepositoryLogsResponse struct {
	Logs []RepositoryLog `json:"logs"`
	Err  error           `json:"-"`
}

func (*ListRepositoryLogsResponse) Body

func (r *ListRepositoryLogsResponse) Body() interface{}

func (*ListRepositoryLogsResponse) Failed

func (r *ListRepositoryLogsResponse) Failed() error

Failed implements endpoint.Failer.

type Page

type Page struct {
	Size  int
	Token string
}

type RemoveRepositoryFileRequest

type RemoveRepositoryFileRequest struct {
	Repository string `json:"repository"`
	Tag        string `json:"tag"`
}

type RemoveRepositoryFileResponse

type RemoveRepositoryFileResponse struct {
	Err error `json:"-"`
}

func (*RemoveRepositoryFileResponse) Body

func (r *RemoveRepositoryFileResponse) Body() interface{}

func (*RemoveRepositoryFileResponse) Failed

func (r *RemoveRepositoryFileResponse) Failed() error

Failed implements endpoint.Failer.

type RepositoryFile

type RepositoryFile struct {
	Tag        string `json:"tag"`
	ID         string `json:"id"`
	Name       string `json:"name"`
	UploadTime string `json:"upload_time"`
	Size       uint64 `json:"size"`
}

Repository files.

type RepositoryLog

type RepositoryLog struct {
	Level   string `json:"level"`
	Date    string `json:"date"`
	Message string `json:"message"`
}

Repository logs.

type Static

type Static interface {
	// Delete a static repository.
	//kun:op DELETE /repository
	//kun:success statusCode=200
	DeleteRepository(ctx context.Context, repository string) (err error)

	// List static repository logs.
	//kun:op GET /repository/logs
	//kun:success statusCode=200
	ListRepositoryLogs(ctx context.Context, repository string, page *Page) (logs []RepositoryLog, err error)

	// Get file information by tag from static repository.
	//kun:op GET /repository/file:bytag
	//kun:success statusCode=200
	GetRepositoryFileByTag(ctx context.Context, repository string, tag string) (repositoryFile *RepositoryFile, err error)

	// Get file information by name from static repository.
	//kun:op GET /repository/file:byname
	//kun:success statusCode=200
	GetRepositoryFileByName(ctx context.Context, repository string, name string) (repositoryFile *RepositoryFile, err error)

	// Remove file from static repository.
	//kun:op DELETE /repository/file
	//kun:success statusCode=200
	RemoveRepositoryFile(ctx context.Context, repository string, tag string) (err error)

	// List files for a static repository.
	//kun:op GET /repository/file:list
	//kun:success statusCode=200
	ListRepositoryFiles(ctx context.Context, repository string, page *Page) (repositoryFiles []*RepositoryFile, err error)
}

Static is used for managing static file repositories. This is the API documentation of Static.

Jump to

Keyboard shortcuts

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