swagger: document async

This commit is contained in:
André Roth
2024-11-28 16:07:33 +01:00
parent c6e0a06b14
commit e5e3c49ace
7 changed files with 29 additions and 18 deletions

View File

@@ -17,7 +17,7 @@ import (
// @Description It is a good idea to run this command after massive deletion of mirrors, snapshots or local repos. // @Description It is a good idea to run this command after massive deletion of mirrors, snapshots or local repos.
// @Tags Database // @Tags Database
// @Produce json // @Produce json
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Success 200 {object} string "Output" // @Success 200 {object} string "Output"
// @Failure 404 {object} Error "Not Found" // @Failure 404 {object} Error "Not Found"
// @Router /api/db/cleanup [post] // @Router /api/db/cleanup [post]

View File

@@ -164,6 +164,7 @@ func apiMirrorsCreate(c *gin.Context) {
// @Tags Mirrors // @Tags Mirrors
// @Param name path string true "mirror name" // @Param name path string true "mirror name"
// @Param force query int true "force: 1 to enable" // @Param force query int true "force: 1 to enable"
// @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 200 {object} task.ProcessReturnValue // @Success 200 {object} task.ProcessReturnValue
// @Failure 404 {object} Error "Mirror not found" // @Failure 404 {object} Error "Mirror not found"
@@ -364,6 +365,7 @@ type mirrorUpdateParams struct {
// @Param name path string true "mirror name to update" // @Param name path string true "mirror name to update"
// @Consume json // @Consume json
// @Param request body mirrorUpdateParams true "Parameters" // @Param request body mirrorUpdateParams true "Parameters"
// @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 200 {object} task.ProcessReturnValue "Mirror was updated successfully" // @Success 200 {object} task.ProcessReturnValue "Mirror was updated successfully"
// @Success 202 {object} task.Task "Mirror is being updated" // @Success 202 {object} task.Task "Mirror is being updated"

View File

@@ -188,6 +188,7 @@ type publishedRepoCreateParams struct {
// @Description See also: `aptly publish create` // @Description See also: `aptly publish create`
// @Tags Publish // @Tags Publish
// @Param prefix path string true "publishing prefix" // @Param prefix path string true "publishing prefix"
// @Param _async query bool false "Run in background and return task object"
// @Consume json // @Consume json
// @Param request body publishedRepoCreateParams true "Parameters" // @Param request body publishedRepoCreateParams true "Parameters"
// @Produce json // @Produce json
@@ -395,6 +396,7 @@ type publishedRepoUpdateSwitchParams struct {
// @Produce json // @Produce json
// @Param prefix path string true "publishing prefix" // @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name" // @Param distribution path string true "distribution name"
// @Param _async query bool false "Run in background and return task object"
// @Consume json // @Consume json
// @Param request body publishedRepoUpdateSwitchParams true "Parameters" // @Param request body publishedRepoUpdateSwitchParams true "Parameters"
// @Produce json // @Produce json
@@ -525,6 +527,7 @@ func apiPublishUpdateSwitch(c *gin.Context) {
// @Param distribution path string true "distribution name" // @Param distribution path string true "distribution name"
// @Param force query int true "force: 1 to enable" // @Param force query int true "force: 1 to enable"
// @Param skipCleanup query int true "skipCleanup: 1 to enable" // @Param skipCleanup query int true "skipCleanup: 1 to enable"
// @Param _async query bool false "Run in background and return task object"
// @Success 200 // @Success 200
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Published repository not found" // @Failure 404 {object} Error "Published repository not found"
@@ -571,6 +574,7 @@ func apiPublishDrop(c *gin.Context) {
// @Tags Publish // @Tags Publish
// @Param prefix path string true "publishing prefix" // @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name" // @Param distribution path string true "distribution name"
// @Param _async query bool false "Run in background and return task object"
// @Consume json // @Consume json
// @Param request body sourceParams true "Parameters" // @Param request body sourceParams true "Parameters"
// @Produce json // @Produce json
@@ -688,6 +692,7 @@ func apiPublishListChanges(c *gin.Context) {
// @Tags Publish // @Tags Publish
// @Param prefix path string true "publishing prefix" // @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name" // @Param distribution path string true "distribution name"
// @Param _async query bool false "Run in background and return task object"
// @Consume json // @Consume json
// @Param request body []sourceParams true "Parameters" // @Param request body []sourceParams true "Parameters"
// @Produce json // @Produce json
@@ -753,6 +758,7 @@ func apiPublishSetSources(c *gin.Context) {
// @Tags Publish // @Tags Publish
// @Param prefix path string true "publishing prefix" // @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name" // @Param distribution path string true "distribution name"
// @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 200 // @Success 200
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
@@ -805,6 +811,7 @@ func apiPublishDropChanges(c *gin.Context) {
// @Param prefix path string true "publishing prefix" // @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name" // @Param distribution path string true "distribution name"
// @Param component path string true "component name" // @Param component path string true "component name"
// @Param _async query bool false "Run in background and return task object"
// @Consume json // @Consume json
// @Param request body sourceParams true "Parameters" // @Param request body sourceParams true "Parameters"
// @Produce json // @Produce json
@@ -884,6 +891,7 @@ func apiPublishUpdateSource(c *gin.Context) {
// @Param prefix path string true "publishing prefix" // @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name" // @Param distribution path string true "distribution name"
// @Param component path string true "component name" // @Param component path string true "component name"
// @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 200 // @Success 200
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
@@ -960,6 +968,7 @@ type publishedRepoUpdateParams struct {
// @Tags Publish // @Tags Publish
// @Param prefix path string true "publishing prefix" // @Param prefix path string true "publishing prefix"
// @Param distribution path string true "distribution name" // @Param distribution path string true "distribution name"
// @Param _async query bool false "Run in background and return task object"
// @Consume json // @Consume json
// @Param request body publishedRepoUpdateParams true "Parameters" // @Param request body publishedRepoUpdateParams true "Parameters"
// @Produce json // @Produce json

View File

@@ -251,7 +251,7 @@ func apiReposShow(c *gin.Context) {
// @Description Needs force=1 to drop repos used as source by other repos. // @Description Needs force=1 to drop repos used as source by other repos.
// @Tags Repos // @Tags Repos
// @Produce json // @Produce json
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Param force query int false "force: 1 to enable" // @Param force query int false "force: 1 to enable"
// @Success 200 {object} task.ProcessReturnValue "Repo object" // @Success 200 {object} task.ProcessReturnValue "Repo object"
// @Failure 404 {object} Error "Not Found" // @Failure 404 {object} Error "Not Found"
@@ -403,7 +403,7 @@ func apiReposPackagesAddDelete(c *gin.Context, taskNamePrefix string, cb func(li
// @Tags Repos // @Tags Repos
// @Produce json // @Produce json
// @Param request body reposPackagesAddDeleteParams true "Parameters" // @Param request body reposPackagesAddDeleteParams true "Parameters"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Success 200 {object} string "msg" // @Success 200 {object} string "msg"
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Not Found" // @Failure 404 {object} Error "Not Found"
@@ -423,7 +423,7 @@ func apiReposPackagesAdd(c *gin.Context) {
// @Tags Repos // @Tags Repos
// @Produce json // @Produce json
// @Param request body reposPackagesAddDeleteParams true "Parameters" // @Param request body reposPackagesAddDeleteParams true "Parameters"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Success 200 {object} string "msg" // @Success 200 {object} string "msg"
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Not Found" // @Failure 404 {object} Error "Not Found"
@@ -445,7 +445,7 @@ func apiReposPackagesDelete(c *gin.Context) {
// @Param name path string true "Repository name" // @Param name path string true "Repository name"
// @Param dir path string true "Directory of packages" // @Param dir path string true "Directory of packages"
// @Param file path string false "Filename (optional)" // @Param file path string false "Filename (optional)"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 200 {string} string "OK" // @Success 200 {string} string "OK"
// @Failure 400 {object} Error "wrong file" // @Failure 400 {object} Error "wrong file"
@@ -467,7 +467,7 @@ func apiReposPackageFromFile(c *gin.Context) {
// @Consume json // @Consume json
// @Param noRemove query string false "when value is set to 1, dont remove any files" // @Param noRemove query string false "when value is set to 1, dont remove any files"
// @Param forceReplace query string false "when value is set to 1, remove packages conflicting with package being added (in local repository)" // @Param forceReplace query string false "when value is set to 1, remove packages conflicting with package being added (in local repository)"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 200 {string} string "OK" // @Success 200 {string} string "OK"
// @Failure 400 {object} Error "wrong file" // @Failure 400 {object} Error "wrong file"
@@ -604,7 +604,7 @@ type reposCopyPackageParams struct {
// @Param name path string true "Source repo" // @Param name path string true "Source repo"
// @Param src path string true "Destination repo" // @Param src path string true "Destination repo"
// @Param file path string true "File/packages to copy" // @Param file path string true "File/packages to copy"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Success 200 {object} task.ProcessReturnValue "msg" // @Success 200 {object} task.ProcessReturnValue "msg"
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Not Found" // @Failure 404 {object} Error "Not Found"
@@ -753,7 +753,7 @@ func apiReposCopyPackage(c *gin.Context) {
// @Param noRemoveFiles query int false "when value is set to 1, dont remove files that have been imported successfully into repository" // @Param noRemoveFiles query int false "when value is set to 1, dont remove files that have been imported successfully into repository"
// @Param acceptUnsigned query int false "when value is set to 1, accept unsigned .changes files" // @Param acceptUnsigned query int false "when value is set to 1, accept unsigned .changes files"
// @Param ignoreSignature query int false "when value is set to 1 disable verification of .changes file signature" // @Param ignoreSignature query int false "when value is set to 1 disable verification of .changes file signature"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Success 200 {object} string "msg" // @Success 200 {object} string "msg"
// @Failure 404 {object} Error "Not Found" // @Failure 404 {object} Error "Not Found"
// @Router /api/repos/{name}/include/{dir}/{file} [post] // @Router /api/repos/{name}/include/{dir}/{file} [post]
@@ -781,7 +781,7 @@ type reposIncludePackageFromDirResponse struct {
// @Param noRemoveFiles query int false "when value is set to 1, dont remove files that have been imported successfully into repository" // @Param noRemoveFiles query int false "when value is set to 1, dont remove files that have been imported successfully into repository"
// @Param acceptUnsigned query int false "when value is set to 1, accept unsigned .changes files" // @Param acceptUnsigned query int false "when value is set to 1, accept unsigned .changes files"
// @Param ignoreSignature query int false "when value is set to 1 disable verification of .changes file signature" // @Param ignoreSignature query int false "when value is set to 1 disable verification of .changes file signature"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Success 200 {object} reposIncludePackageFromDirResponse "Response" // @Success 200 {object} reposIncludePackageFromDirResponse "Response"
// @Failure 404 {object} Error "Not Found" // @Failure 404 {object} Error "Not Found"
// @Router /api/repos/{name}/include/{dir} [post] // @Router /api/repos/{name}/include/{dir} [post]

View File

@@ -52,7 +52,7 @@ type snapshotsCreateFromMirrorParams struct {
// @Produce json // @Produce json
// @Param request body snapshotsCreateFromMirrorParams true "Parameters" // @Param request body snapshotsCreateFromMirrorParams true "Parameters"
// @Param name path string true "Mirror name" // @Param name path string true "Mirror name"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Success 201 {object} deb.Snapshot "Created Snapshot" // @Success 201 {object} deb.Snapshot "Created Snapshot"
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Mirror Not Found" // @Failure 404 {object} Error "Mirror Not Found"
@@ -126,7 +126,7 @@ type snapshotsCreateParams struct {
// @Description Refs can be obtained from snapshots, local repos, or mirrors // @Description Refs can be obtained from snapshots, local repos, or mirrors
// @Tags Snapshots // @Tags Snapshots
// @Param request body snapshotsCreateParams true "Parameters" // @Param request body snapshotsCreateParams true "Parameters"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 201 {object} deb.Snapshot "Created snapshot" // @Success 201 {object} deb.Snapshot "Created snapshot"
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
@@ -213,7 +213,7 @@ type snapshotsCreateFromRepositoryParams struct {
// @Consume json // @Consume json
// @Param request body snapshotsCreateFromRepositoryParams true "Parameters" // @Param request body snapshotsCreateFromRepositoryParams true "Parameters"
// @Param name path string true "Name of the snapshot" // @Param name path string true "Name of the snapshot"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 201 {object} deb.Snapshot "Created snapshot object" // @Success 201 {object} deb.Snapshot "Created snapshot object"
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
@@ -279,7 +279,7 @@ type snapshotsUpdateParams struct {
// @Tags Snapshots // @Tags Snapshots
// @Param request body snapshotsUpdateParams true "Parameters" // @Param request body snapshotsUpdateParams true "Parameters"
// @Param name path string true "Snapshot name" // @Param name path string true "Snapshot name"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 200 {object} deb.Snapshot "Updated snapshot object" // @Success 200 {object} deb.Snapshot "Updated snapshot object"
// @Failure 404 {object} Error "Snapshot Not Found" // @Failure 404 {object} Error "Snapshot Not Found"
@@ -366,7 +366,7 @@ func apiSnapshotsShow(c *gin.Context) {
// @Tags Snapshots // @Tags Snapshots
// @Param name path string true "Snapshot name" // @Param name path string true "Snapshot name"
// @Param force query string false "Force operation" // @Param force query string false "Force operation"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Produce json // @Produce json
// @Success 200 "" // @Success 200 ""
// @Failure 404 {object} Error "Snapshot Not Found" // @Failure 404 {object} Error "Snapshot Not Found"
@@ -525,7 +525,7 @@ type snapshotsMergeParams struct {
// @Param latest query int false "merge only the latest version of each package" // @Param latest query int false "merge only the latest version of each package"
// @Param no-remove query int false "all versions of packages are preserved during merge" // @Param no-remove query int false "all versions of packages are preserved during merge"
// @Param request body snapshotsMergeParams true "Parameters" // @Param request body snapshotsMergeParams true "Parameters"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Success 201 {object} deb.Snapshot "Resulting snapshot object" // @Success 201 {object} deb.Snapshot "Resulting snapshot object"
// @Failure 400 {object} Error "Bad Request" // @Failure 400 {object} Error "Bad Request"
// @Failure 404 {object} Error "Not Found" // @Failure 404 {object} Error "Not Found"
@@ -637,7 +637,7 @@ type snapshotsPullParams struct {
// @Param dry-run query int false "dont create destination snapshot, just show what would be pulled: 1 to enable" // @Param dry-run query int false "dont create destination snapshot, just show what would be pulled: 1 to enable"
// @Param no-deps query int false "dont process dependencies, just pull listed packages: 1 to enable" // @Param no-deps query int false "dont process dependencies, just pull listed packages: 1 to enable"
// @Param no-remove query int false "dont remove other package versions when pulling package: 1 to enable" // @Param no-remove query int false "dont remove other package versions when pulling package: 1 to enable"
// @Param _async query bool false "Run task in background using tasks API" // @Param _async query bool false "Run in background and return task object"
// @Consume json // @Consume json
// @Produce json // @Produce json
// @Success 200 {object} deb.Snapshot "Resulting Snapshot object" // @Success 200 {object} deb.Snapshot "Resulting Snapshot object"

View File

@@ -1,4 +1,4 @@
# Publish Repositories and Mirrors # Publish Repositories, Snapshots, Mirrors
<div> <div>
Publish snapshot or local repo as Debian repository to be used as APT source on Debian based systems. Publish snapshot or local repo as Debian repository to be used as APT source on Debian based systems.

View File

@@ -1,4 +1,4 @@
# Manage Snapshots of Repositories and Mirrors # Manage Snapshots
<div> <div>
Local Repositories and Mirrors can be snapshotted to get an immutable state. Local Repositories and Mirrors can be snapshotted to get an immutable state.