/
task_all_of1.go
153 lines (115 loc) · 4 KB
/
task_all_of1.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// 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"
)
// TaskAllOf1 task all of1
// swagger:model taskAllOf1
type TaskAllOf1 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"`
// 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"`
}
/* polymorph taskAllOf1 completed_at false */
/* polymorph taskAllOf1 created_at false */
/* polymorph taskAllOf1 env_vars false */
/* polymorph taskAllOf1 error false */
/* polymorph taskAllOf1 group_name false */
/* polymorph taskAllOf1 reason false */
/* polymorph taskAllOf1 retry_at false */
/* polymorph taskAllOf1 retry_of false */
/* polymorph taskAllOf1 started_at false */
// Validate validates this task all of1
func (m *TaskAllOf1) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateReason(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
var taskAllOf1TypeReasonPropEnum []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 {
taskAllOf1TypeReasonPropEnum = append(taskAllOf1TypeReasonPropEnum, v)
}
}
const (
// TaskAllOf1ReasonTimeout captures enum value "timeout"
TaskAllOf1ReasonTimeout string = "timeout"
// TaskAllOf1ReasonKilled captures enum value "killed"
TaskAllOf1ReasonKilled string = "killed"
// TaskAllOf1ReasonBadExit captures enum value "bad_exit"
TaskAllOf1ReasonBadExit string = "bad_exit"
// TaskAllOf1ReasonClientRequest captures enum value "client_request"
TaskAllOf1ReasonClientRequest string = "client_request"
)
// prop value enum
func (m *TaskAllOf1) validateReasonEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, taskAllOf1TypeReasonPropEnum); err != nil {
return err
}
return nil
}
func (m *TaskAllOf1) 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 *TaskAllOf1) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TaskAllOf1) UnmarshalBinary(b []byte) error {
var res TaskAllOf1
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}