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
@@ -0,0 +1,90 @@
package playbooks
// 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"
)
// CreatePlaybookEndpoint executes the core logic of the related
// route endpoint.
func CreatePlaybookEndpoint(handler func(ctx context.Context, params *CreatePlaybookParams) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
// generate params from request
params := NewCreatePlaybookParams()
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)
}
}
}
// NewCreatePlaybookParams creates a new CreatePlaybookParams object
// with the default values initialized.
func NewCreatePlaybookParams() *CreatePlaybookParams {
var ()
return &CreatePlaybookParams{}
}
// CreatePlaybookParams contains all the bound params for the create playbook operation
// typically these are obtained from a http.Request
//
// swagger:parameters createPlaybook
type CreatePlaybookParams struct {
/*New playbook
Required: true
In: body
*/
Playbook *models.PlaybookTemplateForm
}
// 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 *CreatePlaybookParams) ReadRequest(ctx *gin.Context) error {
var res []error
if runtime.HasBody(ctx.Request) {
var body models.PlaybookTemplateForm
if err := ctx.BindJSON(&body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("playbook", "body", ""))
} else {
res = append(res, errors.NewParseError("playbook", "body", "", err))
}
} else {
o.Playbook = &body
}
} else {
res = append(res, errors.Required("playbook", "body", ""))
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
@@ -0,0 +1,87 @@
package playbooks
// 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"
)
// DeletePlaybookEndpoint executes the core logic of the related
// route endpoint.
func DeletePlaybookEndpoint(handler func(ctx context.Context, params *DeletePlaybookParams) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
// generate params from request
params := NewDeletePlaybookParams()
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)
}
}
}
// NewDeletePlaybookParams creates a new DeletePlaybookParams object
// with the default values initialized.
func NewDeletePlaybookParams() *DeletePlaybookParams {
var ()
return &DeletePlaybookParams{}
}
// DeletePlaybookParams contains all the bound params for the delete playbook operation
// typically these are obtained from a http.Request
//
// swagger:parameters deletePlaybook
type DeletePlaybookParams struct {
/*Playbook name
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 *DeletePlaybookParams) 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 *DeletePlaybookParams) bindID(rawData []string, hasKey bool) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
@@ -0,0 +1,87 @@
package playbooks
// 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"
)
// GetPlaybookEndpoint executes the core logic of the related
// route endpoint.
func GetPlaybookEndpoint(handler func(ctx context.Context, params *GetPlaybookParams) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
// generate params from request
params := NewGetPlaybookParams()
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)
}
}
}
// NewGetPlaybookParams creates a new GetPlaybookParams object
// with the default values initialized.
func NewGetPlaybookParams() *GetPlaybookParams {
var ()
return &GetPlaybookParams{}
}
// GetPlaybookParams contains all the bound params for the get playbook operation
// typically these are obtained from a http.Request
//
// swagger:parameters getPlaybook
type GetPlaybookParams struct {
/*Playbook name
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 *GetPlaybookParams) 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 *GetPlaybookParams) bindID(rawData []string, hasKey bool) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
@@ -0,0 +1,55 @@
package playbooks
// 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"
)
// ListPlaybooksEndpoint executes the core logic of the related
// route endpoint.
func ListPlaybooksEndpoint(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)
}
}
}
// NewListPlaybooksParams creates a new ListPlaybooksParams object
// with the default values initialized.
func NewListPlaybooksParams() *ListPlaybooksParams {
var ()
return &ListPlaybooksParams{}
}
// ListPlaybooksParams contains all the bound params for the list playbooks operation
// typically these are obtained from a http.Request
//
// swagger:parameters listPlaybooks
type ListPlaybooksParams 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 *ListPlaybooksParams) ReadRequest(ctx *gin.Context) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
@@ -0,0 +1,111 @@
package playbooks
// 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"
)
// UpdatePlaybookEndpoint executes the core logic of the related
// route endpoint.
func UpdatePlaybookEndpoint(handler func(ctx context.Context, params *UpdatePlaybookParams) *api.Response) gin.HandlerFunc {
return func(ctx *gin.Context) {
// generate params from request
params := NewUpdatePlaybookParams()
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)
}
}
}
// NewUpdatePlaybookParams creates a new UpdatePlaybookParams object
// with the default values initialized.
func NewUpdatePlaybookParams() *UpdatePlaybookParams {
var ()
return &UpdatePlaybookParams{}
}
// UpdatePlaybookParams contains all the bound params for the update playbook operation
// typically these are obtained from a http.Request
//
// swagger:parameters updatePlaybook
type UpdatePlaybookParams struct {
/*Playbook ID
Required: true
In: path
*/
ID string
/*Updated playbook
Required: true
In: body
*/
Playbook *models.PlaybookTemplateForm
}
// 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 *UpdatePlaybookParams) 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.PlaybookTemplateForm
if err := ctx.BindJSON(&body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("playbook", "body", ""))
} else {
res = append(res, errors.NewParseError("playbook", "body", "", err))
}
} else {
o.Playbook = &body
}
} else {
res = append(res, errors.Required("playbook", "body", ""))
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *UpdatePlaybookParams) bindID(rawData []string, hasKey bool) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}