mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-10 01:02:52 +01:00
Release catalyst
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
package automations
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// CreateAutomationEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func CreateAutomationEndpoint(handler func(ctx context.Context, params *CreateAutomationParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewCreateAutomationParams()
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewCreateAutomationParams creates a new CreateAutomationParams object
|
||||
// with the default values initialized.
|
||||
func NewCreateAutomationParams() *CreateAutomationParams {
|
||||
var ()
|
||||
return &CreateAutomationParams{}
|
||||
}
|
||||
|
||||
// CreateAutomationParams contains all the bound params for the create automation operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters createAutomation
|
||||
type CreateAutomationParams struct {
|
||||
|
||||
/*New automation
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Automation *models.AutomationForm
|
||||
}
|
||||
|
||||
// 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 *CreateAutomationParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.AutomationForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("automation", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("automation", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Automation = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("automation", "body", ""))
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package automations
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DeleteAutomationEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func DeleteAutomationEndpoint(handler func(ctx context.Context, params *DeleteAutomationParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewDeleteAutomationParams()
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeleteAutomationParams creates a new DeleteAutomationParams object
|
||||
// with the default values initialized.
|
||||
func NewDeleteAutomationParams() *DeleteAutomationParams {
|
||||
var ()
|
||||
return &DeleteAutomationParams{}
|
||||
}
|
||||
|
||||
// DeleteAutomationParams contains all the bound params for the delete automation operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters deleteAutomation
|
||||
type DeleteAutomationParams struct {
|
||||
|
||||
/*Automation 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 *DeleteAutomationParams) 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 *DeleteAutomationParams) 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 automations
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// GetAutomationEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func GetAutomationEndpoint(handler func(ctx context.Context, params *GetAutomationParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewGetAutomationParams()
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewGetAutomationParams creates a new GetAutomationParams object
|
||||
// with the default values initialized.
|
||||
func NewGetAutomationParams() *GetAutomationParams {
|
||||
var ()
|
||||
return &GetAutomationParams{}
|
||||
}
|
||||
|
||||
// GetAutomationParams contains all the bound params for the get automation operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters getAutomation
|
||||
type GetAutomationParams struct {
|
||||
|
||||
/*Automation 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 *GetAutomationParams) 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 *GetAutomationParams) 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 automations
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// ListAutomationsEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func ListAutomationsEndpoint(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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewListAutomationsParams creates a new ListAutomationsParams object
|
||||
// with the default values initialized.
|
||||
func NewListAutomationsParams() *ListAutomationsParams {
|
||||
var ()
|
||||
return &ListAutomationsParams{}
|
||||
}
|
||||
|
||||
// ListAutomationsParams contains all the bound params for the list automations operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listAutomations
|
||||
type ListAutomationsParams 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 *ListAutomationsParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package automations
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// UpdateAutomationEndpoint executes the core logic of the related
|
||||
// route endpoint.
|
||||
func UpdateAutomationEndpoint(handler func(ctx context.Context, params *UpdateAutomationParams) *api.Response) gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
// generate params from request
|
||||
params := NewUpdateAutomationParams()
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewUpdateAutomationParams creates a new UpdateAutomationParams object
|
||||
// with the default values initialized.
|
||||
func NewUpdateAutomationParams() *UpdateAutomationParams {
|
||||
var ()
|
||||
return &UpdateAutomationParams{}
|
||||
}
|
||||
|
||||
// UpdateAutomationParams contains all the bound params for the update automation operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters updateAutomation
|
||||
type UpdateAutomationParams struct {
|
||||
|
||||
/*Automation object that needs to be added
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Automation *models.AutomationForm
|
||||
/*Automation 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 *UpdateAutomationParams) ReadRequest(ctx *gin.Context) error {
|
||||
var res []error
|
||||
|
||||
if runtime.HasBody(ctx.Request) {
|
||||
var body models.AutomationForm
|
||||
if err := ctx.BindJSON(&body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("automation", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("automation", "body", "", err))
|
||||
}
|
||||
|
||||
} else {
|
||||
o.Automation = &body
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("automation", "body", ""))
|
||||
}
|
||||
|
||||
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 *UpdateAutomationParams) bindID(rawData []string, hasKey bool) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
o.ID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user