transformer

package
v0.3.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

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"`
	Artifact ArtifactType `yaml:"artifact,omitempty" json:"artifact,omitempty"`

	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 ArtifactPreprocessConfig

type ArtifactPreprocessConfig struct {
	Merge bool `yaml:"merge"`
}

ArtifactPreprocessConfig stores config for how to preprocess artifacts

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
	HonorM2KIgnore              bool `yaml:"honorM2KIgnore"`              // TODO: Add support
	IgnoreServiceSubdirectories bool `yaml:"ignoreServiceSubdirectories"` // TODO: Add support
}

DirectoryDetect stores the config on how to iterate over the directories

type PathContext

type PathContext = string

PathContext is used to Store Path Context prefix

const (
	// Output refers to the Output path context
	Output PathContext = "output:"
	// Source refers to the source path context
	Source PathContext = "source:"
)

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 string `yaml:"changeTypeTo"`
}

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"`
	types.ObjectMeta `yaml:"metadata,omitempty"`
	Spec             TransformerSpec `yaml:"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:"-"`
	Class              string                              `yaml:"class"`
	Isolated           bool                                `yaml:"isolated"`
	DirectoryDetect    DirectoryDetect                     `yaml:"directoryDetect"`
	ExternalFiles      map[string]string                   `yaml:"externalFiles"` // [source]destination
	ArtifactsToProcess map[string]ArtifactPreprocessConfig `yaml:"consumes"`      // plantypes.ArtifactType
	Produces           map[string]ProducedArtifact         `yaml:"produces"`      // plantypes.ArtifactType
	Intercepts         []string                            `yaml:"intercepts"`
	Override           labels.Selector                     `yaml:"-"`
	OverrideAsObj      interface{}                         `yaml:"override"`  // Will be parsed and loaded into TransformersToOverride
	TemplatesDir       string                              `yaml:"templates"` // Relative to yaml directory or working directory in image
	Config             interface{}                         `yaml:"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