From e914c30dd5f2cfa516b458578c24d2d63f889420 Mon Sep 17 00:00:00 2001 From: Tim Zhou Date: Wed, 25 Feb 2026 12:07:21 -0500 Subject: [PATCH] update swagger changes Signed-off-by: Tim Zhou --- pkg/api/server/register_containers.go | 83 ++++++++++++++++++++++++++- pkg/api/server/register_images.go | 22 +++++-- pkg/api/server/register_networks.go | 14 +++++ pkg/api/server/register_secrets.go | 14 ++++- 4 files changed, 124 insertions(+), 9 deletions(-) diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go index c42b98c2fd..b700e09e41 100644 --- a/pkg/api/server/register_containers.go +++ b/pkg/api/server/register_containers.go @@ -149,6 +149,25 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // name: link // type: boolean // description: not supported + // - in: query + // name: ignore + // type: boolean + // default: false + // description: Ignore if a specified container does not exist. + // - in: query + // name: depend + // type: boolean + // default: false + // description: Remove container dependencies. + // - in: query + // name: timeout + // type: integer + // description: Number of seconds to wait before forcibly stopping the container. + // - in: query + // name: volumes + // type: boolean + // default: false + // description: Remove anonymous volumes associated with the container. // produces: // - application/json // responses: @@ -417,6 +436,15 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // name: t // type: integer // description: number of seconds to wait before killing container + // - in: query + // name: timeout + // type: integer + // description: Number of seconds to wait before killing the container (libpod alias for `t`). + // - in: query + // name: ignore + // type: boolean + // default: false + // description: Do not return an error if the container is already stopped. // produces: // - application/json // responses: @@ -754,6 +782,15 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // description: Return this number of most recently created containers, including non-running ones. // type: integer // - in: query + // name: last + // description: Alias for `limit`. Return this number of most recently created containers. + // type: integer + // - in: query + // name: external + // type: boolean + // default: false + // description: Return containers created by external tools that use container storage. + // - in: query // name: namespace // type: boolean // description: Include namespace information @@ -959,6 +996,11 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // type: string // required: true // description: the name or ID of the container + // - in: query + // name: external + // type: boolean + // default: false + // description: Include external containers that are not managed by Podman. // produces: // - application/json // responses: @@ -1338,7 +1380,7 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // default: 10 // description: number of seconds to wait before killing container // - in: query - // name: Ignore + // name: ignore // type: boolean // default: false // description: do not return error if container is already stopped @@ -1684,10 +1726,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // $ref: "#/responses/internalError" r.HandleFunc(VersionedPath("/libpod/containers/{name}/restore"), s.APIHandler(libpod.Restore)).Methods(http.MethodPost) // swagger:operation GET /containers/{name}/changes compat ContainerChanges - // swagger:operation GET /libpod/containers/{name}/changes libpod ContainerChangesLibpod // --- // tags: - // - containers // - containers (compat) // summary: Report on changes to container's filesystem; adds, deletes or modifications. // description: | @@ -1724,6 +1764,43 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error { // $ref: "#/responses/internalError" r.HandleFunc(VersionedPath("/containers/{name}/changes"), s.APIHandler(compat.Changes)).Methods(http.MethodGet) r.HandleFunc("/containers/{name}/changes", s.APIHandler(compat.Changes)).Methods(http.MethodGet) + // swagger:operation GET /libpod/containers/{name}/changes libpod ContainerChangesLibpod + // --- + // tags: + // - containers + // summary: Report on changes to container's filesystem; adds, deletes or modifications. + // description: | + // Returns which files in a container's filesystem have been added, deleted, or modified. The Kind of modification can be one of: + // + // 0: Modified + // 1: Added + // 2: Deleted + // parameters: + // - in: path + // name: name + // type: string + // required: true + // description: the name or id of the container + // - in: query + // name: parent + // type: string + // description: specify a second layer which is used to compare against it instead of the parent layer + // - in: query + // name: diffType + // type: string + // enum: [all, container, image] + // description: select what you want to match, default is all + // responses: + // 200: + // description: Array of Changes + // content: + // application/json: + // schema: + // $ref: "#/responses/Changes" + // 404: + // $ref: "#/responses/containerNotFound" + // 500: + // $ref: "#/responses/internalError" r.HandleFunc(VersionedPath("/libpod/containers/{name}/changes"), s.APIHandler(compat.Changes)).Methods(http.MethodGet) // swagger:operation POST /libpod/containers/{name}/init libpod ContainerInitLibpod // --- diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index a127b886d9..2bc1b970f8 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -92,7 +92,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // - name: filters // in: query // description: | - // A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: + // JSON-encoded string containing filters as a `map[string][]string` to process on the images list. Available filters: // - `before`=(`[:]`, `` or ``) // - `dangling=true` // - `label=key` or `label="key=value"` of an image label @@ -187,7 +187,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // name: filters // type: string // description: | - // A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: + // JSON-encoded string containing filters as a `map[string][]string` to process on the images list. Available filters: // - `is-automated=(true|false)` // - `is-official=(true|false)` // - `stars=` Matches images that have at least 'number' stars. @@ -232,6 +232,11 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // name: noprune // type: boolean // description: do not remove dangling parent images + // - in: query + // name: ignore + // type: boolean + // default: false + // description: Ignore if a specified image does not exist and do not throw an error. // produces: // - application/json // responses: @@ -900,7 +905,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // - name: filters // in: query // description: | - // A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: + // JSON-encoded string containing filters as a `map[string][]string` to process on the images list. Available filters: // - `before`=(`[:]`, `` or ``) // - `dangling=true` // - `label=key` or `label="key=value"` of an image label @@ -1070,6 +1075,15 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // name: force // type: boolean // description: remove the image even if used by containers or has other tags + // - in: query + // name: ignore + // type: boolean + // default: false + // description: Ignore if a specified image does not exist and do not throw an error. + // - in: query + // name: lookupManifest + // type: boolean + // description: Resolve to a manifest list instead of an image. // produces: // - application/json // responses: @@ -1207,7 +1221,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { // name: filters // type: string // description: | - // A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: + // JSON-encoded string containing filters as a `map[string][]string` to process on the images list. Available filters: // - `is-automated=(true|false)` // - `is-official=(true|false)` // - `stars=` Matches images that have at least 'number' stars. diff --git a/pkg/api/server/register_networks.go b/pkg/api/server/register_networks.go index da831a6fa1..1ee39ef3a1 100644 --- a/pkg/api/server/register_networks.go +++ b/pkg/api/server/register_networks.go @@ -23,6 +23,15 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // type: string // required: true // description: the name of the network + // - in: query + // name: force + // type: boolean + // default: false + // description: Remove containers associated with the network. + // - in: query + // name: timeout + // type: integer + // description: Seconds to wait for container removal when force is set. // produces: // - application/json // responses: @@ -352,6 +361,11 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // description: attributes for creating a network // schema: // $ref: "#/definitions/networkCreateLibpod" + // - in: query + // name: ignoreIfExists + // type: boolean + // default: false + // description: Ignore the request if a network with the same name already exists. // responses: // 200: // $ref: "#/responses/networkCreateResponse" diff --git a/pkg/api/server/register_secrets.go b/pkg/api/server/register_secrets.go index b9d2f295e1..f5d3a8630b 100644 --- a/pkg/api/server/register_secrets.go +++ b/pkg/api/server/register_secrets.go @@ -30,11 +30,21 @@ func (s *APIServer) registerSecretHandlers(r *mux.Router) error { // - in: query // name: driveropts // type: string - // description: Secret driver options + // description: JSON-encoded string containing secret driver options as a `map[string]string`. // - in: query // name: labels // type: string - // description: Labels on the secret + // description: JSON-encoded string containing labels as a `map[string]string`. + // - in: query + // name: replace + // type: boolean + // default: false + // description: Replace an existing secret with the same name. + // - in: query + // name: ignore + // type: boolean + // default: false + // description: Ignore the request if a secret with the same name already exists. // - in: body // name: request // description: Secret