@@ -593,6 +593,19 @@ The last one is encrypted info, such as the password of the username-password ty
|
||||
Returns(http.StatusOK, RespOK, devops.Crumb{}).
|
||||
Writes(devops.Crumb{}))
|
||||
|
||||
webservice.Route(webservice.PUT("/namespaces/{namespace}/s2ibinaries/{s2ibinary}/file").
|
||||
To(devopsapi.UploadS2iBinary).
|
||||
Consumes("multipart/form-data").
|
||||
Produces(restful.MIME_JSON).
|
||||
Doc("Upload S2iBinary file").
|
||||
Returns(http.StatusOK, RespOK, devops.Crumb{}))
|
||||
|
||||
webservice.Route(webservice.GET("/namespaces/{namespace}/s2ibinaries/{s2ibinary}/file/{file}").
|
||||
To(devopsapi.DownloadS2iBinary).
|
||||
Produces(restful.MIME_OCTET).
|
||||
Doc("Download S2iBinary file").
|
||||
Returns(http.StatusOK, RespOK, nil))
|
||||
|
||||
// TODO are not used in this version. will be added in 2.1.0
|
||||
//// match /job/init-job/descriptorByName/org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition/checkScriptCompile
|
||||
//webservice.Route(webservice.POST("/devops/check/scriptcompile").
|
||||
|
||||
34
pkg/apiserver/devops/s2ibinary.go
Normal file
34
pkg/apiserver/devops/s2ibinary.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package devops
|
||||
|
||||
import (
|
||||
"code.cloudfoundry.org/bytefmt"
|
||||
"fmt"
|
||||
"github.com/emicklei/go-restful"
|
||||
"github.com/golang/glog"
|
||||
"kubesphere.io/kubesphere/pkg/errors"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func UploadS2iBinary(req *restful.Request, resp *restful.Response) {
|
||||
err := req.Request.ParseMultipartForm(bytefmt.MEGABYTE * 20)
|
||||
if err != nil {
|
||||
glog.Errorf("%+v", err)
|
||||
errors.ParseSvcErr(restful.NewError(http.StatusBadRequest, err.Error()), resp)
|
||||
return
|
||||
}
|
||||
if len(req.Request.MultipartForm.File) == 0 {
|
||||
err := fmt.Errorf("could not get file from form")
|
||||
glog.Errorf("%+v", err)
|
||||
errors.ParseSvcErr(restful.NewError(http.StatusBadRequest, err.Error()), resp)
|
||||
}
|
||||
if len(req.Request.MultipartForm.File["binary"]) == 0 {
|
||||
err := fmt.Errorf("could not get file from form")
|
||||
glog.Errorf("%+v", err)
|
||||
errors.ParseSvcErr(restful.NewError(http.StatusBadRequest, err.Error()), resp)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func DownloadS2iBinary(req *restful.Request, resp *restful.Response) {
|
||||
|
||||
}
|
||||
1
pkg/models/devops/s2ibinary_handler.go
Normal file
1
pkg/models/devops/s2ibinary_handler.go
Normal file
@@ -0,0 +1 @@
|
||||
package devops
|
||||
Reference in New Issue
Block a user