Skip to content

Commit

Permalink
Move operationIds to swagger:operation line
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Deseyn <[email protected]>
  • Loading branch information
tmds authored and jmguzik committed Apr 26, 2021
1 parent 4374335 commit 359663c
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 110 deletions.
6 changes: 2 additions & 4 deletions pkg/api/server/register_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import (
)

func (s *APIServer) registerArchiveHandlers(r *mux.Router) error {
// swagger:operation PUT /containers/{name}/archive compat putArchive
// swagger:operation PUT /containers/{name}/archive compat PutContainerArchive
// ---
// summary: Put files into a container
// operationId: PutContainerArchive
// description: Put a tar archive of files into a container
// tags:
// - containers (compat)
Expand Down Expand Up @@ -53,10 +52,9 @@ func (s *APIServer) registerArchiveHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"

// swagger:operation GET /containers/{name}/archive compat getArchive
// swagger:operation GET /containers/{name}/archive compat ContainerArchive
// ---
// summary: Get files from a container
// operationId: ContainerArchive
// description: Get a tar archive of files from a container
// tags:
// - containers (compat)
Expand Down
60 changes: 20 additions & 40 deletions pkg/api/server/register_containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import (
)

func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// swagger:operation POST /containers/create compat createContainer
// swagger:operation POST /containers/create compat ContainerCreate
// ---
// summary: Create a container
// operationId: ContainerCreate
// tags:
// - containers (compat)
// produces:
Expand All @@ -36,12 +35,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/create"), s.APIHandler(compat.CreateContainer)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/create", s.APIHandler(compat.CreateContainer)).Methods(http.MethodPost)
// swagger:operation GET /containers/json compat listContainers
// swagger:operation GET /containers/json compat ContainerList
// ---
// tags:
// - containers (compat)
// summary: List containers
// operationId: ContainerList
// description: Returns a list of containers
// parameters:
// - in: query
Expand Down Expand Up @@ -94,12 +92,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/json"), s.APIHandler(compat.ListContainers)).Methods(http.MethodGet)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/json", s.APIHandler(compat.ListContainers)).Methods(http.MethodGet)
// swagger:operation POST /containers/prune compat pruneContainers
// swagger:operation POST /containers/prune compat ContainerPrune
// ---
// tags:
// - containers (compat)
// summary: Delete stopped containers
// operationId: ContainerPrune
// description: Remove containers not in use
// parameters:
// - in: query
Expand All @@ -119,12 +116,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/prune"), s.APIHandler(compat.PruneContainers)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/prune", s.APIHandler(compat.PruneContainers)).Methods(http.MethodPost)
// swagger:operation DELETE /containers/{name} compat removeContainer
// swagger:operation DELETE /containers/{name} compat ContainerDelete
// ---
// tags:
// - containers (compat)
// summary: Remove a container
// operationId: ContainerDelete
// parameters:
// - in: path
// name: name
Expand Down Expand Up @@ -161,12 +157,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}"), s.APIHandler(compat.RemoveContainer)).Methods(http.MethodDelete)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}", s.APIHandler(compat.RemoveContainer)).Methods(http.MethodDelete)
// swagger:operation GET /containers/{name}/json compat getContainer
// swagger:operation GET /containers/{name}/json compat ContainerInspect
// ---
// tags:
// - containers (compat)
// summary: Inspect container
// operationId: ContainerInspect
// description: Return low-level information about a container.
// parameters:
// - in: path
Expand All @@ -191,12 +186,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/json"), s.APIHandler(compat.GetContainer)).Methods(http.MethodGet)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/json", s.APIHandler(compat.GetContainer)).Methods(http.MethodGet)
// swagger:operation POST /containers/{name}/kill compat killContainer
// swagger:operation POST /containers/{name}/kill compat ContainerKill
// ---
// 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
Expand Down Expand Up @@ -229,12 +223,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/kill"), s.APIHandler(compat.KillContainer)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/kill", s.APIHandler(compat.KillContainer)).Methods(http.MethodPost)
// swagger:operation GET /containers/{name}/logs compat logsFromContainer
// swagger:operation GET /containers/{name}/logs compat ContainerLogs
// ---
// tags:
// - containers (compat)
// summary: Get container logs
// operationId: ContainerLogs
// description: Get stdout and stderr logs from a container.
// parameters:
// - in: path
Expand Down Expand Up @@ -284,12 +277,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/logs"), s.APIHandler(compat.LogsFromContainer)).Methods(http.MethodGet)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/logs", s.APIHandler(compat.LogsFromContainer)).Methods(http.MethodGet)
// swagger:operation POST /containers/{name}/pause compat pauseContainer
// swagger:operation POST /containers/{name}/pause compat ContainerPause
// ---
// tags:
// - containers (compat)
// summary: Pause container
// operationId: ContainerPause
// description: Use the cgroups freezer to suspend all processes in a container.
// parameters:
// - in: path
Expand All @@ -309,12 +301,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/pause"), s.APIHandler(compat.PauseContainer)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/pause", s.APIHandler(compat.PauseContainer)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/restart compat restartContainer
// swagger:operation POST /containers/{name}/restart compat ContainerRestart
// ---
// tags:
// - containers (compat)
// summary: Restart container
// operationId: ContainerRestart
// parameters:
// - in: path
// name: name
Expand All @@ -337,12 +328,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/restart"), s.APIHandler(compat.RestartContainer)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/restart", s.APIHandler(compat.RestartContainer)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/start compat startContainer
// swagger:operation POST /containers/{name}/start compat ContainerStart
// ---
// tags:
// - containers (compat)
// summary: Start a container
// operationId: ContainerStart
// parameters:
// - in: path
// name: name
Expand All @@ -368,12 +358,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/start"), s.APIHandler(compat.StartContainer)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/start", s.APIHandler(compat.StartContainer)).Methods(http.MethodPost)
// swagger:operation GET /containers/{name}/stats compat statsContainer
// swagger:operation GET /containers/{name}/stats compat ContainerStats
// ---
// 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
Expand All @@ -398,12 +387,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/stats"), s.APIHandler(compat.StatsContainer)).Methods(http.MethodGet)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/stats", s.APIHandler(compat.StatsContainer)).Methods(http.MethodGet)
// swagger:operation POST /containers/{name}/stop compat stopContainer
// swagger:operation POST /containers/{name}/stop compat ContainerStop
// ---
// tags:
// - containers (compat)
// summary: Stop a container
// operationId: ContainerStop
// description: Stop a container
// parameters:
// - in: path
Expand All @@ -429,12 +417,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/stop"), s.APIHandler(compat.StopContainer)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/stop", s.APIHandler(compat.StopContainer)).Methods(http.MethodPost)
// swagger:operation GET /containers/{name}/top compat topContainer
// swagger:operation GET /containers/{name}/top compat ContainerTop
// ---
// tags:
// - containers (compat)
// summary: List processes running inside a container
// operationId: ContainerTop
// parameters:
// - in: path
// name: name
Expand All @@ -457,12 +444,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/top"), s.APIHandler(compat.TopContainer)).Methods(http.MethodGet)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/top", s.APIHandler(compat.TopContainer)).Methods(http.MethodGet)
// swagger:operation POST /containers/{name}/unpause compat unpauseContainer
// swagger:operation POST /containers/{name}/unpause compat ContainerUnpause
// ---
// tags:
// - containers (compat)
// summary: Unpause container
// operationId: ContainerUnpause
// description: Resume a paused container
// parameters:
// - in: path
Expand All @@ -482,12 +468,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/unpause"), s.APIHandler(compat.UnpauseContainer)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/unpause", s.APIHandler(compat.UnpauseContainer)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/wait compat waitContainer
// swagger:operation POST /containers/{name}/wait compat ContainerWait
// ---
// tags:
// - containers (compat)
// summary: Wait on a container
// operationId: ContainerWait
// description: Block until a container stops or given condition is met.
// parameters:
// - in: path
Expand Down Expand Up @@ -523,12 +508,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/wait"), s.APIHandler(compat.WaitContainer)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/wait", s.APIHandler(compat.WaitContainer)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/attach compat attachContainer
// swagger:operation POST /containers/{name}/attach compat ContainerAttach
// ---
// 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
Expand Down Expand Up @@ -581,12 +565,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/attach"), s.APIHandler(compat.AttachContainer)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/attach", s.APIHandler(compat.AttachContainer)).Methods(http.MethodPost)
// swagger:operation POST /containers/{name}/resize compat resizeContainer
// swagger:operation POST /containers/{name}/resize compat ContainerResize
// ---
// 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
Expand Down Expand Up @@ -621,12 +604,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/containers/{name}/resize"), s.APIHandler(compat.ResizeTTY)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.HandleFunc("/containers/{name}/resize", s.APIHandler(compat.ResizeTTY)).Methods(http.MethodPost)
// swagger:operation GET /containers/{name}/export compat exportContainer
// swagger:operation GET /containers/{name}/export compat ContainerExport
// ---
// tags:
// - containers (compat)
// summary: Export a container
// operationId: ContainerExport
// description: Export the contents of a container as a tarball.
// parameters:
// - in: path
Expand All @@ -645,12 +627,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/containers/{name}/export"), s.APIHandler(compat.ExportContainer)).Methods(http.MethodGet)
r.HandleFunc("/containers/{name}/export", s.APIHandler(compat.ExportContainer)).Methods(http.MethodGet)
// swagger:operation POST /containers/{name}/rename compat renameContainer
// swagger:operation POST /containers/{name}/rename compat ContainerRename
// ---
// tags:
// - containers (compat)
// summary: Rename an existing container
// operationId: ContainerRename
// description: Change the name of an existing container.
// parameters:
// - in: path
Expand Down Expand Up @@ -1487,14 +1468,13 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/libpod/containers/{name}/restore"), s.APIHandler(libpod.Restore)).Methods(http.MethodPost)
// swagger:operation GET /containers/{name}/changes libpod libpodChangesContainer
// swagger:operation GET /containers/{name}/changes libpod ContainerChanges
// swagger:operation GET /libpod/containers/{name}/changes compat changesContainer
// ---
// tags:
// - 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:
//
Expand Down
3 changes: 1 addition & 2 deletions pkg/api/server/register_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import (
)

