Documentation
¶
Index ¶
- Constants
- type JsonReturnError
- type ShortLink
- type ShortlinkController
- func (s *ShortlinkController) HandleCreateShortLink(c *gin.Context)
- func (s *ShortlinkController) HandleDeleteShortLink(c *gin.Context)
- func (s *ShortlinkController) HandleGetShortLink(c *gin.Context)
- func (s *ShortlinkController) HandleListShortLink(c *gin.Context)
- func (s *ShortlinkController) HandleUpdateShortLink(c *gin.Context)
Constants ¶
const ( ContentTypeApplicationJSON = "application/json" ContentTypeTextPlain = "text/plain" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JsonReturnError ¶
type ShortLink ¶
type ShortLink struct { Name string `json:"name"` Spec v1alpha1.ShortLinkSpec `json:"spec,omitempty"` Status v1alpha1.ShortLinkStatus `json:"status,omitempty"` }
type ShortlinkController ¶
type ShortlinkController struct {
// contains filtered or unexported fields
}
ShortlinkController is an object who handles the requests made towards our shortlink-application
func NewShortlinkController ¶
func NewShortlinkController(log *logr.Logger, tracer trace.Tracer, client *authClient.ShortlinkClientAuth) *ShortlinkController
NewShortlinkController creates a new ShortlinkController
func (*ShortlinkController) HandleCreateShortLink ¶
func (s *ShortlinkController) HandleCreateShortLink(c *gin.Context)
HandleCreateShortLink handles the creation of a shortlink and redirects according to the configuration @BasePath /api/v1/ @Summary create new shortlink @Schemes http https @Description create a new shortlink @Accept application/json @Produce text/plain @Produce application/json @Param shortlink path string false "the shortlink URL part (shortlink id)" example(home) @Param spec body v1alpha1.ShortLinkSpec true "shortlink spec" @Success 200 {object} int "Success" @Success 301 {object} int "MovedPermanently" @Success 302 {object} int "Found" @Success 307 {object} int "TemporaryRedirect" @Success 308 {object} int "PermanentRedirect" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/{shortlink} [post] @Security bearerAuth
func (*ShortlinkController) HandleDeleteShortLink ¶
func (s *ShortlinkController) HandleDeleteShortLink(c *gin.Context)
HandleDeleteShortLink handles the deletion of a shortlink @BasePath /api/v1/ @Summary delete shortlink @Schemes http https @Description delete shortlink @Produce text/plain @Produce application/json @Param shortlink path string true "the shortlink URL part (shortlink id)" example(home) @Success 200 {object} int "Success" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/{shortlink} [delete] @Security bearerAuth
func (*ShortlinkController) HandleGetShortLink ¶
func (s *ShortlinkController) HandleGetShortLink(c *gin.Context)
HandleGetShortLink returns the shortlink @BasePath /api/v1/ @Summary get a shortlink @Schemes http https @Description get a shortlink @Produce text/plain @Produce application/json @Param shortlink path string false "the shortlink URL part (shortlink id)" example(home) @Success 200 {object} ShortLink "Success" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/{shortlink} [get] @Security bearerAuth
func (*ShortlinkController) HandleListShortLink ¶
func (s *ShortlinkController) HandleListShortLink(c *gin.Context)
HandleListShortLink handles the listing of @BasePath /api/v1/ @Summary list shortlinks @Schemes http https @Description list shortlinks @Produce text/plain @Produce application/json @Success 200 {object} []ShortLink "Success" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/ [get] @Security bearerAuth
func (*ShortlinkController) HandleUpdateShortLink ¶
func (s *ShortlinkController) HandleUpdateShortLink(c *gin.Context)
HandleDeleteShortLink handles the update of a shortlink @BasePath /api/v1/ @Summary update existing shortlink @Schemes http https @Description update a new shortlink @Accept application/json @Produce text/plain @Produce application/json @Param shortlink path string true "the shortlink URL part (shortlink id)" example(home) @Param spec body v1alpha1.ShortLinkSpec true "shortlink spec" @Success 200 {object} int "Success" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/{shortlink} [put] @Security bearerAuth