common

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDomain added in v0.2.0

func GetDomain(domain Domain, ctx context.Context) types.Domain

Get the domain and providers

func GetProvider added in v0.2.0

func GetProvider(provider Provider, ctx context.Context) types.Provider

func IsVersionValid added in v0.1.0

func IsVersionValid(versionConstraint string, version string) (bool, error)

Returns version validity

func ReadFileToBytes

func ReadFileToBytes(path string) ([]byte, error)

ReadFileToBytes reads a file to bytes

func SetCwdToFileDir added in v0.2.0

func SetCwdToFileDir(dirPath string) (resetFunc func(), err error)

SetCwdToFileDir takes a path and changes the current working directory to the directory of the path

func ValidationFromString added in v0.2.0

func ValidationFromString(raw string) (validation types.LulaValidation, err error)

Converts a raw string to a Validation object (string -> common.Validation -> types.Validation)

Types

type Domain added in v0.2.0

type Domain struct {
	Type           string              `json:"type" yaml:"type"`
	KubernetesSpec kube.KubernetesSpec `json:"kubernetes-spec" yaml:"kubernetes-spec"`
	ApiSpec        api.ApiSpec         `json:"api-spec" yaml:"api-spec"`
}

type Metadata added in v0.2.0

type Metadata struct {
	Name string `json:"name" yaml:"name"`
	UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}

TODO: Perhaps extend this structure with other needed information, such as UUID or type of validation if workflow is needed

type Provider added in v0.2.0

type Provider struct {
	Type        string              `json:"type" yaml:"type"`
	OpaSpec     opa.OpaSpec         `json:"opa-spec" yaml:"opa-spec"`
	KyvernoSpec kyverno.KyvernoSpec `json:"kyverno-spec" yaml:"kyverno-spec"`
}

type Validation added in v0.2.0

type Validation struct {
	LulaVersion string   `json:"lula-version" yaml:"lula-version"`
	Metadata    Metadata `json:"metadata" yaml:"metadata"`
	Provider    Provider `json:"provider" yaml:"provider"`
	Domain      Domain   `json:"domain" yaml:"domain"`
}

Data structures for ingesting validation data

func (*Validation) MarshalYaml added in v0.2.0

func (v *Validation) MarshalYaml() ([]byte, error)

MarshalYaml is a convenience method to marshal a Validation object to a YAML byte array

func (*Validation) ToLulaValidation added in v0.2.0

func (validation *Validation) ToLulaValidation() (lulaValidation types.LulaValidation, err error)

ToLulaValidation converts a Validation object to a LulaValidation object

func (*Validation) UnmarshalYaml added in v0.2.0

func (v *Validation) UnmarshalYaml(data []byte) error

UnmarshalYaml is a convenience method to unmarshal a Validation object from a YAML byte array

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL