open-nomad/api/constraint.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
961 B
Go
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
2015-09-09 20:02:39 +00:00
package api
const (
ConstraintDistinctProperty = "distinct_property"
ConstraintDistinctHosts = "distinct_hosts"
ConstraintRegex = "regexp"
ConstraintVersion = "version"
ConstraintSemver = "semver"
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 {
2020-10-21 13:58:45 +00:00
LTarget string `hcl:"attribute,optional"`
RTarget string `hcl:"value,optional"`
Operand string `hcl:"operator,optional"`
2015-09-09 20:02:39 +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,
}
}