template

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2014 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package template provides TemplateProcessor, capable of transforming Template objects into Config objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage struct{}

Storage implements RESTStorage for the Template objects.

func NewStorage

func NewStorage() *Storage

NewStorage creates new RESTStorage for the Template objects.

func (*Storage) Create

func (s *Storage) Create(ctx kapi.Context, obj runtime.Object) (<-chan runtime.Object, error)

func (*Storage) Delete

func (s *Storage) Delete(ctx kapi.Context, id string) (<-chan runtime.Object, error)

func (*Storage) Get

func (s *Storage) Get(ctx kapi.Context, id string) (runtime.Object, error)

func (*Storage) List

func (s *Storage) List(ctx kapi.Context, selector, fields labels.Selector) (runtime.Object, error)

func (*Storage) New

func (s *Storage) New() runtime.Object

func (*Storage) Update

func (s *Storage) Update(ctx kapi.Context, template runtime.Object) (<-chan runtime.Object, error)

type TemplateProcessor

type TemplateProcessor struct {
	Generators map[string]Generator
}

TemplateProcessor transforms Template objects into Config objects.

func NewTemplateProcessor

func NewTemplateProcessor(generators map[string]Generator) *TemplateProcessor

NewTemplateProcessor creates new TemplateProcessor and initializes its set of generators.

func (*TemplateProcessor) AddParameter

func (p *TemplateProcessor) AddParameter(t *api.Template, param api.Parameter)

AddParameter adds new custom parameter to the Template. It overrides the existing parameter, if already defined.

func (*TemplateProcessor) GenerateParameterValues

func (p *TemplateProcessor) GenerateParameterValues(t *api.Template) error

GenerateParameterValues generates Value for each Parameter of the given Template that has Generate field specified.

Examples:

from | value ----------------------------- "test[0-9]{1}x" | "test7x" "[0-1]{8}" | "01001100" "0x[A-F0-9]{4}" | "0xB3AF" "[a-zA-Z0-9]{8}" | "hW4yQU5i"

func (*TemplateProcessor) GetParameterByName

func (p *TemplateProcessor) GetParameterByName(t *api.Template, name string) *api.Parameter

GetParameterByName searches for a Parameter in the Template based on it's name.

func (*TemplateProcessor) Process

func (p *TemplateProcessor) Process(template *api.Template) (*config.Config, error)

Process transforms Template object into Config object. It generates Parameter values using the defined set of generators first, and then it substitutes all Parameter expression occurances with their corresponding values (currently in the containers' Environment variables only).

func (*TemplateProcessor) SubstituteParameters

func (p *TemplateProcessor) SubstituteParameters(t *api.Template) error

SubstituteParameters loops over all Environment variables defined for all ReplicationController and Pod containers and substitutes all Parameter expression occurances with their corresponding values.

Example of Parameter expression:

  • ${PARAMETER_NAME}

TODO: Implement substitution for more types and fields.

Directories

Path Synopsis
api
Package api defines and registers types for Template objects.
Package api defines and registers types for Template objects.
validation
Package validation has functions for validating the correctness of Template objects and explaining what is wrong with them when they aren't valid.
Package validation has functions for validating the correctness of Template objects and explaining what is wrong with them when they aren't valid.
Package generator defines GeneratorInterface interface and implements some random value generators.
Package generator defines GeneratorInterface interface and implements some random value generators.
examples
Package examples demonstrates possible implementation of some random value generators.
Package examples demonstrates possible implementation of some random value generators.

Jump to

Keyboard shortcuts

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