Example #1
0
File: secret.go Project: Ablu/drone
func DeleteSecret(c *gin.Context) {
	repo := session.Repo(c)
	name := c.Param("secret")

	secret, err := store.GetSecret(c, repo, name)
	if err != nil {
		c.String(http.StatusNotFound, "Cannot find secret %s.", name)
		return
	}
	err = store.DeleteSecret(c, secret)
	if err != nil {
		c.String(http.StatusInternalServerError, "Unable to delete secret. %s", err.Error())
		return
	}

	c.String(http.StatusOK, "")
}
Example #2
0
func DeleteSecret(c *gin.Context) {
	repo := session.Repo(c)
	name := c.Param("secret")

	secret, err := store.GetSecret(c, repo, name)
	if err != nil {
		c.String(404, "Cannot find secret %s.", name)
		return
	}
	err = store.DeleteSecret(c, secret)
	if err != nil {
		c.String(500, "Unable to delete secret. %s", err.Error())
		return
	}

	c.String(200, "")
}