2023-04-10 15:36:59 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2021-10-01 13:59:55 +00:00
|
|
|
//go:build !ent
|
2020-08-18 19:35:38 +00:00
|
|
|
// +build !ent
|
|
|
|
|
|
|
|
package structs
|
|
|
|
|
2020-09-29 21:57:46 +00:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
multierror "github.com/hashicorp/go-multierror"
|
|
|
|
)
|
2020-08-18 19:35:38 +00:00
|
|
|
|
2023-06-16 20:30:22 +00:00
|
|
|
func (n *Namespace) Canonicalize() {}
|
|
|
|
|
|
|
|
func (n *NamespaceNodePoolConfiguration) Canonicalize() {}
|
|
|
|
|
|
|
|
func (n *NamespaceNodePoolConfiguration) Validate() error {
|
|
|
|
if n != nil {
|
|
|
|
return errors.New("Node Pools Governance is unlicensed.")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-08-18 19:35:38 +00:00
|
|
|
func (m *Multiregion) Validate(jobType string, jobDatacenters []string) error {
|
|
|
|
if m != nil {
|
|
|
|
return errors.New("Multiregion jobs are unlicensed.")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
2020-09-29 21:57:46 +00:00
|
|
|
|
|
|
|
func (p *ScalingPolicy) validateType() multierror.Error {
|
|
|
|
var mErr multierror.Error
|
|
|
|
|
|
|
|
// Check policy type and target
|
|
|
|
switch p.Type {
|
|
|
|
case ScalingPolicyTypeHorizontal:
|
|
|
|
targetErr := p.validateTargetHorizontal()
|
|
|
|
mErr.Errors = append(mErr.Errors, targetErr.Errors...)
|
|
|
|
default:
|
|
|
|
mErr.Errors = append(mErr.Errors, fmt.Errorf(`scaling policy type "%s" is not valid`, p.Type))
|
|
|
|
}
|
|
|
|
|
|
|
|
return mErr
|
|
|
|
}
|
2020-09-09 22:30:40 +00:00
|
|
|
|
|
|
|
func (j *Job) GetEntScalingPolicies() []*ScalingPolicy {
|
|
|
|
return nil
|
|
|
|
}
|