mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-03-03 18:20:19 +00:00
30 lines
742 B
Go
30 lines
742 B
Go
// Copyright 2020-2021 Clastix Labs
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package pod
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/clastix/capsule/pkg/api"
|
|
"github.com/clastix/capsule/pkg/webhook/utils"
|
|
)
|
|
|
|
type podRuntimeClassForbiddenError struct {
|
|
runtimeClassName string
|
|
spec api.SelectorAllowedListSpec
|
|
}
|
|
|
|
func NewPodRuntimeClassForbidden(runtimeClassName string, spec api.SelectorAllowedListSpec) error {
|
|
return &podRuntimeClassForbiddenError{
|
|
runtimeClassName: runtimeClassName,
|
|
spec: spec,
|
|
}
|
|
}
|
|
|
|
func (f podRuntimeClassForbiddenError) Error() (err string) {
|
|
err = fmt.Sprintf("Pod Runtime Class %s is forbidden for the current Tenant: ", f.runtimeClassName)
|
|
|
|
return utils.AllowedValuesErrorMessage(f.spec, err)
|
|
}
|