Skip to content

Commit

Permalink
document apiPublishRemove
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Oct 7, 2024
1 parent e8adf4f commit c0b096e
Showing 1 changed file with 42 additions and 15 deletions.
57 changes: 42 additions & 15 deletions api/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ import (

// SigningOptions is a shared between publish API GPG options structure
type SigningOptions struct {
Skip bool
GpgKey string
Keyring string
SecretKeyring string
Passphrase string
PassphraseFile string
// Set "true" to skip signing published repository
Skip bool ` json:"Skip" example:"false"`
// key name (local to aptly service user)
GpgKey string ` json:"GpgKey" example:"reposign@aptly.info"`
// keyring filename (local to aptly service user)
Keyring string ` json:"Keyring" example:"trustedkeys.gpg"`
// OBSOLETE (gpg1): secret keyring filename (local to aptly server user)
SecretKeyring string ` json:"SecretKeyring" example:"aptly.sec"`
// key passphrase (if using over http, would be transmitted in clear text!)
Passphrase string ` json:"Passphrase"`
// passphrase file (local to aptly service user)
PassphraseFile string ` json:"PassphraseFile" example:"/etc/aptly.pass"`
}

func getSigner(options *SigningOptions) (pgp.Signer, error) {
Expand Down Expand Up @@ -397,20 +403,41 @@ func apiPublishDrop(c *gin.Context) {
})
}

// POST /publish/:prefix/:distribution/remove
type publishRemoveParams struct {
// Signing parameters
Signing SigningOptions ` json:"Signing"`
// Do not remove unreferenced files in prefix/component
SkipCleanup *bool ` json:"SkipCleanup" example:"false"`
// List of Components to remove
Components []string `binding:"required" json:"Components" example:"main"`
// Enable multiple packages with the same filename in different distributions
MultiDist bool ` json:"MultiDist" example:"false"`
// Overwrite existing files in pool/ directory
ForceOverwrite bool ` json:"ForceOverwrite" example:"false"`
}

// @Summary Remove sources
// @Description **Remove sources (snapshots / local repos) from publish**
// @Description
// @Description This removes specifies sources from a snapshot.
// @Tags Publish
// @Param prefix path string true "Publishing prefix, `.` for root"
// @Param distribution path string true "Distribution name"
// @Consume json
// @Param request body publishRemoveParams true "Parameters"
// @Produce json
// @Success 200 {object} task.ProcessReturnValue "Mirror was updated successfully"
// @Success 202 {object} task.Task "Mirror is being updated"
// @Failure 400 {object} Error "Unable to determine list of architectures"
// @Failure 404 {object} Error "Mirror not found"
// @Failure 500 {object} Error "Internal Error"
// @Router /api/publish/{prefix}/{distribution}/remove [post]
func apiPublishRemove(c *gin.Context) {
param := parseEscapedPath(c.Params.ByName("prefix"))
storage, prefix := deb.ParsePrefix(param)
distribution := c.Params.ByName("distribution")

var b struct {
ForceOverwrite bool
Signing SigningOptions
SkipCleanup *bool
Components []string `binding:"required"`
MultiDist bool
}

var b publishRemoveParams
if c.Bind(&b) != nil {
return
}
Expand Down

0 comments on commit c0b096e

Please sign in to comment.