Files
fn-serverless/cli/vendor/github.com/funcy/functions_go/models/task.go
Denis Makogon 24eacbbbbf Improving certain CLI commands: init, run (#207)
* Consolidating route type utilization

Fixes: #197

* Adding --version to fn init CLI command

* Updating functions_go to 0.1.36

* Updating route init process

* Updating tests

* Adding "memory" CLI flag to fn run

* Make CLI memory flag override what's in func.yaml

* Get rid of default value for memory flag

* Revert UX impact

 func.yaml remains the same, no nested maps
2017-08-18 11:14:29 -07:00

156 lines
4.0 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
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 (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// Task task
// swagger:model Task
type Task struct {
// Time when task completed, whether it was successul or failed. Always in UTC.
CompletedAt strfmt.DateTime `json:"completed_at,omitempty"`
// Time when task was submitted. Always in UTC.
// Read Only: true
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
// Env vars for the task. Comes from the ones set on the Group.
EnvVars map[string]string `json:"env_vars,omitempty"`
// The error message, if status is 'error'. This is errors due to things outside the task itself. Errors from user code will be found in the log.
Error string `json:"error,omitempty"`
// Group this task belongs to.
// Read Only: true
GroupName string `json:"group_name,omitempty"`
// Name of Docker image to use. This is optional and can be used to override the image defined at the group level.
// Required: true
Image *string `json:"image"`
// Payload for the task. This is what you pass into each task to make it do something.
Payload string `json:"payload,omitempty"`
// Machine usable reason for task being in this state.
// Valid values for error status are `timeout | killed | bad_exit`.
// Valid values for cancelled status are `client_request`.
// For everything else, this is undefined.
//
Reason string `json:"reason,omitempty"`
// If this field is set, then this task was retried by the task referenced in this field.
// Read Only: true
RetryAt string `json:"retry_at,omitempty"`
// If this field is set, then this task is a retry of the ID in this field.
// Read Only: true
RetryOf string `json:"retry_of,omitempty"`
// Time when task started execution. Always in UTC.
StartedAt strfmt.DateTime `json:"started_at,omitempty"`
}
// Validate validates this task
func (m *Task) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateImage(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateReason(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Task) validateImage(formats strfmt.Registry) error {
if err := validate.Required("image", "body", m.Image); err != nil {
return err
}
return nil
}
var taskTypeReasonPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["timeout","killed","bad_exit","client_request"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
taskTypeReasonPropEnum = append(taskTypeReasonPropEnum, v)
}
}
const (
// TaskReasonTimeout captures enum value "timeout"
TaskReasonTimeout string = "timeout"
// TaskReasonKilled captures enum value "killed"
TaskReasonKilled string = "killed"
// TaskReasonBadExit captures enum value "bad_exit"
TaskReasonBadExit string = "bad_exit"
// TaskReasonClientRequest captures enum value "client_request"
TaskReasonClientRequest string = "client_request"
)
// prop value enum
func (m *Task) validateReasonEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, taskTypeReasonPropEnum); err != nil {
return err
}
return nil
}
func (m *Task) validateReason(formats strfmt.Registry) error {
if swag.IsZero(m.Reason) { // not required
return nil
}
// value enum
if err := m.validateReasonEnum("reason", "body", m.Reason); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *Task) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Task) UnmarshalBinary(b []byte) error {
var res Task
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}