Documentation ¶
Index ¶
- func BoolValue(r *http.Request, k string) bool
- func BoolValueOrDefault(r *http.Request, k string, d bool) bool
- func CheckForJSON(r *http.Request) error
- func CloseStreams(streams ...interface{})
- func DecodePlatform(platformJSON string) (*ocispec.Platform, error)
- func HijackConnection(w http.ResponseWriter) (io.ReadCloser, io.Writer, error)
- func Int64ValueOrDefault(r *http.Request, field string, def int64) (int64, error)
- func Int64ValueOrZero(r *http.Request, k string) int64
- func ParseForm(r *http.Request) error
- func ReadJSON(r *http.Request, out interface{}) error
- func RepoTagReference(repo, tag string) (reference.NamedTagged, error)
- func Uint32Value(r *http.Request, field string) (uint32, error)
- func VersionFromContext(ctx context.Context) string
- func WriteJSON(w http.ResponseWriter, code int, v interface{}) error
- func WriteLogStream(_ context.Context, w http.ResponseWriter, msgs <-chan *backend.LogMessage, ...)
- type APIFunc
- type APIVersionKey
- type ArchiveOptions
- type ContainerDecoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolValueOrDefault ¶
BoolValueOrDefault returns the default bool passed if the query param is missing, otherwise it's just a proxy to boolValue above.
func CheckForJSON ¶
CheckForJSON makes sure that the request's Content-Type is application/json.
func CloseStreams ¶
func CloseStreams(streams ...interface{})
CloseStreams ensures that a list for http streams are properly closed.
func DecodePlatform ¶
DecodePlatform decodes the OCI platform JSON string into a Platform struct.
func HijackConnection ¶
func HijackConnection(w http.ResponseWriter) (io.ReadCloser, io.Writer, error)
HijackConnection interrupts the http response writer to get the underlying connection and operate with it.
func Int64ValueOrDefault ¶
Int64ValueOrDefault parses a form value into an int64 type. If there is an error, returns the error. If there is no value returns the default value.
func Int64ValueOrZero ¶
Int64ValueOrZero parses a form value into an int64 type. It returns 0 if the parsing fails.
func ParseForm ¶
ParseForm ensures the request form is parsed even with invalid content types. If we don't do this, POST method without Content-type (even with empty body) will fail.
func ReadJSON ¶
ReadJSON validates the request to have the correct content-type, and decodes the request's Body into out.
func RepoTagReference ¶
func RepoTagReference(repo, tag string) (reference.NamedTagged, error)
RepoTagReference parses form values "repo" and "tag" and returns a valid reference with repository and tag. If repo is empty, then a nil reference is returned. If no tag is given, then the default "latest" tag is set.
func Uint32Value ¶
Uint32Value parses a form value into an uint32 type. It returns an error if the field is not set, empty, incorrectly formatted, or out of range.
func VersionFromContext ¶
VersionFromContext returns an API version from the context using APIVersionKey. It panics if the context value does not have version.Version type.
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, code int, v interface{}) error
WriteJSON writes the value v to the http response stream as json with standard json encoding.
func WriteLogStream ¶
func WriteLogStream(_ context.Context, w http.ResponseWriter, msgs <-chan *backend.LogMessage, config *container.LogsOptions, mux bool)
WriteLogStream writes an encoded byte stream of log messages from the messages channel, multiplexing them with a stdcopy.Writer if mux is true
Types ¶
type APIFunc ¶
type APIFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error
APIFunc is an adapter to allow the use of ordinary functions as Docker API endpoints. Any function that has the appropriate signature can be registered as an API endpoint (e.g. getVersion).
type APIVersionKey ¶
type APIVersionKey struct{}
APIVersionKey is the client's requested API version.
type ArchiveOptions ¶
ArchiveOptions stores archive information for different operations.
func ArchiveFormValues ¶
ArchiveFormValues parses form values and turns them into ArchiveOptions. It fails if the archive name and path are not in the request.
type ContainerDecoder ¶
type ContainerDecoder interface {
DecodeConfig(src io.Reader) (*container.Config, *container.HostConfig, *network.NetworkingConfig, error)
}
ContainerDecoder specifies how to translate an io.Reader into container configuration.