|
@@ -1,4 +1,4 @@
|
|
-package local
|
|
|
|
|
|
+package image
|
|
|
|
|
|
import (
|
|
import (
|
|
"encoding/base64"
|
|
"encoding/base64"
|
|
@@ -24,7 +24,7 @@ import (
|
|
"golang.org/x/net/context"
|
|
"golang.org/x/net/context"
|
|
)
|
|
)
|
|
|
|
|
|
-func (s *router) postCommit(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) postCommit(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -79,7 +79,7 @@ func (s *router) postCommit(ctx context.Context, w http.ResponseWriter, r *http.
|
|
}
|
|
}
|
|
|
|
|
|
// Creates an image from Pull or from Import
|
|
// Creates an image from Pull or from Import
|
|
-func (s *router) postImagesCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -188,7 +188,7 @@ func (s *router) postImagesCreate(ctx context.Context, w http.ResponseWriter, r
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *router) postImagesPush(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) postImagesPush(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
metaHeaders := map[string][]string{}
|
|
metaHeaders := map[string][]string{}
|
|
for k, v := range r.Header {
|
|
for k, v := range r.Header {
|
|
if strings.HasPrefix(k, "X-Meta-") {
|
|
if strings.HasPrefix(k, "X-Meta-") {
|
|
@@ -243,7 +243,7 @@ func (s *router) postImagesPush(ctx context.Context, w http.ResponseWriter, r *h
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *router) getImagesGet(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) getImagesGet(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -269,7 +269,7 @@ func (s *router) getImagesGet(ctx context.Context, w http.ResponseWriter, r *htt
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *router) postImagesLoad(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) postImagesLoad(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -278,7 +278,7 @@ func (s *router) postImagesLoad(ctx context.Context, w http.ResponseWriter, r *h
|
|
return s.daemon.LoadImage(r.Body, w, quiet)
|
|
return s.daemon.LoadImage(r.Body, w, quiet)
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *router) deleteImages(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) deleteImages(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -300,7 +300,7 @@ func (s *router) deleteImages(ctx context.Context, w http.ResponseWriter, r *htt
|
|
return httputils.WriteJSON(w, http.StatusOK, list)
|
|
return httputils.WriteJSON(w, http.StatusOK, list)
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *router) getImagesByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) getImagesByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
imageInspect, err := s.daemon.LookupImage(vars["name"])
|
|
imageInspect, err := s.daemon.LookupImage(vars["name"])
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
@@ -309,7 +309,7 @@ func (s *router) getImagesByName(ctx context.Context, w http.ResponseWriter, r *
|
|
return httputils.WriteJSON(w, http.StatusOK, imageInspect)
|
|
return httputils.WriteJSON(w, http.StatusOK, imageInspect)
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *router) getImagesJSON(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) getImagesJSON(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -323,7 +323,7 @@ func (s *router) getImagesJSON(ctx context.Context, w http.ResponseWriter, r *ht
|
|
return httputils.WriteJSON(w, http.StatusOK, images)
|
|
return httputils.WriteJSON(w, http.StatusOK, images)
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *router) getImagesHistory(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) getImagesHistory(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
name := vars["name"]
|
|
name := vars["name"]
|
|
history, err := s.daemon.ImageHistory(name)
|
|
history, err := s.daemon.ImageHistory(name)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -333,7 +333,7 @@ func (s *router) getImagesHistory(ctx context.Context, w http.ResponseWriter, r
|
|
return httputils.WriteJSON(w, http.StatusOK, history)
|
|
return httputils.WriteJSON(w, http.StatusOK, history)
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *router) postImagesTag(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) postImagesTag(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
@@ -355,7 +355,7 @@ func (s *router) postImagesTag(ctx context.Context, w http.ResponseWriter, r *ht
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *router) getImagesSearch(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
|
|
|
|
+func (s *imageRouter) getImagesSearch(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
if err := httputils.ParseForm(r); err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|