transformation

package
v0.0.0-...-cefcf51 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package transformation is a generated protocol buffer package.

It is generated from these files:

transformation_filter.proto

It has these top-level messages:

Transformations
Transformation
Extraction
TransformationTemplate
InjaTemplate
Passthrough
MergeExtractorsToBody

Index

Constants

View Source
const (
	ServiceTypeTransformation = "HTTP-Functions"
)

Variables

This section is empty.

Functions

func EncodeFunctionSpec

func EncodeFunctionSpec(spec Template) *types.Struct

func EncodeRouteExtension

func EncodeRouteExtension(spec RouteExtension) *types.Struct

Types

type Extraction

type Extraction struct {
	Header string `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// what information to extract. if extraction fails the result is
	// an empty value.
	Regex    string `protobuf:"bytes,2,opt,name=regex,proto3" json:"regex,omitempty"`
	Subgroup uint32 `protobuf:"varint,3,opt,name=subgroup,proto3" json:"subgroup,omitempty"`
}

func (*Extraction) Descriptor

func (*Extraction) Descriptor() ([]byte, []int)

func (*Extraction) GetHeader

func (m *Extraction) GetHeader() string

func (*Extraction) GetRegex

func (m *Extraction) GetRegex() string

func (*Extraction) GetSubgroup

func (m *Extraction) GetSubgroup() uint32

func (*Extraction) ProtoMessage

func (*Extraction) ProtoMessage()

func (*Extraction) Reset

func (m *Extraction) Reset()

func (*Extraction) String

func (m *Extraction) String() string

type GetTransformationFunction

type GetTransformationFunction func(destination *v1.Destination_Function) (*TransformationTemplate, error)

type InjaTemplate

type InjaTemplate struct {
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
}

custom functions: header_value(name) -> from the original headers extracted_value(name, index) -> from the extracted values

func (*InjaTemplate) Descriptor

func (*InjaTemplate) Descriptor() ([]byte, []int)

func (*InjaTemplate) GetText

func (m *InjaTemplate) GetText() string

func (*InjaTemplate) ProtoMessage

func (*InjaTemplate) ProtoMessage()

func (*InjaTemplate) Reset

func (m *InjaTemplate) Reset()

func (*InjaTemplate) String

func (m *InjaTemplate) String() string

type MergeExtractorsToBody

type MergeExtractorsToBody struct {
}

func (*MergeExtractorsToBody) Descriptor

func (*MergeExtractorsToBody) Descriptor() ([]byte, []int)

func (*MergeExtractorsToBody) ProtoMessage

func (*MergeExtractorsToBody) ProtoMessage()

func (*MergeExtractorsToBody) Reset

func (m *MergeExtractorsToBody) Reset()

func (*MergeExtractorsToBody) String

func (m *MergeExtractorsToBody) String() string

type Parameters

type Parameters struct {
	// headers that will be used to derive the data for processing the output templates
	// if no syntax containing {variables} are detected in the header value,
	// the whole value will be substituted by its name into the template
	// for example:
	/*
		input:
			header_parmeters:
		      x-header-foo: bar
		output:
			body_template: "{\"path\": {{ path }}}"
	*/
	Headers   map[string]string `json:"headers"`
	Path      string            `json:"path,omitempty"`
	Authority string            `json:"authority"`
}

type Passthrough

type Passthrough struct {
}

func (*Passthrough) Descriptor

func (*Passthrough) Descriptor() ([]byte, []int)

func (*Passthrough) ProtoMessage

func (*Passthrough) ProtoMessage()

func (*Passthrough) Reset

func (m *Passthrough) Reset()

func (*Passthrough) String

func (m *Passthrough) String() string

type Plugin

type Plugin interface {
	ActivateFilterForCluster(out *envoyapi.Cluster)
	AddRequestTransformationsToRoute(getTemplate GetTransformationFunction, in *v1.Route, out *envoyroute.Route) error
	AddResponseTransformationsToRoute(in *v1.Route, out *envoyroute.Route) error
	GetTransformationFilter() *plugin.StagedFilter
}

func NewTransformationPlugin

func NewTransformationPlugin() Plugin

type RouteExtension

type RouteExtension struct {
	Parameters       *Parameters `json:"parameters,omitempty"`
	ResponseTemplate *Template   `json:"response_template,omitempty"`
	ResponseParams   *Parameters `json:"response_parameters,omitempty"`
}

this goes on the route extension

func DecodeRouteExtension

func DecodeRouteExtension(generic *types.Struct) (RouteExtension, error)

type Template

type Template struct {
	Path   string            `json:"path"`
	Header map[string]string `json:"headers"`
	// body is a pointer because, if null, pass through original body
	Body *string `json:"body"`
	// if enabled, the request body will be passed through untouched
	PassthroughBody bool `json:"passthrough_body"`
}

this goes on the function spec or on the response transformation

func DecodeFunctionSpec

func DecodeFunctionSpec(generic *types.Struct) (Template, error)

type Transformation

type Transformation struct {
	// Extractors are in the origin request language domain
	Extractors map[string]*Extraction `` /* 147-byte string literal not displayed */
	// Template is in the transformed request language domain
	// currently both are JSON
	TransformationTemplate *TransformationTemplate `protobuf:"bytes,2,opt,name=transformation_template,json=transformationTemplate" json:"transformation_template,omitempty"`
}

[#proto-status: experimental]

func (*Transformation) Descriptor

func (*Transformation) Descriptor() ([]byte, []int)

func (*Transformation) GetExtractors

func (m *Transformation) GetExtractors() map[string]*Extraction

func (*Transformation) GetTransformationTemplate

func (m *Transformation) GetTransformationTemplate() *TransformationTemplate

func (*Transformation) ProtoMessage

func (*Transformation) ProtoMessage()

func (*Transformation) Reset

func (m *Transformation) Reset()

func (*Transformation) String

func (m *Transformation) String() string

type TransformationTemplate

type TransformationTemplate struct {
	Headers map[string]*InjaTemplate `` /* 141-byte string literal not displayed */
	// Types that are valid to be assigned to BodyTransformation:
	//	*TransformationTemplate_Body
	//	*TransformationTemplate_Passthrough
	//	*TransformationTemplate_MergeExtractorsToBody
	BodyTransformation isTransformationTemplate_BodyTransformation `protobuf_oneof:"body_transformation"`
}

func (*TransformationTemplate) Descriptor

func (*TransformationTemplate) Descriptor() ([]byte, []int)

func (*TransformationTemplate) GetBody

func (m *TransformationTemplate) GetBody() *InjaTemplate

func (*TransformationTemplate) GetBodyTransformation

func (m *TransformationTemplate) GetBodyTransformation() isTransformationTemplate_BodyTransformation

func (*TransformationTemplate) GetHeaders

func (m *TransformationTemplate) GetHeaders() map[string]*InjaTemplate

func (*TransformationTemplate) GetMergeExtractorsToBody

func (m *TransformationTemplate) GetMergeExtractorsToBody() *MergeExtractorsToBody

func (*TransformationTemplate) GetPassthrough

func (m *TransformationTemplate) GetPassthrough() *Passthrough

func (*TransformationTemplate) ProtoMessage

func (*TransformationTemplate) ProtoMessage()

func (*TransformationTemplate) Reset

func (m *TransformationTemplate) Reset()

func (*TransformationTemplate) String

func (m *TransformationTemplate) String() string

func (*TransformationTemplate) XXX_OneofFuncs

func (*TransformationTemplate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type TransformationTemplate_Body

type TransformationTemplate_Body struct {
	Body *InjaTemplate `protobuf:"bytes,2,opt,name=body,oneof"`
}

type TransformationTemplate_MergeExtractorsToBody

type TransformationTemplate_MergeExtractorsToBody struct {
	MergeExtractorsToBody *MergeExtractorsToBody `protobuf:"bytes,4,opt,name=merge_extractors_to_body,json=mergeExtractorsToBody,oneof"`
}

type TransformationTemplate_Passthrough

type TransformationTemplate_Passthrough struct {
	Passthrough *Passthrough `protobuf:"bytes,3,opt,name=passthrough,oneof"`
}

type Transformations

type Transformations struct {
	Transformations   map[string]*Transformation `` /* 157-byte string literal not displayed */
	AdvancedTemplates bool                       `protobuf:"varint,2,opt,name=advanced_templates,json=advancedTemplates,proto3" json:"advanced_templates,omitempty"`
}

func (*Transformations) Descriptor

func (*Transformations) Descriptor() ([]byte, []int)

func (*Transformations) GetAdvancedTemplates

func (m *Transformations) GetAdvancedTemplates() bool

func (*Transformations) GetTransformations

func (m *Transformations) GetTransformations() map[string]*Transformation

func (*Transformations) ProtoMessage

func (*Transformations) ProtoMessage()

func (*Transformations) Reset

func (m *Transformations) Reset()

func (*Transformations) String

func (m *Transformations) String() string

Jump to

Keyboard shortcuts

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