Documentation ¶
Index ¶
- Constants
- Variables
- func BadRequest(w http.ResponseWriter, key string, value string, err error)
- func ContainerNotFound(w http.ResponseWriter, name string, err error)
- func ContainerNotRunning(w http.ResponseWriter, containerID string, err error)
- func CreateContainer(ctx context.Context, w http.ResponseWriter, runtime *libpod.Runtime, ...)
- func Error(w http.ResponseWriter, apiMessage string, code int, err error)
- func FilterMapToString(filters map[string][]string) (string, error)
- func GetImage(r *http.Request, name string) (*image.Image, error)
- func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error)
- func GetName(r *http.Request) string
- func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport, error)
- func ImageNotFound(w http.ResponseWriter, name string, err error)
- func InternalServerError(w http.ResponseWriter, err error)
- func IsLibpodRequest(r *http.Request) bool
- func NetworkNotFound(w http.ResponseWriter, name string, err error)
- func ParseDockerReference(name string) (types.ImageReference, error)
- func ParseStorageReference(name string) (types.ImageReference, error)
- func PodNotFound(w http.ResponseWriter, name string, err error)
- func SessionNotFound(w http.ResponseWriter, name string, err error)
- func SupportedVersion(r *http.Request, condition string) (semver.Version, error)
- func SupportedVersionWithDefaults(r *http.Request) (semver.Version, error)
- func UnSupportedParameter(param string)
- func VolumeNotFound(w http.ResponseWriter, name string, err error)
- func WaitContainer(w http.ResponseWriter, r *http.Request) (int32, error)
- func WriteJSON(w http.ResponseWriter, code int, value interface{})
- func WriteResponse(w http.ResponseWriter, code int, value interface{})
- type VersionLevel
- type VersionTree
Constants ¶
const ( // LibpodTree supports Libpod endpoints LibpodTree = VersionTree(iota) // CompatTree supports Libpod endpoints CompatTree // CurrentAPIVersion announces what is the current API level CurrentAPIVersion = VersionLevel(iota) // MinimalAPIVersion announces what is the oldest API level supported MinimalAPIVersion )
Variables ¶
var ( // APIVersion provides the current and minimal API versions for compat and libpod endpoint trees // Note: GET|HEAD /_ping is never versioned and provides the API-Version and Libpod-API-Version headers to allow // clients to shop for the Version they wish to support APIVersion = map[VersionTree]map[VersionLevel]semver.Version{ LibpodTree: { CurrentAPIVersion: semver.MustParse("1.0.0"), MinimalAPIVersion: semver.MustParse("1.0.0"), }, CompatTree: { CurrentAPIVersion: semver.MustParse("1.40.0"), MinimalAPIVersion: semver.MustParse("1.24.0"), }, } // ErrVersionNotGiven returned when version not given by client ErrVersionNotGiven = errors.New("version not given in URL path") // ErrVersionNotSupported returned when given version is too old ErrVersionNotSupported = errors.New("given version is not supported") )
var (
ErrLinkNotSupport = errors.New("Link is not supported")
)
Functions ¶
func BadRequest ¶
func BadRequest(w http.ResponseWriter, key string, value string, err error)
func ContainerNotFound ¶
func ContainerNotFound(w http.ResponseWriter, name string, err error)
func ContainerNotRunning ¶
func ContainerNotRunning(w http.ResponseWriter, containerID string, err error)
func CreateContainer ¶
func CreateContainer(ctx context.Context, w http.ResponseWriter, runtime *libpod.Runtime, cc *createconfig.CreateConfig)
func Error ¶
func Error(w http.ResponseWriter, apiMessage string, code int, err error)
Error formats an API response to an error
apiMessage and code must match the container API, and are sent to client err is logged on the system running the podman service
func GetImages ¶
GetImages is a common function used to get images for libpod and other compatibility mechanisms
func GetPods ¶
func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport, error)
func ImageNotFound ¶
func ImageNotFound(w http.ResponseWriter, name string, err error)
func InternalServerError ¶
func InternalServerError(w http.ResponseWriter, err error)
func IsLibpodRequest ¶
IsLibpodRequest returns true if the request related to a libpod endpoint (e.g., /v2/libpod/...).
func NetworkNotFound ¶ added in v2.0.5
func NetworkNotFound(w http.ResponseWriter, name string, err error)
func ParseDockerReference ¶
func ParseDockerReference(name string) (types.ImageReference, error)
ParseDockerReference parses the specified image name to a `types.ImageReference` and enforces it to refer to a docker-transport reference.
func ParseStorageReference ¶
func ParseStorageReference(name string) (types.ImageReference, error)
ParseStorageReference parses the specified image name to a `types.ImageReference` and enforces it to refer to a containers-storage-transport reference.
func PodNotFound ¶
func PodNotFound(w http.ResponseWriter, name string, err error)
func SessionNotFound ¶
func SessionNotFound(w http.ResponseWriter, name string, err error)
func SupportedVersion ¶
SupportedVersion validates that the version provided by client is included in the given condition https://github.com/blang/semver#ranges provides the details for writing conditions If a version is not given in URL path, ErrVersionNotGiven is returned
func SupportedVersionWithDefaults ¶
SupportedVersionWithDefaults validates that the version provided by client valid is supported by server minimal API version <= client path version <= maximum API version focused on the endpoint tree from URL
func UnSupportedParameter ¶
func UnSupportedParameter(param string)
UnsupportedParameter logs a given param by its string name as not supported.
func VolumeNotFound ¶
func VolumeNotFound(w http.ResponseWriter, name string, err error)
func WaitContainer ¶
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, code int, value interface{})
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, code int, value interface{})
WriteResponse encodes the given value as JSON or string and renders it for http client
Types ¶
type VersionLevel ¶
type VersionLevel int
VersionLevel determines which API level, current or something from the past