2015-09-09 20:02:39 +00:00
|
|
|
package api
|
|
|
|
|
2019-05-09 12:23:49 +00:00
|
|
|
const (
|
|
|
|
ConstraintDistinctProperty = "distinct_property"
|
|
|
|
ConstraintDistinctHosts = "distinct_hosts"
|
|
|
|
ConstraintRegex = "regexp"
|
|
|
|
ConstraintVersion = "version"
|
2019-11-13 23:36:15 +00:00
|
|
|
ConstraintSemver = "semver"
|
2019-05-09 12:23:49 +00:00
|
|
|
ConstraintSetContains = "set_contains"
|
|
|
|
ConstraintSetContainsAll = "set_contains_all"
|
|
|
|
ConstraintSetContainsAny = "set_contains_any"
|
|
|
|
ConstraintAttributeIsSet = "is_set"
|
|
|
|
ConstraintAttributeIsNotSet = "is_not_set"
|
|
|
|
)
|
|
|
|
|
2015-09-09 20:02:39 +00:00
|
|
|
// Constraint is used to serialize a job placement constraint.
|
|
|
|
type Constraint struct {
|
|
|
|
LTarget string
|
|
|
|
RTarget string
|
|
|
|
Operand string
|
|
|
|
}
|
|
|
|
|
2015-10-27 21:31:14 +00:00
|
|
|
// NewConstraint generates a new job placement constraint.
|
|
|
|
func NewConstraint(left, operand, right string) *Constraint {
|
2015-09-09 20:02:39 +00:00
|
|
|
return &Constraint{
|
|
|
|
LTarget: left,
|
|
|
|
RTarget: right,
|
|
|
|
Operand: operand,
|
|
|
|
}
|
|
|
|
}
|