apiv1

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func MakeEndpointOfCreateRepository

func MakeEndpointOfCreateRepository(s Mirror) endpoint.Endpoint

MakeEndpointOfCreateRepository creates the endpoint for s.CreateRepository.

func MakeEndpointOfDeleteRepository

func MakeEndpointOfDeleteRepository(s Mirror) endpoint.Endpoint

MakeEndpointOfDeleteRepository creates the endpoint for s.DeleteRepository.

func MakeEndpointOfGetRepository

func MakeEndpointOfGetRepository(s Mirror) endpoint.Endpoint

MakeEndpointOfGetRepository creates the endpoint for s.GetRepository.

func MakeEndpointOfGetRepositoryFile

func MakeEndpointOfGetRepositoryFile(s Mirror) endpoint.Endpoint

MakeEndpointOfGetRepositoryFile creates the endpoint for s.GetRepositoryFile.

func MakeEndpointOfGetRepositorySyncStatus

func MakeEndpointOfGetRepositorySyncStatus(s Mirror) endpoint.Endpoint

MakeEndpointOfGetRepositorySyncStatus creates the endpoint for s.GetRepositorySyncStatus.

func MakeEndpointOfListRepositoryFiles

func MakeEndpointOfListRepositoryFiles(s Mirror) endpoint.Endpoint

MakeEndpointOfListRepositoryFiles creates the endpoint for s.ListRepositoryFiles.

func MakeEndpointOfListRepositoryLogs

func MakeEndpointOfListRepositoryLogs(s Mirror) endpoint.Endpoint

MakeEndpointOfListRepositoryLogs creates the endpoint for s.ListRepositoryLogs.

func MakeEndpointOfSyncRepository

func MakeEndpointOfSyncRepository(s Mirror) endpoint.Endpoint

MakeEndpointOfSyncRepository creates the endpoint for s.SyncRepository.

func MakeEndpointOfUpdateRepository

func MakeEndpointOfUpdateRepository(s Mirror) endpoint.Endpoint

MakeEndpointOfUpdateRepository creates the endpoint for s.UpdateRepository.

func NewHTTPRouter

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

func OASv2APIDoc

func OASv2APIDoc(schema oas2.Schema) string

func RepositoryMatch

func RepositoryMatch(repository string) bool

func ValidateCreateRepositoryRequest

func ValidateCreateRepositoryRequest(newSchema func(*CreateRepositoryRequest) validating.Schema) httpoption.Validator

ValidateCreateRepositoryRequest creates a validator for CreateRepositoryRequest.

func ValidateDeleteRepositoryRequest

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

ValidateDeleteRepositoryRequest creates a validator for DeleteRepositoryRequest.

func ValidateGetRepositoryFileRequest

func ValidateGetRepositoryFileRequest(newSchema func(*GetRepositoryFileRequest) validating.Schema) httpoption.Validator

ValidateGetRepositoryFileRequest creates a validator for GetRepositoryFileRequest.

func ValidateGetRepositoryRequest

func ValidateGetRepositoryRequest(newSchema func(*GetRepositoryRequest) validating.Schema) httpoption.Validator

ValidateGetRepositoryRequest creates a validator for GetRepositoryRequest.

func ValidateGetRepositorySyncStatusRequest

func ValidateGetRepositorySyncStatusRequest(newSchema func(*GetRepositorySyncStatusRequest) validating.Schema) httpoption.Validator

ValidateGetRepositorySyncStatusRequest creates a validator for GetRepositorySyncStatusRequest.

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 ValidateSyncRepositoryRequest

func ValidateSyncRepositoryRequest(newSchema func(*SyncRepositoryRequest) validating.Schema) httpoption.Validator

ValidateSyncRepositoryRequest creates a validator for SyncRepositoryRequest.

func ValidateUpdateRepositoryRequest

func ValidateUpdateRepositoryRequest(newSchema func(*UpdateRepositoryRequest) validating.Schema) httpoption.Validator

ValidateUpdateRepositoryRequest creates a validator for UpdateRepositoryRequest.

Types

type CreateRepositoryRequest

type CreateRepositoryRequest struct {
	Repository string                `json:"repository"`
	Properties *RepositoryProperties `json:"properties"`
}

type CreateRepositoryResponse

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

func (*CreateRepositoryResponse) Body

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

func (*CreateRepositoryResponse) Failed

func (r *CreateRepositoryResponse) Failed() error

Failed implements endpoint.Failer.

type DeleteRepositoryRequest

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

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 GetRepositoryFileRequest

type GetRepositoryFileRequest struct {
	Repository string `json:"repository"`
	File       string `json:"file"`
}

type GetRepositoryFileResponse

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

func (*GetRepositoryFileResponse) Body

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

func (*GetRepositoryFileResponse) Failed

func (r *GetRepositoryFileResponse) Failed() error

Failed implements endpoint.Failer.

type GetRepositoryRequest

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

