From 1214b1a38b1877fecfdf232d8b3fc7f2a1dab9a2 Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Wed, 27 Jan 2021 13:48:16 +0100 Subject: swagger: add operationIds that match with docker Signed-off-by: Tom Deseyn --- pkg/api/server/register_archive.go | 2 ++ pkg/api/server/register_containers.go | 20 +++++++++++++++++ pkg/api/server/register_events.go | 1 + pkg/api/server/register_exec.go | 4 ++++ pkg/api/server/register_images.go | 14 ++++++++++++ pkg/api/server/register_info.go | 1 + pkg/api/server/register_networks.go | 42 +++++++++++++++++++++++++++++++++++ pkg/api/server/register_version.go | 1 + pkg/api/server/register_volumes.go | 5 +++++ 9 files changed, 90 insertions(+) diff --git a/pkg/api/server/register_archive.go b/pkg/api/server/register_archive.go index 2ac126644..15933abbf 100644 --- a/pkg/api/server/register_archive.go +++ b/pkg/api/server/register_archive.go @@ -11,6 +11,7 @@ func (s *APIServer) registerArchiveHandlers(r *mux.Router) error { // swagger:operation PUT /containers/{name}/archive compat putArchive // --- // summary: Put files into a container + // operationId: PutContainerArchive // description: Put a tar archive of files into a container // tags: // - containers (compat) @@ -55,6 +56,7 @@ func (s *APIServer) registerArchiveHandlers(r *mux.Router) error { // swagger:operation GET /containers/{name}/archive compat getArchive // --- // summary: Get files from a container + // operationId: ContainerArchive // description: Get a tar archive of files from a container // tags: // - containers (compat) diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go index b379d52ce..fd43eb4ef 100644 --- a/pkg/api/server/register_containers.go +++ b/pkg/api/server/register_containers.go @@ -12,6 +12,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // swagger:operation POST /containers/create compat createContainer // --- // summary: Create a container + // operationId: ContainerCreate // tags: // - containers (compat) // produces: @@ -40,6 +41,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: List containers + // operationId: ContainerList // description: Returns a list of containers // parameters: // - in: query @@ -97,6 +99,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Delete stopped containers + // operationId: ContainerPrune // description: Remove containers not in use // parameters: // - in: query @@ -121,6 +124,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Remove a container + // operationId: ContainerDelete // parameters: // - in: path // name: name @@ -162,6 +166,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Inspect container + // operationId: ContainerInspect // description: Return low-level information about a container. // parameters: // - in: path @@ -191,6 +196,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Kill container + // operationId: ContainerKill // description: Signal to send to the container as an integer or string (e.g. SIGINT) // parameters: // - in: path @@ -228,6 +234,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Get container logs + // operationId: ContainerLogs // description: Get stdout and stderr logs from a container. // parameters: // - in: path @@ -282,6 +289,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Pause container + // operationId: ContainerPause // description: Use the cgroups freezer to suspend all processes in a container. // parameters: // - in: path @@ -306,6 +314,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Restart container + // operationId: ContainerRestart // parameters: // - in: path // name: name @@ -333,6 +342,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Start a container + // operationId: ContainerStart // parameters: // - in: path // name: name @@ -363,6 +373,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Get stats for a container + // operationId: ContainerStats // description: This returns a live stream of a container’s resource usage statistics. // parameters: // - in: path @@ -392,6 +403,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Stop a container + // operationId: ContainerStop // description: Stop a container // parameters: // - in: path @@ -422,6 +434,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: List processes running inside a container + // operationId: ContainerTop // parameters: // - in: path // name: name @@ -449,6 +462,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Unpause container + // operationId: ContainerUnpause // description: Resume a paused container // parameters: // - in: path @@ -473,6 +487,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Wait on a container + // operationId: ContainerWait // description: Block until a container stops or given condition is met. // parameters: // - in: path @@ -513,6 +528,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Attach to a container + // operationId: ContainerAttach // description: Hijacks the connection to forward the container's standard streams to the client. // parameters: // - in: path @@ -570,6 +586,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Resize a container's TTY + // operationId: ContainerResize // description: Resize the terminal attached to a container (for use with Attach). // parameters: // - in: path @@ -609,6 +626,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Export a container + // operationId: ContainerExport // description: Export the contents of a container as a tarball. // parameters: // - in: path @@ -632,6 +650,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: Rename an existing container + // operationId: ContainerRename // description: Change the name of an existing container. // parameters: // - in: path @@ -1475,6 +1494,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // - containers // - containers (compat) // summary: Report on changes to container's filesystem; adds, deletes or modifications. + // operationId: ContainerChanges // description: | // Returns which files in a container's filesystem have been added, deleted, or modified. The Kind of modification can be one of: // diff --git a/pkg/api/server/register_events.go b/pkg/api/server/register_events.go index acccebac1..008d8aa1a 100644 --- a/pkg/api/server/register_events.go +++ b/pkg/api/server/register_events.go @@ -13,6 +13,7 @@ func (s *APIServer) registerEventsHandlers(r *mux.Router) error { // tags: // - system (compat) // summary: Get events + // operationId: SystemEvents // description: Returns events filtered on query parameters // produces: // - application/json diff --git a/pkg/api/server/register_exec.go b/pkg/api/server/register_exec.go index de437ab1a..6f33d9784 100644 --- a/pkg/api/server/register_exec.go +++ b/pkg/api/server/register_exec.go @@ -13,6 +13,7 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error { // tags: // - exec (compat) // summary: Create an exec instance + // operationId: ContainerExec // description: Create an exec session to run a command inside a running container. Exec sessions will be automatically removed 5 minutes after they exit. // parameters: // - in: path @@ -82,6 +83,7 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error { // tags: // - exec (compat) // summary: Start an exec instance + // operationId: ExecStart // description: Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command. Otherwise, it sets up an interactive session with the command. // parameters: // - in: path @@ -120,6 +122,7 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error { // tags: // - exec (compat) // summary: Resize an exec instance + // operationId: ExecResize // description: | // Resize the TTY session used by an exec instance. This endpoint only works if tty was specified as part of creating and starting the exec instance. // parameters: @@ -158,6 +161,7 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error { // tags: // - exec (compat) // summary: Inspect an exec instance + // operationId: ExecInspect // description: Return low-level information about an exec instance. // parameters: // - in: path diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index 423766bd8..9046cdd11 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -18,6 +18,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Create an image + // operationId: ImageCreate // description: Create an image by either pulling it from a registry or importing it. // produces: // - application/json @@ -61,6 +62,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: List Images + // operationId: ImageList // description: Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image. // parameters: // - name: all @@ -98,6 +100,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Import image + // operationId: ImageLoad // description: Load a set of images and tags into a repository. // parameters: // - in: query @@ -124,6 +127,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Prune unused images + // operationId: ImagePrune // description: Remove images from local storage that are not being used by a container // parameters: // - in: query @@ -151,6 +155,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Search images + // operationId: ImageSearch // description: Search registries for an image // parameters: // - in: query @@ -190,6 +195,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Remove Image + // operationId: ImageDelete // description: Delete an image from local storage // parameters: // - in: path @@ -224,6 +230,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Push Image + // operationId: ImagePush // description: Push an image to a container registry // parameters: // - in: path @@ -271,6 +278,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Export an image + // operationId: ImageGet // description: Export an image in tarball format // parameters: // - in: path @@ -296,6 +304,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Export several images + // operationId: ImageGetAll // description: Get a tarball containing all images and metadata for several image repositories // parameters: // - in: query @@ -321,6 +330,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: History of an image + // operationId: ImageHistory // description: Return parent layers of an image. // parameters: // - in: path @@ -345,6 +355,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Inspect an image + // operationId: ImageInspect // description: Return low-level information about an image. // parameters: // - in: path @@ -369,6 +380,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Tag an image + // operationId: ImageTag // description: Tag an image so that it becomes part of a repository. // parameters: // - in: path @@ -405,6 +417,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - containers (compat) // summary: New Image + // operationId: ImageCommit // description: Create a new image from a container // parameters: // - in: query @@ -453,6 +466,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // tags: // - images (compat) // summary: Create image + // operationId: ImageBuild // description: Build an image from the given Dockerfile(s) // parameters: // - in: query diff --git a/pkg/api/server/register_info.go b/pkg/api/server/register_info.go index c07d4699d..35000e7d7 100644 --- a/pkg/api/server/register_info.go +++ b/pkg/api/server/register_info.go @@ -14,6 +14,7 @@ func (s *APIServer) registerInfoHandlers(r *mux.Router) error { // tags: // - system (compat) // summary: Get info + // operationId: SystemInfo // description: Returns information on the system and libpod configuration // produces: // - application/json diff --git a/pkg/api/server/register_networks.go b/pkg/api/server/register_networks.go index a07c6a55e..02729d093 100644 --- a/pkg/api/server/register_networks.go +++ b/pkg/api/server/register_networks.go @@ -9,11 +9,26 @@ import ( ) func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { + // swagger:operation POST /networks/prune compat compatPruneNetwork + // --- + // tags: + // - networks (compat) + // Summary: Delete unused networks + // operationId: NetworkPrune + // description: Not supported + // produces: + // - application/json + // responses: + // 404: + // $ref: "#/responses/NoSuchNetwork" + r.HandleFunc(VersionedPath("/networks/prune"), compat.UnsupportedHandler).Methods(http.MethodPost) + r.HandleFunc("/networks/prune", compat.UnsupportedHandler).Methods(http.MethodPost) // swagger:operation DELETE /networks/{name} compat compatRemoveNetwork // --- // tags: // - networks (compat) // summary: Remove a network + // operationId: NetworkDelete // description: Remove a network // parameters: // - in: path @@ -37,6 +52,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // tags: // - networks (compat) // summary: Inspect a network + // operationId: NetworkInspect // description: Display low level configuration network // parameters: // - in: path @@ -60,6 +76,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // tags: // - networks (compat) // summary: List networks + // operationId: NetworkList // description: Display summary of network configurations // parameters: // - in: query @@ -85,6 +102,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // tags: // - networks (compat) // summary: Create network + // operationId: NetworkCreate // description: Create a network configuration // produces: // - application/json @@ -108,6 +126,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // tags: // - networks (compat) // summary: Connect container to network + // operationId: NetworkConnect // description: Connect a container to a network. This endpoint is current a no-op // produces: // - application/json @@ -136,6 +155,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // tags: // - networks (compat) // summary: Disconnect container from network + // operationId: NetworkDisconnect // description: Disconnect a container from a network. This endpoint is current a no-op // produces: // - application/json @@ -219,6 +239,28 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { */ r.HandleFunc(VersionedPath("/libpod/networks/{name}"), s.APIHandler(libpod.RemoveNetwork)).Methods(http.MethodDelete) + // swagger:operation GET /libpod/networks/{name}/json libpod libpodInspectNetwork + // --- + // tags: + // - networks + // summary: Inspect a network + // description: Display low level configuration for a CNI network + // parameters: + // - in: path + // name: name + // type: string + // required: true + // description: the name of the network + // produces: + // - application/json + // responses: + // 200: + // $ref: "#/responses/NetworkInspectReport" + // 404: + // $ref: "#/responses/NoSuchNetwork" + // 500: + // $ref: "#/responses/InternalError" + r.HandleFunc(VersionedPath("/libpod/networks/{name}/json"), s.APIHandler(libpod.InspectNetwork)).Methods(http.MethodGet) // swagger:operation GET /libpod/networks/{name}/exists libpod libpodExistsNetwork // --- // tags: diff --git a/pkg/api/server/register_version.go b/pkg/api/server/register_version.go index 0cedb5dc6..361412cd0 100644 --- a/pkg/api/server/register_version.go +++ b/pkg/api/server/register_version.go @@ -11,6 +11,7 @@ func (s *APIServer) registerVersionHandlers(r *mux.Router) error { // swagger:operation GET /version compat CompatSystemVersion // --- // summary: Component Version information + // operationId: SystemVersion // tags: // - system (compat) // produces: diff --git a/pkg/api/server/register_volumes.go b/pkg/api/server/register_volumes.go index b19faefdd..8020b3661 100644 --- a/pkg/api/server/register_volumes.go +++ b/pkg/api/server/register_volumes.go @@ -145,6 +145,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // tags: // - volumes (compat) // summary: List volumes + // operationId: VolumeList // description: Returns a list of volume // produces: // - application/json @@ -173,6 +174,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // tags: // - volumes (compat) // summary: Create a volume + // operationId: VolumeCreate // parameters: // - in: body // name: create @@ -196,6 +198,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // tags: // - volumes (compat) // summary: Inspect volume + // operationId: VolumeInspect // parameters: // - in: path // name: name @@ -219,6 +222,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // tags: // - volumes (compat) // summary: Remove volume + // operationId: VolumeDelete // parameters: // - in: path // name: name @@ -251,6 +255,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // tags: // - volumes (compat) // summary: Prune volumes + // operationId: VolumePrune // produces: // - application/json // parameters: -- cgit v1.2.3-54-g00ecf