mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Initial work on async functions
This commit is contained in:
71
api/models/group.go
Normal file
71
api/models/group.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
/*Group group
|
||||
|
||||
swagger:model Group
|
||||
*/
|
||||
type Group struct {
|
||||
|
||||
/* Time when image first used/created.
|
||||
|
||||
Read Only: true
|
||||
*/
|
||||
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
|
||||
|
||||
/* User defined environment variables that will be passed in to each task in this group.
|
||||
*/
|
||||
EnvVars map[string]string `json:"env_vars,omitempty"`
|
||||
|
||||
/* Name of Docker image to use in this group. You should include the image tag, which should be a version number, to be more accurate. Can be overridden on a per task basis with task.image.
|
||||
*/
|
||||
Image string `json:"image,omitempty"`
|
||||
|
||||
/* The maximum number of tasks that will run at the exact same time in this group.
|
||||
*/
|
||||
MaxConcurrency int32 `json:"max_concurrency,omitempty"`
|
||||
|
||||
/* Name of this group. Must be different than the image name. Can ony contain alphanumeric, -, and _.
|
||||
|
||||
Read Only: true
|
||||
*/
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this group
|
||||
func (m *Group) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateEnvVars(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Group) validateEnvVars(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.EnvVars) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := validate.Required("env_vars", "body", m.EnvVars); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user