summaryrefslogtreecommitdiff
path: root/pkg/api/server
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-17 16:00:05 +0100
committerGitHub <noreply@github.com>2020-03-17 16:00:05 +0100
commit9ef5d28759e6d37c6f5c1f07df4cf676077851dc (patch)
treee52f03e9b59d721461e1a5724ab5eb48cffd0cb2 /pkg/api/server
parentc4a62733aeb6334c755d1deb2ccd0cd7e2d47702 (diff)
parentabbbeacd68b4d4973a55a8d7263bd0a27f5c4e8e (diff)
downloadpodman-9ef5d28759e6d37c6f5c1f07df4cf676077851dc.tar.gz
podman-9ef5d28759e6d37c6f5c1f07df4cf676077851dc.tar.bz2
podman-9ef5d28759e6d37c6f5c1f07df4cf676077851dc.zip
Merge pull request #5449 from baude/manifests
apiv2 addition of manifests
Diffstat (limited to 'pkg/api/server')
-rw-r--r--pkg/api/server/register_manifest.go145
-rw-r--r--pkg/api/server/server.go3
-rw-r--r--pkg/api/server/swagger.go9
3 files changed, 156 insertions, 1 deletions
diff --git a/pkg/api/server/register_manifest.go b/pkg/api/server/register_manifest.go
new file mode 100644
index 000000000..ccfc2192d
--- /dev/null
+++ b/pkg/api/server/register_manifest.go
@@ -0,0 +1,145 @@
+package server
+
+import (
+ "net/http"
+
+ "github.com/containers/libpod/pkg/api/handlers/libpod"
+ "github.com/gorilla/mux"
+)
+
+func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
+ // swagger:operation POST /libpod/manifests/create manifests Create
+ // ---
+ // summary: Create
+ // description: Create a manifest list
+ // produces:
+ // - application/json
+ // parameters:
+ // - in: query
+ // name: name
+ // type: string
+ // description: manifest list name
+ // required: true
+ // - in: query
+ // name: image
+ // type: string
+ // description: name of the image
+ // - in: query
+ // name: all
+ // type: boolean
+ // description: add all contents if given list
+ // responses:
+ // 200:
+ // $ref: "#/definitions/IDResponse"
+ // 400:
+ // $ref: "#/responses/BadParamError"
+ // 404:
+ // $ref: "#/responses/NoSuchImage"
+ // 500:
+ // $ref: "#/responses/InternalError"
+ r.Handle(VersionedPath("/libpod/manifests/create"), s.APIHandler(libpod.ManifestCreate)).Methods(http.MethodPost)
+ // swagger:operation GET /libpod/manifests/{name}/json manifests Inspect
+ // ---
+ // summary: Inspect
+ // description: Display a manifest list
+ // produces:
+ // - application/json
+ // parameters:
+ // - in: path
+ // name: name
+ // type: string
+ // required: true
+ // description: the name or ID of the manifest
+ // responses:
+ // 200:
+ // $ref: "#/responses/InspectManifest"
+ // 404:
+ // $ref: "#/responses/NoSuchManifest"
+ // 500:
+ // $ref: "#/responses/InternalError"
+ r.Handle(VersionedPath("/libpod/manifests/{name:.*}/json"), s.APIHandler(libpod.ManifestInspect)).Methods(http.MethodGet)
+ // swagger:operation POST /libpod/manifests/{name}/add manifests AddManifest
+ // ---
+ // description: Add an image to a manifest list
+ // produces:
+ // - application/json
+ // parameters:
+ // - in: path
+ // name: name
+ // type: string
+ // required: true
+ // description: the name or ID of the manifest
+ // - in: body
+ // name: options
+ // description: options for creating a manifest
+ // schema:
+ // $ref: "#/definitions/ManifestAddOpts"
+ // responses:
+ // 200:
+ // $ref: "#/definitions/IDResponse"
+ // 404:
+ // $ref: "#/responses/NoSuchManifest"
+ // 409:
+ // $ref: "#/responses/BadParamError"
+ // 500:
+ // $ref: "#/responses/InternalError"
+ r.Handle(VersionedPath("/libpod/manifests/{name:.*}/add"), s.APIHandler(libpod.ManifestAdd)).Methods(http.MethodPost)
+ // swagger:operation DELETE /libpod/manifests/{name} manifests RemoveManifest
+ // ---
+ // summary: Remove
+ // description: Remove an image from a manifest list
+ // produces:
+ // - application/json
+ // parameters:
+ // - in: path
+ // name: name
+ // type: string
+ // required: true
+ // description: the image associated with the manifest
+ // - in: query
+ // name: digest
+ // type: string
+ // description: image digest to be removed
+ // responses:
+ // 200:
+ // $ref: "#/definitions/IDResponse"
+ // 400:
+ // $ref: "#/responses/BadParamError"
+ // 404:
+ // $ref: "#/responses/NoSuchManifest"
+ // 500:
+ // $ref: "#/responses/InternalError"
+ r.Handle(VersionedPath("/libpod/manifests/{name:.*}"), s.APIHandler(libpod.ManifestRemove)).Methods(http.MethodDelete)
+ // swagger:operation POST /libpod/manifests/{name}/push manifests PushManifest
+ // ---
+ // summary: Push
+ // description: Push a manifest list or image index to a registry
+ // produces:
+ // - application/json
+ // parameters:
+ // - in: path
+ // name: name
+ // type: string
+ // required: true
+ // description: the name or ID of the manifest
+ // - in: query
+ // name: destination
+ // type: string
+ // required: true
+ // description: the destination for the manifest
+ // - in: query
+ // name: all
+ // description: push all images
+ // type: boolean
+ // responses:
+ // 200:
+ // $ref: "#/definitions/IDResponse"
+ // 400:
+ // $ref: "#/responses/BadParamError"
+ // 404:
+ // $ref: "#/responses/NoSuchManifest"
+ // 500:
+ // $ref: "#/responses/InternalError"
+ r.Handle(VersionedPath("/libpod/manifests/{name}/push"), s.APIHandler(libpod.ManifestPush)).Methods(http.MethodPost)
+ return nil
+}
diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go
index a0addb303..8496cd11c 100644
--- a/pkg/api/server/server.go
+++ b/pkg/api/server/server.go
@@ -99,11 +99,12 @@ func newServer(runtime *libpod.Runtime, duration time.Duration, listener *net.Li
server.registerAuthHandlers,
server.registerContainersHandlers,
server.registerDistributionHandlers,
- server.registerExecHandlers,
server.registerEventsHandlers,
+ server.registerExecHandlers,
server.registerHealthCheckHandlers,
server.registerImagesHandlers,
server.registerInfoHandlers,
+ server.registerManifestHandlers,
server.registerMonitorHandlers,
server.registerPingHandlers,
server.registerPluginsHandlers,
diff --git a/pkg/api/server/swagger.go b/pkg/api/server/swagger.go
index e3c991d6d..d2cf7503e 100644
--- a/pkg/api/server/swagger.go
+++ b/pkg/api/server/swagger.go
@@ -51,6 +51,15 @@ type swagErrNoSuchPod struct {
}
}
+// No such manifest
+// swagger:response NoSuchManifest
+type swagErrNoSuchManifest struct {
+ // in:body
+ Body struct {
+ utils.ErrorModel
+ }
+}
+
// Internal server error
// swagger:response InternalError
type swagInternalError struct {