apicommon

package
v0.16.0-dev Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ApiBasePathV1 = "api/v1"

ApiBasePathV1 is the base path for version 1 of the API.

View Source
const DeltaApiPath = "delta"

DeltaApiPath is the sub path for the delta creation API.

Variables

View Source
var ErrImagesIdentical = APIError{InnerError: APIErrorInner{
	Message:      "artifacts are not compatible",
	ErrorContext: "from and to image are identical",
}}

ErrImagesIdentical is returned by the API when the delta would have to be created from identical images.

View Source
var ErrImagesIncompatible = APIError{InnerError: APIErrorInner{
	Message:      "artifacts are not compatible",
	ErrorContext: "cannot build a delta from images",
}}

ErrImagesIncompatible is returned by the API when the delta would have to be created from identical images.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	InnerError APIErrorInner `json:"error"`
}

APIError wraps around the actual error for easier JSON parsing.

func (APIError) Error

func (a APIError) Error() string

func (APIError) Is added in v0.10.2

func (a APIError) Is(target error) bool

Is allows to call errors.Is() on APIError for better error handling.

type APIErrorInner

type APIErrorInner struct {
	Code         int    `json:"code"`
	Message      string `json:"message,omitempty"`
	ErrorContext string `json:"context,omitempty"`
}

APIErrorInner represents an error from the API.

func (APIErrorInner) Error added in v0.10.2

func (a APIErrorInner) Error() string

type Config

type Config struct {
	RepoClients map[string]remote.Client
}

Config is used to configure repository clients for Server.

type ReadDeltaRequest

type ReadDeltaRequest struct {
	From               string   `json:"from"`
	To                 string   `json:"to"`
	AcceptedAlgorithms []string `json:"accepted_algorithms"`
}

type ReadDeltaResponse

type ReadDeltaResponse struct {
	TargetImage string `json:"target_image"`
	DeltaImage  string `json:"delta_image"`
}

type SuccessResponse

type SuccessResponse[T any] struct {
	Success T `json:"success"`
}

Jump to

Keyboard shortcuts

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