Documentation ¶
Index ¶
- func AsRegoCompilationErr(err error) ast.Errors
- func AsRegoTopdownErr(err error) *topdown.Error
- func AsStringSlice(val interface{}) ([]string, bool)
- func ChainErrors(errs ...error) error
- func ContainsString(values []string, wanted string) bool
- func CopyBytes(src []byte) []byte
- func ImmediateDeletionOptions() *metav1.DeleteOptions
- func IsDirPath(path string) bool
- func JoinLines(lines ...string) string
- func NamespaceOrDefault(u *unstructured.Unstructured) string
- func NewSelectorFromObject(u *unstructured.Unstructured) labels.Selector
- func ParseCheckFragment(input string) (*ast.Module, error)
- func ParseModuleFile(filePath string) (*ast.Module, error)
- func RandomStringN(length int) string
- func SplitObjectName(fullName string) (string, string)
- func WalkFiles(walkPath string, walkFn func(string) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsRegoCompilationErr ¶
AsRegoCompilationErr attempts to convert this error into a Rego compilation error.
func AsRegoTopdownErr ¶
AsRegoTopdownErr attempts to convert this error error to a Rego topdown.Error.
func AsStringSlice ¶
AsStringSlice tries to coerce an interface that may actually be a []string.
func ChainErrors ¶
ChainErrors takes the slice of errors and constructs a single chained error from is. The captures errors can be retrieved by inspecting the result with errors.As and errors.Is.
func ContainsString ¶
ContainsString checks whether the wanted string is in the values slice. This is suitable for short, unsorted slices.
func ImmediateDeletionOptions ¶
func ImmediateDeletionOptions() *metav1.DeleteOptions
ImmediateDeletionOptions returns metav1.DeleteOptions specifying that the caller requires immediate foreground deletion semantics.
func NamespaceOrDefault ¶
func NamespaceOrDefault(u *unstructured.Unstructured) string
NamespaceOrDefault returns the namespace from u, or "default" if u has no namespace field.
func NewSelectorFromObject ¶
func NewSelectorFromObject(u *unstructured.Unstructured) labels.Selector
NewSelectorFromObject creates a selector to match all the labels in u.
func ParseCheckFragment ¶
ParseCheckFragment parses a Rego string into a *ast.Module. The Rego input is assumed to not have a package declaration so a random package name is prepended to make the parsed module globally unique. ParseCheckFragment can return nil with no error if the input is empty.
func ParseModuleFile ¶
ParseModuleFile parses the Rego module in the given file path.
func SplitObjectName ¶
SplitObjectName splits a string into namespace and name.
Types ¶
This section is empty.