Documentation ¶
Overview ¶
Package template provides TemplateProcessor, capable of transforming Template objects into Config objects.
Index ¶
- func AddParameter(t *templateapi.Template, param templateapi.Parameter)
- func ConvertTemplateInstanceRequesterToUser(templateReq *templateapi.TemplateInstanceRequester) user.Info
- func ConvertUserToTemplateInstanceRequester(u user.Info) templateapi.TemplateInstanceRequester
- func GetParameterByName(t *templateapi.Template, name string) *templateapi.Parameter
- type Processor
- func (p *Processor) EvaluateParameterSubstitution(params map[string]templateapi.Parameter, in string) (string, bool)
- func (p *Processor) GenerateParameterValues(t *templateapi.Template) field.ErrorList
- func (p *Processor) Process(template *templateapi.Template) field.ErrorList
- func (p *Processor) SubstituteParameters(params map[string]templateapi.Parameter, item runtime.Object) (runtime.Object, error)
- type TemplateReference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddParameter ¶
func AddParameter(t *templateapi.Template, param templateapi.Parameter)
AddParameter adds new custom parameter to the Template. It overrides the existing parameter, if already defined.
func ConvertTemplateInstanceRequesterToUser ¶
func ConvertTemplateInstanceRequesterToUser(templateReq *templateapi.TemplateInstanceRequester) user.Info
ConvertTemplateInstanceRequesterToUser copies analogous fields from TemplateInstanceRequester to user.Info
func ConvertUserToTemplateInstanceRequester ¶
func ConvertUserToTemplateInstanceRequester(u user.Info) templateapi.TemplateInstanceRequester
ConvertUserToTemplateInstanceRequester copies analogous fields from user.Info to TemplateInstanceRequester
func GetParameterByName ¶
func GetParameterByName(t *templateapi.Template, name string) *templateapi.Parameter
GetParameterByName searches for a Parameter in the Template based on its name.
Types ¶
type Processor ¶
type Processor struct {
Generators map[string]Generator
}
Processor process the Template into the List with substituted parameters
func NewProcessor ¶
NewProcessor creates new Processor and initializes its set of generators.
func (*Processor) EvaluateParameterSubstitution ¶ added in v1.3.0
func (p *Processor) EvaluateParameterSubstitution(params map[string]templateapi.Parameter, in string) (string, bool)
EvaluateParameterSubstitution replaces escaped parameters in a string with values from the provided map. Returns the substituted value (if any substitution applied) and a boolean indicating if the resulting value should be treated as a string(true) or a non-string value(false) for purposes of json encoding.
func (*Processor) GenerateParameterValues ¶
func (p *Processor) GenerateParameterValues(t *templateapi.Template) field.ErrorList
GenerateParameterValues generates Value for each Parameter of the given Template that has Generate field specified where Value is not already supplied.
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" If an error occurs, the parameter that caused the error is returned along with the error message.
func (*Processor) Process ¶
func (p *Processor) Process(template *templateapi.Template) field.ErrorList
Process transforms Template object into List object. It generates Parameter values using the defined set of generators first, and then it substitutes all Parameter expression occurrences with their corresponding values (currently in the containers' Environment variables only).
func (*Processor) SubstituteParameters ¶
func (p *Processor) SubstituteParameters(params map[string]templateapi.Parameter, item runtime.Object) (runtime.Object, error)
SubstituteParameters loops over all values defined in structured and unstructured types that are children of item.
Example of Parameter expression:
- ${PARAMETER_NAME}
type TemplateReference ¶ added in v1.3.0
TemplateReference points to a stored template
func ParseTemplateReference ¶ added in v1.3.0
func ParseTemplateReference(s string) (TemplateReference, error)
ParseTemplateReference parses the reference to a template into a TemplateReference.
func (TemplateReference) HasNamespace ¶ added in v1.3.0
func (r TemplateReference) HasNamespace() bool
func (TemplateReference) String ¶ added in v1.3.0
func (r TemplateReference) String() string
Directories ¶
Path | Synopsis |
---|---|
apis
|
|
template
+groupName=template.openshift.io Package api is the internal version of the API.
|
+groupName=template.openshift.io Package api is the internal version of the API. |
template/v1
+groupName=template.openshift.io Package v1 is the v1 version of the API.
|
+groupName=template.openshift.io Package v1 is the v1 version of the API. |
template/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. |
client
|
|
generated
|
|
internalclientset
This package has the automatically generated clientset.
|
This package has the automatically generated clientset. |
internalclientset/fake
This package has the automatically generated fake clientset.
|
This package has the automatically generated fake clientset. |
internalclientset/scheme
This package contains the scheme of the automatically generated clientset.
|
This package contains the scheme of the automatically generated clientset. |
internalclientset/typed/template/internalversion
This package has the automatically generated typed clients.
|
This package has the automatically generated typed clients. |
internalclientset/typed/template/internalversion/fake
Package fake has the automatically generated clients.
|
Package fake has the automatically generated clients. |
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. |
registry
|
|
servicebroker
|
|
apis/config
+groupName=config.templateservicebroker.openshift.io
|
+groupName=config.templateservicebroker.openshift.io |
apis/config/v1
+groupName=config.templateservicebroker.openshift.io Package v1 is the v1 version of the API.
|
+groupName=config.templateservicebroker.openshift.io Package v1 is the v1 version of the API. |