type GetRepositoryResponse

type GetRepositoryResponse struct {
	Properties *RepositoryProperties `json:"properties"`
	Err        error                 `json:"-"`
}

func (*GetRepositoryResponse) Body

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

func (*GetRepositoryResponse) Failed

func (r *GetRepositoryResponse) Failed() error

Failed implements endpoint.Failer.

type GetRepositorySyncStatusRequest

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

type GetRepositorySyncStatusResponse

type GetRepositorySyncStatusResponse struct {
	SyncStatus *SyncStatus `json:"sync_status"`
	Err        error       `json:"-"`
}

func (*GetRepositorySyncStatusResponse) Body

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

func (*GetRepositorySyncStatusResponse) 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) CreateRepository

func (c *HTTPClient) CreateRepository(ctx context.Context, repository string, properties *RepositoryProperties) (err error)

func (*HTTPClient) DeleteRepository

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

func (*HTTPClient) GetRepository

func (c *HTTPClient) GetRepository(ctx context.Context, repository string) (properties *RepositoryProperties, err error)

func (*HTTPClient) GetRepositoryFile

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

func (*HTTPClient) GetRepositorySyncStatus

func (c *HTTPClient) GetRepositorySyncStatus(ctx context.Context, repository string) (syncStatus *SyncStatus, 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) SyncRepository

func (c *HTTPClient) SyncRepository(ctx context.Context, repository string, wait bool) (err error)

func (*HTTPClient) UpdateRepository

func (c *HTTPClient) UpdateRepository(ctx context.Context, repository string, properties *RepositoryProperties) (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 Mirror

type Mirror interface {
	// Create a Mirror repository.
	//kun:op POST /repository
	//kun:success statusCode=200
	CreateRepository(ctx context.Context, repository string, properties *RepositoryProperties) (err error)

	// Delete a Mirror repository.
	//kun:op DELETE /repository
	//kun:success statusCode=200
	DeleteRepository(ctx context.Context, repository string, deleteFiles bool) (err error)

	// Update Mirror repository properties.
	//kun:op PUT /repository
	//kun:success statusCode=200
	UpdateRepository(ctx context.Context, repository string, properties *RepositoryProperties) (err error)

	// Get Mirror repository properties.
	//kun:op GET /repository
	//kun:success statusCode=200
	GetRepository(ctx context.Context, repository string) (properties *RepositoryProperties, err error)

	// Sync Mirror repository with an upstream repository.
	//kun:op GET /repository/sync
	//kun:success statusCode=200
	SyncRepository(ctx context.Context, repository string, wait bool) (err error)

	// Get Mirror repository sync status.
	//kun:op GET /repository/sync:status
	//kun:success statusCode=200
	GetRepositorySyncStatus(ctx context.Context, repository string) (syncStatus *SyncStatus, err error)

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

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

	// Get file for a Mirror repository.
	//kun:op GET /repository/file
	//kun:success statusCode=200
	GetRepositoryFile(ctx context.Context, repository, file string) (repositoryFile *RepositoryFile, err error)
}

Mirror is used for managing mirror repositories. This is the API documentation of Mirror.

type Page

type Page struct {
	Size  int
	Token string
}

type RepositoryFile

type RepositoryFile struct {
	Tag          string `json:"tag"`
	Name         string `json:"name"`
	Link         string `json:"link"`
	ModifiedTime string `json:"modified_time"`
	Mode         uint32 `json:"mode"`
	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 RepositoryProperties

type RepositoryProperties struct {
	// Configure the repository as a mirror.
	Mirror *bool `json:"mirror,omitempty"`
	// Mirror/Upstream URLs for mirroring.
	MirrorURLs []string `json:"mirror_urls,omitempty"`
}

Repository properties/configuration.

type SyncRepositoryRequest

type SyncRepositoryRequest struct {
	Repository string `json:"repository"`
	Wait       bool   `json:"wait"`
}

type SyncRepositoryResponse

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

func (*SyncRepositoryResponse) Body

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

func (*SyncRepositoryResponse) Failed

func (r *SyncRepositoryResponse) Failed() error

Failed implements endpoint.Failer.

type SyncStatus

type SyncStatus struct {
	Syncing     bool   `json:"syncing"`
	StartTime   string `json:"start_time"`
	EndTime     string `json:"end_time"`
	TotalFiles  int    `json:"total_files"`
	SyncedFiles int    `json:"synced_files"`
	SyncError   string `json:"sync_error"`
}

Mirror sync status.

type UpdateRepositoryRequest

type UpdateRepositoryRequest struct {
	Repository string                `json:"repository"`
	Properties *RepositoryProperties `json:"properties"`
}

type UpdateRepositoryResponse

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

func (*UpdateRepositoryResponse) Body

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

func (*UpdateRepositoryResponse) Failed

func (r *UpdateRepositoryResponse) Failed() error

Failed implements endpoint.Failer.

Jump to

Keyboard shortcuts

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