Added the service definitions in api structs too

This commit is contained in:
Diptanu Choudhury
2015-11-17 02:20:35 -05:00
parent 5a0777fccb
commit 53e9d21ac0
2 changed files with 40 additions and 19 deletions

View File

@@ -20,6 +20,25 @@ func NewRestartPolicy() *RestartPolicy {
}
}
// The ServiceCheck data model represents the consul health check that
// Nomad registers for a Task
type ServiceCheck struct {
Id string
Name string
Type string
Interval time.Duration
Timeout time.Duration
}
// The Service model represents a Consul service defintion
type Service struct {
Id string
Name string
Tags []string
PortLabel string `mapstructure:"port"`
Checks []ServiceCheck
}
// TaskGroup is the unit of scheduling.
type TaskGroup struct {
Name string
@@ -68,6 +87,7 @@ type Task struct {
Config map[string]interface{}
Constraints []*Constraint
Env map[string]string
Services []Service
Resources *Resources
Meta map[string]string
}

View File

@@ -906,25 +906,6 @@ func NewRestartPolicy(jobType string) *RestartPolicy {
return nil
}
// The ServiceCheck data model represents the consul health check that
// Nomad registers for a Task
type ServiceCheck struct {
Id string
Name string
Type string
Interval time.Duration
Timeout time.Duration
}
// The Service model represents a Consul service defintion
type Service struct {
Id string
Name string
Tags []string
PortLabel string `mapstructure:"port"`
Checks []ServiceCheck
}
// TaskGroup is an atomic unit of placement. Each task group belongs to
// a job and may contain any number of tasks. A task group support running
// in many replicas using the same configuration..
@@ -1014,6 +995,25 @@ func (tg *TaskGroup) GoString() string {
return fmt.Sprintf("*%#v", *tg)
}
// The ServiceCheck data model represents the consul health check that
// Nomad registers for a Task
type ServiceCheck struct {
Id string
Name string
Type string
Interval time.Duration
Timeout time.Duration
}
// The Service model represents a Consul service defintion
type Service struct {
Id string
Name string
Tags []string
PortLabel string `mapstructure:"port"`
Checks []ServiceCheck
}
// Task is a single process typically that is executed as part of a task group.
type Task struct {
// Name of the task
@@ -1028,6 +1028,7 @@ type Task struct {
// Map of environment variables to be used by the driver
Env map[string]string
// List of service definitions exposed by the Task
Services []Service
// Constraints can be specified at a task level and apply only to