Skip to content

Commit 1ac2e55

Browse files
authored
✨ Add yaml tags to task resources. (#333)
Signed-off-by: Jeff Ortel <[email protected]>
1 parent 3bd44e4 commit 1ac2e55

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

Diff for: api/task.go

+24-24
Original file line numberDiff line numberDiff line change
@@ -499,27 +499,27 @@ type TTL struct {
499499
//
500500
// Task REST resource.
501501
type Task struct {
502-
Resource
502+
Resource `yaml:",inline"`
503503
Name string `json:"name"`
504-
Locator string `json:"locator,omitempty"`
505-
Priority int `json:"priority,omitempty"`
506-
Variant string `json:"variant,omitempty"`
507-
Policy string `json:"policy,omitempty"`
508-
TTL *TTL `json:"ttl,omitempty"`
509-
Addon string `json:"addon,omitempty" binding:"required"`
504+
Locator string `json:"locator,omitempty" yaml:",omitempty"`
505+
Priority int `json:"priority,omitempty" yaml:",omitempty"`
506+
Variant string `json:"variant,omitempty" yaml:",omitempty"`
507+
Policy string `json:"policy,omitempty" yaml:",omitempty"`
508+
TTL *TTL `json:"ttl,omitempty" yaml:",omitempty"`
509+
Addon string `json:"addon,omitempty" binding:"required" yaml:",omitempty"`
510510
Data interface{} `json:"data" swaggertype:"object" binding:"required"`
511-
Application *Ref `json:"application,omitempty"`
511+
Application *Ref `json:"application,omitempty" yaml:",omitempty"`
512512
State string `json:"state"`
513-
Image string `json:"image,omitempty"`
514-
Bucket *Ref `json:"bucket,omitempty"`
515-
Purged bool `json:"purged,omitempty"`
516-
Started *time.Time `json:"started,omitempty"`
517-
Terminated *time.Time `json:"terminated,omitempty"`
518-
Error string `json:"error,omitempty"`
519-
Pod string `json:"pod,omitempty"`
520-
Retries int `json:"retries,omitempty"`
521-
Canceled bool `json:"canceled,omitempty"`
522-
Report *TaskReport `json:"report,omitempty"`
513+
Image string `json:"image,omitempty" yaml:",omitempty"`
514+
Bucket *Ref `json:"bucket,omitempty" yaml:",omitempty"`
515+
Purged bool `json:"purged,omitempty" yaml:",omitempty"`
516+
Started *time.Time `json:"started,omitempty" yaml:",omitempty"`
517+
Terminated *time.Time `json:"terminated,omitempty" yaml:",omitempty"`
518+
Error string `json:"error,omitempty" yaml:",omitempty"`
519+
Pod string `json:"pod,omitempty" yaml:",omitempty"`
520+
Retries int `json:"retries,omitempty" yaml:",omitempty"`
521+
Canceled bool `json:"canceled,omitempty" yaml:",omitempty"`
522+
Report *TaskReport `json:"report,omitempty" yaml:",omitempty"`
523523
}
524524

525525
//
@@ -577,13 +577,13 @@ func (r *Task) Model() (m *model.Task) {
577577
//
578578
// TaskReport REST resource.
579579
type TaskReport struct {
580-
Resource
580+
Resource `yaml:",inline"`
581581
Status string `json:"status"`
582-
Error string `json:"error"`
583-
Total int `json:"total"`
584-
Completed int `json:"completed"`
585-
Activity []string `json:"activity"`
586-
Result interface{} `json:"result,omitempty" swaggertype:"object"`
582+
Error string `json:"error,omitempty" yaml:",omitempty"`
583+
Total int `json:"total,omitempty" yaml:",omitempty"`
584+
Completed int `json:"completed,omitempty" yaml:",omitempty"`
585+
Activity []string `json:"activity,omitempty" yaml:",omitempty"`
586+
Result interface{} `json:"result,omitempty" yaml:",omitempty" swaggertype:"object"`
587587
TaskID uint `json:"task"`
588588
}
589589

0 commit comments

Comments
 (0)