transformer

package
v0.3.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelName stores label of Name
	LabelName = types.GroupName + "/name"
)
View Source
const TransformerKind = "Transformer"

TransformerKind represents the Transformer kind

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Name        string               `yaml:"name,omitempty" json:"name,omitempty"`
	Type        ArtifactType         `yaml:"type,omitempty" json:"type,omitempty"`
	ProcessWith metav1.LabelSelector `yaml:"processWith,omitempty" json:"processWith,omitempty"` // Selector for choosing transformers that should process this artifact, empty is everything

	Paths   map[PathType][]string      `yaml:"paths,omitempty" json:"paths,omitempty" m2kpath:"normal"`
	Configs map[ConfigType]interface{} `yaml:"configs,omitempty" json:"config,omitempty"` // Could be IR or template config or any custom configuration
}

Artifact represents the artifact that can be passed between transformers

func (*Artifact) GetConfig

func (a *Artifact) GetConfig(configName ConfigType, obj interface{}) (err error)

GetConfig returns the config that has a particular config name

type ArtifactProcessConfig

type ArtifactProcessConfig struct {
	Merge    bool                   `yaml:"merge" json:"merge"`
	Mode     ArtifactProcessingMode `yaml:"mode" json:"mode"`
	Disabled bool                   `yaml:"disabled" json:"disabled"` // default is false
}

ArtifactProcessConfig stores config for preprocessing artifact

type ArtifactProcessingMode

type ArtifactProcessingMode string

ArtifactProcessingMode denotes the artifact processing mode

const (
	// Normal denotes normal consumes
	Normal ArtifactProcessingMode = "Normal"
	// MandatoryPassThrough denotes pass through
	MandatoryPassThrough ArtifactProcessingMode = "MandatoryPassThrough"
	// OnDemandPassThrough is generally used for dependencies
	OnDemandPassThrough ArtifactProcessingMode = "OnDemandPassThrough"
)

type ArtifactType

type ArtifactType string

ArtifactType is used to store the artifact type

type Config

type Config interface {
	// Merge helps in merging configs
	Merge(c interface{}) bool
}

Config represents the interface for config functions

type ConfigType

type ConfigType = string

ConfigType is used to store the config type

type DirectoryDetect

type DirectoryDetect struct {
	Levels int `yaml:"levels"` // Supports only 0,1 and -1 currently - default behaviour is -1, when directory detect section is missing
}

DirectoryDetect stores the config on how to iterate over the directories

type PathMapping

type PathMapping struct {
	Type           PathMappingType `yaml:"type,omitempty" json:"type,omitempty"` // Default - Normal copy
	SrcPath        string          `yaml:"sourcePath" json:"sourcePath" m2kpath:"normal"`
	DestPath       string          `yaml:"destinationPath" json:"destinationPath" m2kpath:"normal"` // Relative to output directory
	TemplateConfig interface{}     `yaml:"templateConfig" json:"templateConfig"`
}

PathMapping is the mapping between source and intermediate files and output files

type PathMappingType

type PathMappingType string

PathMappingType refers to the Path Mapping type

const (
	// DefaultPathMappingType allows normal copy with overwrite
	DefaultPathMappingType PathMappingType = "Default" // Normal Copy with overwrite
	// TemplatePathMappingType allows copy of source to destination and applying of template
	TemplatePathMappingType PathMappingType = "Template" // Source path when relative, is relative to yaml file location
	// SourcePathMappingType allows for copying of source directory to another directory
	SourcePathMappingType PathMappingType = "Source" // Source path becomes relative to source directory
	// DeletePathMappingType allows for deleting of files or folder directory
	DeletePathMappingType PathMappingType = "Delete" // Delete path becomes relative to source directory
	// ModifiedSourcePathMappingType allows for copying of deltas wrt source
	ModifiedSourcePathMappingType PathMappingType = "SourceDiff" // Source path becomes relative to source directory
	// PathTemplatePathMappingType allows for path template registration
	PathTemplatePathMappingType PathMappingType = "PathTemplate" // Path Template type
	// SpecialTemplatePathMappingType allows copy of source to destination and applying of template with custom delimiter
	SpecialTemplatePathMappingType PathMappingType = "SpecialTemplate" // Source path when relative, is relative to yaml file location
)

type PathType

type PathType string

PathType is used to store the path type

type ProducedArtifact

type ProducedArtifact struct {
	ChangeTypeTo ArtifactType `yaml:"changeTypeTo" json:"changeTypeTo"`
	Disabled     bool         `yaml:"disabled" json:"disabled"`
}

ProducedArtifact stores config for postprocessing produced artifact

type TransformOutput

type TransformOutput struct {
	PathMappings     []PathMapping `yaml:"pathMappings,omitempty" json:"pathMappings,omitempty"`
	CreatedArtifacts []Artifact    `yaml:"artifacts,omitempty" json:"artifacts,omitempty"`
}

TransformOutput structure is the data format for receiving data from starlark transform functions

type Transformer

type Transformer struct {
	types.TypeMeta   `yaml:",inline" json:",inline"`
	types.ObjectMeta `yaml:"metadata,omitempty" json:"metadata,omitempty"`
	Spec             TransformerSpec `yaml:"spec,omitempty" json:"spec,omitempty"`
}

Transformer defines definition of cf runtime instance apps file

func NewTransformer

func NewTransformer() Transformer

NewTransformer creates a new instance of tansformer

type TransformerDisabledError

type TransformerDisabledError struct {
	Err error
}

TransformerDisabledError indicates that the transformer had been intentionally disabled

func (*TransformerDisabledError) Error

func (e *TransformerDisabledError) Error() string

Error implements the interface required for Error

type TransformerSpec

type TransformerSpec struct {
	FilePath           string                                 `yaml:"-" json:"-"`
	Class              string                                 `yaml:"class" json:"class"`
	Isolated           bool                                   `yaml:"isolated" json:"isolated"`
	DirectoryDetect    DirectoryDetect                        `yaml:"directoryDetect" json:"directoryDetect"`
	ExternalFiles      map[string]string                      `yaml:"externalFiles" json:"externalFiles"` // [source]destination
	ConsumedArtifacts  map[ArtifactType]ArtifactProcessConfig `yaml:"consumes" json:"consumes"`
	ProducedArtifacts  map[ArtifactType]ProducedArtifact      `yaml:"produces" json:"produces"`
	Dependency         interface{}                            `yaml:"dependency" json:"dependency"` // metav1.LabelSelector
	Override           interface{}                            `yaml:"override" json:"override"`     // metav1.LabelSelector
	DependencySelector labels.Selector                        `yaml:"-" json:"-"`
	OverrideSelector   labels.Selector                        `yaml:"-" json:"-"`
	TemplatesDir       string                                 `yaml:"templates" json:"templates"` // Relative to yaml directory or working directory in image
	Config             interface{}                            `yaml:"config" json:"config"`
}

TransformerSpec stores the data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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