func (s *APIServer) registerEventsHandlers(r *mux.Router) error {
// swagger:operation GET /events system getEvents
// swagger:operation GET /events system SystemEvents
// ---
// tags:
// - system (compat)
// summary: Get events
// operationId: SystemEvents
// description: Returns events filtered on query parameters
// produces:
// - application/json
Expand Down
12 changes: 4 additions & 8 deletions pkg/api/server/register_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import (
)

func (s *APIServer) registerExecHandlers(r *mux.Router) error {
// swagger:operation POST /containers/{name}/exec compat createExec
// swagger:operation POST /containers/{name}/exec compat ContainerExec
// ---
// 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
Expand Down Expand Up @@ -78,12 +77,11 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/containers/{name}/exec"), s.APIHandler(compat.ExecCreateHandler)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.Handle("/containers/{name}/exec", s.APIHandler(compat.ExecCreateHandler)).Methods(http.MethodPost)
// swagger:operation POST /exec/{id}/start compat startExec
// swagger:operation POST /exec/{id}/start compat ExecStart
// ---
// 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
Expand Down Expand Up @@ -117,12 +115,11 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/exec/{id}/start"), s.APIHandler(compat.ExecStartHandler)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.Handle("/exec/{id}/start", s.APIHandler(compat.ExecStartHandler)).Methods(http.MethodPost)
// swagger:operation POST /exec/{id}/resize compat resizeExec
// swagger:operation POST /exec/{id}/resize compat ExecResize
// ---
// 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:
Expand Down Expand Up @@ -156,12 +153,11 @@ func (s *APIServer) registerExecHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/exec/{id}/resize"), s.APIHandler(compat.ResizeTTY)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.Handle("/exec/{id}/resize", s.APIHandler(compat.ResizeTTY)).Methods(http.MethodPost)
// swagger:operation GET /exec/{id}/json compat inspectExec
// swagger:operation GET /exec/{id}/json compat ExecInspect
// ---
// tags:
// - exec (compat)
// summary: Inspect an exec instance
// operationId: ExecInspect
// description: Return low-level information about an exec instance.
// parameters:
// - in: path
Expand Down
Loading

0 comments on commit 359663c

Please sign in to comment.