gettransformdata

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SimpleTransformTOutputs    = "outputs"
	SimpleTransformTTransforms = "transforms"
	SimpleTransformTTransform  = "transform"
	// SimpleTransformTFilters is the key used to specify filters for each transformation.
	// It is a json object. Key and values are regex patterns. Example:
	//   "filter": {
	//     "Pod": ["v1"],
	//     "Deployment": ["v1", "v1beta1"],
	//     "Ingress": ["v1.*"],
	//   }
	// Any empty key matches all kinds. Exmaple: "": ["v1", "v1beta1"]
	// Any empty array matches all apiVersions. Exmaple: "Deployment": []
	SimpleTransformTFilters    = "filter"
	SimpleTransformTQuestionFn = "query"
)

Various keys used in the file format.

Variables

This section is empty.

Functions

func GetK8sResourceFromObject

func GetK8sResourceFromObject(obj runtime.Object) (types.K8sResourceT, error)

GetK8sResourceFromObject converts a runtime.Object into a K8sResourceT

func GetK8sResources

func GetK8sResources(k8sResourcesPath string) ([]types.K8sResourceT, error)

GetK8sResources gets the k8s resources

func GetK8sResourcesFromYaml

func GetK8sResourcesFromYaml(k8sYaml string) ([]types.K8sResourceT, error)

GetK8sResourcesFromYaml decodes k8s resources from yaml

func GetObjectFromK8sResource

func GetObjectFromK8sResource(resource types.K8sResourceT, obj runtime.Object) (runtime.Object, error)

GetObjectFromK8sResource converts a K8sResourceT into a runtime.Object resource: The resource to convert obj: The target struct type (Deployment, Pod, Service, etc.). This can be just an empty struct of the correct type.

func GetTransforms

func GetTransforms(transformsPath string, dynQuesFn types.DynamicQuestionFnT) ([]types.TransformT, error)

GetTransforms returns the transformations

func GetTransformsFromPaths

func GetTransformsFromPaths(transformPaths []string, dynQuesFn types.DynamicQuestionFnT) ([]types.TransformT, error)

GetTransformsFromPaths returns the transformations given a list of script file paths

func GetTransformsFromSource

func GetTransformsFromSource(transformStr string, dynQuesFn types.DynamicQuestionFnT) ([]types.TransformT, error)

GetTransformsFromSource gets a list of transforms given a transformation script

Types

type SimpleTransformT

type SimpleTransformT struct {
	// contains filtered or unexported fields
}

SimpleTransformT implements the TransformT interface

func NewSimpleTransform

func NewSimpleTransform(transformFn *starlark.Function, kindsAPIVersions types.KindsAPIVersionsT) *SimpleTransformT

NewSimpleTransform returns a new instance of SimpleTransformT

func (*SimpleTransformT) Filter

func (st *SimpleTransformT) Filter(k8sResource types.K8sResourceT) (bool, error)

Filter returns true if this transformation can be applied to the given k8s resource

func (*SimpleTransformT) GetTransformsFromSource

func (st *SimpleTransformT) GetTransformsFromSource(transformStr string, dynQuesFn types.DynamicQuestionFnT) ([]types.TransformT, error)

GetTransformsFromSource returns a list of transforms given the transformation script

func (*SimpleTransformT) Transform

func (st *SimpleTransformT) Transform(k8sResource types.K8sResourceT) (types.K8sResourceT, error)

Transform transforms the k8s resource

Jump to

Keyboard shortcuts

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