2022-07-26 22:21:49 +02:00
|
|
|
package controller
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/go-openapi/runtime/middleware"
|
|
|
|
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
2022-11-18 21:36:55 +01:00
|
|
|
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/service"
|
2022-07-26 22:21:49 +02:00
|
|
|
)
|
|
|
|
|
2022-11-21 19:45:08 +01:00
|
|
|
type shareHandler struct{}
|
2022-08-09 17:49:40 +02:00
|
|
|
|
2022-11-18 21:36:55 +01:00
|
|
|
func newShareHandler() *shareHandler {
|
|
|
|
return &shareHandler{}
|
2022-08-09 17:49:40 +02:00
|
|
|
}
|
|
|
|
|
2022-11-18 21:36:55 +01:00
|
|
|
func (h *shareHandler) Handle(params service.ShareParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
2022-11-21 19:45:08 +01:00
|
|
|
switch params.Body.ShareMode {
|
|
|
|
case "public":
|
|
|
|
return newSharePublicHandler().Handle(params, principal)
|
|
|
|
default:
|
2022-11-18 21:36:55 +01:00
|
|
|
return service.NewShareInternalServerError()
|
2022-07-27 15:49:54 +02:00
|
|
|
}
|
2022-09-15 21:18:37 +02:00
|
|
|
}
|