Release catalyst

This commit is contained in:
Jonas Plum
2021-12-13 00:39:15 +01:00
commit 15cf0ebd49
339 changed files with 111677 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
package users
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"io"
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/SecurityBrewery/catalyst/generated/models"
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
)
// CreateUserEndpoint executes the core logic of the related
// route endpoint.
func CreateUserEndpoint(handler func(ctx context.Context, params *CreateUserParams) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
// generate params from request
params := NewCreateUserParams()
err := params.ReadRequest(ctx)
if err != nil {
errObj := err.(*errors.CompositeError)
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
return
}
resp := handler(ctx, params)
switch resp.Code {
case http.StatusNoContent:
ctx.AbortWithStatus(resp.Code)
default:
ctx.JSON(resp.Code, resp.Body)
}
}
}
// NewCreateUserParams creates a new CreateUserParams object
// with the default values initialized.
func NewCreateUserParams() *CreateUserParams {
var ()
return &CreateUserParams{}
}
// CreateUserParams contains all the bound params for the create user operation
// typically these are obtained from a http.Request
//
// swagger:parameters createUser
type CreateUserParams struct {
/*user object that needs to be added
Required: true
In: body
*/
User *models.UserForm
}
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *CreateUserParams) ReadRequest(ctx *gin.Context) error {
var res []error
if runtime.HasBody(ctx.Request) {
var body models.UserForm
if err := ctx.BindJSON(&body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("user", "body", ""))
} else {
res = append(res, errors.NewParseError("user", "body", "", err))
}
} else {
o.User = &body
}
} else {
res = append(res, errors.Required("user", "body", ""))
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,55 @@
package users
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-openapi/errors"
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
)
// CurrentUserEndpoint executes the core logic of the related
// route endpoint.
func CurrentUserEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
resp := handler(ctx)
switch resp.Code {
case http.StatusNoContent:
ctx.AbortWithStatus(resp.Code)
default:
ctx.JSON(resp.Code, resp.Body)
}
}
}
// NewCurrentUserParams creates a new CurrentUserParams object
// with the default values initialized.
func NewCurrentUserParams() *CurrentUserParams {
var ()
return &CurrentUserParams{}
}
// CurrentUserParams contains all the bound params for the current user operation
// typically these are obtained from a http.Request
//
// swagger:parameters currentUser
type CurrentUserParams struct {
}
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *CurrentUserParams) ReadRequest(ctx *gin.Context) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,87 @@
package users
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-openapi/errors"
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
)
// DeleteUserEndpoint executes the core logic of the related
// route endpoint.
func DeleteUserEndpoint(handler func(ctx context.Context, params *DeleteUserParams) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
// generate params from request
params := NewDeleteUserParams()
err := params.ReadRequest(ctx)
if err != nil {
errObj := err.(*errors.CompositeError)
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
return
}
resp := handler(ctx, params)
switch resp.Code {
case http.StatusNoContent:
ctx.AbortWithStatus(resp.Code)
default:
ctx.JSON(resp.Code, resp.Body)
}
}
}
// NewDeleteUserParams creates a new DeleteUserParams object
// with the default values initialized.
func NewDeleteUserParams() *DeleteUserParams {
var ()
return &DeleteUserParams{}
}
// DeleteUserParams contains all the bound params for the delete user operation
// typically these are obtained from a http.Request
//
// swagger:parameters deleteUser
type DeleteUserParams struct {
/*user ID
Required: true
In: path
*/
ID string
}
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *DeleteUserParams) ReadRequest(ctx *gin.Context) error {
var res []error
rID := []string{ctx.Param("id")}
if err := o.bindID(rID, true); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *DeleteUserParams) bindID(rawData []string, hasKey bool) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@@ -0,0 +1,87 @@
package users
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-openapi/errors"
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
)
// GetUserEndpoint executes the core logic of the related
// route endpoint.
func GetUserEndpoint(handler func(ctx context.Context, params *GetUserParams) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
// generate params from request
params := NewGetUserParams()
err := params.ReadRequest(ctx)
if err != nil {
errObj := err.(*errors.CompositeError)
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
return
}
resp := handler(ctx, params)
switch resp.Code {
case http.StatusNoContent:
ctx.AbortWithStatus(resp.Code)
default:
ctx.JSON(resp.Code, resp.Body)
}
}
}
// NewGetUserParams creates a new GetUserParams object
// with the default values initialized.
func NewGetUserParams() *GetUserParams {
var ()
return &GetUserParams{}
}
// GetUserParams contains all the bound params for the get user operation
// typically these are obtained from a http.Request
//
// swagger:parameters getUser
type GetUserParams struct {
/*user ID
Required: true
In: path
*/
ID string
}
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *GetUserParams) ReadRequest(ctx *gin.Context) error {
var res []error
rID := []string{ctx.Param("id")}
if err := o.bindID(rID, true); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetUserParams) bindID(rawData []string, hasKey bool) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@@ -0,0 +1,55 @@
package users
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-openapi/errors"
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
)
// ListUsersEndpoint executes the core logic of the related
// route endpoint.
func ListUsersEndpoint(handler func(ctx context.Context) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
resp := handler(ctx)
switch resp.Code {
case http.StatusNoContent:
ctx.AbortWithStatus(resp.Code)
default:
ctx.JSON(resp.Code, resp.Body)
}
}
}
// NewListUsersParams creates a new ListUsersParams object
// with the default values initialized.
func NewListUsersParams() *ListUsersParams {
var ()
return &ListUsersParams{}
}
// ListUsersParams contains all the bound params for the list users operation
// typically these are obtained from a http.Request
//
// swagger:parameters listUsers
type ListUsersParams struct {
}
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *ListUsersParams) ReadRequest(ctx *gin.Context) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,111 @@
package users
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"io"
"net/http"
"github.com/gin-gonic/gin"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/SecurityBrewery/catalyst/generated/models"
"github.com/SecurityBrewery/catalyst/generated/restapi/api"
)
// UpdateUserEndpoint executes the core logic of the related
// route endpoint.
func UpdateUserEndpoint(handler func(ctx context.Context, params *UpdateUserParams) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
// generate params from request
params := NewUpdateUserParams()
err := params.ReadRequest(ctx)
if err != nil {
errObj := err.(*errors.CompositeError)
ctx.Writer.Header().Set("Content-Type", "application/problem+json")
ctx.JSON(int(errObj.Code()), gin.H{"error": errObj.Error()})
return
}
resp := handler(ctx, params)
switch resp.Code {
case http.StatusNoContent:
ctx.AbortWithStatus(resp.Code)
default:
ctx.JSON(resp.Code, resp.Body)
}
}
}
// NewUpdateUserParams creates a new UpdateUserParams object
// with the default values initialized.
func NewUpdateUserParams() *UpdateUserParams {
var ()
return &UpdateUserParams{}
}
// UpdateUserParams contains all the bound params for the update user operation
// typically these are obtained from a http.Request
//
// swagger:parameters updateUser
type UpdateUserParams struct {
/*Template ID
Required: true
In: path
*/
ID string
/*user object that needs to be added
Required: true
In: body
*/
User *models.UserForm
}
// ReadRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls
func (o *UpdateUserParams) ReadRequest(ctx *gin.Context) error {
var res []error
rID := []string{ctx.Param("id")}
if err := o.bindID(rID, true); err != nil {
res = append(res, err)
}
if runtime.HasBody(ctx.Request) {
var body models.UserForm
if err := ctx.BindJSON(&body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("user", "body", ""))
} else {
res = append(res, errors.NewParseError("user", "body", "", err))
}
} else {
o.User = &body
}
} else {
res = append(res, errors.Required("user", "body", ""))
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *UpdateUserParams) bindID(rawData []string, hasKey bool) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}