transformer

package
v0.3.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 4 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 ArtifactType

type ArtifactType = string

ArtifactType is used to store the artifact type

type ConfigType

type ConfigType = string

ConfigType is used to store the config type

type DetectOutput

type DetectOutput struct {
	NamedServices   map[string]ServicePlan `yaml:"namedServices,omitempty" json:"namedServices,omitempty"`
	UnNamedServices []TransformerPlan      `yaml:"unnamedServices,omitempty" json:"unnamedServices,omitempty"`
}

DetectOutput structure is the data format for receiving data from starlark detect functions

type Mode

type Mode = string

Mode represents the mode of deployment artifacts

const (
	// ModeContainer represents artifacts for container mode of deployment
	ModeContainer Mode = "Container"
	// ModeCR represents artifacts for custom resource mode of deployment
	ModeCR Mode = "CustomResource"
	// ModeService represents artifacts for service mode of deployment
	ModeService Mode = "Service" // Possibly Terraform
	// ModeCustom represents artifacts for custom mode of deployment
	ModeCustom Mode = "Custom"
)

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
	// ModifiedSourcePathMappingType allows for copying of deltas wrt source
	ModifiedSourcePathMappingType PathMappingType = "SourceDiff" // Source path becomes relative to source directory
)

type PathType

type PathType = string

PathType is used to store the path type

type ServicePlan

type ServicePlan []TransformerPlan

ServicePlan is the type that stores a plan service

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 TransformerPlan

type TransformerPlan struct {
	Mode              Mode                       `yaml:"mode" json:"mode"` // container, customresource, service, generic
	TransformerName   string                     `yaml:"transformerName" json:"transformerName"`
	ArtifactTypes     []ArtifactType             `yaml:"generates,omitempty" json:"generates,omitempty"`
	BaseArtifactTypes []ArtifactType             `yaml:"generatedBases,omitempty" json:"generatedBases,omitempty"`
	Paths             map[PathType][]string      `yaml:"paths,omitempty" json:"paths,omitempty" m2kpath:"normal"`
	Configs           map[ConfigType]interface{} `yaml:"configs,omitempty" json:"configs,omitempty"`
}

TransformerPlan stores transformer option

type TransformerSpec

type TransformerSpec struct {
	FilePath           string            `yaml:"-"`
	Mode               Mode              `yaml:"mode"`
	Class              string            `yaml:"class"`
	ExternalFiles      map[string]string `yaml:"externalFiles"` // [source]destination
	ArtifactsToProcess []string          `yaml:"consumes"`      //plantypes.ArtifactType
	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