aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/handlers/swagger/errors.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2022-05-19 10:27:31 -0700
committerMatthew Heon <mheon@redhat.com>2022-06-14 13:48:20 -0400
commitf4f3a4afd971d1729894bb77a10fc8e691094e32 (patch)
treecd96951e384113379927ce78f2b537b8f4a4952c /pkg/api/handlers/swagger/errors.go
parent31d310a4b1441fb383d4e1cf1ce6d5b17b4c07b5 (diff)
downloadpodman-f4f3a4afd971d1729894bb77a10fc8e691094e32.tar.gz
podman-f4f3a4afd971d1729894bb77a10fc8e691094e32.tar.bz2
podman-f4f3a4afd971d1729894bb77a10fc8e691094e32.zip
Swagger refactor/cleanup
* Remove duplicate or unused types and constants * Move all documetation-only models and responses into swagger package * Remove all unecessary names, go-swagger will determine names from struct declarations * Use Libpod suffix to differentiate between compat and libpod models and responses. Taken from swagger:operation declarations. * Models and responses that start with lowercase are for swagger use only while uppercase are used "as is" in the code and swagger comments * Used gofumpt on new code ```release-note ``` Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/api/handlers/swagger/errors.go')
-rw-r--r--pkg/api/handlers/swagger/errors.go116
1 files changed, 116 insertions, 0 deletions
diff --git a/pkg/api/handlers/swagger/errors.go b/pkg/api/handlers/swagger/errors.go
new file mode 100644
index 000000000..28e11c9fb
--- /dev/null
+++ b/pkg/api/handlers/swagger/errors.go
@@ -0,0 +1,116 @@
+//nolint:deadcode,unused // these types are used to wire generated swagger to API code
+package swagger
+
+import (
+ "github.com/containers/podman/v4/pkg/errorhandling"
+)
+
+// Error model embedded in swagger:response to aid in documentation generation
+
+// No such image
+// swagger:response
+type imageNotFound struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// No such container
+// swagger:response
+type containerNotFound struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// No such network
+// swagger:response
+type networkNotFound struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// No such exec instance
+// swagger:response
+type execSessionNotFound struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// No such volume
+// swagger:response
+type volumeNotFound struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// No such pod
+// swagger:response
+type podNotFound struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// No such manifest
+// swagger:response
+type manifestNotFound struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// Internal server error
+// swagger:response
+type internalError struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// Conflict error in operation
+// swagger:response
+type conflictError struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// Bad parameter in request
+// swagger:response
+type badParamError struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// Container already started
+// swagger:response
+type containerAlreadyStartedError struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// Container already stopped
+// swagger:response
+type containerAlreadyStoppedError struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// Pod already started
+// swagger:response
+type podAlreadyStartedError struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// Pod already stopped
+// swagger:response
+type podAlreadyStoppedError struct {
+ // in:body
+ Body errorhandling.ErrorModel
+}
+
+// Success
+// swagger:response
+type ok struct {
+ // in:body
+ Body struct {
+ // example: OK
+ ok string
+ }
+}